Sin descripción

editor.js 384KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926
  1. this["wp"] = this["wp"] || {}; this["wp"]["editor"] =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "PLxR");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "16Al":
  90. /***/ (function(module, exports, __webpack_require__) {
  91. "use strict";
  92. /**
  93. * Copyright (c) 2013-present, Facebook, Inc.
  94. *
  95. * This source code is licensed under the MIT license found in the
  96. * LICENSE file in the root directory of this source tree.
  97. */
  98. var ReactPropTypesSecret = __webpack_require__("WbBG");
  99. function emptyFunction() {}
  100. function emptyFunctionWithReset() {}
  101. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  102. module.exports = function() {
  103. function shim(props, propName, componentName, location, propFullName, secret) {
  104. if (secret === ReactPropTypesSecret) {
  105. // It is still safe when called from React.
  106. return;
  107. }
  108. var err = new Error(
  109. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  110. 'Use PropTypes.checkPropTypes() to call them. ' +
  111. 'Read more at http://fb.me/use-check-prop-types'
  112. );
  113. err.name = 'Invariant Violation';
  114. throw err;
  115. };
  116. shim.isRequired = shim;
  117. function getShim() {
  118. return shim;
  119. };
  120. // Important!
  121. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  122. var ReactPropTypes = {
  123. array: shim,
  124. bool: shim,
  125. func: shim,
  126. number: shim,
  127. object: shim,
  128. string: shim,
  129. symbol: shim,
  130. any: shim,
  131. arrayOf: getShim,
  132. element: shim,
  133. elementType: shim,
  134. instanceOf: getShim,
  135. node: shim,
  136. objectOf: getShim,
  137. oneOf: getShim,
  138. oneOfType: getShim,
  139. shape: getShim,
  140. exact: getShim,
  141. checkPropTypes: emptyFunctionWithReset,
  142. resetWarningCache: emptyFunction
  143. };
  144. ReactPropTypes.PropTypes = ReactPropTypes;
  145. return ReactPropTypes;
  146. };
  147. /***/ }),
  148. /***/ "17x9":
  149. /***/ (function(module, exports, __webpack_require__) {
  150. /**
  151. * Copyright (c) 2013-present, Facebook, Inc.
  152. *
  153. * This source code is licensed under the MIT license found in the
  154. * LICENSE file in the root directory of this source tree.
  155. */
  156. if (false) { var throwOnDirectAccess, ReactIs; } else {
  157. // By explicitly using `prop-types` you are opting into new production behavior.
  158. // http://fb.me/prop-types-in-prod
  159. module.exports = __webpack_require__("16Al")();
  160. }
  161. /***/ }),
  162. /***/ "1ZqX":
  163. /***/ (function(module, exports) {
  164. (function() { module.exports = window["wp"]["data"]; }());
  165. /***/ }),
  166. /***/ "51Zz":
  167. /***/ (function(module, exports) {
  168. (function() { module.exports = window["wp"]["dataControls"]; }());
  169. /***/ }),
  170. /***/ "6aBm":
  171. /***/ (function(module, exports) {
  172. (function() { module.exports = window["wp"]["mediaUtils"]; }());
  173. /***/ }),
  174. /***/ "7fqt":
  175. /***/ (function(module, exports) {
  176. (function() { module.exports = window["wp"]["wordcount"]; }());
  177. /***/ }),
  178. /***/ "CNgt":
  179. /***/ (function(module, exports, __webpack_require__) {
  180. "use strict";
  181. var __extends = (this && this.__extends) || (function () {
  182. var extendStatics = Object.setPrototypeOf ||
  183. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  184. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  185. return function (d, b) {
  186. extendStatics(d, b);
  187. function __() { this.constructor = d; }
  188. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  189. };
  190. })();
  191. var __assign = (this && this.__assign) || Object.assign || function(t) {
  192. for (var s, i = 1, n = arguments.length; i < n; i++) {
  193. s = arguments[i];
  194. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  195. t[p] = s[p];
  196. }
  197. return t;
  198. };
  199. var __rest = (this && this.__rest) || function (s, e) {
  200. var t = {};
  201. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  202. t[p] = s[p];
  203. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  204. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
  205. t[p[i]] = s[p[i]];
  206. return t;
  207. };
  208. exports.__esModule = true;
  209. var React = __webpack_require__("cDcd");
  210. var PropTypes = __webpack_require__("17x9");
  211. var autosize = __webpack_require__("GemG");
  212. var _getLineHeight = __webpack_require__("Rk8H");
  213. var getLineHeight = _getLineHeight;
  214. var RESIZED = "autosize:resized";
  215. /**
  216. * A light replacement for built-in textarea component
  217. * which automaticaly adjusts its height to match the content
  218. */
  219. var TextareaAutosizeClass = /** @class */ (function (_super) {
  220. __extends(TextareaAutosizeClass, _super);
  221. function TextareaAutosizeClass() {
  222. var _this = _super !== null && _super.apply(this, arguments) || this;
  223. _this.state = {
  224. lineHeight: null
  225. };
  226. _this.textarea = null;
  227. _this.onResize = function (e) {
  228. if (_this.props.onResize) {
  229. _this.props.onResize(e);
  230. }
  231. };
  232. _this.updateLineHeight = function () {
  233. if (_this.textarea) {
  234. _this.setState({
  235. lineHeight: getLineHeight(_this.textarea)
  236. });
  237. }
  238. };
  239. _this.onChange = function (e) {
  240. var onChange = _this.props.onChange;
  241. _this.currentValue = e.currentTarget.value;
  242. onChange && onChange(e);
  243. };
  244. return _this;
  245. }
  246. TextareaAutosizeClass.prototype.componentDidMount = function () {
  247. var _this = this;
  248. var _a = this.props, maxRows = _a.maxRows, async = _a.async;
  249. if (typeof maxRows === "number") {
  250. this.updateLineHeight();
  251. }
  252. if (typeof maxRows === "number" || async) {
  253. /*
  254. the defer is needed to:
  255. - force "autosize" to activate the scrollbar when this.props.maxRows is passed
  256. - support StyledComponents (see #71)
  257. */
  258. setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
  259. }
  260. else {
  261. this.textarea && autosize(this.textarea);
  262. }
  263. if (this.textarea) {
  264. this.textarea.addEventListener(RESIZED, this.onResize);
  265. }
  266. };
  267. TextareaAutosizeClass.prototype.componentWillUnmount = function () {
  268. if (this.textarea) {
  269. this.textarea.removeEventListener(RESIZED, this.onResize);
  270. autosize.destroy(this.textarea);
  271. }
  272. };
  273. TextareaAutosizeClass.prototype.render = function () {
  274. var _this = this;
  275. var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
  276. var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
  277. return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
  278. _this.textarea = element;
  279. if (typeof _this.props.innerRef === 'function') {
  280. _this.props.innerRef(element);
  281. }
  282. else if (_this.props.innerRef) {
  283. _this.props.innerRef.current = element;
  284. }
  285. } }), children));
  286. };
  287. TextareaAutosizeClass.prototype.componentDidUpdate = function () {
  288. this.textarea && autosize.update(this.textarea);
  289. };
  290. TextareaAutosizeClass.defaultProps = {
  291. rows: 1,
  292. async: false
  293. };
  294. TextareaAutosizeClass.propTypes = {
  295. rows: PropTypes.number,
  296. maxRows: PropTypes.number,
  297. onResize: PropTypes.func,
  298. innerRef: PropTypes.any,
  299. async: PropTypes.bool
  300. };
  301. return TextareaAutosizeClass;
  302. }(React.Component));
  303. exports.TextareaAutosize = React.forwardRef(function (props, ref) {
  304. return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
  305. });
  306. /***/ }),
  307. /***/ "Civd":
  308. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  309. "use strict";
  310. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  311. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  312. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  313. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  314. /**
  315. * WordPress dependencies
  316. */
  317. const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  318. xmlns: "http://www.w3.org/2000/svg",
  319. viewBox: "0 0 24 24"
  320. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  321. 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"
  322. }));
  323. /* harmony default export */ __webpack_exports__["a"] = (layout);
  324. /***/ }),
  325. /***/ "FqII":
  326. /***/ (function(module, exports) {
  327. (function() { module.exports = window["wp"]["date"]; }());
  328. /***/ }),
  329. /***/ "GRId":
  330. /***/ (function(module, exports) {
  331. (function() { module.exports = window["wp"]["element"]; }());
  332. /***/ }),
  333. /***/ "GemG":
  334. /***/ (function(module, exports, __webpack_require__) {
  335. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  336. autosize 4.0.4
  337. license: MIT
  338. http://www.jacklmoore.com/autosize
  339. */
  340. (function (global, factory) {
  341. if (true) {
  342. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  343. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  344. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  345. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  346. } else { var mod; }
  347. })(this, function (module, exports) {
  348. 'use strict';
  349. var map = typeof Map === "function" ? new Map() : function () {
  350. var keys = [];
  351. var values = [];
  352. return {
  353. has: function has(key) {
  354. return keys.indexOf(key) > -1;
  355. },
  356. get: function get(key) {
  357. return values[keys.indexOf(key)];
  358. },
  359. set: function set(key, value) {
  360. if (keys.indexOf(key) === -1) {
  361. keys.push(key);
  362. values.push(value);
  363. }
  364. },
  365. delete: function _delete(key) {
  366. var index = keys.indexOf(key);
  367. if (index > -1) {
  368. keys.splice(index, 1);
  369. values.splice(index, 1);
  370. }
  371. }
  372. };
  373. }();
  374. var createEvent = function createEvent(name) {
  375. return new Event(name, { bubbles: true });
  376. };
  377. try {
  378. new Event('test');
  379. } catch (e) {
  380. // IE does not support `new Event()`
  381. createEvent = function createEvent(name) {
  382. var evt = document.createEvent('Event');
  383. evt.initEvent(name, true, false);
  384. return evt;
  385. };
  386. }
  387. function assign(ta) {
  388. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  389. var heightOffset = null;
  390. var clientWidth = null;
  391. var cachedHeight = null;
  392. function init() {
  393. var style = window.getComputedStyle(ta, null);
  394. if (style.resize === 'vertical') {
  395. ta.style.resize = 'none';
  396. } else if (style.resize === 'both') {
  397. ta.style.resize = 'horizontal';
  398. }
  399. if (style.boxSizing === 'content-box') {
  400. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  401. } else {
  402. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  403. }
  404. // Fix when a textarea is not on document body and heightOffset is Not a Number
  405. if (isNaN(heightOffset)) {
  406. heightOffset = 0;
  407. }
  408. update();
  409. }
  410. function changeOverflow(value) {
  411. {
  412. // Chrome/Safari-specific fix:
  413. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  414. // made available by removing the scrollbar. The following forces the necessary text reflow.
  415. var width = ta.style.width;
  416. ta.style.width = '0px';
  417. // Force reflow:
  418. /* jshint ignore:start */
  419. ta.offsetWidth;
  420. /* jshint ignore:end */
  421. ta.style.width = width;
  422. }
  423. ta.style.overflowY = value;
  424. }
  425. function getParentOverflows(el) {
  426. var arr = [];
  427. while (el && el.parentNode && el.parentNode instanceof Element) {
  428. if (el.parentNode.scrollTop) {
  429. arr.push({
  430. node: el.parentNode,
  431. scrollTop: el.parentNode.scrollTop
  432. });
  433. }
  434. el = el.parentNode;
  435. }
  436. return arr;
  437. }
  438. function resize() {
  439. if (ta.scrollHeight === 0) {
  440. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  441. return;
  442. }
  443. var overflows = getParentOverflows(ta);
  444. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  445. ta.style.height = '';
  446. ta.style.height = ta.scrollHeight + heightOffset + 'px';
  447. // used to check if an update is actually necessary on window.resize
  448. clientWidth = ta.clientWidth;
  449. // prevents scroll-position jumping
  450. overflows.forEach(function (el) {
  451. el.node.scrollTop = el.scrollTop;
  452. });
  453. if (docTop) {
  454. document.documentElement.scrollTop = docTop;
  455. }
  456. }
  457. function update() {
  458. resize();
  459. var styleHeight = Math.round(parseFloat(ta.style.height));
  460. var computed = window.getComputedStyle(ta, null);
  461. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  462. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  463. // The actual height not matching the style height (set via the resize method) indicates that
  464. // the max-height has been exceeded, in which case the overflow should be allowed.
  465. if (actualHeight < styleHeight) {
  466. if (computed.overflowY === 'hidden') {
  467. changeOverflow('scroll');
  468. resize();
  469. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  470. }
  471. } else {
  472. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  473. if (computed.overflowY !== 'hidden') {
  474. changeOverflow('hidden');
  475. resize();
  476. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  477. }
  478. }
  479. if (cachedHeight !== actualHeight) {
  480. cachedHeight = actualHeight;
  481. var evt = createEvent('autosize:resized');
  482. try {
  483. ta.dispatchEvent(evt);
  484. } catch (err) {
  485. // Firefox will throw an error on dispatchEvent for a detached element
  486. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  487. }
  488. }
  489. }
  490. var pageResize = function pageResize() {
  491. if (ta.clientWidth !== clientWidth) {
  492. update();
  493. }
  494. };
  495. var destroy = function (style) {
  496. window.removeEventListener('resize', pageResize, false);
  497. ta.removeEventListener('input', update, false);
  498. ta.removeEventListener('keyup', update, false);
  499. ta.removeEventListener('autosize:destroy', destroy, false);
  500. ta.removeEventListener('autosize:update', update, false);
  501. Object.keys(style).forEach(function (key) {
  502. ta.style[key] = style[key];
  503. });
  504. map.delete(ta);
  505. }.bind(ta, {
  506. height: ta.style.height,
  507. resize: ta.style.resize,
  508. overflowY: ta.style.overflowY,
  509. overflowX: ta.style.overflowX,
  510. wordWrap: ta.style.wordWrap
  511. });
  512. ta.addEventListener('autosize:destroy', destroy, false);
  513. // IE9 does not fire onpropertychange or oninput for deletions,
  514. // so binding to onkeyup to catch most of those events.
  515. // There is no way that I know of to detect something like 'cut' in IE9.
  516. if ('onpropertychange' in ta && 'oninput' in ta) {
  517. ta.addEventListener('keyup', update, false);
  518. }
  519. window.addEventListener('resize', pageResize, false);
  520. ta.addEventListener('input', update, false);
  521. ta.addEventListener('autosize:update', update, false);
  522. ta.style.overflowX = 'hidden';
  523. ta.style.wordWrap = 'break-word';
  524. map.set(ta, {
  525. destroy: destroy,
  526. update: update
  527. });
  528. init();
  529. }
  530. function destroy(ta) {
  531. var methods = map.get(ta);
  532. if (methods) {
  533. methods.destroy();
  534. }
  535. }
  536. function update(ta) {
  537. var methods = map.get(ta);
  538. if (methods) {
  539. methods.update();
  540. }
  541. }
  542. var autosize = null;
  543. // Do nothing in Node.js environment and IE8 (or lower)
  544. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  545. autosize = function autosize(el) {
  546. return el;
  547. };
  548. autosize.destroy = function (el) {
  549. return el;
  550. };
  551. autosize.update = function (el) {
  552. return el;
  553. };
  554. } else {
  555. autosize = function autosize(el, options) {
  556. if (el) {
  557. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  558. return assign(x, options);
  559. });
  560. }
  561. return el;
  562. };
  563. autosize.destroy = function (el) {
  564. if (el) {
  565. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  566. }
  567. return el;
  568. };
  569. autosize.update = function (el) {
  570. if (el) {
  571. Array.prototype.forEach.call(el.length ? el : [el], update);
  572. }
  573. return el;
  574. };
  575. }
  576. exports.default = autosize;
  577. module.exports = exports['default'];
  578. });
  579. /***/ }),
  580. /***/ "HSyU":
  581. /***/ (function(module, exports) {
  582. (function() { module.exports = window["wp"]["blocks"]; }());
  583. /***/ }),
  584. /***/ "JREk":
  585. /***/ (function(module, exports) {
  586. (function() { module.exports = window["wp"]["serverSideRender"]; }());
  587. /***/ }),
  588. /***/ "K2cm":
  589. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  590. "use strict";
  591. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  592. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  593. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  594. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  595. /**
  596. * WordPress dependencies
  597. */
  598. const redo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  599. xmlns: "http://www.w3.org/2000/svg",
  600. viewBox: "0 0 24 24"
  601. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  602. d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
  603. }));
  604. /* harmony default export */ __webpack_exports__["a"] = (redo);
  605. /***/ }),
  606. /***/ "K9lf":
  607. /***/ (function(module, exports) {
  608. (function() { module.exports = window["wp"]["compose"]; }());
  609. /***/ }),
  610. /***/ "Mmq9":
  611. /***/ (function(module, exports) {
  612. (function() { module.exports = window["wp"]["url"]; }());
  613. /***/ }),
  614. /***/ "NMb1":
  615. /***/ (function(module, exports) {
  616. (function() { module.exports = window["wp"]["deprecated"]; }());
  617. /***/ }),
  618. /***/ "Ntru":
  619. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  620. "use strict";
  621. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  622. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  623. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  624. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  625. /**
  626. * WordPress dependencies
  627. */
  628. const undo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  629. xmlns: "http://www.w3.org/2000/svg",
  630. viewBox: "0 0 24 24"
  631. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  632. d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
  633. }));
  634. /* harmony default export */ __webpack_exports__["a"] = (undo);
  635. /***/ }),
  636. /***/ "O6Fj":
  637. /***/ (function(module, exports, __webpack_require__) {
  638. "use strict";
  639. exports.__esModule = true;
  640. var TextareaAutosize_1 = __webpack_require__("CNgt");
  641. exports["default"] = TextareaAutosize_1.TextareaAutosize;
  642. /***/ }),
  643. /***/ "PLxR":
  644. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  645. "use strict";
  646. // ESM COMPAT FLAG
  647. __webpack_require__.r(__webpack_exports__);
  648. // EXPORTS
  649. __webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; });
  650. __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
  651. __webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return /* reexport */ autocompleters_user; });
  652. __webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return /* reexport */ autosave_monitor; });
  653. __webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return /* reexport */ document_outline; });
  654. __webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return /* reexport */ check; });
  655. __webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return /* reexport */ visual_editor_shortcuts; });
  656. __webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; });
  657. __webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", function() { return /* reexport */ register_shortcuts; });
  658. __webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; });
  659. __webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; });
  660. __webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; });
  661. __webpack_require__.d(__webpack_exports__, "EditorSnackbars", function() { return /* reexport */ EditorSnackbars; });
  662. __webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; });
  663. __webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; });
  664. __webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; });
  665. __webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return /* reexport */ page_attributes_check; });
  666. __webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return /* reexport */ page_attributes_order; });
  667. __webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return /* reexport */ page_attributes_parent; });
  668. __webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return /* reexport */ post_template; });
  669. __webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return /* reexport */ post_author; });
  670. __webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return /* reexport */ post_author_check; });
  671. __webpack_require__.d(__webpack_exports__, "PostComments", function() { return /* reexport */ post_comments; });
  672. __webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return /* reexport */ post_excerpt; });
  673. __webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return /* reexport */ post_excerpt_check; });
  674. __webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return /* reexport */ post_featured_image; });
  675. __webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return /* reexport */ post_featured_image_check; });
  676. __webpack_require__.d(__webpack_exports__, "PostFormat", function() { return /* reexport */ PostFormat; });
  677. __webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return /* reexport */ post_format_check; });
  678. __webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return /* reexport */ post_last_revision; });
  679. __webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return /* reexport */ post_last_revision_check; });
  680. __webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return /* reexport */ PostLockedModal; });
  681. __webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return /* reexport */ post_pending_status; });
  682. __webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return /* reexport */ post_pending_status_check; });
  683. __webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return /* reexport */ post_pingbacks; });
  684. __webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return /* reexport */ post_preview_button; });
  685. __webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return /* reexport */ post_publish_button; });
  686. __webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return /* reexport */ post_publish_button_label; });
  687. __webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return /* reexport */ post_publish_panel; });
  688. __webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return /* reexport */ PostSavedState; });
  689. __webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return /* reexport */ PostSchedule; });
  690. __webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return /* reexport */ post_schedule_check; });
  691. __webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return /* reexport */ post_schedule_label; });
  692. __webpack_require__.d(__webpack_exports__, "PostSlug", function() { return /* reexport */ post_slug; });
  693. __webpack_require__.d(__webpack_exports__, "PostSlugCheck", function() { return /* reexport */ PostSlugCheck; });
  694. __webpack_require__.d(__webpack_exports__, "PostSticky", function() { return /* reexport */ post_sticky; });
  695. __webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return /* reexport */ post_sticky_check; });
  696. __webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return /* reexport */ post_switch_to_draft_button; });
  697. __webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return /* reexport */ post_taxonomies; });
  698. __webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return /* reexport */ post_taxonomies_check; });
  699. __webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return /* reexport */ PostTextEditor; });
  700. __webpack_require__.d(__webpack_exports__, "PostTitle", function() { return /* reexport */ PostTitle; });
  701. __webpack_require__.d(__webpack_exports__, "PostTrash", function() { return /* reexport */ post_trash; });
  702. __webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return /* reexport */ post_trash_check; });
  703. __webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return /* reexport */ post_type_support_check; });
  704. __webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return /* reexport */ post_visibility; });
  705. __webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return /* reexport */ post_visibility_label; });
  706. __webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return /* reexport */ post_visibility_check; });
  707. __webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return /* reexport */ table_of_contents; });
  708. __webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return /* reexport */ UnsavedChangesWarning; });
  709. __webpack_require__.d(__webpack_exports__, "WordCount", function() { return /* reexport */ WordCount; });
  710. __webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return /* reexport */ provider; });
  711. __webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return /* reexport */ external_wp_serverSideRender_default.a; });
  712. __webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ RichText; });
  713. __webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; });
  714. __webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; });
  715. __webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; });
  716. __webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ BlockControls; });
  717. __webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ deprecated_BlockEdit; });
  718. __webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ BlockEditorKeyboardShortcuts; });
  719. __webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; });
  720. __webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; });
  721. __webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ BlockInspector; });
  722. __webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; });
  723. __webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ BlockMover; });
  724. __webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ BlockNavigationDropdown; });
  725. __webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; });
  726. __webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ BlockSettingsMenu; });
  727. __webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; });
  728. __webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; });
  729. __webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; });
  730. __webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ ContrastChecker; });
  731. __webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ CopyHandler; });
  732. __webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ DefaultBlockAppender; });
  733. __webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ FontSizePicker; });
  734. __webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ Inserter; });
  735. __webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ InnerBlocks; });
  736. __webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ InspectorAdvancedControls; });
  737. __webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ InspectorControls; });
  738. __webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ PanelColorSettings; });
  739. __webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ PlainText; });
  740. __webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; });
  741. __webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; });
  742. __webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ __unstableRichTextInputEvent; });
  743. __webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ MediaPlaceholder; });
  744. __webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ MediaUpload; });
  745. __webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ MediaUploadCheck; });
  746. __webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; });
  747. __webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ NavigableToolbar; });
  748. __webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ ObserveTyping; });
  749. __webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; });
  750. __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ SkipToSelectedBlock; });
  751. __webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ URLInput; });
  752. __webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ URLInputButton; });
  753. __webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ URLPopover; });
  754. __webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ Warning; });
  755. __webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; });
  756. __webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; });
  757. __webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; });
  758. __webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; });
  759. __webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; });
  760. __webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; });
  761. __webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; });
  762. __webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ withColorContext; });
  763. __webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; });
  764. __webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ withFontSizes; });
  765. __webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return /* reexport */ mediaUpload; });
  766. __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; });
  767. __webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ external_wp_blockEditor_["transformStyles"]; });
  768. // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js
  769. var selectors_namespaceObject = {};
  770. __webpack_require__.r(selectors_namespaceObject);
  771. __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; });
  772. __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; });
  773. __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; });
  774. __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; });
  775. __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; });
  776. __webpack_require__.d(selectors_namespaceObject, "hasNonPostEntityChanges", function() { return selectors_hasNonPostEntityChanges; });
  777. __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; });
  778. __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; });
  779. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; });
  780. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; });
  781. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; });
  782. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; });
  783. __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return selectors_getPostEdits; });
  784. __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; });
  785. __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; });
  786. __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; });
  787. __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; });
  788. __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; });
  789. __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPending", function() { return isCurrentPostPending; });
  790. __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPublished", function() { return selectors_isCurrentPostPublished; });
  791. __webpack_require__.d(selectors_namespaceObject, "isCurrentPostScheduled", function() { return selectors_isCurrentPostScheduled; });
  792. __webpack_require__.d(selectors_namespaceObject, "isEditedPostPublishable", function() { return selectors_isEditedPostPublishable; });
  793. __webpack_require__.d(selectors_namespaceObject, "isEditedPostSaveable", function() { return selectors_isEditedPostSaveable; });
  794. __webpack_require__.d(selectors_namespaceObject, "isEditedPostEmpty", function() { return isEditedPostEmpty; });
  795. __webpack_require__.d(selectors_namespaceObject, "isEditedPostAutosaveable", function() { return selectors_isEditedPostAutosaveable; });
  796. __webpack_require__.d(selectors_namespaceObject, "getAutosave", function() { return getAutosave; });
  797. __webpack_require__.d(selectors_namespaceObject, "hasAutosave", function() { return hasAutosave; });
  798. __webpack_require__.d(selectors_namespaceObject, "isEditedPostBeingScheduled", function() { return selectors_isEditedPostBeingScheduled; });
  799. __webpack_require__.d(selectors_namespaceObject, "isEditedPostDateFloating", function() { return isEditedPostDateFloating; });
  800. __webpack_require__.d(selectors_namespaceObject, "isSavingPost", function() { return selectors_isSavingPost; });
  801. __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestSucceed", function() { return didPostSaveRequestSucceed; });
  802. __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestFail", function() { return didPostSaveRequestFail; });
  803. __webpack_require__.d(selectors_namespaceObject, "isAutosavingPost", function() { return selectors_isAutosavingPost; });
  804. __webpack_require__.d(selectors_namespaceObject, "isPreviewingPost", function() { return isPreviewingPost; });
  805. __webpack_require__.d(selectors_namespaceObject, "getEditedPostPreviewLink", function() { return selectors_getEditedPostPreviewLink; });
  806. __webpack_require__.d(selectors_namespaceObject, "getSuggestedPostFormat", function() { return selectors_getSuggestedPostFormat; });
  807. __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; });
  808. __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; });
  809. __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; });
  810. __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return isPermalinkEditable; });
  811. __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; });
  812. __webpack_require__.d(selectors_namespaceObject, "getEditedPostSlug", function() { return getEditedPostSlug; });
  813. __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return getPermalinkParts; });
  814. __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return selectors_isPostLocked; });
  815. __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; });
  816. __webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; });
  817. __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; });
  818. __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; });
  819. __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; });
  820. __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; });
  821. __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; });
  822. __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return getEditorBlocks; });
  823. __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionStart", function() { return getEditorSelectionStart; });
  824. __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionEnd", function() { return getEditorSelectionEnd; });
  825. __webpack_require__.d(selectors_namespaceObject, "getEditorSelection", function() { return selectors_getEditorSelection; });
  826. __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return selectors_unstableIsEditorReady; });
  827. __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; });
  828. __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; });
  829. __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; });
  830. __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; });
  831. __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; });
  832. __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; });
  833. __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; });
  834. __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; });
  835. __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; });
  836. __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; });
  837. __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; });
  838. __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return selectors_getGlobalBlockCount; });
  839. __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; });
  840. __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; });
  841. __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; });
  842. __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; });
  843. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; });
  844. __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; });
  845. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; });
  846. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; });
  847. __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; });
  848. __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; });
  849. __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; });
  850. __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; });
  851. __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; });
  852. __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return getSelectedBlocksInitialCaretPosition; });
  853. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return getMultiSelectedBlockClientIds; });
  854. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; });
  855. __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; });
  856. __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; });
  857. __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return isFirstMultiSelectedBlock; });
  858. __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return isBlockMultiSelected; });
  859. __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return isAncestorMultiSelected; });
  860. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; });
  861. __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; });
  862. __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return getBlockOrder; });
  863. __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return getBlockIndex; });
  864. __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return isBlockSelected; });
  865. __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return hasSelectedInnerBlock; });
  866. __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; });
  867. __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; });
  868. __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; });
  869. __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; });
  870. __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; });
  871. __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; });
  872. __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; });
  873. __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; });
  874. __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; });
  875. __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; });
  876. __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; });
  877. __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; });
  878. __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; });
  879. __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; });
  880. __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; });
  881. __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; });
  882. __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateTypes", function() { return __experimentalGetDefaultTemplateTypes; });
  883. __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplatePartAreas", function() { return __experimentalGetDefaultTemplatePartAreas; });
  884. __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateType", function() { return __experimentalGetDefaultTemplateType; });
  885. __webpack_require__.d(selectors_namespaceObject, "__experimentalGetTemplateInfo", function() { return __experimentalGetTemplateInfo; });
  886. // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js
  887. var actions_namespaceObject = {};
  888. __webpack_require__.r(actions_namespaceObject);
  889. __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return actions_setupEditor; });
  890. __webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return actions_experimentalTearDownEditor; });
  891. __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; });
  892. __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; });
  893. __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; });
  894. __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; });
  895. __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; });
  896. __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; });
  897. __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; });
  898. __webpack_require__.d(actions_namespaceObject, "savePost", function() { return actions_savePost; });
  899. __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; });
  900. __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; });
  901. __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; });
  902. __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; });
  903. __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; });
  904. __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; });
  905. __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return actions_updatePostLock; });
  906. __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; });
  907. __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; });
  908. __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; });
  909. __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; });
  910. __webpack_require__.d(actions_namespaceObject, "lockPostAutosaving", function() { return lockPostAutosaving; });
  911. __webpack_require__.d(actions_namespaceObject, "unlockPostAutosaving", function() { return unlockPostAutosaving; });
  912. __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; });
  913. __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return actions_updateEditorSettings; });
  914. __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; });
  915. __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; });
  916. __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; });
  917. __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; });
  918. __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; });
  919. __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; });
  920. __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; });
  921. __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; });
  922. __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; });
  923. __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; });
  924. __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; });
  925. __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; });
  926. __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; });
  927. __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; });
  928. __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; });
  929. __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; });
  930. __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; });
  931. __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return showInsertionPoint; });
  932. __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return hideInsertionPoint; });
  933. __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return actions_setTemplateValidity; });
  934. __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return actions_synchronizeTemplate; });
  935. __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; });
  936. __webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return removeBlocks; });
  937. __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; });
  938. __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; });
  939. __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; });
  940. __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; });
  941. __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; });
  942. __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; });
  943. __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; });
  944. __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; });
  945. // EXTERNAL MODULE: external ["wp","blockEditor"]
  946. var external_wp_blockEditor_ = __webpack_require__("axFQ");
  947. // EXTERNAL MODULE: external ["wp","coreData"]
  948. var external_wp_coreData_ = __webpack_require__("jZUy");
  949. // EXTERNAL MODULE: external ["wp","richText"]
  950. var external_wp_richText_ = __webpack_require__("qRz9");
  951. // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  952. var esm_extends = __webpack_require__("wx14");
  953. // EXTERNAL MODULE: external ["wp","element"]
  954. var external_wp_element_ = __webpack_require__("GRId");
  955. // EXTERNAL MODULE: external "lodash"
  956. var external_lodash_ = __webpack_require__("YLtl");
  957. // EXTERNAL MODULE: external ["wp","blocks"]
  958. var external_wp_blocks_ = __webpack_require__("HSyU");
  959. // EXTERNAL MODULE: external ["wp","data"]
  960. var external_wp_data_ = __webpack_require__("1ZqX");
  961. // EXTERNAL MODULE: external ["wp","compose"]
  962. var external_wp_compose_ = __webpack_require__("K9lf");
  963. // EXTERNAL MODULE: external ["wp","hooks"]
  964. var external_wp_hooks_ = __webpack_require__("g56x");
  965. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js
  966. /**
  967. * External dependencies
  968. */
  969. /**
  970. * WordPress dependencies
  971. */
  972. /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
  973. /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
  974. /**
  975. * Object whose keys are the names of block attributes, where each value
  976. * represents the meta key to which the block attribute is intended to save.
  977. *
  978. * @see https://developer.wordpress.org/reference/functions/register_meta/
  979. *
  980. * @typedef {Object<string,string>} WPMetaAttributeMapping
  981. */
  982. /**
  983. * Given a mapping of attribute names (meta source attributes) to their
  984. * associated meta key, returns a higher order component that overrides its
  985. * `attributes` and `setAttributes` props to sync any changes with the edited
  986. * post's meta keys.
  987. *
  988. * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.
  989. *
  990. * @return {WPHigherOrderComponent} Higher-order component.
  991. */
  992. const createWithMetaAttributeSource = metaAttributes => Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => ({
  993. attributes,
  994. setAttributes,
  995. ...props
  996. }) => {
  997. const postType = Object(external_wp_data_["useSelect"])(select => select('core/editor').getCurrentPostType(), []);
  998. const [meta, setMeta] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'meta');
  999. const mergedAttributes = Object(external_wp_element_["useMemo"])(() => ({ ...attributes,
  1000. ...Object(external_lodash_["mapValues"])(metaAttributes, metaKey => meta[metaKey])
  1001. }), [attributes, meta]);
  1002. return Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({
  1003. attributes: mergedAttributes,
  1004. setAttributes: nextAttributes => {
  1005. const nextMeta = Object(external_lodash_["mapKeys"])( // Filter to intersection of keys between the updated
  1006. // attributes and those with an associated meta key.
  1007. Object(external_lodash_["pickBy"])(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name.
  1008. (value, attributeKey) => metaAttributes[attributeKey]);
  1009. if (!Object(external_lodash_["isEmpty"])(nextMeta)) {
  1010. setMeta(nextMeta);
  1011. }
  1012. setAttributes(nextAttributes);
  1013. }
  1014. }, props));
  1015. }, 'withMetaAttributeSource');
  1016. /**
  1017. * Filters a registered block's settings to enhance a block's `edit` component
  1018. * to upgrade meta-sourced attributes to use the post's meta entity property.
  1019. *
  1020. * @param {WPBlockSettings} settings Registered block settings.
  1021. *
  1022. * @return {WPBlockSettings} Filtered block settings.
  1023. */
  1024. function shimAttributeSource(settings) {
  1025. /** @type {WPMetaAttributeMapping} */
  1026. const metaAttributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(settings.attributes, {
  1027. source: 'meta'
  1028. }), 'meta');
  1029. if (!Object(external_lodash_["isEmpty"])(metaAttributes)) {
  1030. settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
  1031. }
  1032. return settings;
  1033. }
  1034. Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was
  1035. // added. There may already be blocks registered by this point, and those must
  1036. // be updated to apply the shim.
  1037. //
  1038. // The following implementation achieves this, albeit with a couple caveats:
  1039. // - Only blocks registered on the global store will be modified.
  1040. // - The block settings are directly mutated, since there is currently no
  1041. // mechanism to update an existing block registration. This is the reason for
  1042. // `getBlockType` separate from `getBlockTypes`, since the latter returns a
  1043. // _copy_ of the block registration (i.e. the mutation would not affect the
  1044. // actual registered block settings).
  1045. //
  1046. // `getBlockTypes` or `getBlockType` implementation could change in the future
  1047. // in regards to creating settings clones, but the corresponding end-to-end
  1048. // tests for meta blocks should cover against any potential regressions.
  1049. //
  1050. // In the future, we could support updating block settings, at which point this
  1051. // implementation could use that mechanism instead.
  1052. Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockTypes().map(({
  1053. name
  1054. }) => Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockType(name)).forEach(shimAttributeSource);
  1055. // EXTERNAL MODULE: external ["wp","apiFetch"]
  1056. var external_wp_apiFetch_ = __webpack_require__("ywyh");
  1057. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_);
  1058. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
  1059. /**
  1060. * WordPress dependencies
  1061. */
  1062. /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
  1063. /**
  1064. * A user mentions completer.
  1065. *
  1066. * @type {WPCompleter}
  1067. */
  1068. /* harmony default export */ var autocompleters_user = ({
  1069. name: 'users',
  1070. className: 'editor-autocompleters__user',
  1071. triggerPrefix: '@',
  1072. options(search) {
  1073. let payload = '';
  1074. if (search) {
  1075. payload = '?search=' + encodeURIComponent(search);
  1076. }
  1077. return external_wp_apiFetch_default()({
  1078. path: '/wp/v2/users' + payload
  1079. });
  1080. },
  1081. isDebounced: true,
  1082. getOptionKeywords(user) {
  1083. return [user.slug, user.name];
  1084. },
  1085. getOptionLabel(user) {
  1086. const avatar = user.avatar_urls && user.avatar_urls[24] ? Object(external_wp_element_["createElement"])("img", {
  1087. key: "avatar",
  1088. className: "editor-autocompleters__user-avatar",
  1089. alt: "",
  1090. src: user.avatar_urls[24]
  1091. }) : Object(external_wp_element_["createElement"])("span", {
  1092. className: "editor-autocompleters__no-avatar"
  1093. });
  1094. return [avatar, Object(external_wp_element_["createElement"])("span", {
  1095. key: "name",
  1096. className: "editor-autocompleters__user-name"
  1097. }, user.name), Object(external_wp_element_["createElement"])("span", {
  1098. key: "slug",
  1099. className: "editor-autocompleters__user-slug"
  1100. }, user.slug)];
  1101. },
  1102. getOptionCompletion(user) {
  1103. return `@${user.slug}`;
  1104. }
  1105. });
  1106. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js
  1107. /**
  1108. * External dependencies
  1109. */
  1110. /**
  1111. * WordPress dependencies
  1112. */
  1113. /**
  1114. * Internal dependencies
  1115. */
  1116. function setDefaultCompleters(completers = []) {
  1117. // Provide copies so filters may directly modify them.
  1118. completers.push(Object(external_lodash_["clone"])(autocompleters_user));
  1119. return completers;
  1120. }
  1121. Object(external_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
  1122. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js
  1123. /**
  1124. * Internal dependencies
  1125. */
  1126. // EXTERNAL MODULE: external ["wp","dataControls"]
  1127. var external_wp_dataControls_ = __webpack_require__("51Zz");
  1128. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
  1129. /**
  1130. * WordPress dependencies
  1131. */
  1132. const PREFERENCES_DEFAULTS = {
  1133. insertUsage: {},
  1134. // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580.
  1135. isPublishSidebarEnabled: true
  1136. };
  1137. /**
  1138. * The default post editor settings
  1139. *
  1140. * allowedBlockTypes boolean|Array Allowed block types
  1141. * richEditingEnabled boolean Whether rich editing is enabled or not
  1142. * codeEditingEnabled boolean Whether code editing is enabled or not
  1143. * enableCustomFields boolean Whether the WordPress custom fields are enabled or not
  1144. * autosaveInterval number Autosave Interval
  1145. * availableTemplates array? The available post templates
  1146. * disablePostFormats boolean Whether or not the post formats are disabled
  1147. * allowedMimeTypes array? List of allowed mime types and file extensions
  1148. * maxUploadFileSize number Maximum upload file size
  1149. * supportsLayout boolean Whether the editor supports layouts.
  1150. */
  1151. const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_["SETTINGS_DEFAULTS"],
  1152. richEditingEnabled: true,
  1153. codeEditingEnabled: true,
  1154. enableCustomFields: false,
  1155. supportsLayout: true
  1156. };
  1157. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js
  1158. /**
  1159. * External dependencies
  1160. */
  1161. /**
  1162. * WordPress dependencies
  1163. */
  1164. /**
  1165. * Internal dependencies
  1166. */
  1167. /**
  1168. * Returns a post attribute value, flattening nested rendered content using its
  1169. * raw value in place of its original object form.
  1170. *
  1171. * @param {*} value Original value.
  1172. *
  1173. * @return {*} Raw value.
  1174. */
  1175. function getPostRawValue(value) {
  1176. if (value && 'object' === typeof value && 'raw' in value) {
  1177. return value.raw;
  1178. }
  1179. return value;
  1180. }
  1181. /**
  1182. * Returns true if the two object arguments have the same keys, or false
  1183. * otherwise.
  1184. *
  1185. * @param {Object} a First object.
  1186. * @param {Object} b Second object.
  1187. *
  1188. * @return {boolean} Whether the two objects have the same keys.
  1189. */
  1190. function hasSameKeys(a, b) {
  1191. return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b));
  1192. }
  1193. /**
  1194. * Returns true if, given the currently dispatching action and the previously
  1195. * dispatched action, the two actions are editing the same post property, or
  1196. * false otherwise.
  1197. *
  1198. * @param {Object} action Currently dispatching action.
  1199. * @param {Object} previousAction Previously dispatched action.
  1200. *
  1201. * @return {boolean} Whether actions are updating the same post property.
  1202. */
  1203. function isUpdatingSamePostProperty(action, previousAction) {
  1204. return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
  1205. }
  1206. /**
  1207. * Returns true if, given the currently dispatching action and the previously
  1208. * dispatched action, the two actions are modifying the same property such that
  1209. * undo history should be batched.
  1210. *
  1211. * @param {Object} action Currently dispatching action.
  1212. * @param {Object} previousAction Previously dispatched action.
  1213. *
  1214. * @return {boolean} Whether to overwrite present state.
  1215. */
  1216. function shouldOverwriteState(action, previousAction) {
  1217. if (action.type === 'RESET_EDITOR_BLOCKS') {
  1218. return !action.shouldCreateUndoLevel;
  1219. }
  1220. if (!previousAction || action.type !== previousAction.type) {
  1221. return false;
  1222. }
  1223. return isUpdatingSamePostProperty(action, previousAction);
  1224. }
  1225. function reducer_postId(state = null, action) {
  1226. switch (action.type) {
  1227. case 'SETUP_EDITOR_STATE':
  1228. case 'RESET_POST':
  1229. return action.post.id;
  1230. }
  1231. return state;
  1232. }
  1233. function reducer_postType(state = null, action) {
  1234. switch (action.type) {
  1235. case 'SETUP_EDITOR_STATE':
  1236. case 'RESET_POST':
  1237. return action.post.type;
  1238. }
  1239. return state;
  1240. }
  1241. /**
  1242. * Reducer returning whether the post blocks match the defined template or not.
  1243. *
  1244. * @param {Object} state Current state.
  1245. * @param {Object} action Dispatched action.
  1246. *
  1247. * @return {boolean} Updated state.
  1248. */
  1249. function reducer_template(state = {
  1250. isValid: true
  1251. }, action) {
  1252. switch (action.type) {
  1253. case 'SET_TEMPLATE_VALIDITY':
  1254. return { ...state,
  1255. isValid: action.isValid
  1256. };
  1257. }
  1258. return state;
  1259. }
  1260. /**
  1261. * Reducer returning the user preferences.
  1262. *
  1263. * @param {Object} state Current state.
  1264. * @param {Object} action Dispatched action.
  1265. *
  1266. * @return {string} Updated state.
  1267. */
  1268. function preferences(state = PREFERENCES_DEFAULTS, action) {
  1269. switch (action.type) {
  1270. case 'ENABLE_PUBLISH_SIDEBAR':
  1271. return { ...state,
  1272. isPublishSidebarEnabled: true
  1273. };
  1274. case 'DISABLE_PUBLISH_SIDEBAR':
  1275. return { ...state,
  1276. isPublishSidebarEnabled: false
  1277. };
  1278. }
  1279. return state;
  1280. }
  1281. /**
  1282. * Reducer returning current network request state (whether a request to
  1283. * the WP REST API is in progress, successful, or failed).
  1284. *
  1285. * @param {Object} state Current state.
  1286. * @param {Object} action Dispatched action.
  1287. *
  1288. * @return {Object} Updated state.
  1289. */
  1290. function saving(state = {}, action) {
  1291. switch (action.type) {
  1292. case 'REQUEST_POST_UPDATE_START':
  1293. case 'REQUEST_POST_UPDATE_FINISH':
  1294. return {
  1295. pending: action.type === 'REQUEST_POST_UPDATE_START',
  1296. options: action.options || {}
  1297. };
  1298. }
  1299. return state;
  1300. }
  1301. /**
  1302. * Post Lock State.
  1303. *
  1304. * @typedef {Object} PostLockState
  1305. *
  1306. * @property {boolean} isLocked Whether the post is locked.
  1307. * @property {?boolean} isTakeover Whether the post editing has been taken over.
  1308. * @property {?boolean} activePostLock Active post lock value.
  1309. * @property {?Object} user User that took over the post.
  1310. */
  1311. /**
  1312. * Reducer returning the post lock status.
  1313. *
  1314. * @param {PostLockState} state Current state.
  1315. * @param {Object} action Dispatched action.
  1316. *
  1317. * @return {PostLockState} Updated state.
  1318. */
  1319. function postLock(state = {
  1320. isLocked: false
  1321. }, action) {
  1322. switch (action.type) {
  1323. case 'UPDATE_POST_LOCK':
  1324. return action.lock;
  1325. }
  1326. return state;
  1327. }
  1328. /**
  1329. * Post saving lock.
  1330. *
  1331. * When post saving is locked, the post cannot be published or updated.
  1332. *
  1333. * @param {PostLockState} state Current state.
  1334. * @param {Object} action Dispatched action.
  1335. *
  1336. * @return {PostLockState} Updated state.
  1337. */
  1338. function postSavingLock(state = {}, action) {
  1339. switch (action.type) {
  1340. case 'LOCK_POST_SAVING':
  1341. return { ...state,
  1342. [action.lockName]: true
  1343. };
  1344. case 'UNLOCK_POST_SAVING':
  1345. return Object(external_lodash_["omit"])(state, action.lockName);
  1346. }
  1347. return state;
  1348. }
  1349. /**
  1350. * Post autosaving lock.
  1351. *
  1352. * When post autosaving is locked, the post will not autosave.
  1353. *
  1354. * @param {PostLockState} state Current state.
  1355. * @param {Object} action Dispatched action.
  1356. *
  1357. * @return {PostLockState} Updated state.
  1358. */
  1359. function postAutosavingLock(state = {}, action) {
  1360. switch (action.type) {
  1361. case 'LOCK_POST_AUTOSAVING':
  1362. return { ...state,
  1363. [action.lockName]: true
  1364. };
  1365. case 'UNLOCK_POST_AUTOSAVING':
  1366. return Object(external_lodash_["omit"])(state, action.lockName);
  1367. }
  1368. return state;
  1369. }
  1370. /**
  1371. * Reducer returning whether the editor is ready to be rendered.
  1372. * The editor is considered ready to be rendered once
  1373. * the post object is loaded properly and the initial blocks parsed.
  1374. *
  1375. * @param {boolean} state
  1376. * @param {Object} action
  1377. *
  1378. * @return {boolean} Updated state.
  1379. */
  1380. function reducer_isReady(state = false, action) {
  1381. switch (action.type) {
  1382. case 'SETUP_EDITOR_STATE':
  1383. return true;
  1384. case 'TEAR_DOWN_EDITOR':
  1385. return false;
  1386. }
  1387. return state;
  1388. }
  1389. /**
  1390. * Reducer returning the post editor setting.
  1391. *
  1392. * @param {Object} state Current state.
  1393. * @param {Object} action Dispatched action.
  1394. *
  1395. * @return {Object} Updated state.
  1396. */
  1397. function reducer_editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
  1398. switch (action.type) {
  1399. case 'UPDATE_EDITOR_SETTINGS':
  1400. return { ...state,
  1401. ...action.settings
  1402. };
  1403. }
  1404. return state;
  1405. }
  1406. /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
  1407. postId: reducer_postId,
  1408. postType: reducer_postType,
  1409. preferences,
  1410. saving,
  1411. postLock,
  1412. template: reducer_template,
  1413. postSavingLock,
  1414. isReady: reducer_isReady,
  1415. editorSettings: reducer_editorSettings,
  1416. postAutosavingLock
  1417. }));
  1418. // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
  1419. var rememo = __webpack_require__("pPDe");
  1420. // EXTERNAL MODULE: external ["wp","date"]
  1421. var external_wp_date_ = __webpack_require__("FqII");
  1422. // EXTERNAL MODULE: external ["wp","url"]
  1423. var external_wp_url_ = __webpack_require__("Mmq9");
  1424. // EXTERNAL MODULE: external ["wp","deprecated"]
  1425. var external_wp_deprecated_ = __webpack_require__("NMb1");
  1426. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
  1427. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
  1428. var layout = __webpack_require__("Civd");
  1429. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js
  1430. /**
  1431. * Set of post properties for which edits should assume a merging behavior,
  1432. * assuming an object value.
  1433. *
  1434. * @type {Set}
  1435. */
  1436. const EDIT_MERGE_PROPERTIES = new Set(['meta']);
  1437. /**
  1438. * Constant for the store module (or reducer) key.
  1439. *
  1440. * @type {string}
  1441. */
  1442. const STORE_NAME = 'core/editor';
  1443. const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
  1444. const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
  1445. const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
  1446. const ONE_MINUTE_IN_MS = 60 * 1000;
  1447. const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
  1448. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js
  1449. /**
  1450. * External dependencies
  1451. */
  1452. /**
  1453. * WordPress dependencies
  1454. */
  1455. /**
  1456. * Returns the URL of a WPAdmin Page.
  1457. *
  1458. * TODO: This should be moved to a module less specific to the editor.
  1459. *
  1460. * @param {string} page Page to navigate to.
  1461. * @param {Object} query Query Args.
  1462. *
  1463. * @return {string} WPAdmin URL.
  1464. */
  1465. function getWPAdminURL(page, query) {
  1466. return Object(external_wp_url_["addQueryArgs"])(page, query);
  1467. }
  1468. /**
  1469. * Performs some basic cleanup of a string for use as a post slug
  1470. *
  1471. * This replicates some of what sanitize_title() does in WordPress core, but
  1472. * is only designed to approximate what the slug will be.
  1473. *
  1474. * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters.
  1475. * Removes combining diacritical marks. Converts whitespace, periods,
  1476. * and forward slashes to hyphens. Removes any remaining non-word characters
  1477. * except hyphens and underscores. Converts remaining string to lowercase.
  1478. * It does not account for octets, HTML entities, or other encoded characters.
  1479. *
  1480. * @param {string} string Title or slug to be processed
  1481. *
  1482. * @return {string} Processed string
  1483. */
  1484. function cleanForSlug(string) {
  1485. if (!string) {
  1486. return '';
  1487. }
  1488. return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-');
  1489. }
  1490. // EXTERNAL MODULE: external ["wp","primitives"]
  1491. var external_wp_primitives_ = __webpack_require__("Tqx9");
  1492. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
  1493. /**
  1494. * WordPress dependencies
  1495. */
  1496. const header = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  1497. xmlns: "http://www.w3.org/2000/svg",
  1498. viewBox: "0 0 24 24"
  1499. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  1500. d: "M18.5 10.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"
  1501. }));
  1502. /* harmony default export */ var library_header = (header);
  1503. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
  1504. /**
  1505. * WordPress dependencies
  1506. */
  1507. const footer = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  1508. xmlns: "http://www.w3.org/2000/svg",
  1509. viewBox: "0 0 24 24"
  1510. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  1511. fillRule: "evenodd",
  1512. d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  1513. }));
  1514. /* harmony default export */ var library_footer = (footer);
  1515. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
  1516. /**
  1517. * WordPress dependencies
  1518. */
  1519. const sidebar = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  1520. xmlns: "http://www.w3.org/2000/svg",
  1521. viewBox: "0 0 24 24"
  1522. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  1523. 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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  1524. }));
  1525. /* harmony default export */ var library_sidebar = (sidebar);
  1526. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/get-template-part-icon.js
  1527. /**
  1528. * WordPress dependencies
  1529. */
  1530. /**
  1531. * Helper function to retrieve the corresponding icon by name.
  1532. *
  1533. * @param {string} iconName The name of the icon.
  1534. *
  1535. * @return {Object} The corresponding icon.
  1536. */
  1537. function getTemplatePartIcon(iconName) {
  1538. if ('header' === iconName) {
  1539. return library_header;
  1540. } else if ('footer' === iconName) {
  1541. return library_footer;
  1542. } else if ('sidebar' === iconName) {
  1543. return library_sidebar;
  1544. }
  1545. return layout["a" /* default */];
  1546. }
  1547. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
  1548. /**
  1549. * External dependencies
  1550. */
  1551. /**
  1552. * WordPress dependencies
  1553. */
  1554. /**
  1555. * Internal dependencies
  1556. */
  1557. /**
  1558. * Shared reference to an empty object for cases where it is important to avoid
  1559. * returning a new object reference on every invocation, as in a connected or
  1560. * other pure component which performs `shouldComponentUpdate` check on props.
  1561. * This should be used as a last resort, since the normalized data should be
  1562. * maintained by the reducer result in state.
  1563. */
  1564. const EMPTY_OBJECT = {};
  1565. /**
  1566. * Shared reference to an empty array for cases where it is important to avoid
  1567. * returning a new array reference on every invocation, as in a connected or
  1568. * other pure component which performs `shouldComponentUpdate` check on props.
  1569. * This should be used as a last resort, since the normalized data should be
  1570. * maintained by the reducer result in state.
  1571. */
  1572. const EMPTY_ARRAY = [];
  1573. /**
  1574. * Returns true if any past editor history snapshots exist, or false otherwise.
  1575. *
  1576. * @param {Object} state Global application state.
  1577. *
  1578. * @return {boolean} Whether undo history exists.
  1579. */
  1580. const hasEditorUndo = Object(external_wp_data_["createRegistrySelector"])(select => () => {
  1581. return select('core').hasUndo();
  1582. });
  1583. /**
  1584. * Returns true if any future editor history snapshots exist, or false
  1585. * otherwise.
  1586. *
  1587. * @param {Object} state Global application state.
  1588. *
  1589. * @return {boolean} Whether redo history exists.
  1590. */
  1591. const hasEditorRedo = Object(external_wp_data_["createRegistrySelector"])(select => () => {
  1592. return select('core').hasRedo();
  1593. });
  1594. /**
  1595. * Returns true if the currently edited post is yet to be saved, or false if
  1596. * the post has been saved.
  1597. *
  1598. * @param {Object} state Global application state.
  1599. *
  1600. * @return {boolean} Whether the post is new.
  1601. */
  1602. function selectors_isEditedPostNew(state) {
  1603. return selectors_getCurrentPost(state).status === 'auto-draft';
  1604. }
  1605. /**
  1606. * Returns true if content includes unsaved changes, or false otherwise.
  1607. *
  1608. * @param {Object} state Editor state.
  1609. *
  1610. * @return {boolean} Whether content includes unsaved changes.
  1611. */
  1612. function hasChangedContent(state) {
  1613. const edits = selectors_getPostEdits(state);
  1614. return 'blocks' in edits || // `edits` is intended to contain only values which are different from
  1615. // the saved post, so the mere presence of a property is an indicator
  1616. // that the value is different than what is known to be saved. While
  1617. // content in Visual mode is represented by the blocks state, in Text
  1618. // mode it is tracked by `edits.content`.
  1619. 'content' in edits;
  1620. }
  1621. /**
  1622. * Returns true if there are unsaved values for the current edit session, or
  1623. * false if the editing state matches the saved or new post.
  1624. *
  1625. * @param {Object} state Global application state.
  1626. *
  1627. * @return {boolean} Whether unsaved values exist.
  1628. */
  1629. const selectors_isEditedPostDirty = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  1630. // Edits should contain only fields which differ from the saved post (reset
  1631. // at initial load and save complete). Thus, a non-empty edits state can be
  1632. // inferred to contain unsaved values.
  1633. const postType = selectors_getCurrentPostType(state);
  1634. const postId = selectors_getCurrentPostId(state);
  1635. if (select('core').hasEditsForEntityRecord('postType', postType, postId)) {
  1636. return true;
  1637. }
  1638. return false;
  1639. });
  1640. /**
  1641. * Returns true if there are unsaved edits for entities other than
  1642. * the editor's post, and false otherwise.
  1643. *
  1644. * @param {Object} state Global application state.
  1645. *
  1646. * @return {boolean} Whether there are edits or not.
  1647. */
  1648. const selectors_hasNonPostEntityChanges = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  1649. const dirtyEntityRecords = select('core').__experimentalGetDirtyEntityRecords();
  1650. const {
  1651. type,
  1652. id
  1653. } = selectors_getCurrentPost(state);
  1654. return Object(external_lodash_["some"])(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
  1655. });
  1656. /**
  1657. * Returns true if there are no unsaved values for the current edit session and
  1658. * if the currently edited post is new (has never been saved before).
  1659. *
  1660. * @param {Object} state Global application state.
  1661. *
  1662. * @return {boolean} Whether new post and unsaved values exist.
  1663. */
  1664. function selectors_isCleanNewPost(state) {
  1665. return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state);
  1666. }
  1667. /**
  1668. * Returns the post currently being edited in its last known saved state, not
  1669. * including unsaved edits. Returns an object containing relevant default post
  1670. * values if the post has not yet been saved.
  1671. *
  1672. * @param {Object} state Global application state.
  1673. *
  1674. * @return {Object} Post object.
  1675. */
  1676. const selectors_getCurrentPost = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  1677. const postId = selectors_getCurrentPostId(state);
  1678. const postType = selectors_getCurrentPostType(state);
  1679. const post = select('core').getRawEntityRecord('postType', postType, postId);
  1680. if (post) {
  1681. return post;
  1682. } // This exists for compatibility with the previous selector behavior
  1683. // which would guarantee an object return based on the editor reducer's
  1684. // default empty object state.
  1685. return EMPTY_OBJECT;
  1686. });
  1687. /**
  1688. * Returns the post type of the post currently being edited.
  1689. *
  1690. * @param {Object} state Global application state.
  1691. *
  1692. * @return {string} Post type.
  1693. */
  1694. function selectors_getCurrentPostType(state) {
  1695. return state.postType;
  1696. }
  1697. /**
  1698. * Returns the ID of the post currently being edited, or null if the post has
  1699. * not yet been saved.
  1700. *
  1701. * @param {Object} state Global application state.
  1702. *
  1703. * @return {?number} ID of current post.
  1704. */
  1705. function selectors_getCurrentPostId(state) {
  1706. return state.postId;
  1707. }
  1708. /**
  1709. * Returns the number of revisions of the post currently being edited.
  1710. *
  1711. * @param {Object} state Global application state.
  1712. *
  1713. * @return {number} Number of revisions.
  1714. */
  1715. function getCurrentPostRevisionsCount(state) {
  1716. return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0);
  1717. }
  1718. /**
  1719. * Returns the last revision ID of the post currently being edited,
  1720. * or null if the post has no revisions.
  1721. *
  1722. * @param {Object} state Global application state.
  1723. *
  1724. * @return {?number} ID of the last revision.
  1725. */
  1726. function getCurrentPostLastRevisionId(state) {
  1727. return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null);
  1728. }
  1729. /**
  1730. * Returns any post values which have been changed in the editor but not yet
  1731. * been saved.
  1732. *
  1733. * @param {Object} state Global application state.
  1734. *
  1735. * @return {Object} Object of key value pairs comprising unsaved edits.
  1736. */
  1737. const selectors_getPostEdits = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  1738. const postType = selectors_getCurrentPostType(state);
  1739. const postId = selectors_getCurrentPostId(state);
  1740. return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
  1741. });
  1742. /**
  1743. * Returns a new reference when edited values have changed. This is useful in
  1744. * inferring where an edit has been made between states by comparison of the
  1745. * return values using strict equality.
  1746. *
  1747. * @deprecated since Gutenberg 6.5.0.
  1748. *
  1749. * @example
  1750. *
  1751. * ```
  1752. * const hasEditOccurred = (
  1753. * getReferenceByDistinctEdits( beforeState ) !==
  1754. * getReferenceByDistinctEdits( afterState )
  1755. * );
  1756. * ```
  1757. *
  1758. * @param {Object} state Editor state.
  1759. *
  1760. * @return {*} A value whose reference will change only when an edit occurs.
  1761. */
  1762. const getReferenceByDistinctEdits = Object(external_wp_data_["createRegistrySelector"])(select => () =>
  1763. /* state */
  1764. {
  1765. external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`", {
  1766. since: '5.4',
  1767. alternative: "`wp.data.select( 'core' ).getReferenceByDistinctEdits`"
  1768. });
  1769. return select('core').getReferenceByDistinctEdits();
  1770. });
  1771. /**
  1772. * Returns an attribute value of the saved post.
  1773. *
  1774. * @param {Object} state Global application state.
  1775. * @param {string} attributeName Post attribute name.
  1776. *
  1777. * @return {*} Post attribute value.
  1778. */
  1779. function selectors_getCurrentPostAttribute(state, attributeName) {
  1780. switch (attributeName) {
  1781. case 'type':
  1782. return selectors_getCurrentPostType(state);
  1783. case 'id':
  1784. return selectors_getCurrentPostId(state);
  1785. default:
  1786. const post = selectors_getCurrentPost(state);
  1787. if (!post.hasOwnProperty(attributeName)) {
  1788. break;
  1789. }
  1790. return getPostRawValue(post[attributeName]);
  1791. }
  1792. }
  1793. /**
  1794. * Returns a single attribute of the post being edited, preferring the unsaved
  1795. * edit if one exists, but merging with the attribute value for the last known
  1796. * saved state of the post (this is needed for some nested attributes like meta).
  1797. *
  1798. * @param {Object} state Global application state.
  1799. * @param {string} attributeName Post attribute name.
  1800. *
  1801. * @return {*} Post attribute value.
  1802. */
  1803. const getNestedEditedPostProperty = (state, attributeName) => {
  1804. const edits = selectors_getPostEdits(state);
  1805. if (!edits.hasOwnProperty(attributeName)) {
  1806. return selectors_getCurrentPostAttribute(state, attributeName);
  1807. }
  1808. return { ...selectors_getCurrentPostAttribute(state, attributeName),
  1809. ...edits[attributeName]
  1810. };
  1811. };
  1812. /**
  1813. * Returns a single attribute of the post being edited, preferring the unsaved
  1814. * edit if one exists, but falling back to the attribute for the last known
  1815. * saved state of the post.
  1816. *
  1817. * @param {Object} state Global application state.
  1818. * @param {string} attributeName Post attribute name.
  1819. *
  1820. * @return {*} Post attribute value.
  1821. */
  1822. function selectors_getEditedPostAttribute(state, attributeName) {
  1823. // Special cases
  1824. switch (attributeName) {
  1825. case 'content':
  1826. return getEditedPostContent(state);
  1827. } // Fall back to saved post value if not edited.
  1828. const edits = selectors_getPostEdits(state);
  1829. if (!edits.hasOwnProperty(attributeName)) {
  1830. return selectors_getCurrentPostAttribute(state, attributeName);
  1831. } // Merge properties are objects which contain only the patch edit in state,
  1832. // and thus must be merged with the current post attribute.
  1833. if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
  1834. return getNestedEditedPostProperty(state, attributeName);
  1835. }
  1836. return edits[attributeName];
  1837. }
  1838. /**
  1839. * Returns an attribute value of the current autosave revision for a post, or
  1840. * null if there is no autosave for the post.
  1841. *
  1842. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
  1843. * from the '@wordpress/core-data' package and access properties on the returned
  1844. * autosave object using getPostRawValue.
  1845. *
  1846. * @param {Object} state Global application state.
  1847. * @param {string} attributeName Autosave attribute name.
  1848. *
  1849. * @return {*} Autosave attribute value.
  1850. */
  1851. const getAutosaveAttribute = Object(external_wp_data_["createRegistrySelector"])(select => (state, attributeName) => {
  1852. if (!Object(external_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') {
  1853. return;
  1854. }
  1855. const postType = selectors_getCurrentPostType(state);
  1856. const postId = selectors_getCurrentPostId(state);
  1857. const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
  1858. const autosave = select('core').getAutosave(postType, postId, currentUserId);
  1859. if (autosave) {
  1860. return getPostRawValue(autosave[attributeName]);
  1861. }
  1862. });
  1863. /**
  1864. * Returns the current visibility of the post being edited, preferring the
  1865. * unsaved value if different than the saved post. The return value is one of
  1866. * "private", "password", or "public".
  1867. *
  1868. * @param {Object} state Global application state.
  1869. *
  1870. * @return {string} Post visibility.
  1871. */
  1872. function selectors_getEditedPostVisibility(state) {
  1873. const status = selectors_getEditedPostAttribute(state, 'status');
  1874. if (status === 'private') {
  1875. return 'private';
  1876. }
  1877. const password = selectors_getEditedPostAttribute(state, 'password');
  1878. if (password) {
  1879. return 'password';
  1880. }
  1881. return 'public';
  1882. }
  1883. /**
  1884. * Returns true if post is pending review.
  1885. *
  1886. * @param {Object} state Global application state.
  1887. *
  1888. * @return {boolean} Whether current post is pending review.
  1889. */
  1890. function isCurrentPostPending(state) {
  1891. return selectors_getCurrentPost(state).status === 'pending';
  1892. }
  1893. /**
  1894. * Return true if the current post has already been published.
  1895. *
  1896. * @param {Object} state Global application state.
  1897. * @param {Object?} currentPost Explicit current post for bypassing registry selector.
  1898. *
  1899. * @return {boolean} Whether the post has been published.
  1900. */
  1901. function selectors_isCurrentPostPublished(state, currentPost) {
  1902. const post = currentPost || selectors_getCurrentPost(state);
  1903. return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_wp_date_["isInTheFuture"])(new Date(Number(Object(external_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS));
  1904. }
  1905. /**
  1906. * Returns true if post is already scheduled.
  1907. *
  1908. * @param {Object} state Global application state.
  1909. *
  1910. * @return {boolean} Whether current post is scheduled to be posted.
  1911. */
  1912. function selectors_isCurrentPostScheduled(state) {
  1913. return selectors_getCurrentPost(state).status === 'future' && !selectors_isCurrentPostPublished(state);
  1914. }
  1915. /**
  1916. * Return true if the post being edited can be published.
  1917. *
  1918. * @param {Object} state Global application state.
  1919. *
  1920. * @return {boolean} Whether the post can been published.
  1921. */
  1922. function selectors_isEditedPostPublishable(state) {
  1923. const post = selectors_getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post
  1924. // being saveable. Currently this restriction is imposed at UI.
  1925. //
  1926. // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`)
  1927. return selectors_isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
  1928. }
  1929. /**
  1930. * Returns true if the post can be saved, or false otherwise. A post must
  1931. * contain a title, an excerpt, or non-empty content to be valid for save.
  1932. *
  1933. * @param {Object} state Global application state.
  1934. *
  1935. * @return {boolean} Whether the post can be saved.
  1936. */
  1937. function selectors_isEditedPostSaveable(state) {
  1938. if (selectors_isSavingPost(state)) {
  1939. return false;
  1940. } // TODO: Post should not be saveable if not dirty. Cannot be added here at
  1941. // this time since posts where meta boxes are present can be saved even if
  1942. // the post is not dirty. Currently this restriction is imposed at UI, but
  1943. // should be moved here.
  1944. //
  1945. // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
  1946. // See: <PostSavedState /> (`forceIsDirty` prop)
  1947. // See: <PostPublishButton /> (`forceIsDirty` prop)
  1948. // See: https://github.com/WordPress/gutenberg/pull/4184
  1949. return !!selectors_getEditedPostAttribute(state, 'title') || !!selectors_getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_["Platform"].OS === 'native';
  1950. }
  1951. /**
  1952. * Returns true if the edited post has content. A post has content if it has at
  1953. * least one saveable block or otherwise has a non-empty content property
  1954. * assigned.
  1955. *
  1956. * @param {Object} state Global application state.
  1957. *
  1958. * @return {boolean} Whether post has content.
  1959. */
  1960. function isEditedPostEmpty(state) {
  1961. // While the condition of truthy content string is sufficient to determine
  1962. // emptiness, testing saveable blocks length is a trivial operation. Since
  1963. // this function can be called frequently, optimize for the fast case as a
  1964. // condition of the mere existence of blocks. Note that the value of edited
  1965. // content takes precedent over block content, and must fall through to the
  1966. // default logic.
  1967. const blocks = getEditorBlocks(state);
  1968. if (blocks.length) {
  1969. // Pierce the abstraction of the serializer in knowing that blocks are
  1970. // joined with with newlines such that even if every individual block
  1971. // produces an empty save result, the serialized content is non-empty.
  1972. if (blocks.length > 1) {
  1973. return false;
  1974. } // There are two conditions under which the optimization cannot be
  1975. // assumed, and a fallthrough to getEditedPostContent must occur:
  1976. //
  1977. // 1. getBlocksForSerialization has special treatment in omitting a
  1978. // single unmodified default block.
  1979. // 2. Comment delimiters are omitted for a freeform or unregistered
  1980. // block in its serialization. The freeform block specifically may
  1981. // produce an empty string in its saved output.
  1982. //
  1983. // For all other content, the single block is assumed to make a post
  1984. // non-empty, if only by virtue of its own comment delimiters.
  1985. const blockName = blocks[0].name;
  1986. if (blockName !== Object(external_wp_blocks_["getDefaultBlockName"])() && blockName !== Object(external_wp_blocks_["getFreeformContentHandlerName"])()) {
  1987. return false;
  1988. }
  1989. }
  1990. return !getEditedPostContent(state);
  1991. }
  1992. /**
  1993. * Returns true if the post can be autosaved, or false otherwise.
  1994. *
  1995. * @param {Object} state Global application state.
  1996. * @param {Object} autosave A raw autosave object from the REST API.
  1997. *
  1998. * @return {boolean} Whether the post can be autosaved.
  1999. */
  2000. const selectors_isEditedPostAutosaveable = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2001. // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
  2002. if (!selectors_isEditedPostSaveable(state)) {
  2003. return false;
  2004. } // A post is not autosavable when there is a post autosave lock.
  2005. if (isPostAutosavingLocked(state)) {
  2006. return false;
  2007. }
  2008. const postType = selectors_getCurrentPostType(state);
  2009. const postId = selectors_getCurrentPostId(state);
  2010. const hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId);
  2011. const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave
  2012. // via a resolver, moving below the return would result in the autosave never
  2013. // being fetched.
  2014. // eslint-disable-next-line @wordpress/no-unused-vars-before-return
  2015. const autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is
  2016. // unable to determine if the post is autosaveable, so return false.
  2017. if (!hasFetchedAutosave) {
  2018. return false;
  2019. } // If we don't already have an autosave, the post is autosaveable.
  2020. if (!autosave) {
  2021. return true;
  2022. } // To avoid an expensive content serialization, use the content dirtiness
  2023. // flag in place of content field comparison against the known autosave.
  2024. // This is not strictly accurate, and relies on a tolerance toward autosave
  2025. // request failures for unnecessary saves.
  2026. if (hasChangedContent(state)) {
  2027. return true;
  2028. } // If the title or excerpt has changed, the post is autosaveable.
  2029. return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field));
  2030. });
  2031. /**
  2032. * Returns the current autosave, or null if one is not set (i.e. if the post
  2033. * has yet to be autosaved, or has been saved or published since the last
  2034. * autosave).
  2035. *
  2036. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )`
  2037. * selector from the '@wordpress/core-data' package.
  2038. *
  2039. * @param {Object} state Editor state.
  2040. *
  2041. * @return {?Object} Current autosave, if exists.
  2042. */
  2043. const getAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2044. external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getAutosave()`", {
  2045. since: '5.3',
  2046. alternative: "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`"
  2047. });
  2048. const postType = selectors_getCurrentPostType(state);
  2049. const postId = selectors_getCurrentPostId(state);
  2050. const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
  2051. const autosave = select('core').getAutosave(postType, postId, currentUserId);
  2052. return Object(external_lodash_["mapValues"])(Object(external_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue);
  2053. });
  2054. /**
  2055. * Returns the true if there is an existing autosave, otherwise false.
  2056. *
  2057. * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
  2058. * from the '@wordpress/core-data' package and check for a truthy value.
  2059. *
  2060. * @param {Object} state Global application state.
  2061. *
  2062. * @return {boolean} Whether there is an existing autosave.
  2063. */
  2064. const hasAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2065. external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).hasAutosave()`", {
  2066. since: '5.3',
  2067. alternative: "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`"
  2068. });
  2069. const postType = selectors_getCurrentPostType(state);
  2070. const postId = selectors_getCurrentPostId(state);
  2071. const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
  2072. return !!select('core').getAutosave(postType, postId, currentUserId);
  2073. });
  2074. /**
  2075. * Return true if the post being edited is being scheduled. Preferring the
  2076. * unsaved status values.
  2077. *
  2078. * @param {Object} state Global application state.
  2079. *
  2080. * @return {boolean} Whether the post has been published.
  2081. */
  2082. function selectors_isEditedPostBeingScheduled(state) {
  2083. const date = selectors_getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency)
  2084. const checkedDate = new Date(Number(Object(external_wp_date_["getDate"])(date)) - ONE_MINUTE_IN_MS);
  2085. return Object(external_wp_date_["isInTheFuture"])(checkedDate);
  2086. }
  2087. /**
  2088. * Returns whether the current post should be considered to have a "floating"
  2089. * date (i.e. that it would publish "Immediately" rather than at a set time).
  2090. *
  2091. * Unlike in the PHP backend, the REST API returns a full date string for posts
  2092. * where the 0000-00-00T00:00:00 placeholder is present in the database. To
  2093. * infer that a post is set to publish "Immediately" we check whether the date
  2094. * and modified date are the same.
  2095. *
  2096. * @param {Object} state Editor state.
  2097. *
  2098. * @return {boolean} Whether the edited post has a floating date value.
  2099. */
  2100. function isEditedPostDateFloating(state) {
  2101. const date = selectors_getEditedPostAttribute(state, 'date');
  2102. const modified = selectors_getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post
  2103. // It shouldn't use the "edited" status otherwise it breaks the
  2104. // infered post data floating status
  2105. // See https://github.com/WordPress/gutenberg/issues/28083
  2106. const status = selectors_getCurrentPost(state).status;
  2107. if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
  2108. return date === modified || date === null;
  2109. }
  2110. return false;
  2111. }
  2112. /**
  2113. * Returns true if the post is currently being saved, or false otherwise.
  2114. *
  2115. * @param {Object} state Global application state.
  2116. *
  2117. * @return {boolean} Whether post is being saved.
  2118. */
  2119. const selectors_isSavingPost = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2120. const postType = selectors_getCurrentPostType(state);
  2121. const postId = selectors_getCurrentPostId(state);
  2122. return select('core').isSavingEntityRecord('postType', postType, postId);
  2123. });
  2124. /**
  2125. * Returns true if a previous post save was attempted successfully, or false
  2126. * otherwise.
  2127. *
  2128. * @param {Object} state Global application state.
  2129. *
  2130. * @return {boolean} Whether the post was saved successfully.
  2131. */
  2132. const didPostSaveRequestSucceed = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2133. const postType = selectors_getCurrentPostType(state);
  2134. const postId = selectors_getCurrentPostId(state);
  2135. return !select('core').getLastEntitySaveError('postType', postType, postId);
  2136. });
  2137. /**
  2138. * Returns true if a previous post save was attempted but failed, or false
  2139. * otherwise.
  2140. *
  2141. * @param {Object} state Global application state.
  2142. *
  2143. * @return {boolean} Whether the post save failed.
  2144. */
  2145. const didPostSaveRequestFail = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2146. const postType = selectors_getCurrentPostType(state);
  2147. const postId = selectors_getCurrentPostId(state);
  2148. return !!select('core').getLastEntitySaveError('postType', postType, postId);
  2149. });
  2150. /**
  2151. * Returns true if the post is autosaving, or false otherwise.
  2152. *
  2153. * @param {Object} state Global application state.
  2154. *
  2155. * @return {boolean} Whether the post is autosaving.
  2156. */
  2157. function selectors_isAutosavingPost(state) {
  2158. if (!selectors_isSavingPost(state)) {
  2159. return false;
  2160. }
  2161. return !!Object(external_lodash_["get"])(state.saving, ['options', 'isAutosave']);
  2162. }
  2163. /**
  2164. * Returns true if the post is being previewed, or false otherwise.
  2165. *
  2166. * @param {Object} state Global application state.
  2167. *
  2168. * @return {boolean} Whether the post is being previewed.
  2169. */
  2170. function isPreviewingPost(state) {
  2171. if (!selectors_isSavingPost(state)) {
  2172. return false;
  2173. }
  2174. return !!state.saving.options.isPreview;
  2175. }
  2176. /**
  2177. * Returns the post preview link
  2178. *
  2179. * @param {Object} state Global application state.
  2180. *
  2181. * @return {string?} Preview Link.
  2182. */
  2183. function selectors_getEditedPostPreviewLink(state) {
  2184. if (state.saving.pending || selectors_isSavingPost(state)) {
  2185. return;
  2186. }
  2187. let previewLink = getAutosaveAttribute(state, 'preview_link');
  2188. if (!previewLink) {
  2189. previewLink = selectors_getEditedPostAttribute(state, 'link');
  2190. if (previewLink) {
  2191. previewLink = Object(external_wp_url_["addQueryArgs"])(previewLink, {
  2192. preview: true
  2193. });
  2194. }
  2195. }
  2196. const featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media');
  2197. if (previewLink && featuredImageId) {
  2198. return Object(external_wp_url_["addQueryArgs"])(previewLink, {
  2199. _thumbnail_id: featuredImageId
  2200. });
  2201. }
  2202. return previewLink;
  2203. }
  2204. /**
  2205. * Returns a suggested post format for the current post, inferred only if there
  2206. * is a single block within the post and it is of a type known to match a
  2207. * default post format. Returns null if the format cannot be determined.
  2208. *
  2209. * @param {Object} state Global application state.
  2210. *
  2211. * @return {?string} Suggested post format.
  2212. */
  2213. function selectors_getSuggestedPostFormat(state) {
  2214. const blocks = getEditorBlocks(state);
  2215. if (blocks.length > 2) return null;
  2216. let name; // If there is only one block in the content of the post grab its name
  2217. // so we can derive a suitable post format from it.
  2218. if (blocks.length === 1) {
  2219. name = blocks[0].name; // check for core/embed `video` and `audio` eligible suggestions
  2220. if (name === 'core/embed') {
  2221. var _blocks$0$attributes;
  2222. const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug;
  2223. if (['youtube', 'vimeo'].includes(provider)) {
  2224. name = 'core/video';
  2225. } else if (['spotify', 'soundcloud'].includes(provider)) {
  2226. name = 'core/audio';
  2227. }
  2228. }
  2229. } // If there are two blocks in the content and the last one is a text blocks
  2230. // grab the name of the first one to also suggest a post format from it.
  2231. if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
  2232. name = blocks[0].name;
  2233. } // We only convert to default post formats in core.
  2234. switch (name) {
  2235. case 'core/image':
  2236. return 'image';
  2237. case 'core/quote':
  2238. case 'core/pullquote':
  2239. return 'quote';
  2240. case 'core/gallery':
  2241. return 'gallery';
  2242. case 'core/video':
  2243. return 'video';
  2244. case 'core/audio':
  2245. return 'audio';
  2246. default:
  2247. return null;
  2248. }
  2249. }
  2250. /**
  2251. * Returns a set of blocks which are to be used in consideration of the post's
  2252. * generated save content.
  2253. *
  2254. * @deprecated since Gutenberg 6.2.0.
  2255. *
  2256. * @param {Object} state Editor state.
  2257. *
  2258. * @return {WPBlock[]} Filtered set of blocks for save.
  2259. */
  2260. function getBlocksForSerialization(state) {
  2261. external_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', {
  2262. since: '5.3',
  2263. alternative: 'getEditorBlocks',
  2264. hint: 'Blocks serialization pre-processing occurs at save time'
  2265. });
  2266. const blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified
  2267. // against the implementation of isEditedPostEmpty, which bypasses this
  2268. // function for performance' sake, in an assumption of this current logic
  2269. // being irrelevant to the optimized condition of emptiness.
  2270. // A single unmodified default block is assumed to be equivalent to an
  2271. // empty post.
  2272. const isSingleUnmodifiedDefaultBlock = blocks.length === 1 && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[0]);
  2273. if (isSingleUnmodifiedDefaultBlock) {
  2274. return [];
  2275. }
  2276. return blocks;
  2277. }
  2278. /**
  2279. * Returns the content of the post being edited.
  2280. *
  2281. * @param {Object} state Global application state.
  2282. *
  2283. * @return {string} Post content.
  2284. */
  2285. const getEditedPostContent = Object(external_wp_data_["createRegistrySelector"])(select => state => {
  2286. const postId = selectors_getCurrentPostId(state);
  2287. const postType = selectors_getCurrentPostType(state);
  2288. const record = select('core').getEditedEntityRecord('postType', postType, postId);
  2289. if (record) {
  2290. if (typeof record.content === 'function') {
  2291. return record.content(record);
  2292. } else if (record.blocks) {
  2293. return Object(external_wp_blocks_["__unstableSerializeAndClean"])(record.blocks);
  2294. } else if (record.content) {
  2295. return record.content;
  2296. }
  2297. }
  2298. return '';
  2299. });
  2300. /**
  2301. * Returns true if the post is being published, or false otherwise.
  2302. *
  2303. * @param {Object} state Global application state.
  2304. *
  2305. * @return {boolean} Whether post is being published.
  2306. */
  2307. function selectors_isPublishingPost(state) {
  2308. return selectors_isSavingPost(state) && !selectors_isCurrentPostPublished(state) && selectors_getEditedPostAttribute(state, 'status') === 'publish';
  2309. }
  2310. /**
  2311. * Returns whether the permalink is editable or not.
  2312. *
  2313. * @param {Object} state Editor state.
  2314. *
  2315. * @return {boolean} Whether or not the permalink is editable.
  2316. */
  2317. function isPermalinkEditable(state) {
  2318. const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template');
  2319. return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
  2320. }
  2321. /**
  2322. * Returns the permalink for the post.
  2323. *
  2324. * @param {Object} state Editor state.
  2325. *
  2326. * @return {?string} The permalink, or null if the post is not viewable.
  2327. */
  2328. function getPermalink(state) {
  2329. const permalinkParts = getPermalinkParts(state);
  2330. if (!permalinkParts) {
  2331. return null;
  2332. }
  2333. const {
  2334. prefix,
  2335. postName,
  2336. suffix
  2337. } = permalinkParts;
  2338. if (isPermalinkEditable(state)) {
  2339. return prefix + postName + suffix;
  2340. }
  2341. return prefix;
  2342. }
  2343. /**
  2344. * Returns the slug for the post being edited, preferring a manually edited
  2345. * value if one exists, then a sanitized version of the current post title, and
  2346. * finally the post ID.
  2347. *
  2348. * @param {Object} state Editor state.
  2349. *
  2350. * @return {string} The current slug to be displayed in the editor
  2351. */
  2352. function getEditedPostSlug(state) {
  2353. return selectors_getEditedPostAttribute(state, 'slug') || cleanForSlug(selectors_getEditedPostAttribute(state, 'title')) || selectors_getCurrentPostId(state);
  2354. }
  2355. /**
  2356. * Returns the permalink for a post, split into it's three parts: the prefix,
  2357. * the postName, and the suffix.
  2358. *
  2359. * @param {Object} state Editor state.
  2360. *
  2361. * @return {Object} An object containing the prefix, postName, and suffix for
  2362. * the permalink, or null if the post is not viewable.
  2363. */
  2364. function getPermalinkParts(state) {
  2365. const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template');
  2366. if (!permalinkTemplate) {
  2367. return null;
  2368. }
  2369. const postName = selectors_getEditedPostAttribute(state, 'slug') || selectors_getEditedPostAttribute(state, 'generated_slug');
  2370. const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
  2371. return {
  2372. prefix,
  2373. postName,
  2374. suffix
  2375. };
  2376. }
  2377. /**
  2378. * Returns whether the post is locked.
  2379. *
  2380. * @param {Object} state Global application state.
  2381. *
  2382. * @return {boolean} Is locked.
  2383. */
  2384. function selectors_isPostLocked(state) {
  2385. return state.postLock.isLocked;
  2386. }
  2387. /**
  2388. * Returns whether post saving is locked.
  2389. *
  2390. * @param {Object} state Global application state.
  2391. *
  2392. * @return {boolean} Is locked.
  2393. */
  2394. function selectors_isPostSavingLocked(state) {
  2395. return Object.keys(state.postSavingLock).length > 0;
  2396. }
  2397. /**
  2398. * Returns whether post autosaving is locked.
  2399. *
  2400. * @param {Object} state Global application state.
  2401. *
  2402. * @return {boolean} Is locked.
  2403. */
  2404. function isPostAutosavingLocked(state) {
  2405. return Object.keys(state.postAutosavingLock).length > 0;
  2406. }
  2407. /**
  2408. * Returns whether the edition of the post has been taken over.
  2409. *
  2410. * @param {Object} state Global application state.
  2411. *
  2412. * @return {boolean} Is post lock takeover.
  2413. */
  2414. function isPostLockTakeover(state) {
  2415. return state.postLock.isTakeover;
  2416. }
  2417. /**
  2418. * Returns details about the post lock user.
  2419. *
  2420. * @param {Object} state Global application state.
  2421. *
  2422. * @return {Object} A user object.
  2423. */
  2424. function getPostLockUser(state) {
  2425. return state.postLock.user;
  2426. }
  2427. /**
  2428. * Returns the active post lock.
  2429. *
  2430. * @param {Object} state Global application state.
  2431. *
  2432. * @return {Object} The lock object.
  2433. */
  2434. function getActivePostLock(state) {
  2435. return state.postLock.activePostLock;
  2436. }
  2437. /**
  2438. * Returns whether or not the user has the unfiltered_html capability.
  2439. *
  2440. * @param {Object} state Editor state.
  2441. *
  2442. * @return {boolean} Whether the user can or can't post unfiltered HTML.
  2443. */
  2444. function selectors_canUserUseUnfilteredHTML(state) {
  2445. return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']);
  2446. }
  2447. /**
  2448. * Returns whether the pre-publish panel should be shown
  2449. * or skipped when the user clicks the "publish" button.
  2450. *
  2451. * @param {Object} state Global application state.
  2452. *
  2453. * @return {boolean} Whether the pre-publish panel should be shown or not.
  2454. */
  2455. function selectors_isPublishSidebarEnabled(state) {
  2456. if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) {
  2457. return state.preferences.isPublishSidebarEnabled;
  2458. }
  2459. return PREFERENCES_DEFAULTS.isPublishSidebarEnabled;
  2460. }
  2461. /**
  2462. * Return the current block list.
  2463. *
  2464. * @param {Object} state
  2465. * @return {Array} Block list.
  2466. */
  2467. function getEditorBlocks(state) {
  2468. return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY;
  2469. }
  2470. /**
  2471. * A block selection object.
  2472. *
  2473. * @typedef {Object} WPBlockSelection
  2474. *
  2475. * @property {string} clientId A block client ID.
  2476. * @property {string} attributeKey A block attribute key.
  2477. * @property {number} offset An attribute value offset, based on the rich
  2478. * text value. See `wp.richText.create`.
  2479. */
  2480. /**
  2481. * Returns the current selection start.
  2482. *
  2483. * @param {Object} state
  2484. * @return {WPBlockSelection} The selection start.
  2485. *
  2486. * @deprecated since Gutenberg 10.0.0.
  2487. */
  2488. function getEditorSelectionStart(state) {
  2489. var _getEditedPostAttribu;
  2490. external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
  2491. since: '10.0',
  2492. plugin: 'Gutenberg',
  2493. alternative: "select('core/editor').getEditorSelection"
  2494. });
  2495. return (_getEditedPostAttribu = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart;
  2496. }
  2497. /**
  2498. * Returns the current selection end.
  2499. *
  2500. * @param {Object} state
  2501. * @return {WPBlockSelection} The selection end.
  2502. *
  2503. * @deprecated since Gutenberg 10.0.0.
  2504. */
  2505. function getEditorSelectionEnd(state) {
  2506. var _getEditedPostAttribu2;
  2507. external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
  2508. since: '10.0',
  2509. plugin: 'Gutenberg',
  2510. alternative: "select('core/editor').getEditorSelection"
  2511. });
  2512. return (_getEditedPostAttribu2 = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd;
  2513. }
  2514. /**
  2515. * Returns the current selection.
  2516. *
  2517. * @param {Object} state
  2518. * @return {WPBlockSelection} The selection end.
  2519. */
  2520. function selectors_getEditorSelection(state) {
  2521. return selectors_getEditedPostAttribute(state, 'selection');
  2522. }
  2523. /**
  2524. * Is the editor ready
  2525. *
  2526. * @param {Object} state
  2527. * @return {boolean} is Ready.
  2528. */
  2529. function selectors_unstableIsEditorReady(state) {
  2530. return state.isReady;
  2531. }
  2532. /**
  2533. * Returns the post editor settings.
  2534. *
  2535. * @param {Object} state Editor state.
  2536. *
  2537. * @return {Object} The editor settings object.
  2538. */
  2539. function selectors_getEditorSettings(state) {
  2540. return state.editorSettings;
  2541. }
  2542. /*
  2543. * Backward compatibility
  2544. */
  2545. /**
  2546. * Returns state object prior to a specified optimist transaction ID, or `null`
  2547. * if the transaction corresponding to the given ID cannot be found.
  2548. *
  2549. * @deprecated since Gutenberg 9.7.0.
  2550. */
  2551. function getStateBeforeOptimisticTransaction() {
  2552. external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", {
  2553. since: '5.7',
  2554. hint: 'No state history is kept on this store anymore'
  2555. });
  2556. return null;
  2557. }
  2558. /**
  2559. * Returns true if an optimistic transaction is pending commit, for which the
  2560. * before state satisfies the given predicate function.
  2561. *
  2562. * @deprecated since Gutenberg 9.7.0.
  2563. */
  2564. function inSomeHistory() {
  2565. external_wp_deprecated_default()("select('core/editor').inSomeHistory", {
  2566. since: '5.7',
  2567. hint: 'No state history is kept on this store anymore'
  2568. });
  2569. return false;
  2570. }
  2571. function getBlockEditorSelector(name) {
  2572. return Object(external_wp_data_["createRegistrySelector"])(select => (state, ...args) => {
  2573. external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', {
  2574. since: '5.3',
  2575. alternative: "`wp.data.select( 'core/block-editor' )." + name + '`'
  2576. });
  2577. return select('core/block-editor')[name](...args);
  2578. });
  2579. }
  2580. /**
  2581. * @see getBlockName in core/block-editor store.
  2582. */
  2583. const getBlockName = getBlockEditorSelector('getBlockName');
  2584. /**
  2585. * @see isBlockValid in core/block-editor store.
  2586. */
  2587. const isBlockValid = getBlockEditorSelector('isBlockValid');
  2588. /**
  2589. * @see getBlockAttributes in core/block-editor store.
  2590. */
  2591. const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
  2592. /**
  2593. * @see getBlock in core/block-editor store.
  2594. */
  2595. const getBlock = getBlockEditorSelector('getBlock');
  2596. /**
  2597. * @see getBlocks in core/block-editor store.
  2598. */
  2599. const selectors_getBlocks = getBlockEditorSelector('getBlocks');
  2600. /**
  2601. * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store.
  2602. */
  2603. const __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks');
  2604. /**
  2605. * @see getClientIdsOfDescendants in core/block-editor store.
  2606. */
  2607. const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
  2608. /**
  2609. * @see getClientIdsWithDescendants in core/block-editor store.
  2610. */
  2611. const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
  2612. /**
  2613. * @see getGlobalBlockCount in core/block-editor store.
  2614. */
  2615. const selectors_getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
  2616. /**
  2617. * @see getBlocksByClientId in core/block-editor store.
  2618. */
  2619. const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
  2620. /**
  2621. * @see getBlockCount in core/block-editor store.
  2622. */
  2623. const getBlockCount = getBlockEditorSelector('getBlockCount');
  2624. /**
  2625. * @see getBlockSelectionStart in core/block-editor store.
  2626. */
  2627. const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
  2628. /**
  2629. * @see getBlockSelectionEnd in core/block-editor store.
  2630. */
  2631. const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
  2632. /**
  2633. * @see getSelectedBlockCount in core/block-editor store.
  2634. */
  2635. const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
  2636. /**
  2637. * @see hasSelectedBlock in core/block-editor store.
  2638. */
  2639. const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
  2640. /**
  2641. * @see getSelectedBlockClientId in core/block-editor store.
  2642. */
  2643. const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
  2644. /**
  2645. * @see getSelectedBlock in core/block-editor store.
  2646. */
  2647. const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
  2648. /**
  2649. * @see getBlockRootClientId in core/block-editor store.
  2650. */
  2651. const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
  2652. /**
  2653. * @see getBlockHierarchyRootClientId in core/block-editor store.
  2654. */
  2655. const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
  2656. /**
  2657. * @see getAdjacentBlockClientId in core/block-editor store.
  2658. */
  2659. const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
  2660. /**
  2661. * @see getPreviousBlockClientId in core/block-editor store.
  2662. */
  2663. const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
  2664. /**
  2665. * @see getNextBlockClientId in core/block-editor store.
  2666. */
  2667. const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
  2668. /**
  2669. * @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
  2670. */
  2671. const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
  2672. /**
  2673. * @see getMultiSelectedBlockClientIds in core/block-editor store.
  2674. */
  2675. const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
  2676. /**
  2677. * @see getMultiSelectedBlocks in core/block-editor store.
  2678. */
  2679. const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
  2680. /**
  2681. * @see getFirstMultiSelectedBlockClientId in core/block-editor store.
  2682. */
  2683. const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
  2684. /**
  2685. * @see getLastMultiSelectedBlockClientId in core/block-editor store.
  2686. */
  2687. const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
  2688. /**
  2689. * @see isFirstMultiSelectedBlock in core/block-editor store.
  2690. */
  2691. const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
  2692. /**
  2693. * @see isBlockMultiSelected in core/block-editor store.
  2694. */
  2695. const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
  2696. /**
  2697. * @see isAncestorMultiSelected in core/block-editor store.
  2698. */
  2699. const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
  2700. /**
  2701. * @see getMultiSelectedBlocksStartClientId in core/block-editor store.
  2702. */
  2703. const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
  2704. /**
  2705. * @see getMultiSelectedBlocksEndClientId in core/block-editor store.
  2706. */
  2707. const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
  2708. /**
  2709. * @see getBlockOrder in core/block-editor store.
  2710. */
  2711. const getBlockOrder = getBlockEditorSelector('getBlockOrder');
  2712. /**
  2713. * @see getBlockIndex in core/block-editor store.
  2714. */
  2715. const getBlockIndex = getBlockEditorSelector('getBlockIndex');
  2716. /**
  2717. * @see isBlockSelected in core/block-editor store.
  2718. */
  2719. const isBlockSelected = getBlockEditorSelector('isBlockSelected');
  2720. /**
  2721. * @see hasSelectedInnerBlock in core/block-editor store.
  2722. */
  2723. const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
  2724. /**
  2725. * @see isBlockWithinSelection in core/block-editor store.
  2726. */
  2727. const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
  2728. /**
  2729. * @see hasMultiSelection in core/block-editor store.
  2730. */
  2731. const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
  2732. /**
  2733. * @see isMultiSelecting in core/block-editor store.
  2734. */
  2735. const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
  2736. /**
  2737. * @see isSelectionEnabled in core/block-editor store.
  2738. */
  2739. const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
  2740. /**
  2741. * @see getBlockMode in core/block-editor store.
  2742. */
  2743. const getBlockMode = getBlockEditorSelector('getBlockMode');
  2744. /**
  2745. * @see isTyping in core/block-editor store.
  2746. */
  2747. const isTyping = getBlockEditorSelector('isTyping');
  2748. /**
  2749. * @see isCaretWithinFormattedText in core/block-editor store.
  2750. */
  2751. const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
  2752. /**
  2753. * @see getBlockInsertionPoint in core/block-editor store.
  2754. */
  2755. const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
  2756. /**
  2757. * @see isBlockInsertionPointVisible in core/block-editor store.
  2758. */
  2759. const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
  2760. /**
  2761. * @see isValidTemplate in core/block-editor store.
  2762. */
  2763. const isValidTemplate = getBlockEditorSelector('isValidTemplate');
  2764. /**
  2765. * @see getTemplate in core/block-editor store.
  2766. */
  2767. const getTemplate = getBlockEditorSelector('getTemplate');
  2768. /**
  2769. * @see getTemplateLock in core/block-editor store.
  2770. */
  2771. const getTemplateLock = getBlockEditorSelector('getTemplateLock');
  2772. /**
  2773. * @see canInsertBlockType in core/block-editor store.
  2774. */
  2775. const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
  2776. /**
  2777. * @see getInserterItems in core/block-editor store.
  2778. */
  2779. const getInserterItems = getBlockEditorSelector('getInserterItems');
  2780. /**
  2781. * @see hasInserterItems in core/block-editor store.
  2782. */
  2783. const hasInserterItems = getBlockEditorSelector('hasInserterItems');
  2784. /**
  2785. * @see getBlockListSettings in core/block-editor store.
  2786. */
  2787. const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
  2788. /**
  2789. * Returns the default template types.
  2790. *
  2791. * @param {Object} state Global application state.
  2792. *
  2793. * @return {Object} The template types.
  2794. */
  2795. function __experimentalGetDefaultTemplateTypes(state) {
  2796. var _getEditorSettings;
  2797. return (_getEditorSettings = selectors_getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes;
  2798. }
  2799. /**
  2800. * Returns the default template part areas.
  2801. *
  2802. * @param {Object} state Global application state.
  2803. *
  2804. * @return {Array} The template part areas.
  2805. */
  2806. const __experimentalGetDefaultTemplatePartAreas = Object(rememo["a" /* default */])(state => {
  2807. var _getEditorSettings2;
  2808. const areas = ((_getEditorSettings2 = selectors_getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || [];
  2809. return areas === null || areas === void 0 ? void 0 : areas.map(item => {
  2810. return { ...item,
  2811. icon: getTemplatePartIcon(item.icon)
  2812. };
  2813. });
  2814. }, state => {
  2815. var _getEditorSettings3;
  2816. return [(_getEditorSettings3 = selectors_getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas];
  2817. });
  2818. /**
  2819. * Returns a default template type searched by slug.
  2820. *
  2821. * @param {Object} state Global application state.
  2822. * @param {string} slug The template type slug.
  2823. *
  2824. * @return {Object} The template type.
  2825. */
  2826. const __experimentalGetDefaultTemplateType = Object(rememo["a" /* default */])((state, slug) => Object(external_lodash_["find"])(__experimentalGetDefaultTemplateTypes(state), {
  2827. slug
  2828. }) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
  2829. /**
  2830. * Given a template entity, return information about it which is ready to be
  2831. * rendered, such as the title, description, and icon.
  2832. *
  2833. * @param {Object} state Global application state.
  2834. * @param {Object} template The template for which we need information.
  2835. * @return {Object} Information about the template, including title, description, and icon.
  2836. */
  2837. function __experimentalGetTemplateInfo(state, template) {
  2838. var _experimentalGetDefa;
  2839. if (!template) {
  2840. return {};
  2841. }
  2842. const {
  2843. excerpt,
  2844. slug,
  2845. title,
  2846. area
  2847. } = template;
  2848. const {
  2849. title: defaultTitle,
  2850. description: defaultDescription
  2851. } = __experimentalGetDefaultTemplateType(state, slug);
  2852. const templateTitle = Object(external_lodash_["isString"])(title) ? title : title === null || title === void 0 ? void 0 : title.rendered;
  2853. const templateDescription = Object(external_lodash_["isString"])(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw;
  2854. const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || layout["a" /* default */];
  2855. return {
  2856. title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
  2857. description: templateDescription || defaultDescription,
  2858. icon: templateIcon
  2859. };
  2860. }
  2861. // EXTERNAL MODULE: external ["wp","notices"]
  2862. var external_wp_notices_ = __webpack_require__("onLe");
  2863. // EXTERNAL MODULE: external ["wp","i18n"]
  2864. var external_wp_i18n_ = __webpack_require__("l3Sj");
  2865. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
  2866. /**
  2867. * WordPress dependencies
  2868. */
  2869. /**
  2870. * Internal dependencies
  2871. */
  2872. /**
  2873. * External dependencies
  2874. */
  2875. /**
  2876. * Builds the arguments for a success notification dispatch.
  2877. *
  2878. * @param {Object} data Incoming data to build the arguments from.
  2879. *
  2880. * @return {Array} Arguments for dispatch. An empty array signals no
  2881. * notification should be sent.
  2882. */
  2883. function getNotificationArgumentsForSaveSuccess(data) {
  2884. const {
  2885. previousPost,
  2886. post,
  2887. postType
  2888. } = data; // Autosaves are neither shown a notice nor redirected.
  2889. if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) {
  2890. return [];
  2891. }
  2892. const publishStatus = ['publish', 'private', 'future'];
  2893. const isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status);
  2894. const willPublish = Object(external_lodash_["includes"])(publishStatus, post.status);
  2895. let noticeMessage;
  2896. let shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false);
  2897. if (!isPublished && !willPublish) {
  2898. // If saving a non-published post, don't show notice.
  2899. noticeMessage = null;
  2900. } else if (isPublished && !willPublish) {
  2901. // If undoing publish status, show specific notice
  2902. noticeMessage = postType.labels.item_reverted_to_draft;
  2903. shouldShowLink = false;
  2904. } else if (!isPublished && willPublish) {
  2905. // If publishing or scheduling a post, show the corresponding
  2906. // publish message
  2907. noticeMessage = {
  2908. publish: postType.labels.item_published,
  2909. private: postType.labels.item_published_privately,
  2910. future: postType.labels.item_scheduled
  2911. }[post.status];
  2912. } else {
  2913. // Generic fallback notice
  2914. noticeMessage = postType.labels.item_updated;
  2915. }
  2916. if (noticeMessage) {
  2917. const actions = [];
  2918. if (shouldShowLink) {
  2919. actions.push({
  2920. label: postType.labels.view_item,
  2921. url: post.link
  2922. });
  2923. }
  2924. return [noticeMessage, {
  2925. id: SAVE_POST_NOTICE_ID,
  2926. type: 'snackbar',
  2927. actions
  2928. }];
  2929. }
  2930. return [];
  2931. }
  2932. /**
  2933. * Builds the fail notification arguments for dispatch.
  2934. *
  2935. * @param {Object} data Incoming data to build the arguments with.
  2936. *
  2937. * @return {Array} Arguments for dispatch. An empty array signals no
  2938. * notification should be sent.
  2939. */
  2940. function getNotificationArgumentsForSaveFail(data) {
  2941. const {
  2942. post,
  2943. edits,
  2944. error
  2945. } = data;
  2946. if (error && 'rest_autosave_no_changes' === error.code) {
  2947. // Autosave requested a new autosave, but there were no changes. This shouldn't
  2948. // result in an error notice for the user.
  2949. return [];
  2950. }
  2951. const publishStatus = ['publish', 'private', 'future'];
  2952. const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message
  2953. // Unless we publish an "updating failed" message
  2954. const messages = {
  2955. publish: Object(external_wp_i18n_["__"])('Publishing failed.'),
  2956. private: Object(external_wp_i18n_["__"])('Publishing failed.'),
  2957. future: Object(external_wp_i18n_["__"])('Scheduling failed.')
  2958. };
  2959. let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only
  2960. // supported as plaintext, and stripping the tags may muddle the meaning.
  2961. if (error.message && !/<\/?[^>]*>/.test(error.message)) {
  2962. noticeMessage = [noticeMessage, error.message].join(' ');
  2963. }
  2964. return [noticeMessage, {
  2965. id: SAVE_POST_NOTICE_ID
  2966. }];
  2967. }
  2968. /**
  2969. * Builds the trash fail notification arguments for dispatch.
  2970. *
  2971. * @param {Object} data
  2972. *
  2973. * @return {Array} Arguments for dispatch.
  2974. */
  2975. function getNotificationArgumentsForTrashFail(data) {
  2976. return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_wp_i18n_["__"])('Trashing failed'), {
  2977. id: TRASH_POST_NOTICE_ID
  2978. }];
  2979. }
  2980. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
  2981. /**
  2982. * External dependencies
  2983. */
  2984. /**
  2985. * WordPress dependencies
  2986. */
  2987. /**
  2988. * Internal dependencies
  2989. */
  2990. /**
  2991. * Returns an action generator used in signalling that editor has initialized with
  2992. * the specified post object and editor settings.
  2993. *
  2994. * @param {Object} post Post object.
  2995. * @param {Object} edits Initial edited attributes object.
  2996. * @param {Array?} template Block Template.
  2997. */
  2998. function* actions_setupEditor(post, edits, template) {
  2999. // In order to ensure maximum of a single parse during setup, edits are
  3000. // included as part of editor setup action. Assume edited content as
  3001. // canonical if provided, falling back to post.
  3002. let content;
  3003. if (Object(external_lodash_["has"])(edits, ['content'])) {
  3004. content = edits.content;
  3005. } else {
  3006. content = post.content.raw;
  3007. }
  3008. let blocks = Object(external_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists.
  3009. const isNewPost = post.status === 'auto-draft';
  3010. if (isNewPost && template) {
  3011. blocks = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template);
  3012. }
  3013. yield resetPost(post);
  3014. yield {
  3015. type: 'SETUP_EDITOR',
  3016. post,
  3017. edits,
  3018. template
  3019. };
  3020. yield actions_resetEditorBlocks(blocks, {
  3021. __unstableShouldCreateUndoLevel: false
  3022. });
  3023. yield setupEditorState(post);
  3024. if (edits && Object.keys(edits).some(key => edits[key] !== (Object(external_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]))) {
  3025. yield actions_editPost(edits);
  3026. }
  3027. }
  3028. /**
  3029. * Returns an action object signalling that the editor is being destroyed and
  3030. * that any necessary state or side-effect cleanup should occur.
  3031. *
  3032. * @return {Object} Action object.
  3033. */
  3034. function actions_experimentalTearDownEditor() {
  3035. return {
  3036. type: 'TEAR_DOWN_EDITOR'
  3037. };
  3038. }
  3039. /**
  3040. * Returns an action object used in signalling that the latest version of the
  3041. * post has been received, either by initialization or save.
  3042. *
  3043. * @param {Object} post Post object.
  3044. *
  3045. * @return {Object} Action object.
  3046. */
  3047. function resetPost(post) {
  3048. return {
  3049. type: 'RESET_POST',
  3050. post
  3051. };
  3052. }
  3053. /**
  3054. * Returns an action object used in signalling that the latest autosave of the
  3055. * post has been received, by initialization or autosave.
  3056. *
  3057. * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )`
  3058. * selector from the '@wordpress/core-data' package.
  3059. *
  3060. * @param {Object} newAutosave Autosave post object.
  3061. *
  3062. * @return {Object} Action object.
  3063. */
  3064. function* resetAutosave(newAutosave) {
  3065. external_wp_deprecated_default()('resetAutosave action (`core/editor` store)', {
  3066. since: '5.3',
  3067. alternative: 'receiveAutosaves action (`core` store)'
  3068. });
  3069. const postId = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostId');
  3070. yield external_wp_data_["controls"].dispatch('core', 'receiveAutosaves', postId, newAutosave);
  3071. return {
  3072. type: '__INERT__'
  3073. };
  3074. }
  3075. /**
  3076. * Action for dispatching that a post update request has started.
  3077. *
  3078. * @param {Object} options
  3079. *
  3080. * @return {Object} An action object
  3081. */
  3082. function __experimentalRequestPostUpdateStart(options = {}) {
  3083. return {
  3084. type: 'REQUEST_POST_UPDATE_START',
  3085. options
  3086. };
  3087. }
  3088. /**
  3089. * Action for dispatching that a post update request has finished.
  3090. *
  3091. * @param {Object} options
  3092. *
  3093. * @return {Object} An action object
  3094. */
  3095. function __experimentalRequestPostUpdateFinish(options = {}) {
  3096. return {
  3097. type: 'REQUEST_POST_UPDATE_FINISH',
  3098. options
  3099. };
  3100. }
  3101. /**
  3102. * Returns an action object used in signalling that a patch of updates for the
  3103. * latest version of the post have been received.
  3104. *
  3105. * @return {Object} Action object.
  3106. * @deprecated since Gutenberg 9.7.0.
  3107. */
  3108. function updatePost() {
  3109. external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
  3110. since: '5.7',
  3111. alternative: 'User the core entitires store instead'
  3112. });
  3113. return {
  3114. type: 'DO_NOTHING'
  3115. };
  3116. }
  3117. /**
  3118. * Returns an action object used to setup the editor state when first opening
  3119. * an editor.
  3120. *
  3121. * @param {Object} post Post object.
  3122. *
  3123. * @return {Object} Action object.
  3124. */
  3125. function setupEditorState(post) {
  3126. return {
  3127. type: 'SETUP_EDITOR_STATE',
  3128. post
  3129. };
  3130. }
  3131. /**
  3132. * Returns an action object used in signalling that attributes of the post have
  3133. * been edited.
  3134. *
  3135. * @param {Object} edits Post attributes to edit.
  3136. * @param {Object} options Options for the edit.
  3137. *
  3138. * @yield {Object} Action object or control.
  3139. */
  3140. function* actions_editPost(edits, options) {
  3141. const {
  3142. id,
  3143. type
  3144. } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3145. yield external_wp_data_["controls"].dispatch('core', 'editEntityRecord', 'postType', type, id, edits, options);
  3146. }
  3147. /**
  3148. * Action generator for saving the current post in the editor.
  3149. *
  3150. * @param {Object} options
  3151. */
  3152. function* actions_savePost(options = {}) {
  3153. if (!(yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostSaveable'))) {
  3154. return;
  3155. }
  3156. let edits = {
  3157. content: yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostContent')
  3158. };
  3159. if (!options.isAutosave) {
  3160. yield external_wp_data_["controls"].dispatch(STORE_NAME, 'editPost', edits, {
  3161. undoIgnore: true
  3162. });
  3163. }
  3164. yield __experimentalRequestPostUpdateStart(options);
  3165. const previousRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3166. edits = {
  3167. id: previousRecord.id,
  3168. ...(yield external_wp_data_["controls"].select('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)),
  3169. ...edits
  3170. };
  3171. yield external_wp_data_["controls"].dispatch('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options);
  3172. yield __experimentalRequestPostUpdateFinish(options);
  3173. const error = yield external_wp_data_["controls"].select('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id);
  3174. if (error) {
  3175. const args = getNotificationArgumentsForSaveFail({
  3176. post: previousRecord,
  3177. edits,
  3178. error
  3179. });
  3180. if (args.length) {
  3181. yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...args);
  3182. }
  3183. } else {
  3184. const updatedRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3185. const args = getNotificationArgumentsForSaveSuccess({
  3186. previousPost: previousRecord,
  3187. post: updatedRecord,
  3188. postType: yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', updatedRecord.type),
  3189. options
  3190. });
  3191. if (args.length) {
  3192. yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createSuccessNotice', ...args);
  3193. } // Make sure that any edits after saving create an undo level and are
  3194. // considered for change detection.
  3195. if (!options.isAutosave) {
  3196. yield external_wp_data_["controls"].dispatch('core/block-editor', '__unstableMarkLastChangeAsPersistent');
  3197. }
  3198. }
  3199. }
  3200. /**
  3201. * Action generator for handling refreshing the current post.
  3202. */
  3203. function* refreshPost() {
  3204. const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3205. const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType');
  3206. const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug);
  3207. const newPost = yield Object(external_wp_dataControls_["apiFetch"])({
  3208. // Timestamp arg allows caller to bypass browser caching, which is
  3209. // expected for this specific function.
  3210. path: `/wp/v2/${postType.rest_base}/${post.id}` + `?context=edit&_timestamp=${Date.now()}`
  3211. });
  3212. yield external_wp_data_["controls"].dispatch(STORE_NAME, 'resetPost', newPost);
  3213. }
  3214. /**
  3215. * Action generator for trashing the current post in the editor.
  3216. */
  3217. function* trashPost() {
  3218. const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType');
  3219. const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug);
  3220. yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'removeNotice', TRASH_POST_NOTICE_ID);
  3221. try {
  3222. const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3223. yield Object(external_wp_dataControls_["apiFetch"])({
  3224. path: `/wp/v2/${postType.rest_base}/${post.id}`,
  3225. method: 'DELETE'
  3226. });
  3227. yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost');
  3228. } catch (error) {
  3229. yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...getNotificationArgumentsForTrashFail({
  3230. error
  3231. }));
  3232. }
  3233. }
  3234. /**
  3235. * Action generator used in signalling that the post should autosave. This
  3236. * includes server-side autosaving (default) and client-side (a.k.a. local)
  3237. * autosaving (e.g. on the Web, the post might be committed to Session
  3238. * Storage).
  3239. *
  3240. * @param {Object?} options Extra flags to identify the autosave.
  3241. */
  3242. function* actions_autosave({
  3243. local = false,
  3244. ...options
  3245. } = {}) {
  3246. if (local) {
  3247. const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3248. const isPostNew = yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostNew');
  3249. const title = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'title');
  3250. const content = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'content');
  3251. const excerpt = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'excerpt');
  3252. yield {
  3253. type: 'LOCAL_AUTOSAVE_SET',
  3254. postId: post.id,
  3255. isPostNew,
  3256. title,
  3257. content,
  3258. excerpt
  3259. };
  3260. } else {
  3261. yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost', {
  3262. isAutosave: true,
  3263. ...options
  3264. });
  3265. }
  3266. }
  3267. /**
  3268. * Returns an action object used in signalling that undo history should
  3269. * restore last popped state.
  3270. *
  3271. * @yield {Object} Action object.
  3272. */
  3273. function* actions_redo() {
  3274. yield external_wp_data_["controls"].dispatch('core', 'redo');
  3275. }
  3276. /**
  3277. * Returns an action object used in signalling that undo history should pop.
  3278. *
  3279. * @yield {Object} Action object.
  3280. */
  3281. function* actions_undo() {
  3282. yield external_wp_data_["controls"].dispatch('core', 'undo');
  3283. }
  3284. /**
  3285. * Returns an action object used in signalling that undo history record should
  3286. * be created.
  3287. *
  3288. * @return {Object} Action object.
  3289. */
  3290. function createUndoLevel() {
  3291. return {
  3292. type: 'CREATE_UNDO_LEVEL'
  3293. };
  3294. }
  3295. /**
  3296. * Returns an action object used to lock the editor.
  3297. *
  3298. * @param {Object} lock Details about the post lock status, user, and nonce.
  3299. *
  3300. * @return {Object} Action object.
  3301. */
  3302. function actions_updatePostLock(lock) {
  3303. return {
  3304. type: 'UPDATE_POST_LOCK',
  3305. lock
  3306. };
  3307. }
  3308. /**
  3309. * Returns an action object used in signalling that the user has enabled the
  3310. * publish sidebar.
  3311. *
  3312. * @return {Object} Action object
  3313. */
  3314. function enablePublishSidebar() {
  3315. return {
  3316. type: 'ENABLE_PUBLISH_SIDEBAR'
  3317. };
  3318. }
  3319. /**
  3320. * Returns an action object used in signalling that the user has disabled the
  3321. * publish sidebar.
  3322. *
  3323. * @return {Object} Action object
  3324. */
  3325. function disablePublishSidebar() {
  3326. return {
  3327. type: 'DISABLE_PUBLISH_SIDEBAR'
  3328. };
  3329. }
  3330. /**
  3331. * Returns an action object used to signal that post saving is locked.
  3332. *
  3333. * @param {string} lockName The lock name.
  3334. *
  3335. * @example
  3336. * ```
  3337. * const { subscribe } = wp.data;
  3338. *
  3339. * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
  3340. *
  3341. * // Only allow publishing posts that are set to a future date.
  3342. * if ( 'publish' !== initialPostStatus ) {
  3343. *
  3344. * // Track locking.
  3345. * let locked = false;
  3346. *
  3347. * // Watch for the publish event.
  3348. * let unssubscribe = subscribe( () => {
  3349. * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
  3350. * if ( 'publish' !== currentPostStatus ) {
  3351. *
  3352. * // Compare the post date to the current date, lock the post if the date isn't in the future.
  3353. * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
  3354. * const currentDate = new Date();
  3355. * if ( postDate.getTime() <= currentDate.getTime() ) {
  3356. * if ( ! locked ) {
  3357. * locked = true;
  3358. * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
  3359. * }
  3360. * } else {
  3361. * if ( locked ) {
  3362. * locked = false;
  3363. * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
  3364. * }
  3365. * }
  3366. * }
  3367. * } );
  3368. * }
  3369. * ```
  3370. *
  3371. * @return {Object} Action object
  3372. */
  3373. function lockPostSaving(lockName) {
  3374. return {
  3375. type: 'LOCK_POST_SAVING',
  3376. lockName
  3377. };
  3378. }
  3379. /**
  3380. * Returns an action object used to signal that post saving is unlocked.
  3381. *
  3382. * @param {string} lockName The lock name.
  3383. *
  3384. * @example
  3385. * ```
  3386. * // Unlock post saving with the lock key `mylock`:
  3387. * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
  3388. * ```
  3389. *
  3390. * @return {Object} Action object
  3391. */
  3392. function unlockPostSaving(lockName) {
  3393. return {
  3394. type: 'UNLOCK_POST_SAVING',
  3395. lockName
  3396. };
  3397. }
  3398. /**
  3399. * Returns an action object used to signal that post autosaving is locked.
  3400. *
  3401. * @param {string} lockName The lock name.
  3402. *
  3403. * @example
  3404. * ```
  3405. * // Lock post autosaving with the lock key `mylock`:
  3406. * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );
  3407. * ```
  3408. *
  3409. * @return {Object} Action object
  3410. */
  3411. function lockPostAutosaving(lockName) {
  3412. return {
  3413. type: 'LOCK_POST_AUTOSAVING',
  3414. lockName
  3415. };
  3416. }
  3417. /**
  3418. * Returns an action object used to signal that post autosaving is unlocked.
  3419. *
  3420. * @param {string} lockName The lock name.
  3421. *
  3422. * @example
  3423. * ```
  3424. * // Unlock post saving with the lock key `mylock`:
  3425. * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );
  3426. * ```
  3427. *
  3428. * @return {Object} Action object
  3429. */
  3430. function unlockPostAutosaving(lockName) {
  3431. return {
  3432. type: 'UNLOCK_POST_AUTOSAVING',
  3433. lockName
  3434. };
  3435. }
  3436. /**
  3437. * Returns an action object used to signal that the blocks have been updated.
  3438. *
  3439. * @param {Array} blocks Block Array.
  3440. * @param {?Object} options Optional options.
  3441. *
  3442. * @yield {Object} Action object
  3443. */
  3444. function* actions_resetEditorBlocks(blocks, options = {}) {
  3445. const {
  3446. __unstableShouldCreateUndoLevel,
  3447. selection
  3448. } = options;
  3449. const edits = {
  3450. blocks,
  3451. selection
  3452. };
  3453. if (__unstableShouldCreateUndoLevel !== false) {
  3454. const {
  3455. id,
  3456. type
  3457. } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
  3458. const noChange = (yield external_wp_data_["controls"].select('core', 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks;
  3459. if (noChange) {
  3460. return yield external_wp_data_["controls"].dispatch('core', '__unstableCreateUndoLevel', 'postType', type, id);
  3461. } // We create a new function here on every persistent edit
  3462. // to make sure the edit makes the post dirty and creates
  3463. // a new undo level.
  3464. edits.content = ({
  3465. blocks: blocksForSerialization = []
  3466. }) => Object(external_wp_blocks_["__unstableSerializeAndClean"])(blocksForSerialization);
  3467. }
  3468. yield* actions_editPost(edits);
  3469. }
  3470. /*
  3471. * Returns an action object used in signalling that the post editor settings have been updated.
  3472. *
  3473. * @param {Object} settings Updated settings
  3474. *
  3475. * @return {Object} Action object
  3476. */
  3477. function actions_updateEditorSettings(settings) {
  3478. return {
  3479. type: 'UPDATE_EDITOR_SETTINGS',
  3480. settings
  3481. };
  3482. }
  3483. /**
  3484. * Backward compatibility
  3485. */
  3486. const getBlockEditorAction = name => function* (...args) {
  3487. external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', {
  3488. since: '5.3',
  3489. alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`'
  3490. });
  3491. yield external_wp_data_["controls"].dispatch('core/block-editor', name, ...args);
  3492. };
  3493. /**
  3494. * @see resetBlocks in core/block-editor store.
  3495. */
  3496. const resetBlocks = getBlockEditorAction('resetBlocks');
  3497. /**
  3498. * @see receiveBlocks in core/block-editor store.
  3499. */
  3500. const receiveBlocks = getBlockEditorAction('receiveBlocks');
  3501. /**
  3502. * @see updateBlock in core/block-editor store.
  3503. */
  3504. const updateBlock = getBlockEditorAction('updateBlock');
  3505. /**
  3506. * @see updateBlockAttributes in core/block-editor store.
  3507. */
  3508. const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes');
  3509. /**
  3510. * @see selectBlock in core/block-editor store.
  3511. */
  3512. const actions_selectBlock = getBlockEditorAction('selectBlock');
  3513. /**
  3514. * @see startMultiSelect in core/block-editor store.
  3515. */
  3516. const startMultiSelect = getBlockEditorAction('startMultiSelect');
  3517. /**
  3518. * @see stopMultiSelect in core/block-editor store.
  3519. */
  3520. const stopMultiSelect = getBlockEditorAction('stopMultiSelect');
  3521. /**
  3522. * @see multiSelect in core/block-editor store.
  3523. */
  3524. const multiSelect = getBlockEditorAction('multiSelect');
  3525. /**
  3526. * @see clearSelectedBlock in core/block-editor store.
  3527. */
  3528. const actions_clearSelectedBlock = getBlockEditorAction('clearSelectedBlock');
  3529. /**
  3530. * @see toggleSelection in core/block-editor store.
  3531. */
  3532. const toggleSelection = getBlockEditorAction('toggleSelection');
  3533. /**
  3534. * @see replaceBlocks in core/block-editor store.
  3535. */
  3536. const replaceBlocks = getBlockEditorAction('replaceBlocks');
  3537. /**
  3538. * @see replaceBlock in core/block-editor store.
  3539. */
  3540. const replaceBlock = getBlockEditorAction('replaceBlock');
  3541. /**
  3542. * @see moveBlocksDown in core/block-editor store.
  3543. */
  3544. const moveBlocksDown = getBlockEditorAction('moveBlocksDown');
  3545. /**
  3546. * @see moveBlocksUp in core/block-editor store.
  3547. */
  3548. const moveBlocksUp = getBlockEditorAction('moveBlocksUp');
  3549. /**
  3550. * @see moveBlockToPosition in core/block-editor store.
  3551. */
  3552. const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition');
  3553. /**
  3554. * @see insertBlock in core/block-editor store.
  3555. */
  3556. const insertBlock = getBlockEditorAction('insertBlock');
  3557. /**
  3558. * @see insertBlocks in core/block-editor store.
  3559. */
  3560. const actions_insertBlocks = getBlockEditorAction('insertBlocks');
  3561. /**
  3562. * @see showInsertionPoint in core/block-editor store.
  3563. */
  3564. const showInsertionPoint = getBlockEditorAction('showInsertionPoint');
  3565. /**
  3566. * @see hideInsertionPoint in core/block-editor store.
  3567. */
  3568. const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint');
  3569. /**
  3570. * @see setTemplateValidity in core/block-editor store.
  3571. */
  3572. const actions_setTemplateValidity = getBlockEditorAction('setTemplateValidity');
  3573. /**
  3574. * @see synchronizeTemplate in core/block-editor store.
  3575. */
  3576. const actions_synchronizeTemplate = getBlockEditorAction('synchronizeTemplate');
  3577. /**
  3578. * @see mergeBlocks in core/block-editor store.
  3579. */
  3580. const mergeBlocks = getBlockEditorAction('mergeBlocks');
  3581. /**
  3582. * @see removeBlocks in core/block-editor store.
  3583. */
  3584. const removeBlocks = getBlockEditorAction('removeBlocks');
  3585. /**
  3586. * @see removeBlock in core/block-editor store.
  3587. */
  3588. const removeBlock = getBlockEditorAction('removeBlock');
  3589. /**
  3590. * @see toggleBlockMode in core/block-editor store.
  3591. */
  3592. const toggleBlockMode = getBlockEditorAction('toggleBlockMode');
  3593. /**
  3594. * @see startTyping in core/block-editor store.
  3595. */
  3596. const startTyping = getBlockEditorAction('startTyping');
  3597. /**
  3598. * @see stopTyping in core/block-editor store.
  3599. */
  3600. const stopTyping = getBlockEditorAction('stopTyping');
  3601. /**
  3602. * @see enterFormattedText in core/block-editor store.
  3603. */
  3604. const enterFormattedText = getBlockEditorAction('enterFormattedText');
  3605. /**
  3606. * @see exitFormattedText in core/block-editor store.
  3607. */
  3608. const exitFormattedText = getBlockEditorAction('exitFormattedText');
  3609. /**
  3610. * @see insertDefaultBlock in core/block-editor store.
  3611. */
  3612. const actions_insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
  3613. /**
  3614. * @see updateBlockListSettings in core/block-editor store.
  3615. */
  3616. const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
  3617. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js
  3618. /**
  3619. * Function returning a sessionStorage key to set or retrieve a given post's
  3620. * automatic session backup.
  3621. *
  3622. * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
  3623. * `loggedout` handler can clear sessionStorage of any user-private content.
  3624. *
  3625. * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
  3626. *
  3627. * @param {string} postId Post ID.
  3628. * @param {boolean} isPostNew Whether post new.
  3629. * @return {string} sessionStorage key
  3630. */
  3631. function postKey(postId, isPostNew) {
  3632. return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
  3633. }
  3634. function localAutosaveGet(postId, isPostNew) {
  3635. return window.sessionStorage.getItem(postKey(postId, isPostNew));
  3636. }
  3637. function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
  3638. window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
  3639. post_title: title,
  3640. content,
  3641. excerpt
  3642. }));
  3643. }
  3644. function localAutosaveClear(postId, isPostNew) {
  3645. window.sessionStorage.removeItem(postKey(postId, isPostNew));
  3646. }
  3647. const controls = {
  3648. LOCAL_AUTOSAVE_SET({
  3649. postId,
  3650. isPostNew,
  3651. title,
  3652. content,
  3653. excerpt
  3654. }) {
  3655. localAutosaveSet(postId, isPostNew, title, content, excerpt);
  3656. }
  3657. };
  3658. /* harmony default export */ var store_controls = (controls);
  3659. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
  3660. /**
  3661. * WordPress dependencies
  3662. */
  3663. /**
  3664. * Internal dependencies
  3665. */
  3666. /**
  3667. * Post editor data store configuration.
  3668. *
  3669. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
  3670. *
  3671. * @type {Object}
  3672. */
  3673. const storeConfig = {
  3674. reducer: reducer,
  3675. selectors: selectors_namespaceObject,
  3676. actions: actions_namespaceObject,
  3677. controls: { ...external_wp_dataControls_["controls"],
  3678. ...store_controls
  3679. }
  3680. };
  3681. /**
  3682. * Store definition for the editor namespace.
  3683. *
  3684. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  3685. *
  3686. * @type {Object}
  3687. */
  3688. const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { ...storeConfig,
  3689. persist: ['preferences']
  3690. }); // Once we build a more generic persistence plugin that works across types of stores
  3691. // we'd be able to replace this with a register call.
  3692. Object(external_wp_data_["registerStore"])(STORE_NAME, { ...storeConfig,
  3693. persist: ['preferences']
  3694. });
  3695. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js
  3696. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js
  3697. /**
  3698. * WordPress dependencies
  3699. */
  3700. /**
  3701. * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected.
  3702. *
  3703. * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
  3704. * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
  3705. * the specific way of detecting changes.
  3706. *
  3707. * There are two caveats:
  3708. * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
  3709. * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
  3710. */
  3711. class autosave_monitor_AutosaveMonitor extends external_wp_element_["Component"] {
  3712. constructor(props) {
  3713. super(props);
  3714. this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
  3715. }
  3716. componentDidMount() {
  3717. if (!this.props.disableIntervalChecks) {
  3718. this.setAutosaveTimer();
  3719. }
  3720. }
  3721. componentDidUpdate(prevProps) {
  3722. if (this.props.disableIntervalChecks) {
  3723. if (this.props.editsReference !== prevProps.editsReference) {
  3724. this.props.autosave();
  3725. }
  3726. return;
  3727. }
  3728. if (!this.props.isDirty) {
  3729. this.needsAutosave = false;
  3730. return;
  3731. }
  3732. if (this.props.isAutosaving && !prevProps.isAutosaving) {
  3733. this.needsAutosave = false;
  3734. return;
  3735. }
  3736. if (this.props.editsReference !== prevProps.editsReference) {
  3737. this.needsAutosave = true;
  3738. }
  3739. }
  3740. componentWillUnmount() {
  3741. clearTimeout(this.timerId);
  3742. }
  3743. setAutosaveTimer(timeout = this.props.interval * 1000) {
  3744. this.timerId = setTimeout(() => {
  3745. this.autosaveTimerHandler();
  3746. }, timeout);
  3747. }
  3748. autosaveTimerHandler() {
  3749. if (!this.props.isAutosaveable) {
  3750. this.setAutosaveTimer(1000);
  3751. return;
  3752. }
  3753. if (this.needsAutosave) {
  3754. this.needsAutosave = false;
  3755. this.props.autosave();
  3756. }
  3757. this.setAutosaveTimer();
  3758. }
  3759. render() {
  3760. return null;
  3761. }
  3762. }
  3763. /* harmony default export */ var autosave_monitor = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, ownProps) => {
  3764. const {
  3765. getReferenceByDistinctEdits
  3766. } = select('core');
  3767. const {
  3768. isEditedPostDirty,
  3769. isEditedPostAutosaveable,
  3770. isAutosavingPost,
  3771. getEditorSettings
  3772. } = select('core/editor');
  3773. const {
  3774. interval = getEditorSettings().autosaveInterval
  3775. } = ownProps;
  3776. return {
  3777. editsReference: getReferenceByDistinctEdits(),
  3778. isDirty: isEditedPostDirty(),
  3779. isAutosaveable: isEditedPostAutosaveable(),
  3780. isAutosaving: isAutosavingPost(),
  3781. interval
  3782. };
  3783. }), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => ({
  3784. autosave() {
  3785. const {
  3786. autosave = dispatch('core/editor').autosave
  3787. } = ownProps;
  3788. autosave();
  3789. }
  3790. }))])(autosave_monitor_AutosaveMonitor));
  3791. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  3792. var classnames = __webpack_require__("TSYQ");
  3793. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  3794. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
  3795. /**
  3796. * External dependencies
  3797. */
  3798. const TableOfContentsItem = ({
  3799. children,
  3800. isValid,
  3801. level,
  3802. href,
  3803. onSelect
  3804. }) => Object(external_wp_element_["createElement"])("li", {
  3805. className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, {
  3806. 'is-invalid': !isValid
  3807. })
  3808. }, Object(external_wp_element_["createElement"])("a", {
  3809. href: href,
  3810. className: "document-outline__button",
  3811. onClick: onSelect
  3812. }, Object(external_wp_element_["createElement"])("span", {
  3813. className: "document-outline__emdash",
  3814. "aria-hidden": "true"
  3815. }), Object(external_wp_element_["createElement"])("strong", {
  3816. className: "document-outline__level"
  3817. }, level), Object(external_wp_element_["createElement"])("span", {
  3818. className: "document-outline__item-content"
  3819. }, children)));
  3820. /* harmony default export */ var document_outline_item = (TableOfContentsItem);
  3821. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
  3822. /**
  3823. * External dependencies
  3824. */
  3825. /**
  3826. * WordPress dependencies
  3827. */
  3828. /**
  3829. * Internal dependencies
  3830. */
  3831. /**
  3832. * Module constants
  3833. */
  3834. const emptyHeadingContent = Object(external_wp_element_["createElement"])("em", null, Object(external_wp_i18n_["__"])('(Empty heading)'));
  3835. const incorrectLevelContent = [Object(external_wp_element_["createElement"])("br", {
  3836. key: "incorrect-break"
  3837. }), Object(external_wp_element_["createElement"])("em", {
  3838. key: "incorrect-message"
  3839. }, Object(external_wp_i18n_["__"])('(Incorrect heading level)'))];
  3840. const singleH1Headings = [Object(external_wp_element_["createElement"])("br", {
  3841. key: "incorrect-break-h1"
  3842. }), Object(external_wp_element_["createElement"])("em", {
  3843. key: "incorrect-message-h1"
  3844. }, Object(external_wp_i18n_["__"])('(Your theme may already use a H1 for the post title)'))];
  3845. const multipleH1Headings = [Object(external_wp_element_["createElement"])("br", {
  3846. key: "incorrect-break-multiple-h1"
  3847. }), Object(external_wp_element_["createElement"])("em", {
  3848. key: "incorrect-message-multiple-h1"
  3849. }, Object(external_wp_i18n_["__"])('(Multiple H1 headings are not recommended)'))];
  3850. /**
  3851. * Returns an array of heading blocks enhanced with the following properties:
  3852. * level - An integer with the heading level.
  3853. * isEmpty - Flag indicating if the heading has no content.
  3854. *
  3855. * @param {?Array} blocks An array of blocks.
  3856. *
  3857. * @return {Array} An array of heading blocks enhanced with the properties described above.
  3858. */
  3859. const computeOutlineHeadings = (blocks = []) => {
  3860. return Object(external_lodash_["flatMap"])(blocks, (block = {}) => {
  3861. if (block.name === 'core/heading') {
  3862. return { ...block,
  3863. level: block.attributes.level,
  3864. isEmpty: isEmptyHeading(block)
  3865. };
  3866. }
  3867. return computeOutlineHeadings(block.innerBlocks);
  3868. });
  3869. };
  3870. const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0;
  3871. const DocumentOutline = ({
  3872. blocks = [],
  3873. title,
  3874. onSelect,
  3875. isTitleSupported,
  3876. hasOutlineItemsDisabled
  3877. }) => {
  3878. const headings = computeOutlineHeadings(blocks);
  3879. if (headings.length < 1) {
  3880. return null;
  3881. }
  3882. let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now.
  3883. const titleNode = document.querySelector('.editor-post-title__input');
  3884. const hasTitle = isTitleSupported && title && titleNode;
  3885. const countByLevel = Object(external_lodash_["countBy"])(headings, 'level');
  3886. const hasMultipleH1 = countByLevel[1] > 1;
  3887. return Object(external_wp_element_["createElement"])("div", {
  3888. className: "document-outline"
  3889. }, Object(external_wp_element_["createElement"])("ul", null, hasTitle && Object(external_wp_element_["createElement"])(document_outline_item, {
  3890. level: Object(external_wp_i18n_["__"])('Title'),
  3891. isValid: true,
  3892. onSelect: onSelect,
  3893. href: `#${titleNode.id}`,
  3894. isDisabled: hasOutlineItemsDisabled
  3895. }, title), headings.map((item, index) => {
  3896. // Headings remain the same, go up by one, or down by any amount.
  3897. // Otherwise there are missing levels.
  3898. const isIncorrectLevel = item.level > prevHeadingLevel + 1;
  3899. const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
  3900. prevHeadingLevel = item.level;
  3901. return Object(external_wp_element_["createElement"])(document_outline_item, {
  3902. key: index,
  3903. level: `H${item.level}`,
  3904. isValid: isValid,
  3905. isDisabled: hasOutlineItemsDisabled,
  3906. href: `#block-${item.clientId}`,
  3907. onSelect: onSelect
  3908. }, item.isEmpty ? emptyHeadingContent : Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["create"])({
  3909. html: item.attributes.content
  3910. })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
  3911. })));
  3912. };
  3913. /* harmony default export */ var document_outline = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => {
  3914. const {
  3915. getBlocks
  3916. } = select(external_wp_blockEditor_["store"]);
  3917. const {
  3918. getEditedPostAttribute
  3919. } = select('core/editor');
  3920. const {
  3921. getPostType
  3922. } = select('core');
  3923. const postType = getPostType(getEditedPostAttribute('type'));
  3924. return {
  3925. title: getEditedPostAttribute('title'),
  3926. blocks: getBlocks(),
  3927. isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false)
  3928. };
  3929. }))(DocumentOutline));
  3930. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
  3931. /**
  3932. * External dependencies
  3933. */
  3934. /**
  3935. * WordPress dependencies
  3936. */
  3937. function DocumentOutlineCheck({
  3938. blocks,
  3939. children
  3940. }) {
  3941. const headings = Object(external_lodash_["filter"])(blocks, block => block.name === 'core/heading');
  3942. if (headings.length < 1) {
  3943. return null;
  3944. }
  3945. return children;
  3946. }
  3947. /* harmony default export */ var check = (Object(external_wp_data_["withSelect"])(select => ({
  3948. blocks: select(external_wp_blockEditor_["store"]).getBlocks()
  3949. }))(DocumentOutlineCheck));
  3950. // EXTERNAL MODULE: external ["wp","keyboardShortcuts"]
  3951. var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m");
  3952. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js
  3953. /**
  3954. * WordPress dependencies
  3955. */
  3956. function SaveShortcut({
  3957. resetBlocksOnSave
  3958. }) {
  3959. const {
  3960. resetEditorBlocks,
  3961. savePost
  3962. } = Object(external_wp_data_["useDispatch"])('core/editor');
  3963. const {
  3964. isEditedPostDirty,
  3965. getPostEdits
  3966. } = Object(external_wp_data_["useSelect"])(select => {
  3967. const {
  3968. isEditedPostDirty: _isEditedPostDirty,
  3969. getPostEdits: _getPostEdits
  3970. } = select('core/editor');
  3971. return {
  3972. isEditedPostDirty: _isEditedPostDirty,
  3973. getPostEdits: _getPostEdits
  3974. };
  3975. }, []);
  3976. Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/save', event => {
  3977. event.preventDefault(); // TODO: This should be handled in the `savePost` effect in
  3978. // considering `isSaveable`. See note on `isEditedPostSaveable`
  3979. // selector about dirtiness and meta-boxes.
  3980. //
  3981. // See: `isEditedPostSaveable`
  3982. if (!isEditedPostDirty()) {
  3983. return;
  3984. } // The text editor requires that editor blocks are updated for a
  3985. // save to work correctly. Usually this happens when the textarea
  3986. // for the code editors blurs, but the shortcut can be used without
  3987. // blurring the textarea.
  3988. if (resetBlocksOnSave) {
  3989. const postEdits = getPostEdits();
  3990. if (postEdits.content && typeof postEdits.content === 'string') {
  3991. const blocks = Object(external_wp_blocks_["parse"])(postEdits.content);
  3992. resetEditorBlocks(blocks);
  3993. }
  3994. }
  3995. savePost();
  3996. }, {
  3997. bindGlobal: true
  3998. });
  3999. return null;
  4000. }
  4001. /* harmony default export */ var save_shortcut = (SaveShortcut);
  4002. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js
  4003. /**
  4004. * WordPress dependencies
  4005. */
  4006. /**
  4007. * Internal dependencies
  4008. */
  4009. function VisualEditorGlobalKeyboardShortcuts() {
  4010. const {
  4011. redo,
  4012. undo
  4013. } = Object(external_wp_data_["useDispatch"])('core/editor');
  4014. Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/undo', event => {
  4015. undo();
  4016. event.preventDefault();
  4017. }, {
  4018. bindGlobal: true
  4019. });
  4020. Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/redo', event => {
  4021. redo();
  4022. event.preventDefault();
  4023. }, {
  4024. bindGlobal: true
  4025. });
  4026. return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_wp_element_["createElement"])(save_shortcut, null));
  4027. }
  4028. /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts);
  4029. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js
  4030. /**
  4031. * Internal dependencies
  4032. */
  4033. function TextEditorGlobalKeyboardShortcuts() {
  4034. return Object(external_wp_element_["createElement"])(save_shortcut, {
  4035. resetBlocksOnSave: true
  4036. });
  4037. }
  4038. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
  4039. /**
  4040. * WordPress dependencies
  4041. */
  4042. function EditorKeyboardShortcutsRegister() {
  4043. // Registering the shortcuts
  4044. const {
  4045. registerShortcut
  4046. } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]);
  4047. Object(external_wp_element_["useEffect"])(() => {
  4048. registerShortcut({
  4049. name: 'core/editor/save',
  4050. category: 'global',
  4051. description: Object(external_wp_i18n_["__"])('Save your changes.'),
  4052. keyCombination: {
  4053. modifier: 'primary',
  4054. character: 's'
  4055. }
  4056. });
  4057. registerShortcut({
  4058. name: 'core/editor/undo',
  4059. category: 'global',
  4060. description: Object(external_wp_i18n_["__"])('Undo your last changes.'),
  4061. keyCombination: {
  4062. modifier: 'primary',
  4063. character: 'z'
  4064. }
  4065. });
  4066. registerShortcut({
  4067. name: 'core/editor/redo',
  4068. category: 'global',
  4069. description: Object(external_wp_i18n_["__"])('Redo your last undo.'),
  4070. keyCombination: {
  4071. modifier: 'primaryShift',
  4072. character: 'z'
  4073. }
  4074. });
  4075. }, [registerShortcut]);
  4076. return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null);
  4077. }
  4078. /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister);
  4079. // EXTERNAL MODULE: external ["wp","components"]
  4080. var external_wp_components_ = __webpack_require__("tI+e");
  4081. // EXTERNAL MODULE: external ["wp","keycodes"]
  4082. var external_wp_keycodes_ = __webpack_require__("RxS6");
  4083. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
  4084. var library_redo = __webpack_require__("K2cm");
  4085. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
  4086. var library_undo = __webpack_require__("Ntru");
  4087. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
  4088. /**
  4089. * WordPress dependencies
  4090. */
  4091. /**
  4092. * Internal dependencies
  4093. */
  4094. function EditorHistoryRedo(props, ref) {
  4095. const hasRedo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorRedo(), []);
  4096. const {
  4097. redo
  4098. } = Object(external_wp_data_["useDispatch"])(store);
  4099. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, {
  4100. ref: ref,
  4101. icon: !Object(external_wp_i18n_["isRTL"])() ? library_redo["a" /* default */] : library_undo["a" /* default */]
  4102. /* translators: button label text should, if possible, be under 16 characters. */
  4103. ,
  4104. label: Object(external_wp_i18n_["__"])('Redo'),
  4105. shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this
  4106. // button, because it will remove focus for keyboard users.
  4107. // See: https://github.com/WordPress/gutenberg/issues/3486
  4108. ,
  4109. "aria-disabled": !hasRedo,
  4110. onClick: hasRedo ? redo : undefined,
  4111. className: "editor-history__redo"
  4112. }));
  4113. }
  4114. /* harmony default export */ var editor_history_redo = (Object(external_wp_element_["forwardRef"])(EditorHistoryRedo));
  4115. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
  4116. /**
  4117. * WordPress dependencies
  4118. */
  4119. /**
  4120. * Internal dependencies
  4121. */
  4122. function EditorHistoryUndo(props, ref) {
  4123. const hasUndo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorUndo(), []);
  4124. const {
  4125. undo
  4126. } = Object(external_wp_data_["useDispatch"])(store);
  4127. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, {
  4128. ref: ref,
  4129. icon: !Object(external_wp_i18n_["isRTL"])() ? library_undo["a" /* default */] : library_redo["a" /* default */]
  4130. /* translators: button label text should, if possible, be under 16 characters. */
  4131. ,
  4132. label: Object(external_wp_i18n_["__"])('Undo'),
  4133. shortcut: external_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this
  4134. // button, because it will remove focus for keyboard users.
  4135. // See: https://github.com/WordPress/gutenberg/issues/3486
  4136. ,
  4137. "aria-disabled": !hasUndo,
  4138. onClick: hasUndo ? undo : undefined,
  4139. className: "editor-history__undo"
  4140. }));
  4141. }
  4142. /* harmony default export */ var editor_history_undo = (Object(external_wp_element_["forwardRef"])(EditorHistoryUndo));
  4143. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
  4144. /**
  4145. * WordPress dependencies
  4146. */
  4147. function TemplateValidationNotice({
  4148. isValid,
  4149. ...props
  4150. }) {
  4151. if (isValid) {
  4152. return null;
  4153. }
  4154. const confirmSynchronization = () => {
  4155. if ( // eslint-disable-next-line no-alert
  4156. window.confirm(Object(external_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) {
  4157. props.synchronizeTemplate();
  4158. }
  4159. };
  4160. return Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], {
  4161. className: "editor-template-validation-notice",
  4162. isDismissible: false,
  4163. status: "warning",
  4164. actions: [{
  4165. label: Object(external_wp_i18n_["__"])('Keep it as is'),
  4166. onClick: props.resetTemplateValidity
  4167. }, {
  4168. label: Object(external_wp_i18n_["__"])('Reset the template'),
  4169. onClick: confirmSynchronization
  4170. }]
  4171. }, Object(external_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.'));
  4172. }
  4173. /* harmony default export */ var template_validation_notice = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({
  4174. isValid: select(external_wp_blockEditor_["store"]).isValidTemplate()
  4175. })), Object(external_wp_data_["withDispatch"])(dispatch => {
  4176. const {
  4177. setTemplateValidity,
  4178. synchronizeTemplate
  4179. } = dispatch(external_wp_blockEditor_["store"]);
  4180. return {
  4181. resetTemplateValidity: () => setTemplateValidity(true),
  4182. synchronizeTemplate
  4183. };
  4184. })])(TemplateValidationNotice));
  4185. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
  4186. /**
  4187. * External dependencies
  4188. */
  4189. /**
  4190. * WordPress dependencies
  4191. */
  4192. /**
  4193. * Internal dependencies
  4194. */
  4195. function EditorNotices({
  4196. notices,
  4197. onRemove
  4198. }) {
  4199. const dismissibleNotices = Object(external_lodash_["filter"])(notices, {
  4200. isDismissible: true,
  4201. type: 'default'
  4202. });
  4203. const nonDismissibleNotices = Object(external_lodash_["filter"])(notices, {
  4204. isDismissible: false,
  4205. type: 'default'
  4206. });
  4207. return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], {
  4208. notices: nonDismissibleNotices,
  4209. className: "components-editor-notices__pinned"
  4210. }), Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], {
  4211. notices: dismissibleNotices,
  4212. className: "components-editor-notices__dismissible",
  4213. onRemove: onRemove
  4214. }, Object(external_wp_element_["createElement"])(template_validation_notice, null)));
  4215. }
  4216. /* harmony default export */ var editor_notices = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({
  4217. notices: select(external_wp_notices_["store"]).getNotices()
  4218. })), Object(external_wp_data_["withDispatch"])(dispatch => ({
  4219. onRemove: dispatch(external_wp_notices_["store"]).removeNotice
  4220. }))])(EditorNotices));
  4221. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
  4222. /**
  4223. * External dependencies
  4224. */
  4225. /**
  4226. * WordPress dependencies
  4227. */
  4228. function EditorSnackbars() {
  4229. const notices = Object(external_wp_data_["useSelect"])(select => select(external_wp_notices_["store"]).getNotices(), []);
  4230. const {
  4231. removeNotice
  4232. } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]);
  4233. const snackbarNotices = Object(external_lodash_["filter"])(notices, {
  4234. type: 'snackbar'
  4235. });
  4236. return Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], {
  4237. notices: snackbarNotices,
  4238. className: "components-editor-notices__snackbar",
  4239. onRemove: removeNotice
  4240. });
  4241. }
  4242. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  4243. var library_close = __webpack_require__("w95h");
  4244. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
  4245. /**
  4246. * WordPress dependencies
  4247. */
  4248. const page_page = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  4249. xmlns: "http://www.w3.org/2000/svg",
  4250. viewBox: "0 0 24 24"
  4251. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  4252. d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"
  4253. }));
  4254. /* harmony default export */ var library_page = (page_page);
  4255. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js
  4256. /**
  4257. * WordPress dependencies
  4258. */
  4259. function EntityRecordItem({
  4260. record,
  4261. checked,
  4262. onChange,
  4263. closePanel
  4264. }) {
  4265. const {
  4266. name,
  4267. kind,
  4268. title,
  4269. key
  4270. } = record;
  4271. const parentBlockId = Object(external_wp_data_["useSelect"])(select => {
  4272. var _blocks$;
  4273. // Get entity's blocks.
  4274. const {
  4275. blocks = []
  4276. } = select('core').getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block.
  4277. const parents = select(external_wp_blockEditor_["store"]).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId.
  4278. return parents[parents.length - 1];
  4279. }, []); // Handle templates that might use default descriptive titles
  4280. const entityRecordTitle = Object(external_wp_data_["useSelect"])(select => {
  4281. if ('postType' !== kind || 'wp_template' !== name) {
  4282. return title;
  4283. }
  4284. const template = select('core').getEditedEntityRecord(kind, name, key);
  4285. return select('core/editor').__experimentalGetTemplateInfo(template).title;
  4286. }, [name, kind, title, key]);
  4287. const isSelected = Object(external_wp_data_["useSelect"])(select => {
  4288. const selectedBlockId = select(external_wp_blockEditor_["store"]).getSelectedBlockClientId();
  4289. return selectedBlockId === parentBlockId;
  4290. }, [parentBlockId]);
  4291. const isSelectedText = isSelected ? Object(external_wp_i18n_["__"])('Selected') : Object(external_wp_i18n_["__"])('Select');
  4292. const {
  4293. selectBlock
  4294. } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
  4295. const selectParentBlock = Object(external_wp_element_["useCallback"])(() => selectBlock(parentBlockId), [parentBlockId]);
  4296. const selectAndDismiss = Object(external_wp_element_["useCallback"])(() => {
  4297. selectBlock(parentBlockId);
  4298. closePanel();
  4299. }, [parentBlockId]);
  4300. return Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  4301. label: Object(external_wp_element_["createElement"])("strong", null, entityRecordTitle || Object(external_wp_i18n_["__"])('Untitled')),
  4302. checked: checked,
  4303. onChange: onChange
  4304. }), parentBlockId ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  4305. onClick: selectParentBlock,
  4306. className: "entities-saved-states__find-entity",
  4307. disabled: isSelected
  4308. }, isSelectedText), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  4309. onClick: selectAndDismiss,
  4310. className: "entities-saved-states__find-entity-small",
  4311. disabled: isSelected
  4312. }, isSelectedText)) : null);
  4313. }
  4314. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js
  4315. /**
  4316. * External dependencies
  4317. */
  4318. /**
  4319. * WordPress dependencies
  4320. */
  4321. /**
  4322. * Internal dependencies
  4323. */
  4324. const ENTITY_NAME_ICONS = {
  4325. site: layout["a" /* default */],
  4326. page: library_page
  4327. };
  4328. function EntityTypeList({
  4329. list,
  4330. unselectedEntities,
  4331. setUnselectedEntities,
  4332. closePanel
  4333. }) {
  4334. const firstRecord = list[0];
  4335. const entity = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntity(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); // Set icon based on type of entity.
  4336. const {
  4337. name
  4338. } = firstRecord;
  4339. const icon = ENTITY_NAME_ICONS[name];
  4340. return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
  4341. title: entity.label,
  4342. initialOpen: true,
  4343. icon: icon
  4344. }, list.map(record => {
  4345. return Object(external_wp_element_["createElement"])(EntityRecordItem, {
  4346. key: record.key || record.property,
  4347. record: record,
  4348. checked: !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
  4349. onChange: value => setUnselectedEntities(record, value),
  4350. closePanel: closePanel
  4351. });
  4352. }));
  4353. }
  4354. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
  4355. /**
  4356. * External dependencies
  4357. */
  4358. /**
  4359. * WordPress dependencies
  4360. */
  4361. /**
  4362. * Internal dependencies
  4363. */
  4364. const TRANSLATED_SITE_PROTPERTIES = {
  4365. title: Object(external_wp_i18n_["__"])('Title'),
  4366. description: Object(external_wp_i18n_["__"])('Tagline'),
  4367. site_logo: Object(external_wp_i18n_["__"])('Logo'),
  4368. show_on_front: Object(external_wp_i18n_["__"])('Show on front'),
  4369. page_on_front: Object(external_wp_i18n_["__"])('Page on front')
  4370. };
  4371. function EntitiesSavedStates({
  4372. close
  4373. }) {
  4374. const saveButtonRef = Object(external_wp_element_["useRef"])();
  4375. const {
  4376. dirtyEntityRecords
  4377. } = Object(external_wp_data_["useSelect"])(select => {
  4378. const dirtyRecords = select(external_wp_coreData_["store"]).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
  4379. const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
  4380. const siteEdits = select(external_wp_coreData_["store"]).getEntityRecordEdits('root', 'site');
  4381. const siteEditsAsEntities = [];
  4382. for (const property in siteEdits) {
  4383. siteEditsAsEntities.push({
  4384. kind: 'root',
  4385. name: 'site',
  4386. title: TRANSLATED_SITE_PROTPERTIES[property] || property,
  4387. property
  4388. });
  4389. }
  4390. const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
  4391. return {
  4392. dirtyEntityRecords: dirtyRecordsWithSiteItems
  4393. };
  4394. }, []);
  4395. const {
  4396. saveEditedEntityRecord,
  4397. __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
  4398. } = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]); // To group entities by type.
  4399. const partitionedSavables = Object.values(Object(external_lodash_["groupBy"])(dirtyEntityRecords, 'name')); // Unchecked entities to be ignored by save function.
  4400. const [unselectedEntities, _setUnselectedEntities] = Object(external_wp_element_["useState"])([]);
  4401. const setUnselectedEntities = ({
  4402. kind,
  4403. name,
  4404. key,
  4405. property
  4406. }, checked) => {
  4407. if (checked) {
  4408. _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
  4409. } else {
  4410. _setUnselectedEntities([...unselectedEntities, {
  4411. kind,
  4412. name,
  4413. key,
  4414. property
  4415. }]);
  4416. }
  4417. };
  4418. const saveCheckedEntities = () => {
  4419. const entitiesToSave = dirtyEntityRecords.filter(({
  4420. kind,
  4421. name,
  4422. key,
  4423. property
  4424. }) => {
  4425. return !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
  4426. });
  4427. close(entitiesToSave);
  4428. const siteItemsToSave = [];
  4429. entitiesToSave.forEach(({
  4430. kind,
  4431. name,
  4432. key,
  4433. property
  4434. }) => {
  4435. if ('root' === kind && 'site' === name) {
  4436. siteItemsToSave.push(property);
  4437. } else {
  4438. saveEditedEntityRecord(kind, name, key);
  4439. }
  4440. });
  4441. saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave);
  4442. }; // Explicitly define this with no argument passed. Using `close` on
  4443. // its own will use the event object in place of the expected saved entities.
  4444. const dismissPanel = Object(external_wp_element_["useCallback"])(() => close(), [close]);
  4445. const [saveDialogRef, saveDialogProps] = Object(external_wp_compose_["__experimentalUseDialog"])({
  4446. onClose: () => dismissPanel()
  4447. });
  4448. return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
  4449. ref: saveDialogRef
  4450. }, saveDialogProps, {
  4451. className: "entities-saved-states__panel"
  4452. }), Object(external_wp_element_["createElement"])("div", {
  4453. className: "entities-saved-states__panel-header"
  4454. }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  4455. ref: saveButtonRef,
  4456. isPrimary: true,
  4457. disabled: dirtyEntityRecords.length - unselectedEntities.length === 0,
  4458. onClick: saveCheckedEntities,
  4459. className: "editor-entities-saved-states__save-button"
  4460. }, Object(external_wp_i18n_["__"])('Save')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  4461. icon: library_close["a" /* default */],
  4462. onClick: dismissPanel,
  4463. label: Object(external_wp_i18n_["__"])('Close panel')
  4464. })), Object(external_wp_element_["createElement"])("div", {
  4465. className: "entities-saved-states__text-prompt"
  4466. }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('Select the changes you want to save')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Some changes may affect other areas of your site.'))), partitionedSavables.map(list => {
  4467. return Object(external_wp_element_["createElement"])(EntityTypeList, {
  4468. key: list[0].name,
  4469. list: list,
  4470. closePanel: dismissPanel,
  4471. unselectedEntities: unselectedEntities,
  4472. setUnselectedEntities: setUnselectedEntities
  4473. });
  4474. }));
  4475. }
  4476. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
  4477. /**
  4478. * WordPress dependencies
  4479. */
  4480. function CopyButton({
  4481. text,
  4482. children
  4483. }) {
  4484. const ref = Object(external_wp_compose_["useCopyToClipboard"])(text);
  4485. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  4486. isSecondary: true,
  4487. ref: ref
  4488. }, children);
  4489. }
  4490. class error_boundary_ErrorBoundary extends external_wp_element_["Component"] {
  4491. constructor() {
  4492. super(...arguments);
  4493. this.reboot = this.reboot.bind(this);
  4494. this.getContent = this.getContent.bind(this);
  4495. this.state = {
  4496. error: null
  4497. };
  4498. }
  4499. componentDidCatch(error) {
  4500. this.setState({
  4501. error
  4502. });
  4503. }
  4504. reboot() {
  4505. this.props.onError();
  4506. }
  4507. getContent() {
  4508. try {
  4509. // While `select` in a component is generally discouraged, it is
  4510. // used here because it (a) reduces the chance of data loss in the
  4511. // case of additional errors by performing a direct retrieval and
  4512. // (b) avoids the performance cost associated with unnecessary
  4513. // content serialization throughout the lifetime of a non-erroring
  4514. // application.
  4515. return Object(external_wp_data_["select"])('core/editor').getEditedPostContent();
  4516. } catch (error) {}
  4517. }
  4518. render() {
  4519. const {
  4520. error
  4521. } = this.state;
  4522. if (!error) {
  4523. return this.props.children;
  4524. }
  4525. return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], {
  4526. className: "editor-error-boundary",
  4527. actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  4528. key: "recovery",
  4529. onClick: this.reboot,
  4530. isSecondary: true
  4531. }, Object(external_wp_i18n_["__"])('Attempt Recovery')), Object(external_wp_element_["createElement"])(CopyButton, {
  4532. key: "copy-post",
  4533. text: this.getContent
  4534. }, Object(external_wp_i18n_["__"])('Copy Post Text')), Object(external_wp_element_["createElement"])(CopyButton, {
  4535. key: "copy-error",
  4536. text: error.stack
  4537. }, Object(external_wp_i18n_["__"])('Copy Error'))]
  4538. }, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.'));
  4539. }
  4540. }
  4541. /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary);
  4542. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
  4543. /**
  4544. * External dependencies
  4545. */
  4546. /**
  4547. * WordPress dependencies
  4548. */
  4549. /**
  4550. * Internal dependencies
  4551. */
  4552. const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
  4553. /**
  4554. * Function which returns true if the current environment supports browser
  4555. * sessionStorage, or false otherwise. The result of this function is cached and
  4556. * reused in subsequent invocations.
  4557. */
  4558. const hasSessionStorageSupport = Object(external_lodash_["once"])(() => {
  4559. try {
  4560. // Private Browsing in Safari 10 and earlier will throw an error when
  4561. // attempting to set into sessionStorage. The test here is intentional in
  4562. // causing a thrown error as condition bailing from local autosave.
  4563. window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
  4564. window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
  4565. return true;
  4566. } catch (error) {
  4567. return false;
  4568. }
  4569. });
  4570. /**
  4571. * Custom hook which manages the creation of a notice prompting the user to
  4572. * restore a local autosave, if one exists.
  4573. */
  4574. function useAutosaveNotice() {
  4575. const {
  4576. postId,
  4577. isEditedPostNew,
  4578. hasRemoteAutosave
  4579. } = Object(external_wp_data_["useSelect"])(select => ({
  4580. postId: select('core/editor').getCurrentPostId(),
  4581. isEditedPostNew: select('core/editor').isEditedPostNew(),
  4582. getEditedPostAttribute: select('core/editor').getEditedPostAttribute,
  4583. hasRemoteAutosave: !!select('core/editor').getEditorSettings().autosave
  4584. }), []);
  4585. const {
  4586. getEditedPostAttribute
  4587. } = Object(external_wp_data_["useSelect"])('core/editor');
  4588. const {
  4589. createWarningNotice,
  4590. removeNotice
  4591. } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]);
  4592. const {
  4593. editPost,
  4594. resetEditorBlocks
  4595. } = Object(external_wp_data_["useDispatch"])('core/editor');
  4596. Object(external_wp_element_["useEffect"])(() => {
  4597. let localAutosave = localAutosaveGet(postId, isEditedPostNew);
  4598. if (!localAutosave) {
  4599. return;
  4600. }
  4601. try {
  4602. localAutosave = JSON.parse(localAutosave);
  4603. } catch (error) {
  4604. // Not usable if it can't be parsed.
  4605. return;
  4606. }
  4607. const {
  4608. post_title: title,
  4609. content,
  4610. excerpt
  4611. } = localAutosave;
  4612. const edits = {
  4613. title,
  4614. content,
  4615. excerpt
  4616. };
  4617. {
  4618. // Only display a notice if there is a difference between what has been
  4619. // saved and that which is stored in sessionStorage.
  4620. const hasDifference = Object.keys(edits).some(key => {
  4621. return edits[key] !== getEditedPostAttribute(key);
  4622. });
  4623. if (!hasDifference) {
  4624. // If there is no difference, it can be safely ejected from storage.
  4625. localAutosaveClear(postId, isEditedPostNew);
  4626. return;
  4627. }
  4628. }
  4629. if (hasRemoteAutosave) {
  4630. return;
  4631. }
  4632. const noticeId = Object(external_lodash_["uniqueId"])('wpEditorAutosaveRestore');
  4633. createWarningNotice(Object(external_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), {
  4634. id: noticeId,
  4635. actions: [{
  4636. label: Object(external_wp_i18n_["__"])('Restore the backup'),
  4637. onClick() {
  4638. editPost(Object(external_lodash_["omit"])(edits, ['content']));
  4639. resetEditorBlocks(Object(external_wp_blocks_["parse"])(edits.content));
  4640. removeNotice(noticeId);
  4641. }
  4642. }]
  4643. });
  4644. }, [isEditedPostNew, postId]);
  4645. }
  4646. /**
  4647. * Custom hook which ejects a local autosave after a successful save occurs.
  4648. */
  4649. function useAutosavePurge() {
  4650. const {
  4651. postId,
  4652. isEditedPostNew,
  4653. isDirty,
  4654. isAutosaving,
  4655. didError
  4656. } = Object(external_wp_data_["useSelect"])(select => ({
  4657. postId: select('core/editor').getCurrentPostId(),
  4658. isEditedPostNew: select('core/editor').isEditedPostNew(),
  4659. isDirty: select('core/editor').isEditedPostDirty(),
  4660. isAutosaving: select('core/editor').isAutosavingPost(),
  4661. didError: select('core/editor').didPostSaveRequestFail()
  4662. }), []);
  4663. const lastIsDirty = Object(external_wp_element_["useRef"])(isDirty);
  4664. const lastIsAutosaving = Object(external_wp_element_["useRef"])(isAutosaving);
  4665. Object(external_wp_element_["useEffect"])(() => {
  4666. if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
  4667. localAutosaveClear(postId, isEditedPostNew);
  4668. }
  4669. lastIsDirty.current = isDirty;
  4670. lastIsAutosaving.current = isAutosaving;
  4671. }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
  4672. const wasEditedPostNew = Object(external_wp_compose_["usePrevious"])(isEditedPostNew);
  4673. const prevPostId = Object(external_wp_compose_["usePrevious"])(postId);
  4674. Object(external_wp_element_["useEffect"])(() => {
  4675. if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
  4676. localAutosaveClear(postId, true);
  4677. }
  4678. }, [isEditedPostNew, postId]);
  4679. }
  4680. function LocalAutosaveMonitor() {
  4681. const {
  4682. autosave
  4683. } = Object(external_wp_data_["useDispatch"])('core/editor');
  4684. const deferedAutosave = Object(external_wp_element_["useCallback"])(() => {
  4685. requestIdleCallback(() => autosave({
  4686. local: true
  4687. }));
  4688. }, []);
  4689. useAutosaveNotice();
  4690. useAutosavePurge();
  4691. const {
  4692. localAutosaveInterval
  4693. } = Object(external_wp_data_["useSelect"])(select => ({
  4694. localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval
  4695. }), []);
  4696. return Object(external_wp_element_["createElement"])(autosave_monitor, {
  4697. interval: localAutosaveInterval,
  4698. autosave: deferedAutosave
  4699. });
  4700. }
  4701. /* harmony default export */ var local_autosave_monitor = (Object(external_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor));
  4702. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
  4703. /**
  4704. * External dependencies
  4705. */
  4706. /**
  4707. * WordPress dependencies
  4708. */
  4709. /**
  4710. * Internal dependencies
  4711. */
  4712. function PageAttributesCheck({
  4713. children
  4714. }) {
  4715. const postType = Object(external_wp_data_["useSelect"])(select => {
  4716. const {
  4717. getEditedPostAttribute
  4718. } = select(store);
  4719. const {
  4720. getPostType
  4721. } = select(external_wp_coreData_["store"]);
  4722. return getPostType(getEditedPostAttribute('type'));
  4723. }, []);
  4724. const supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist.
  4725. if (!supportsPageAttributes) {
  4726. return null;
  4727. }
  4728. return children;
  4729. }
  4730. /* harmony default export */ var page_attributes_check = (PageAttributesCheck);
  4731. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
  4732. /**
  4733. * External dependencies
  4734. */
  4735. /**
  4736. * WordPress dependencies
  4737. */
  4738. /**
  4739. * A component which renders its own children only if the current editor post
  4740. * type supports one of the given `supportKeys` prop.
  4741. *
  4742. * @param {Object} props Props.
  4743. * @param {string} [props.postType] Current post type.
  4744. * @param {WPElement} props.children Children to be rendered if post
  4745. * type supports.
  4746. * @param {(string|string[])} props.supportKeys String or string array of keys
  4747. * to test.
  4748. *
  4749. * @return {WPComponent} The component to be rendered.
  4750. */
  4751. function PostTypeSupportCheck({
  4752. postType,
  4753. children,
  4754. supportKeys
  4755. }) {
  4756. let isSupported = true;
  4757. if (postType) {
  4758. isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => !!postType.supports[key]);
  4759. }
  4760. if (!isSupported) {
  4761. return null;
  4762. }
  4763. return children;
  4764. }
  4765. /* harmony default export */ var post_type_support_check = (Object(external_wp_data_["withSelect"])(select => {
  4766. const {
  4767. getEditedPostAttribute
  4768. } = select('core/editor');
  4769. const {
  4770. getPostType
  4771. } = select('core');
  4772. return {
  4773. postType: getPostType(getEditedPostAttribute('type'))
  4774. };
  4775. })(PostTypeSupportCheck));
  4776. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
  4777. /**
  4778. * External dependencies
  4779. */
  4780. /**
  4781. * WordPress dependencies
  4782. */
  4783. /**
  4784. * Internal dependencies
  4785. */
  4786. const PageAttributesOrder = Object(external_wp_compose_["withState"])({
  4787. orderInput: null
  4788. })(({
  4789. onUpdateOrder,
  4790. order = 0,
  4791. orderInput,
  4792. setState
  4793. }) => {
  4794. const setUpdatedOrder = value => {
  4795. setState({
  4796. orderInput: value
  4797. });
  4798. const newOrder = Number(value);
  4799. if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') {
  4800. onUpdateOrder(Number(value));
  4801. }
  4802. };
  4803. const value = orderInput === null ? order : orderInput;
  4804. return Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
  4805. className: "editor-page-attributes__order",
  4806. type: "number",
  4807. label: Object(external_wp_i18n_["__"])('Order'),
  4808. value: value,
  4809. onChange: setUpdatedOrder,
  4810. size: 6,
  4811. onBlur: () => {
  4812. setState({
  4813. orderInput: null
  4814. });
  4815. }
  4816. });
  4817. });
  4818. function PageAttributesOrderWithChecks(props) {
  4819. return Object(external_wp_element_["createElement"])(post_type_support_check, {
  4820. supportKeys: "page-attributes"
  4821. }, Object(external_wp_element_["createElement"])(PageAttributesOrder, props));
  4822. }
  4823. /* harmony default export */ var page_attributes_order = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  4824. return {
  4825. order: select('core/editor').getEditedPostAttribute('menu_order')
  4826. };
  4827. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  4828. onUpdateOrder(order) {
  4829. dispatch('core/editor').editPost({
  4830. menu_order: order
  4831. });
  4832. }
  4833. }))])(PageAttributesOrderWithChecks));
  4834. // EXTERNAL MODULE: external ["wp","htmlEntities"]
  4835. var external_wp_htmlEntities_ = __webpack_require__("rmEH");
  4836. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
  4837. /**
  4838. * External dependencies
  4839. */
  4840. /**
  4841. * Returns terms in a tree form.
  4842. *
  4843. * @param {Array} flatTerms Array of terms in flat format.
  4844. *
  4845. * @return {Array} Array of terms in tree format.
  4846. */
  4847. function buildTermsTree(flatTerms) {
  4848. const flatTermsWithParentAndChildren = flatTerms.map(term => {
  4849. return {
  4850. children: [],
  4851. parent: null,
  4852. ...term
  4853. };
  4854. });
  4855. const termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent');
  4856. if (termsByParent.null && termsByParent.null.length) {
  4857. return flatTermsWithParentAndChildren;
  4858. }
  4859. const fillWithChildren = terms => {
  4860. return terms.map(term => {
  4861. const children = termsByParent[term.id];
  4862. return { ...term,
  4863. children: children && children.length ? fillWithChildren(children) : []
  4864. };
  4865. });
  4866. };
  4867. return fillWithChildren(termsByParent['0'] || []);
  4868. } // Lodash unescape function handles &#39; but not &#039; which may be return in some API requests.
  4869. const unescapeString = arg => {
  4870. return Object(external_lodash_["unescape"])(arg.replace('&#039;', "'"));
  4871. };
  4872. /**
  4873. * Returns a term object with name unescaped.
  4874. * The unescape of the name property is done using lodash unescape function.
  4875. *
  4876. * @param {Object} term The term object to unescape.
  4877. *
  4878. * @return {Object} Term object with name property unescaped.
  4879. */
  4880. const unescapeTerm = term => {
  4881. return { ...term,
  4882. name: unescapeString(term.name)
  4883. };
  4884. };
  4885. /**
  4886. * Returns an array of term objects with names unescaped.
  4887. * The unescape of each term is performed using the unescapeTerm function.
  4888. *
  4889. * @param {Object[]} terms Array of term objects to unescape.
  4890. *
  4891. * @return {Object[]} Array of term objects unescaped.
  4892. */
  4893. const unescapeTerms = terms => {
  4894. return Object(external_lodash_["map"])(terms, unescapeTerm);
  4895. };
  4896. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
  4897. /**
  4898. * External dependencies
  4899. */
  4900. /**
  4901. * WordPress dependencies
  4902. */
  4903. /**
  4904. * Internal dependencies
  4905. */
  4906. function getTitle(post) {
  4907. var _post$title;
  4908. return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? Object(external_wp_htmlEntities_["decodeEntities"])(post.title.rendered) : `#${post.id} (${Object(external_wp_i18n_["__"])('no title')})`;
  4909. }
  4910. const getItemPriority = (name, searchValue) => {
  4911. const normalizedName = Object(external_lodash_["deburr"])(name).toLowerCase();
  4912. const normalizedSearch = Object(external_lodash_["deburr"])(searchValue).toLowerCase();
  4913. if (normalizedName === normalizedSearch) {
  4914. return 0;
  4915. }
  4916. if (normalizedName.startsWith(normalizedSearch)) {
  4917. return normalizedName.length;
  4918. }
  4919. return Infinity;
  4920. };
  4921. function PageAttributesParent() {
  4922. const {
  4923. editPost
  4924. } = Object(external_wp_data_["useDispatch"])('core/editor');
  4925. const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])(false);
  4926. const {
  4927. parentPost,
  4928. parentPostId,
  4929. items,
  4930. postType
  4931. } = Object(external_wp_data_["useSelect"])(select => {
  4932. const {
  4933. getPostType,
  4934. getEntityRecords,
  4935. getEntityRecord
  4936. } = select('core');
  4937. const {
  4938. getCurrentPostId,
  4939. getEditedPostAttribute
  4940. } = select('core/editor');
  4941. const postTypeSlug = getEditedPostAttribute('type');
  4942. const pageId = getEditedPostAttribute('parent');
  4943. const pType = getPostType(postTypeSlug);
  4944. const postId = getCurrentPostId();
  4945. const isHierarchical = Object(external_lodash_["get"])(pType, ['hierarchical'], false);
  4946. const query = {
  4947. per_page: 100,
  4948. exclude: postId,
  4949. parent_exclude: postId,
  4950. orderby: 'menu_order',
  4951. order: 'asc',
  4952. _fields: 'id,title,parent'
  4953. }; // Perform a search when the field is changed.
  4954. if (!!fieldValue) {
  4955. query.search = fieldValue;
  4956. }
  4957. return {
  4958. parentPostId: pageId,
  4959. parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null,
  4960. items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [],
  4961. postType: pType
  4962. };
  4963. }, [fieldValue]);
  4964. const isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false);
  4965. const parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']);
  4966. const pageItems = items || [];
  4967. const parentOptions = Object(external_wp_element_["useMemo"])(() => {
  4968. const getOptionsFromTree = (tree, level = 0) => {
  4969. const mappedNodes = tree.map(treeNode => [{
  4970. value: treeNode.id,
  4971. label: Object(external_lodash_["repeat"])('— ', level) + Object(external_lodash_["unescape"])(treeNode.name),
  4972. rawName: treeNode.name
  4973. }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
  4974. const sortedNodes = mappedNodes.sort(([a], [b]) => {
  4975. const priorityA = getItemPriority(a.rawName, fieldValue);
  4976. const priorityB = getItemPriority(b.rawName, fieldValue);
  4977. return priorityA >= priorityB ? 1 : -1;
  4978. });
  4979. return Object(external_lodash_["flatten"])(sortedNodes);
  4980. };
  4981. let tree = pageItems.map(item => ({
  4982. id: item.id,
  4983. parent: item.parent,
  4984. name: getTitle(item)
  4985. })); // Only build a hierarchical tree when not searching.
  4986. if (!fieldValue) {
  4987. tree = buildTermsTree(tree);
  4988. }
  4989. const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list.
  4990. const optsHasParent = Object(external_lodash_["find"])(opts, item => item.value === parentPostId);
  4991. if (parentPost && !optsHasParent) {
  4992. opts.unshift({
  4993. value: parentPostId,
  4994. label: getTitle(parentPost)
  4995. });
  4996. }
  4997. return opts;
  4998. }, [pageItems, fieldValue]);
  4999. if (!isHierarchical || !parentPageLabel) {
  5000. return null;
  5001. }
  5002. /**
  5003. * Handle user input.
  5004. *
  5005. * @param {string} inputValue The current value of the input field.
  5006. */
  5007. const handleKeydown = inputValue => {
  5008. setFieldValue(inputValue);
  5009. };
  5010. /**
  5011. * Handle author selection.
  5012. *
  5013. * @param {Object} selectedPostId The selected Author.
  5014. */
  5015. const handleChange = selectedPostId => {
  5016. editPost({
  5017. parent: selectedPostId
  5018. });
  5019. };
  5020. return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], {
  5021. className: "editor-page-attributes__parent",
  5022. label: parentPageLabel,
  5023. value: parentPostId,
  5024. options: parentOptions,
  5025. onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300),
  5026. onChange: handleChange
  5027. });
  5028. }
  5029. /* harmony default export */ var page_attributes_parent = (PageAttributesParent);
  5030. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js
  5031. /**
  5032. * External dependencies
  5033. */
  5034. /**
  5035. * WordPress dependencies
  5036. */
  5037. /**
  5038. * Internal dependencies
  5039. */
  5040. function PostTemplate({}) {
  5041. const {
  5042. availableTemplates,
  5043. selectedTemplate,
  5044. isViewable
  5045. } = Object(external_wp_data_["useSelect"])(select => {
  5046. var _getPostType$viewable, _getPostType;
  5047. const {
  5048. getEditedPostAttribute,
  5049. getEditorSettings,
  5050. getCurrentPostType
  5051. } = select(store);
  5052. const {
  5053. getPostType
  5054. } = select(external_wp_coreData_["store"]);
  5055. return {
  5056. selectedTemplate: getEditedPostAttribute('template'),
  5057. availableTemplates: getEditorSettings().availableTemplates,
  5058. isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
  5059. };
  5060. }, []);
  5061. const {
  5062. editPost
  5063. } = Object(external_wp_data_["useDispatch"])(store);
  5064. if (!isViewable || Object(external_lodash_["isEmpty"])(availableTemplates)) {
  5065. return null;
  5066. }
  5067. return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
  5068. label: Object(external_wp_i18n_["__"])('Template:'),
  5069. value: selectedTemplate,
  5070. onChange: templateSlug => {
  5071. editPost({
  5072. template: templateSlug || ''
  5073. });
  5074. },
  5075. options: Object(external_lodash_["map"])(availableTemplates, (templateName, templateSlug) => ({
  5076. value: templateSlug,
  5077. label: templateName
  5078. }))
  5079. });
  5080. }
  5081. /* harmony default export */ var post_template = (PostTemplate);
  5082. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js
  5083. /**
  5084. * External dependencies
  5085. */
  5086. /**
  5087. * WordPress dependencies
  5088. */
  5089. function PostAuthorCombobox() {
  5090. const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])();
  5091. const {
  5092. authorId,
  5093. isLoading,
  5094. authors,
  5095. postAuthor
  5096. } = Object(external_wp_data_["useSelect"])(select => {
  5097. const {
  5098. __unstableGetAuthor,
  5099. getAuthors,
  5100. isResolving
  5101. } = select('core');
  5102. const {
  5103. getEditedPostAttribute
  5104. } = select('core/editor');
  5105. const author = __unstableGetAuthor(getEditedPostAttribute('author'));
  5106. const query = !fieldValue || '' === fieldValue ? {} : {
  5107. search: fieldValue
  5108. };
  5109. return {
  5110. authorId: getEditedPostAttribute('author'),
  5111. postAuthor: author,
  5112. authors: getAuthors(query),
  5113. isLoading: isResolving('core', 'getAuthors', [query])
  5114. };
  5115. }, [fieldValue]);
  5116. const {
  5117. editPost
  5118. } = Object(external_wp_data_["useDispatch"])('core/editor');
  5119. const authorOptions = Object(external_wp_element_["useMemo"])(() => {
  5120. const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
  5121. return {
  5122. value: author.id,
  5123. label: author.name
  5124. };
  5125. }); // Ensure the current author is included in the dropdown list.
  5126. const foundAuthor = fetchedAuthors.findIndex(({
  5127. value
  5128. }) => (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value);
  5129. if (foundAuthor < 0 && postAuthor) {
  5130. return [{
  5131. value: postAuthor.id,
  5132. label: postAuthor.name
  5133. }, ...fetchedAuthors];
  5134. }
  5135. return fetchedAuthors;
  5136. }, [authors, postAuthor]); // Initializes the post author properly
  5137. // Also ensures external changes are reflected.
  5138. Object(external_wp_element_["useEffect"])(() => {
  5139. if (postAuthor) {
  5140. setFieldValue(postAuthor.name);
  5141. }
  5142. }, [postAuthor]);
  5143. /**
  5144. * Handle author selection.
  5145. *
  5146. * @param {number} postAuthorId The selected Author.
  5147. */
  5148. const handleSelect = postAuthorId => {
  5149. if (!postAuthorId) {
  5150. return;
  5151. }
  5152. editPost({
  5153. author: postAuthorId
  5154. });
  5155. };
  5156. /**
  5157. * Handle user input.
  5158. *
  5159. * @param {string} inputValue The current value of the input field.
  5160. */
  5161. const handleKeydown = inputValue => {
  5162. setFieldValue(inputValue);
  5163. };
  5164. if (!postAuthor) {
  5165. return null;
  5166. }
  5167. return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], {
  5168. label: Object(external_wp_i18n_["__"])('Author'),
  5169. options: authorOptions,
  5170. value: authorId,
  5171. onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300),
  5172. onChange: handleSelect,
  5173. isLoading: isLoading,
  5174. allowReset: false
  5175. });
  5176. }
  5177. /* harmony default export */ var combobox = (PostAuthorCombobox);
  5178. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js
  5179. /**
  5180. * WordPress dependencies
  5181. */
  5182. function PostAuthorSelect() {
  5183. const {
  5184. editPost
  5185. } = Object(external_wp_data_["useDispatch"])('core/editor');
  5186. const {
  5187. postAuthor,
  5188. authors
  5189. } = Object(external_wp_data_["useSelect"])(select => {
  5190. const authorsFromAPI = select('core').getAuthors();
  5191. return {
  5192. postAuthor: select('core/editor').getEditedPostAttribute('author'),
  5193. authors: authorsFromAPI.map(author => ({
  5194. label: Object(external_wp_htmlEntities_["decodeEntities"])(author.name),
  5195. value: author.id
  5196. }))
  5197. };
  5198. }, []);
  5199. const setAuthorId = value => {
  5200. const author = Number(value);
  5201. editPost({
  5202. author
  5203. });
  5204. };
  5205. return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
  5206. className: "post-author-selector",
  5207. label: Object(external_wp_i18n_["__"])('Author'),
  5208. options: authors,
  5209. onChange: setAuthorId,
  5210. value: postAuthor
  5211. });
  5212. }
  5213. /* harmony default export */ var post_author_select = (PostAuthorSelect);
  5214. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
  5215. /**
  5216. * WordPress dependencies
  5217. */
  5218. /**
  5219. * Internal dependencies
  5220. */
  5221. const minimumUsersForCombobox = 25;
  5222. function PostAuthor() {
  5223. const showCombobox = Object(external_wp_data_["useSelect"])(select => {
  5224. // Not using `getUsers()` because it requires `list_users` capability.
  5225. const authors = select(external_wp_coreData_["store"]).getAuthors();
  5226. return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox;
  5227. }, []);
  5228. if (showCombobox) {
  5229. return Object(external_wp_element_["createElement"])(combobox, null);
  5230. }
  5231. return Object(external_wp_element_["createElement"])(post_author_select, null);
  5232. }
  5233. /* harmony default export */ var post_author = (PostAuthor);
  5234. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
  5235. /**
  5236. * External dependencies
  5237. */
  5238. /**
  5239. * WordPress dependencies
  5240. */
  5241. /**
  5242. * Internal dependencies
  5243. */
  5244. function PostAuthorCheck({
  5245. hasAssignAuthorAction,
  5246. authors,
  5247. children
  5248. }) {
  5249. if (!hasAssignAuthorAction || !authors || 1 >= authors.length) {
  5250. return null;
  5251. }
  5252. return Object(external_wp_element_["createElement"])(post_type_support_check, {
  5253. supportKeys: "author"
  5254. }, children);
  5255. }
  5256. /* harmony default export */ var post_author_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  5257. const post = select('core/editor').getCurrentPost();
  5258. return {
  5259. hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false),
  5260. postType: select('core/editor').getCurrentPostType(),
  5261. authors: select('core').getAuthors()
  5262. };
  5263. }), external_wp_compose_["withInstanceId"]])(PostAuthorCheck));
  5264. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
  5265. /**
  5266. * WordPress dependencies
  5267. */
  5268. function PostComments({
  5269. commentStatus = 'open',
  5270. ...props
  5271. }) {
  5272. const onToggleComments = () => props.editPost({
  5273. comment_status: commentStatus === 'open' ? 'closed' : 'open'
  5274. });
  5275. return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  5276. label: Object(external_wp_i18n_["__"])('Allow comments'),
  5277. checked: commentStatus === 'open',
  5278. onChange: onToggleComments
  5279. });
  5280. }
  5281. /* harmony default export */ var post_comments = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  5282. return {
  5283. commentStatus: select('core/editor').getEditedPostAttribute('comment_status')
  5284. };
  5285. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  5286. editPost: dispatch('core/editor').editPost
  5287. }))])(PostComments));
  5288. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
  5289. /**
  5290. * WordPress dependencies
  5291. */
  5292. function PostExcerpt({
  5293. excerpt,
  5294. onUpdateExcerpt
  5295. }) {
  5296. return Object(external_wp_element_["createElement"])("div", {
  5297. className: "editor-post-excerpt"
  5298. }, Object(external_wp_element_["createElement"])(external_wp_components_["TextareaControl"], {
  5299. label: Object(external_wp_i18n_["__"])('Write an excerpt (optional)'),
  5300. className: "editor-post-excerpt__textarea",
  5301. onChange: value => onUpdateExcerpt(value),
  5302. value: excerpt
  5303. }), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], {
  5304. href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/excerpt/')
  5305. }, Object(external_wp_i18n_["__"])('Learn more about manual excerpts')));
  5306. }
  5307. /* harmony default export */ var post_excerpt = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  5308. return {
  5309. excerpt: select('core/editor').getEditedPostAttribute('excerpt')
  5310. };
  5311. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  5312. onUpdateExcerpt(excerpt) {
  5313. dispatch('core/editor').editPost({
  5314. excerpt
  5315. });
  5316. }
  5317. }))])(PostExcerpt));
  5318. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
  5319. /**
  5320. * Internal dependencies
  5321. */
  5322. function PostExcerptCheck(props) {
  5323. return Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
  5324. supportKeys: "excerpt"
  5325. }));
  5326. }
  5327. /* harmony default export */ var post_excerpt_check = (PostExcerptCheck);
  5328. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
  5329. /**
  5330. * External dependencies
  5331. */
  5332. /**
  5333. * WordPress dependencies
  5334. */
  5335. function ThemeSupportCheck({
  5336. themeSupports,
  5337. children,
  5338. postType,
  5339. supportKeys
  5340. }) {
  5341. const isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => {
  5342. const supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
  5343. // In the latter case, we need to verify `postType` exists
  5344. // within `supported`. If `postType` isn't passed, then the check
  5345. // should fail.
  5346. if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) {
  5347. return Object(external_lodash_["includes"])(supported, postType);
  5348. }
  5349. return supported;
  5350. });
  5351. if (!isSupported) {
  5352. return null;
  5353. }
  5354. return children;
  5355. }
  5356. /* harmony default export */ var theme_support_check = (Object(external_wp_data_["withSelect"])(select => {
  5357. const {
  5358. getThemeSupports
  5359. } = select('core');
  5360. const {
  5361. getEditedPostAttribute
  5362. } = select('core/editor');
  5363. return {
  5364. postType: getEditedPostAttribute('type'),
  5365. themeSupports: getThemeSupports()
  5366. };
  5367. })(ThemeSupportCheck));
  5368. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
  5369. /**
  5370. * Internal dependencies
  5371. */
  5372. function PostFeaturedImageCheck(props) {
  5373. return Object(external_wp_element_["createElement"])(theme_support_check, {
  5374. supportKeys: "post-thumbnails"
  5375. }, Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
  5376. supportKeys: "thumbnail"
  5377. })));
  5378. }
  5379. /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck);
  5380. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
  5381. /**
  5382. * External dependencies
  5383. */
  5384. /**
  5385. * WordPress dependencies
  5386. */
  5387. /**
  5388. * Internal dependencies
  5389. */
  5390. const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present.
  5391. const DEFAULT_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Featured image');
  5392. const DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Set featured image');
  5393. const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Remove image');
  5394. function PostFeaturedImage({
  5395. currentPostId,
  5396. featuredImageId,
  5397. onUpdateImage,
  5398. onDropImage,
  5399. onRemoveImage,
  5400. media,
  5401. postType,
  5402. noticeUI
  5403. }) {
  5404. var _media$media_details$, _media$media_details$2;
  5405. const postLabel = Object(external_lodash_["get"])(postType, ['labels'], {});
  5406. const instructions = Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.'));
  5407. let mediaWidth, mediaHeight, mediaSourceUrl;
  5408. if (media) {
  5409. const mediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId);
  5410. if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) {
  5411. // use mediaSize when available
  5412. mediaWidth = media.media_details.sizes[mediaSize].width;
  5413. mediaHeight = media.media_details.sizes[mediaSize].height;
  5414. mediaSourceUrl = media.media_details.sizes[mediaSize].source_url;
  5415. } else {
  5416. // get fallbackMediaSize if mediaSize is not available
  5417. const fallbackMediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId);
  5418. if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', fallbackMediaSize])) {
  5419. // use fallbackMediaSize when mediaSize is not available
  5420. mediaWidth = media.media_details.sizes[fallbackMediaSize].width;
  5421. mediaHeight = media.media_details.sizes[fallbackMediaSize].height;
  5422. mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url;
  5423. } else {
  5424. // use full image size when mediaFallbackSize and mediaSize are not available
  5425. mediaWidth = media.media_details.width;
  5426. mediaHeight = media.media_details.height;
  5427. mediaSourceUrl = media.source_url;
  5428. }
  5429. }
  5430. }
  5431. return Object(external_wp_element_["createElement"])(post_featured_image_check, null, noticeUI, Object(external_wp_element_["createElement"])("div", {
  5432. className: "editor-post-featured-image"
  5433. }, media && Object(external_wp_element_["createElement"])("div", {
  5434. id: `editor-post-featured-image-${featuredImageId}-describedby`,
  5435. className: "hidden"
  5436. }, media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image alt text.
  5437. Object(external_wp_i18n_["__"])('Current image: %s'), media.alt_text), !media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image filename.
  5438. Object(external_wp_i18n_["__"])('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], {
  5439. fallback: instructions
  5440. }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], {
  5441. title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
  5442. onSelect: onUpdateImage,
  5443. unstableFeaturedImageFlow: true,
  5444. allowedTypes: ALLOWED_MEDIA_TYPES,
  5445. modalClass: "editor-post-featured-image__media-modal",
  5446. render: ({
  5447. open
  5448. }) => Object(external_wp_element_["createElement"])("div", {
  5449. className: "editor-post-featured-image__container"
  5450. }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  5451. className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
  5452. onClick: open,
  5453. "aria-label": !featuredImageId ? null : Object(external_wp_i18n_["__"])('Edit or update the image'),
  5454. "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
  5455. }, !!featuredImageId && media && Object(external_wp_element_["createElement"])(external_wp_components_["ResponsiveWrapper"], {
  5456. naturalWidth: mediaWidth,
  5457. naturalHeight: mediaHeight,
  5458. isInline: true
  5459. }, Object(external_wp_element_["createElement"])("img", {
  5460. src: mediaSourceUrl,
  5461. alt: ""
  5462. })), !!featuredImageId && !media && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), Object(external_wp_element_["createElement"])(external_wp_components_["DropZone"], {
  5463. onFilesDrop: onDropImage
  5464. })),
  5465. value: featuredImageId
  5466. })), !!featuredImageId && media && !media.isLoading && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], {
  5467. title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
  5468. onSelect: onUpdateImage,
  5469. unstableFeaturedImageFlow: true,
  5470. allowedTypes: ALLOWED_MEDIA_TYPES,
  5471. modalClass: "editor-post-featured-image__media-modal",
  5472. render: ({
  5473. open
  5474. }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  5475. onClick: open,
  5476. isSecondary: true
  5477. }, Object(external_wp_i18n_["__"])('Replace Image'))
  5478. })), !!featuredImageId && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  5479. onClick: onRemoveImage,
  5480. isLink: true,
  5481. isDestructive: true
  5482. }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL))));
  5483. }
  5484. const applyWithSelect = Object(external_wp_data_["withSelect"])(select => {
  5485. const {
  5486. getMedia,
  5487. getPostType
  5488. } = select('core');
  5489. const {
  5490. getCurrentPostId,
  5491. getEditedPostAttribute
  5492. } = select('core/editor');
  5493. const featuredImageId = getEditedPostAttribute('featured_media');
  5494. return {
  5495. media: featuredImageId ? getMedia(featuredImageId) : null,
  5496. currentPostId: getCurrentPostId(),
  5497. postType: getPostType(getEditedPostAttribute('type')),
  5498. featuredImageId
  5499. };
  5500. });
  5501. const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, {
  5502. noticeOperations
  5503. }, {
  5504. select
  5505. }) => {
  5506. const {
  5507. editPost
  5508. } = dispatch('core/editor');
  5509. return {
  5510. onUpdateImage(image) {
  5511. editPost({
  5512. featured_media: image.id
  5513. });
  5514. },
  5515. onDropImage(filesList) {
  5516. select(external_wp_blockEditor_["store"]).getSettings().mediaUpload({
  5517. allowedTypes: ['image'],
  5518. filesList,
  5519. onFileChange([image]) {
  5520. editPost({
  5521. featured_media: image.id
  5522. });
  5523. },
  5524. onError(message) {
  5525. noticeOperations.removeAllNotices();
  5526. noticeOperations.createErrorNotice(message);
  5527. }
  5528. });
  5529. },
  5530. onRemoveImage() {
  5531. editPost({
  5532. featured_media: 0
  5533. });
  5534. }
  5535. };
  5536. });
  5537. /* harmony default export */ var post_featured_image = (Object(external_wp_compose_["compose"])(external_wp_components_["withNotices"], applyWithSelect, applyWithDispatch, Object(external_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage));
  5538. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
  5539. /**
  5540. * WordPress dependencies
  5541. */
  5542. /**
  5543. * Internal dependencies
  5544. */
  5545. function PostFormatCheck({
  5546. disablePostFormats,
  5547. ...props
  5548. }) {
  5549. return !disablePostFormats && Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
  5550. supportKeys: "post-formats"
  5551. }));
  5552. }
  5553. /* harmony default export */ var post_format_check = (Object(external_wp_data_["withSelect"])(select => {
  5554. const editorSettings = select('core/editor').getEditorSettings();
  5555. return {
  5556. disablePostFormats: editorSettings.disablePostFormats
  5557. };
  5558. })(PostFormatCheck));
  5559. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
  5560. /**
  5561. * External dependencies
  5562. */
  5563. /**
  5564. * WordPress dependencies
  5565. */
  5566. /**
  5567. * Internal dependencies
  5568. */
  5569. // All WP post formats, sorted alphabetically by translated name.
  5570. const POST_FORMATS = [{
  5571. id: 'aside',
  5572. caption: Object(external_wp_i18n_["__"])('Aside')
  5573. }, {
  5574. id: 'audio',
  5575. caption: Object(external_wp_i18n_["__"])('Audio')
  5576. }, {
  5577. id: 'chat',
  5578. caption: Object(external_wp_i18n_["__"])('Chat')
  5579. }, {
  5580. id: 'gallery',
  5581. caption: Object(external_wp_i18n_["__"])('Gallery')
  5582. }, {
  5583. id: 'image',
  5584. caption: Object(external_wp_i18n_["__"])('Image')
  5585. }, {
  5586. id: 'link',
  5587. caption: Object(external_wp_i18n_["__"])('Link')
  5588. }, {
  5589. id: 'quote',
  5590. caption: Object(external_wp_i18n_["__"])('Quote')
  5591. }, {
  5592. id: 'standard',
  5593. caption: Object(external_wp_i18n_["__"])('Standard')
  5594. }, {
  5595. id: 'status',
  5596. caption: Object(external_wp_i18n_["__"])('Status')
  5597. }, {
  5598. id: 'video',
  5599. caption: Object(external_wp_i18n_["__"])('Video')
  5600. }].sort((a, b) => {
  5601. const normalizedA = a.caption.toUpperCase();
  5602. const normalizedB = b.caption.toUpperCase();
  5603. if (normalizedA < normalizedB) {
  5604. return -1;
  5605. }
  5606. if (normalizedA > normalizedB) {
  5607. return 1;
  5608. }
  5609. return 0;
  5610. });
  5611. function PostFormat() {
  5612. const instanceId = Object(external_wp_compose_["useInstanceId"])(PostFormat);
  5613. const postFormatSelectorId = `post-format-selector-${instanceId}`;
  5614. const {
  5615. postFormat,
  5616. suggestedFormat,
  5617. supportedFormats
  5618. } = Object(external_wp_data_["useSelect"])(select => {
  5619. const {
  5620. getEditedPostAttribute,
  5621. getSuggestedPostFormat
  5622. } = select('core/editor');
  5623. const _postFormat = getEditedPostAttribute('format');
  5624. const themeSupports = select('core').getThemeSupports();
  5625. return {
  5626. postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
  5627. suggestedFormat: getSuggestedPostFormat(),
  5628. // Ensure current format is always in the set.
  5629. // The current format may not be a format supported by the theme.
  5630. supportedFormats: Object(external_lodash_["union"])([_postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], []))
  5631. };
  5632. }, []);
  5633. const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id));
  5634. const suggestion = Object(external_lodash_["find"])(formats, format => format.id === suggestedFormat);
  5635. const {
  5636. editPost
  5637. } = Object(external_wp_data_["useDispatch"])('core/editor');
  5638. const onUpdatePostFormat = format => editPost({
  5639. format
  5640. });
  5641. return Object(external_wp_element_["createElement"])(post_format_check, null, Object(external_wp_element_["createElement"])("div", {
  5642. className: "editor-post-format"
  5643. }, Object(external_wp_element_["createElement"])("div", {
  5644. className: "editor-post-format__content"
  5645. }, Object(external_wp_element_["createElement"])("label", {
  5646. htmlFor: postFormatSelectorId
  5647. }, Object(external_wp_i18n_["__"])('Post Format')), Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
  5648. value: postFormat,
  5649. onChange: format => onUpdatePostFormat(format),
  5650. id: postFormatSelectorId,
  5651. options: formats.map(format => ({
  5652. label: format.caption,
  5653. value: format.id
  5654. }))
  5655. })), suggestion && suggestion.id !== postFormat && Object(external_wp_element_["createElement"])("div", {
  5656. className: "editor-post-format__suggestion"
  5657. }, Object(external_wp_i18n_["__"])('Suggestion:'), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  5658. isLink: true,
  5659. onClick: () => onUpdatePostFormat(suggestion.id)
  5660. }, suggestion.caption))));
  5661. }
  5662. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
  5663. /**
  5664. * WordPress dependencies
  5665. */
  5666. const backup = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  5667. xmlns: "http://www.w3.org/2000/svg",
  5668. viewBox: "0 0 24 24"
  5669. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  5670. d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
  5671. }));
  5672. /* harmony default export */ var library_backup = (backup);
  5673. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
  5674. /**
  5675. * WordPress dependencies
  5676. */
  5677. /**
  5678. * Internal dependencies
  5679. */
  5680. function PostLastRevisionCheck({
  5681. lastRevisionId,
  5682. revisionsCount,
  5683. children
  5684. }) {
  5685. if (!lastRevisionId || revisionsCount < 2) {
  5686. return null;
  5687. }
  5688. return Object(external_wp_element_["createElement"])(post_type_support_check, {
  5689. supportKeys: "revisions"
  5690. }, children);
  5691. }
  5692. /* harmony default export */ var post_last_revision_check = (Object(external_wp_data_["withSelect"])(select => {
  5693. const {
  5694. getCurrentPostLastRevisionId,
  5695. getCurrentPostRevisionsCount
  5696. } = select('core/editor');
  5697. return {
  5698. lastRevisionId: getCurrentPostLastRevisionId(),
  5699. revisionsCount: getCurrentPostRevisionsCount()
  5700. };
  5701. })(PostLastRevisionCheck));
  5702. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
  5703. /**
  5704. * WordPress dependencies
  5705. */
  5706. /**
  5707. * Internal dependencies
  5708. */
  5709. function LastRevision({
  5710. lastRevisionId,
  5711. revisionsCount
  5712. }) {
  5713. return Object(external_wp_element_["createElement"])(post_last_revision_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  5714. href: getWPAdminURL('revision.php', {
  5715. revision: lastRevisionId,
  5716. gutenberg: true
  5717. }),
  5718. className: "editor-post-last-revision__title",
  5719. icon: library_backup
  5720. }, Object(external_wp_i18n_["sprintf"])(
  5721. /* translators: %d: number of revisions */
  5722. Object(external_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
  5723. }
  5724. /* harmony default export */ var post_last_revision = (Object(external_wp_data_["withSelect"])(select => {
  5725. const {
  5726. getCurrentPostLastRevisionId,
  5727. getCurrentPostRevisionsCount
  5728. } = select('core/editor');
  5729. return {
  5730. lastRevisionId: getCurrentPostLastRevisionId(),
  5731. revisionsCount: getCurrentPostRevisionsCount()
  5732. };
  5733. })(LastRevision));
  5734. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js
  5735. /**
  5736. * External dependencies
  5737. */
  5738. /**
  5739. * WordPress dependencies
  5740. */
  5741. function writeInterstitialMessage(targetDocument) {
  5742. let markup = Object(external_wp_element_["renderToString"])(Object(external_wp_element_["createElement"])("div", {
  5743. className: "editor-post-preview-button__interstitial-message"
  5744. }, Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], {
  5745. xmlns: "http://www.w3.org/2000/svg",
  5746. viewBox: "0 0 96 96"
  5747. }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], {
  5748. className: "outer",
  5749. d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
  5750. fill: "none"
  5751. }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], {
  5752. className: "inner",
  5753. d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
  5754. fill: "none"
  5755. })), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Generating preview…'))));
  5756. markup += `
  5757. <style>
  5758. body {
  5759. margin: 0;
  5760. }
  5761. .editor-post-preview-button__interstitial-message {
  5762. display: flex;
  5763. flex-direction: column;
  5764. align-items: center;
  5765. justify-content: center;
  5766. height: 100vh;
  5767. width: 100vw;
  5768. }
  5769. @-webkit-keyframes paint {
  5770. 0% {
  5771. stroke-dashoffset: 0;
  5772. }
  5773. }
  5774. @-moz-keyframes paint {
  5775. 0% {
  5776. stroke-dashoffset: 0;
  5777. }
  5778. }
  5779. @-o-keyframes paint {
  5780. 0% {
  5781. stroke-dashoffset: 0;
  5782. }
  5783. }
  5784. @keyframes paint {
  5785. 0% {
  5786. stroke-dashoffset: 0;
  5787. }
  5788. }
  5789. .editor-post-preview-button__interstitial-message svg {
  5790. width: 192px;
  5791. height: 192px;
  5792. stroke: #555d66;
  5793. stroke-width: 0.75;
  5794. }
  5795. .editor-post-preview-button__interstitial-message svg .outer,
  5796. .editor-post-preview-button__interstitial-message svg .inner {
  5797. stroke-dasharray: 280;
  5798. stroke-dashoffset: 280;
  5799. -webkit-animation: paint 1.5s ease infinite alternate;
  5800. -moz-animation: paint 1.5s ease infinite alternate;
  5801. -o-animation: paint 1.5s ease infinite alternate;
  5802. animation: paint 1.5s ease infinite alternate;
  5803. }
  5804. p {
  5805. text-align: center;
  5806. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  5807. }
  5808. </style>
  5809. `;
  5810. /**
  5811. * Filters the interstitial message shown when generating previews.
  5812. *
  5813. * @param {string} markup The preview interstitial markup.
  5814. */
  5815. markup = Object(external_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup);
  5816. targetDocument.write(markup);
  5817. targetDocument.title = Object(external_wp_i18n_["__"])('Generating preview…');
  5818. targetDocument.close();
  5819. }
  5820. class post_preview_button_PostPreviewButton extends external_wp_element_["Component"] {
  5821. constructor() {
  5822. super(...arguments);
  5823. this.buttonRef = Object(external_wp_element_["createRef"])();
  5824. this.openPreviewWindow = this.openPreviewWindow.bind(this);
  5825. }
  5826. componentDidUpdate(prevProps) {
  5827. const {
  5828. previewLink
  5829. } = this.props; // This relies on the window being responsible to unset itself when
  5830. // navigation occurs or a new preview window is opened, to avoid
  5831. // unintentional forceful redirects.
  5832. if (previewLink && !prevProps.previewLink) {
  5833. this.setPreviewWindowLink(previewLink);
  5834. }
  5835. }
  5836. /**
  5837. * Sets the preview window's location to the given URL, if a preview window
  5838. * exists and is not closed.
  5839. *
  5840. * @param {string} url URL to assign as preview window location.
  5841. */
  5842. setPreviewWindowLink(url) {
  5843. const {
  5844. previewWindow
  5845. } = this;
  5846. if (previewWindow && !previewWindow.closed) {
  5847. previewWindow.location = url;
  5848. if (this.buttonRef.current) {
  5849. this.buttonRef.current.focus();
  5850. }
  5851. }
  5852. }
  5853. getWindowTarget() {
  5854. const {
  5855. postId
  5856. } = this.props;
  5857. return `wp-preview-${postId}`;
  5858. }
  5859. openPreviewWindow(event) {
  5860. // Our Preview button has its 'href' and 'target' set correctly for a11y
  5861. // purposes. Unfortunately, though, we can't rely on the default 'click'
  5862. // handler since sometimes it incorrectly opens a new tab instead of reusing
  5863. // the existing one.
  5864. // https://github.com/WordPress/gutenberg/pull/8330
  5865. event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview.
  5866. if (!this.previewWindow || this.previewWindow.closed) {
  5867. this.previewWindow = window.open('', this.getWindowTarget());
  5868. } // Focus the Preview tab. This might not do anything, depending on the browser's
  5869. // and user's preferences.
  5870. // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
  5871. this.previewWindow.focus();
  5872. if ( // If we don't need to autosave the post before previewing, then we simply
  5873. // load the Preview URL in the Preview tab.
  5874. !this.props.isAutosaveable || // Do not save or overwrite the post, if the post is already locked.
  5875. this.props.isPostLocked) {
  5876. this.setPreviewWindowLink(event.target.href);
  5877. return;
  5878. } // Request an autosave. This happens asynchronously and causes the component
  5879. // to update when finished.
  5880. if (this.props.isDraft) {
  5881. this.props.savePost({
  5882. isPreview: true
  5883. });
  5884. } else {
  5885. this.props.autosave({
  5886. isPreview: true
  5887. });
  5888. } // Display a 'Generating preview' message in the Preview tab while we wait for the
  5889. // autosave to finish.
  5890. writeInterstitialMessage(this.previewWindow.document);
  5891. }
  5892. render() {
  5893. const {
  5894. previewLink,
  5895. currentPostLink,
  5896. isSaveable,
  5897. role
  5898. } = this.props; // Link to the `?preview=true` URL if we have it, since this lets us see
  5899. // changes that were autosaved since the post was last published. Otherwise,
  5900. // just link to the post's URL.
  5901. const href = previewLink || currentPostLink;
  5902. const classNames = classnames_default()({
  5903. 'editor-post-preview': !this.props.className
  5904. }, this.props.className);
  5905. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  5906. isTertiary: !this.props.className,
  5907. className: classNames,
  5908. href: href,
  5909. target: this.getWindowTarget(),
  5910. disabled: !isSaveable,
  5911. onClick: this.openPreviewWindow,
  5912. ref: this.buttonRef,
  5913. role: role
  5914. }, this.props.textContent ? this.props.textContent : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
  5915. as: "span"
  5916. },
  5917. /* translators: accessibility text */
  5918. Object(external_wp_i18n_["__"])('(opens in a new tab)'))));
  5919. }
  5920. }
  5921. /* harmony default export */ var post_preview_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
  5922. forcePreviewLink,
  5923. forceIsAutosaveable
  5924. }) => {
  5925. const {
  5926. getCurrentPostId,
  5927. getCurrentPostAttribute,
  5928. getEditedPostAttribute,
  5929. isEditedPostSaveable,
  5930. isEditedPostAutosaveable,
  5931. getEditedPostPreviewLink,
  5932. isPostLocked
  5933. } = select('core/editor');
  5934. const {
  5935. getPostType
  5936. } = select('core');
  5937. const previewLink = getEditedPostPreviewLink();
  5938. const postType = getPostType(getEditedPostAttribute('type'));
  5939. return {
  5940. postId: getCurrentPostId(),
  5941. currentPostLink: getCurrentPostAttribute('link'),
  5942. previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
  5943. isSaveable: isEditedPostSaveable(),
  5944. isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
  5945. isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
  5946. isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1,
  5947. isPostLocked: isPostLocked()
  5948. };
  5949. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  5950. autosave: dispatch('core/editor').autosave,
  5951. savePost: dispatch('core/editor').savePost
  5952. })), Object(external_wp_compose_["ifCondition"])(({
  5953. isViewable
  5954. }) => isViewable)])(post_preview_button_PostPreviewButton));
  5955. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
  5956. /**
  5957. * External dependencies
  5958. */
  5959. /**
  5960. * WordPress dependencies
  5961. */
  5962. /**
  5963. * Internal dependencies
  5964. */
  5965. function PostLockedModal() {
  5966. const instanceId = Object(external_wp_compose_["useInstanceId"])(PostLockedModal);
  5967. const hookName = 'core/editor/post-locked-modal-' + instanceId;
  5968. const {
  5969. autosave,
  5970. updatePostLock
  5971. } = Object(external_wp_data_["useDispatch"])('core/editor');
  5972. const {
  5973. isLocked,
  5974. isTakeover,
  5975. user,
  5976. postId,
  5977. postLockUtils,
  5978. activePostLock,
  5979. postType
  5980. } = Object(external_wp_data_["useSelect"])(select => {
  5981. const {
  5982. isPostLocked,
  5983. isPostLockTakeover,
  5984. getPostLockUser,
  5985. getCurrentPostId,
  5986. getActivePostLock,
  5987. getEditedPostAttribute,
  5988. getEditorSettings
  5989. } = select('core/editor');
  5990. const {
  5991. getPostType
  5992. } = select('core');
  5993. return {
  5994. isLocked: isPostLocked(),
  5995. isTakeover: isPostLockTakeover(),
  5996. user: getPostLockUser(),
  5997. postId: getCurrentPostId(),
  5998. postLockUtils: getEditorSettings().postLockUtils,
  5999. activePostLock: getActivePostLock(),
  6000. postType: getPostType(getEditedPostAttribute('type'))
  6001. };
  6002. });
  6003. Object(external_wp_element_["useEffect"])(() => {
  6004. /**
  6005. * Keep the lock refreshed.
  6006. *
  6007. * When the user does not send a heartbeat in a heartbeat-tick
  6008. * the user is no longer editing and another user can start editing.
  6009. *
  6010. * @param {Object} data Data to send in the heartbeat request.
  6011. */
  6012. function sendPostLock(data) {
  6013. if (isLocked) {
  6014. return;
  6015. }
  6016. data['wp-refresh-post-lock'] = {
  6017. lock: activePostLock,
  6018. post_id: postId
  6019. };
  6020. }
  6021. /**
  6022. * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
  6023. *
  6024. * @param {Object} data Data received in the heartbeat request
  6025. */
  6026. function receivePostLock(data) {
  6027. if (!data['wp-refresh-post-lock']) {
  6028. return;
  6029. }
  6030. const received = data['wp-refresh-post-lock'];
  6031. if (received.lock_error) {
  6032. // Auto save and display the takeover modal.
  6033. autosave();
  6034. updatePostLock({
  6035. isLocked: true,
  6036. isTakeover: true,
  6037. user: {
  6038. avatar: received.lock_error.avatar_src
  6039. }
  6040. });
  6041. } else if (received.new_lock) {
  6042. updatePostLock({
  6043. isLocked: false,
  6044. activePostLock: received.new_lock
  6045. });
  6046. }
  6047. }
  6048. /**
  6049. * Unlock the post before the window is exited.
  6050. */
  6051. function releasePostLock() {
  6052. if (isLocked || !activePostLock) {
  6053. return;
  6054. }
  6055. const data = new window.FormData();
  6056. data.append('action', 'wp-remove-post-lock');
  6057. data.append('_wpnonce', postLockUtils.unlockNonce);
  6058. data.append('post_ID', postId);
  6059. data.append('active_post_lock', activePostLock);
  6060. if (window.navigator.sendBeacon) {
  6061. window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
  6062. } else {
  6063. const xhr = new window.XMLHttpRequest();
  6064. xhr.open('POST', postLockUtils.ajaxUrl, false);
  6065. xhr.send(data);
  6066. }
  6067. } // Details on these events on the Heartbeat API docs
  6068. // https://developer.wordpress.org/plugins/javascript/heartbeat-api/
  6069. Object(external_wp_hooks_["addAction"])('heartbeat.send', hookName, sendPostLock);
  6070. Object(external_wp_hooks_["addAction"])('heartbeat.tick', hookName, receivePostLock);
  6071. window.addEventListener('beforeunload', releasePostLock);
  6072. return () => {
  6073. Object(external_wp_hooks_["removeAction"])('heartbeat.send', hookName);
  6074. Object(external_wp_hooks_["removeAction"])('heartbeat.tick', hookName);
  6075. window.removeEventListener('beforeunload', releasePostLock);
  6076. };
  6077. }, []);
  6078. if (!isLocked) {
  6079. return null;
  6080. }
  6081. const userDisplayName = user.name;
  6082. const userAvatar = user.avatar;
  6083. const unlockUrl = Object(external_wp_url_["addQueryArgs"])('post.php', {
  6084. 'get-post-lock': '1',
  6085. lockKey: true,
  6086. post: postId,
  6087. action: 'edit',
  6088. _wpnonce: postLockUtils.nonce
  6089. });
  6090. const allPostsUrl = getWPAdminURL('edit.php', {
  6091. post_type: Object(external_lodash_["get"])(postType, ['slug'])
  6092. });
  6093. const allPostsLabel = Object(external_wp_i18n_["__"])('Exit the Editor');
  6094. return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
  6095. title: isTakeover ? Object(external_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_wp_i18n_["__"])('This post is already being edited.'),
  6096. focusOnMount: true,
  6097. shouldCloseOnClickOutside: false,
  6098. shouldCloseOnEsc: false,
  6099. isDismissible: false,
  6100. className: "editor-post-locked-modal"
  6101. }, !!userAvatar && Object(external_wp_element_["createElement"])("img", {
  6102. src: userAvatar,
  6103. alt: Object(external_wp_i18n_["__"])('Avatar'),
  6104. className: "editor-post-locked-modal__avatar"
  6105. }), !!isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])(
  6106. /* translators: %s: user's display name */
  6107. Object(external_wp_i18n_["__"])('%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.')), Object(external_wp_element_["createElement"])("div", {
  6108. className: "editor-post-locked-modal__buttons"
  6109. }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  6110. isPrimary: true,
  6111. href: allPostsUrl
  6112. }, allPostsLabel))), !isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])(
  6113. /* translators: %s: user's display name */
  6114. Object(external_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_wp_element_["createElement"])("div", {
  6115. className: "editor-post-locked-modal__buttons"
  6116. }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  6117. isSecondary: true,
  6118. href: allPostsUrl
  6119. }, allPostsLabel), Object(external_wp_element_["createElement"])(post_preview_button, null), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  6120. isPrimary: true,
  6121. href: unlockUrl
  6122. }, Object(external_wp_i18n_["__"])('Take Over')))));
  6123. }
  6124. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js
  6125. /**
  6126. * External dependencies
  6127. */
  6128. /**
  6129. * WordPress dependencies
  6130. */
  6131. function PostPendingStatusCheck({
  6132. hasPublishAction,
  6133. isPublished,
  6134. children
  6135. }) {
  6136. if (isPublished || !hasPublishAction) {
  6137. return null;
  6138. }
  6139. return children;
  6140. }
  6141. /* harmony default export */ var post_pending_status_check = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => {
  6142. const {
  6143. isCurrentPostPublished,
  6144. getCurrentPostType,
  6145. getCurrentPost
  6146. } = select('core/editor');
  6147. return {
  6148. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  6149. isPublished: isCurrentPostPublished(),
  6150. postType: getCurrentPostType()
  6151. };
  6152. }))(PostPendingStatusCheck));
  6153. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js
  6154. /**
  6155. * WordPress dependencies
  6156. */
  6157. /**
  6158. * Internal dependencies
  6159. */
  6160. function PostPendingStatus({
  6161. status,
  6162. onUpdateStatus
  6163. }) {
  6164. const togglePendingStatus = () => {
  6165. const updatedStatus = status === 'pending' ? 'draft' : 'pending';
  6166. onUpdateStatus(updatedStatus);
  6167. };
  6168. return Object(external_wp_element_["createElement"])(post_pending_status_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  6169. label: Object(external_wp_i18n_["__"])('Pending review'),
  6170. checked: status === 'pending',
  6171. onChange: togglePendingStatus
  6172. }));
  6173. }
  6174. /* harmony default export */ var post_pending_status = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({
  6175. status: select('core/editor').getEditedPostAttribute('status')
  6176. })), Object(external_wp_data_["withDispatch"])(dispatch => ({
  6177. onUpdateStatus(status) {
  6178. dispatch('core/editor').editPost({
  6179. status
  6180. });
  6181. }
  6182. })))(PostPendingStatus));
  6183. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
  6184. /**
  6185. * WordPress dependencies
  6186. */
  6187. function PostPingbacks({
  6188. pingStatus = 'open',
  6189. ...props
  6190. }) {
  6191. const onTogglePingback = () => props.editPost({
  6192. ping_status: pingStatus === 'open' ? 'closed' : 'open'
  6193. });
  6194. return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  6195. label: Object(external_wp_i18n_["__"])('Allow pingbacks & trackbacks'),
  6196. checked: pingStatus === 'open',
  6197. onChange: onTogglePingback
  6198. });
  6199. }
  6200. /* harmony default export */ var post_pingbacks = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  6201. return {
  6202. pingStatus: select('core/editor').getEditedPostAttribute('ping_status')
  6203. };
  6204. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  6205. editPost: dispatch('core/editor').editPost
  6206. }))])(PostPingbacks));
  6207. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js
  6208. /**
  6209. * External dependencies
  6210. */
  6211. /**
  6212. * WordPress dependencies
  6213. */
  6214. function PublishButtonLabel({
  6215. isPublished,
  6216. isBeingScheduled,
  6217. isSaving,
  6218. isPublishing,
  6219. hasPublishAction,
  6220. isAutosaving,
  6221. hasNonPostEntityChanges
  6222. }) {
  6223. if (isPublishing) {
  6224. /* translators: button label text should, if possible, be under 16 characters. */
  6225. return Object(external_wp_i18n_["__"])('Publishing…');
  6226. } else if (isPublished && isSaving && !isAutosaving) {
  6227. /* translators: button label text should, if possible, be under 16 characters. */
  6228. return Object(external_wp_i18n_["__"])('Updating…');
  6229. } else if (isBeingScheduled && isSaving && !isAutosaving) {
  6230. /* translators: button label text should, if possible, be under 16 characters. */
  6231. return Object(external_wp_i18n_["__"])('Scheduling…');
  6232. }
  6233. if (!hasPublishAction) {
  6234. return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Submit for Review…') : Object(external_wp_i18n_["__"])('Submit for Review');
  6235. } else if (isPublished) {
  6236. return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Update…') : Object(external_wp_i18n_["__"])('Update');
  6237. } else if (isBeingScheduled) {
  6238. return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Schedule');
  6239. }
  6240. return Object(external_wp_i18n_["__"])('Publish');
  6241. }
  6242. /* harmony default export */ var post_publish_button_label = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
  6243. forceIsSaving
  6244. }) => {
  6245. const {
  6246. isCurrentPostPublished,
  6247. isEditedPostBeingScheduled,
  6248. isSavingPost,
  6249. isPublishingPost,
  6250. getCurrentPost,
  6251. getCurrentPostType,
  6252. isAutosavingPost
  6253. } = select('core/editor');
  6254. return {
  6255. isPublished: isCurrentPostPublished(),
  6256. isBeingScheduled: isEditedPostBeingScheduled(),
  6257. isSaving: forceIsSaving || isSavingPost(),
  6258. isPublishing: isPublishingPost(),
  6259. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  6260. postType: getCurrentPostType(),
  6261. isAutosaving: isAutosavingPost()
  6262. };
  6263. })])(PublishButtonLabel));
  6264. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js
  6265. /**
  6266. * External dependencies
  6267. */
  6268. /**
  6269. * WordPress dependencies
  6270. */
  6271. /**
  6272. * Internal dependencies
  6273. */
  6274. class post_publish_button_PostPublishButton extends external_wp_element_["Component"] {
  6275. constructor(props) {
  6276. super(props);
  6277. this.buttonNode = Object(external_wp_element_["createRef"])();
  6278. this.createOnClick = this.createOnClick.bind(this);
  6279. this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this);
  6280. this.state = {
  6281. entitiesSavedStatesCallback: false
  6282. };
  6283. }
  6284. componentDidMount() {
  6285. if (this.props.focusOnMount) {
  6286. this.buttonNode.current.focus();
  6287. }
  6288. }
  6289. createOnClick(callback) {
  6290. return (...args) => {
  6291. const {
  6292. hasNonPostEntityChanges
  6293. } = this.props;
  6294. if (hasNonPostEntityChanges) {
  6295. // The modal for multiple entity saving will open,
  6296. // hold the callback for saving/publishing the post
  6297. // so that we can call it if the post entity is checked.
  6298. this.setState({
  6299. entitiesSavedStatesCallback: () => callback(...args)
  6300. }); // Open the save panel by setting its callback.
  6301. // To set a function on the useState hook, we must set it
  6302. // with another function (() => myFunction). Passing the
  6303. // function on its own will cause an error when called.
  6304. this.props.setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates);
  6305. return external_lodash_["noop"];
  6306. }
  6307. return callback(...args);
  6308. };
  6309. }
  6310. closeEntitiesSavedStates(savedEntities) {
  6311. const {
  6312. postType,
  6313. postId
  6314. } = this.props;
  6315. const {
  6316. entitiesSavedStatesCallback
  6317. } = this.state;
  6318. this.setState({
  6319. entitiesSavedStatesCallback: false
  6320. }, () => {
  6321. if (savedEntities && Object(external_lodash_["some"])(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) {
  6322. // The post entity was checked, call the held callback from `createOnClick`.
  6323. entitiesSavedStatesCallback();
  6324. }
  6325. });
  6326. }
  6327. render() {
  6328. const {
  6329. forceIsDirty,
  6330. forceIsSaving,
  6331. hasPublishAction,
  6332. isBeingScheduled,
  6333. isOpen,
  6334. isPostSavingLocked,
  6335. isPublishable,
  6336. isPublished,
  6337. isSaveable,
  6338. isSaving,
  6339. isAutoSaving,
  6340. isToggle,
  6341. onSave,
  6342. onStatusChange,
  6343. onSubmit = external_lodash_["noop"],
  6344. onToggle,
  6345. visibility,
  6346. hasNonPostEntityChanges
  6347. } = this.props;
  6348. const isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty;
  6349. const isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty;
  6350. let publishStatus;
  6351. if (!hasPublishAction) {
  6352. publishStatus = 'pending';
  6353. } else if (visibility === 'private') {
  6354. publishStatus = 'private';
  6355. } else if (isBeingScheduled) {
  6356. publishStatus = 'future';
  6357. } else {
  6358. publishStatus = 'publish';
  6359. }
  6360. const onClickButton = () => {
  6361. if (isButtonDisabled) {
  6362. return;
  6363. }
  6364. onSubmit();
  6365. onStatusChange(publishStatus);
  6366. onSave();
  6367. };
  6368. const onClickToggle = () => {
  6369. if (isToggleDisabled) {
  6370. return;
  6371. }
  6372. onToggle();
  6373. };
  6374. const buttonProps = {
  6375. 'aria-disabled': isButtonDisabled && !hasNonPostEntityChanges,
  6376. className: 'editor-post-publish-button',
  6377. isBusy: !isAutoSaving && isSaving && isPublished,
  6378. isPrimary: true,
  6379. onClick: this.createOnClick(onClickButton)
  6380. };
  6381. const toggleProps = {
  6382. 'aria-disabled': isToggleDisabled && !hasNonPostEntityChanges,
  6383. 'aria-expanded': isOpen,
  6384. className: 'editor-post-publish-panel__toggle',
  6385. isBusy: isSaving && isPublished,
  6386. isPrimary: true,
  6387. onClick: this.createOnClick(onClickToggle)
  6388. };
  6389. const toggleChildren = isBeingScheduled ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Publish');
  6390. const buttonChildren = Object(external_wp_element_["createElement"])(post_publish_button_label, {
  6391. forceIsSaving: forceIsSaving,
  6392. hasNonPostEntityChanges: hasNonPostEntityChanges
  6393. });
  6394. const componentProps = isToggle ? toggleProps : buttonProps;
  6395. const componentChildren = isToggle ? toggleChildren : buttonChildren;
  6396. return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({
  6397. ref: this.buttonNode
  6398. }, componentProps, {
  6399. className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', {
  6400. 'has-changes-dot': hasNonPostEntityChanges
  6401. })
  6402. }), componentChildren));
  6403. }
  6404. }
  6405. /* harmony default export */ var post_publish_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  6406. const {
  6407. isSavingPost,
  6408. isAutosavingPost,
  6409. isEditedPostBeingScheduled,
  6410. getEditedPostVisibility,
  6411. isCurrentPostPublished,
  6412. isEditedPostSaveable,
  6413. isEditedPostPublishable,
  6414. isPostSavingLocked,
  6415. getCurrentPost,
  6416. getCurrentPostType,
  6417. getCurrentPostId,
  6418. hasNonPostEntityChanges
  6419. } = select('core/editor');
  6420. const _isAutoSaving = isAutosavingPost();
  6421. return {
  6422. isSaving: isSavingPost() || _isAutoSaving,
  6423. isAutoSaving: _isAutoSaving,
  6424. isBeingScheduled: isEditedPostBeingScheduled(),
  6425. visibility: getEditedPostVisibility(),
  6426. isSaveable: isEditedPostSaveable(),
  6427. isPostSavingLocked: isPostSavingLocked(),
  6428. isPublishable: isEditedPostPublishable(),
  6429. isPublished: isCurrentPostPublished(),
  6430. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  6431. postType: getCurrentPostType(),
  6432. postId: getCurrentPostId(),
  6433. hasNonPostEntityChanges: hasNonPostEntityChanges()
  6434. };
  6435. }), Object(external_wp_data_["withDispatch"])(dispatch => {
  6436. const {
  6437. editPost,
  6438. savePost
  6439. } = dispatch('core/editor');
  6440. return {
  6441. onStatusChange: status => editPost({
  6442. status
  6443. }, {
  6444. undoIgnore: true
  6445. }),
  6446. onSave: savePost
  6447. };
  6448. })])(post_publish_button_PostPublishButton));
  6449. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  6450. var close_small = __webpack_require__("bWcr");
  6451. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
  6452. var wordpress = __webpack_require__("wduq");
  6453. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js
  6454. /**
  6455. * WordPress dependencies
  6456. */
  6457. const visibilityOptions = [{
  6458. value: 'public',
  6459. label: Object(external_wp_i18n_["__"])('Public'),
  6460. info: Object(external_wp_i18n_["__"])('Visible to everyone.')
  6461. }, {
  6462. value: 'private',
  6463. label: Object(external_wp_i18n_["__"])('Private'),
  6464. info: Object(external_wp_i18n_["__"])('Only visible to site admins and editors.')
  6465. }, {
  6466. value: 'password',
  6467. label: Object(external_wp_i18n_["__"])('Password Protected'),
  6468. info: Object(external_wp_i18n_["__"])('Protected with a password you choose. Only those with the password can view this post.')
  6469. }];
  6470. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js
  6471. /**
  6472. * WordPress dependencies
  6473. */
  6474. /**
  6475. * Internal dependencies
  6476. */
  6477. class post_visibility_PostVisibility extends external_wp_element_["Component"] {
  6478. constructor(props) {
  6479. super(...arguments);
  6480. this.setPublic = this.setPublic.bind(this);
  6481. this.setPrivate = this.setPrivate.bind(this);
  6482. this.setPasswordProtected = this.setPasswordProtected.bind(this);
  6483. this.updatePassword = this.updatePassword.bind(this);
  6484. this.state = {
  6485. hasPassword: !!props.password
  6486. };
  6487. }
  6488. setPublic() {
  6489. const {
  6490. visibility,
  6491. onUpdateVisibility,
  6492. status
  6493. } = this.props;
  6494. onUpdateVisibility(visibility === 'private' ? 'draft' : status);
  6495. this.setState({
  6496. hasPassword: false
  6497. });
  6498. }
  6499. setPrivate() {
  6500. if ( // eslint-disable-next-line no-alert
  6501. !window.confirm(Object(external_wp_i18n_["__"])('Would you like to privately publish this post now?'))) {
  6502. return;
  6503. }
  6504. const {
  6505. onUpdateVisibility,
  6506. onSave
  6507. } = this.props;
  6508. onUpdateVisibility('private');
  6509. this.setState({
  6510. hasPassword: false
  6511. });
  6512. onSave();
  6513. }
  6514. setPasswordProtected() {
  6515. const {
  6516. visibility,
  6517. onUpdateVisibility,
  6518. status,
  6519. password
  6520. } = this.props;
  6521. onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || '');
  6522. this.setState({
  6523. hasPassword: true
  6524. });
  6525. }
  6526. updatePassword(event) {
  6527. const {
  6528. status,
  6529. onUpdateVisibility
  6530. } = this.props;
  6531. onUpdateVisibility(status, event.target.value);
  6532. }
  6533. render() {
  6534. const {
  6535. visibility,
  6536. password,
  6537. instanceId
  6538. } = this.props;
  6539. const visibilityHandlers = {
  6540. public: {
  6541. onSelect: this.setPublic,
  6542. checked: visibility === 'public' && !this.state.hasPassword
  6543. },
  6544. private: {
  6545. onSelect: this.setPrivate,
  6546. checked: visibility === 'private'
  6547. },
  6548. password: {
  6549. onSelect: this.setPasswordProtected,
  6550. checked: this.state.hasPassword
  6551. }
  6552. };
  6553. return [Object(external_wp_element_["createElement"])("fieldset", {
  6554. key: "visibility-selector",
  6555. className: "editor-post-visibility__dialog-fieldset"
  6556. }, Object(external_wp_element_["createElement"])("legend", {
  6557. className: "editor-post-visibility__dialog-legend"
  6558. }, Object(external_wp_i18n_["__"])('Post Visibility')), visibilityOptions.map(({
  6559. value,
  6560. label,
  6561. info
  6562. }) => Object(external_wp_element_["createElement"])("div", {
  6563. key: value,
  6564. className: "editor-post-visibility__choice"
  6565. }, Object(external_wp_element_["createElement"])("input", {
  6566. type: "radio",
  6567. name: `editor-post-visibility__setting-${instanceId}`,
  6568. value: value,
  6569. onChange: visibilityHandlers[value].onSelect,
  6570. checked: visibilityHandlers[value].checked,
  6571. id: `editor-post-${value}-${instanceId}`,
  6572. "aria-describedby": `editor-post-${value}-${instanceId}-description`,
  6573. className: "editor-post-visibility__dialog-radio"
  6574. }), Object(external_wp_element_["createElement"])("label", {
  6575. htmlFor: `editor-post-${value}-${instanceId}`,
  6576. className: "editor-post-visibility__dialog-label"
  6577. }, label), Object(external_wp_element_["createElement"])("p", {
  6578. id: `editor-post-${value}-${instanceId}-description`,
  6579. className: "editor-post-visibility__dialog-info"
  6580. }, info)))), this.state.hasPassword && Object(external_wp_element_["createElement"])("div", {
  6581. className: "editor-post-visibility__dialog-password",
  6582. key: "password-selector"
  6583. }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
  6584. as: "label",
  6585. htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}`
  6586. }, Object(external_wp_i18n_["__"])('Create password')), Object(external_wp_element_["createElement"])("input", {
  6587. className: "editor-post-visibility__dialog-password-input",
  6588. id: `editor-post-visibility__dialog-password-input-${instanceId}`,
  6589. type: "text",
  6590. onChange: this.updatePassword,
  6591. value: password,
  6592. placeholder: Object(external_wp_i18n_["__"])('Use a secure password')
  6593. }))];
  6594. }
  6595. }
  6596. /* harmony default export */ var post_visibility = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  6597. const {
  6598. getEditedPostAttribute,
  6599. getEditedPostVisibility
  6600. } = select('core/editor');
  6601. return {
  6602. status: getEditedPostAttribute('status'),
  6603. visibility: getEditedPostVisibility(),
  6604. password: getEditedPostAttribute('password')
  6605. };
  6606. }), Object(external_wp_data_["withDispatch"])(dispatch => {
  6607. const {
  6608. savePost,
  6609. editPost
  6610. } = dispatch('core/editor');
  6611. return {
  6612. onSave: savePost,
  6613. onUpdateVisibility(status, password = '') {
  6614. editPost({
  6615. status,
  6616. password
  6617. });
  6618. }
  6619. };
  6620. }), external_wp_compose_["withInstanceId"]])(post_visibility_PostVisibility));
  6621. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js
  6622. /**
  6623. * External dependencies
  6624. */
  6625. /**
  6626. * WordPress dependencies
  6627. */
  6628. /**
  6629. * Internal dependencies
  6630. */
  6631. function PostVisibilityLabel({
  6632. visibility
  6633. }) {
  6634. const getVisibilityLabel = () => Object(external_lodash_["find"])(visibilityOptions, {
  6635. value: visibility
  6636. }).label;
  6637. return getVisibilityLabel(visibility);
  6638. }
  6639. /* harmony default export */ var post_visibility_label = (Object(external_wp_data_["withSelect"])(select => ({
  6640. visibility: select('core/editor').getEditedPostVisibility()
  6641. }))(PostVisibilityLabel));
  6642. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
  6643. /**
  6644. * WordPress dependencies
  6645. */
  6646. /**
  6647. * Internal dependencies
  6648. */
  6649. function getDayOfTheMonth(date = new Date(), firstDay = true) {
  6650. const d = new Date(date);
  6651. return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString();
  6652. }
  6653. function PostSchedule() {
  6654. const {
  6655. postDate,
  6656. postType
  6657. } = Object(external_wp_data_["useSelect"])(select => ({
  6658. postDate: select(store).getEditedPostAttribute('date'),
  6659. postType: select(store).getCurrentPostType()
  6660. }), []);
  6661. const {
  6662. editPost
  6663. } = Object(external_wp_data_["useDispatch"])(store);
  6664. const onUpdateDate = date => editPost({
  6665. date
  6666. });
  6667. const [previewedMonth, setPreviewedMonth] = Object(external_wp_element_["useState"])(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts.
  6668. const eventsByPostType = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntityRecords('postType', postType, {
  6669. status: 'publish,future',
  6670. after: getDayOfTheMonth(previewedMonth),
  6671. before: getDayOfTheMonth(previewedMonth, false),
  6672. exclude: [select(store).getCurrentPostId()]
  6673. }), [previewedMonth, postType]);
  6674. const events = Object(external_wp_element_["useMemo"])(() => (eventsByPostType || []).map(({
  6675. title,
  6676. type,
  6677. date: eventDate
  6678. }) => ({
  6679. title: title === null || title === void 0 ? void 0 : title.rendered,
  6680. type,
  6681. date: new Date(eventDate)
  6682. })), [eventsByPostType]);
  6683. const ref = Object(external_wp_element_["useRef"])();
  6684. const settings = Object(external_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
  6685. // We also make sure this a is not escaped by a "/"
  6686. const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a
  6687. .replace(/\\\\/g, '') // Replace "//" with empty strings
  6688. .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash
  6689. );
  6690. function onChange(newDate) {
  6691. onUpdateDate(newDate);
  6692. const {
  6693. ownerDocument
  6694. } = ref.current;
  6695. ownerDocument.activeElement.blur();
  6696. }
  6697. return Object(external_wp_element_["createElement"])(external_wp_components_["DateTimePicker"], {
  6698. ref: ref,
  6699. currentDate: postDate,
  6700. onChange: onChange,
  6701. is12Hour: is12HourTime,
  6702. events: events,
  6703. onMonthPreviewed: setPreviewedMonth
  6704. });
  6705. }
  6706. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js
  6707. /**
  6708. * WordPress dependencies
  6709. */
  6710. function PostScheduleLabel({
  6711. date,
  6712. isFloating
  6713. }) {
  6714. const settings = Object(external_wp_date_["__experimentalGetSettings"])();
  6715. return date && !isFloating ? Object(external_wp_date_["format"])(`${settings.formats.date} ${settings.formats.time}`, date) : Object(external_wp_i18n_["__"])('Immediately');
  6716. }
  6717. /* harmony default export */ var post_schedule_label = (Object(external_wp_data_["withSelect"])(select => {
  6718. return {
  6719. date: select('core/editor').getEditedPostAttribute('date'),
  6720. isFloating: select('core/editor').isEditedPostDateFloating()
  6721. };
  6722. })(PostScheduleLabel));
  6723. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js
  6724. /**
  6725. * External dependencies
  6726. */
  6727. /**
  6728. * WordPress dependencies
  6729. */
  6730. /**
  6731. * Internal dependencies
  6732. */
  6733. const MAX_MOST_USED_TERMS = 10;
  6734. const DEFAULT_QUERY = {
  6735. per_page: MAX_MOST_USED_TERMS,
  6736. orderby: 'count',
  6737. order: 'desc',
  6738. hide_empty: true,
  6739. _fields: 'id,name,count'
  6740. };
  6741. function MostUsedTerms({
  6742. onSelect,
  6743. taxonomy
  6744. }) {
  6745. const {
  6746. _terms,
  6747. showTerms
  6748. } = Object(external_wp_data_["useSelect"])(select => {
  6749. const mostUsedTerms = select(external_wp_coreData_["store"]).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY);
  6750. return {
  6751. _terms: mostUsedTerms,
  6752. showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MAX_MOST_USED_TERMS
  6753. };
  6754. }, []);
  6755. if (!showTerms) {
  6756. return null;
  6757. }
  6758. const terms = unescapeTerms(_terms);
  6759. const label = Object(external_lodash_["get"])(taxonomy, ['labels', 'most_used']);
  6760. return Object(external_wp_element_["createElement"])("div", {
  6761. className: "editor-post-taxonomies__flat-term-most-used"
  6762. }, Object(external_wp_element_["createElement"])("h3", {
  6763. className: "editor-post-taxonomies__flat-term-most-used-label"
  6764. }, label), Object(external_wp_element_["createElement"])("ul", {
  6765. role: "list",
  6766. className: "editor-post-taxonomies__flat-term-most-used-list"
  6767. }, terms.map(term => Object(external_wp_element_["createElement"])("li", {
  6768. key: term.id
  6769. }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  6770. isLink: true,
  6771. onClick: () => onSelect(term)
  6772. }, term.name)))));
  6773. }
  6774. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
  6775. /**
  6776. * External dependencies
  6777. */
  6778. /**
  6779. * WordPress dependencies
  6780. */
  6781. /**
  6782. * Internal dependencies
  6783. */
  6784. /**
  6785. * Module constants
  6786. */
  6787. const MAX_TERMS_SUGGESTIONS = 20;
  6788. const flat_term_selector_DEFAULT_QUERY = {
  6789. per_page: MAX_TERMS_SUGGESTIONS,
  6790. orderby: 'count',
  6791. order: 'desc',
  6792. _fields: 'id,name,count'
  6793. };
  6794. const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
  6795. const termNamesToIds = (names, terms) => {
  6796. return names.map(termName => Object(external_lodash_["find"])(terms, term => isSameTermName(term.name, termName)).id);
  6797. };
  6798. class flat_term_selector_FlatTermSelector extends external_wp_element_["Component"] {
  6799. constructor() {
  6800. super(...arguments);
  6801. this.onChange = this.onChange.bind(this);
  6802. this.searchTerms = Object(external_lodash_["debounce"])(this.searchTerms.bind(this), 500);
  6803. this.findOrCreateTerm = this.findOrCreateTerm.bind(this);
  6804. this.appendTerm = this.appendTerm.bind(this);
  6805. this.state = {
  6806. loading: !Object(external_lodash_["isEmpty"])(this.props.terms),
  6807. availableTerms: [],
  6808. selectedTerms: []
  6809. };
  6810. }
  6811. componentDidMount() {
  6812. if (!Object(external_lodash_["isEmpty"])(this.props.terms)) {
  6813. this.initRequest = this.fetchTerms({
  6814. include: this.props.terms.join(','),
  6815. per_page: -1
  6816. });
  6817. this.initRequest.then(() => {
  6818. this.setState({
  6819. loading: false
  6820. });
  6821. }, xhr => {
  6822. if (xhr.statusText === 'abort') {
  6823. return;
  6824. }
  6825. this.setState({
  6826. loading: false
  6827. });
  6828. });
  6829. }
  6830. }
  6831. componentWillUnmount() {
  6832. Object(external_lodash_["invoke"])(this.initRequest, ['abort']);
  6833. Object(external_lodash_["invoke"])(this.searchRequest, ['abort']);
  6834. }
  6835. componentDidUpdate(prevProps) {
  6836. if (prevProps.terms !== this.props.terms) {
  6837. this.updateSelectedTerms(this.props.terms);
  6838. }
  6839. }
  6840. fetchTerms(params = {}) {
  6841. const {
  6842. taxonomy
  6843. } = this.props;
  6844. const query = { ...flat_term_selector_DEFAULT_QUERY,
  6845. ...params
  6846. };
  6847. const request = external_wp_apiFetch_default()({
  6848. path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, query)
  6849. });
  6850. request.then(unescapeTerms).then(terms => {
  6851. this.setState(state => ({
  6852. availableTerms: state.availableTerms.concat(terms.filter(term => !Object(external_lodash_["find"])(state.availableTerms, availableTerm => availableTerm.id === term.id)))
  6853. }));
  6854. this.updateSelectedTerms(this.props.terms);
  6855. });
  6856. return request;
  6857. }
  6858. updateSelectedTerms(terms = []) {
  6859. const selectedTerms = terms.reduce((accumulator, termId) => {
  6860. const termObject = Object(external_lodash_["find"])(this.state.availableTerms, term => term.id === termId);
  6861. if (termObject) {
  6862. accumulator.push(termObject.name);
  6863. }
  6864. return accumulator;
  6865. }, []);
  6866. this.setState({
  6867. selectedTerms
  6868. });
  6869. }
  6870. findOrCreateTerm(termName) {
  6871. const {
  6872. taxonomy
  6873. } = this.props;
  6874. const termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists.
  6875. return external_wp_apiFetch_default()({
  6876. path: `/wp/v2/${taxonomy.rest_base}`,
  6877. method: 'POST',
  6878. data: {
  6879. name: termNameEscaped
  6880. }
  6881. }).catch(error => {
  6882. const errorCode = error.code;
  6883. if (errorCode === 'term_exists') {
  6884. // If the terms exist, fetch it instead of creating a new one.
  6885. this.addRequest = external_wp_apiFetch_default()({
  6886. path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...flat_term_selector_DEFAULT_QUERY,
  6887. search: termNameEscaped
  6888. })
  6889. }).then(unescapeTerms);
  6890. return this.addRequest.then(searchResult => {
  6891. return Object(external_lodash_["find"])(searchResult, result => isSameTermName(result.name, termName));
  6892. });
  6893. }
  6894. return Promise.reject(error);
  6895. }).then(unescapeTerm);
  6896. }
  6897. onChange(termNames) {
  6898. const uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, term => term.toLowerCase());
  6899. this.setState({
  6900. selectedTerms: uniqueTerms
  6901. });
  6902. const newTermNames = uniqueTerms.filter(termName => !Object(external_lodash_["find"])(this.state.availableTerms, term => isSameTermName(term.name, termName)));
  6903. if (newTermNames.length === 0) {
  6904. return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, this.state.availableTerms), this.props.taxonomy.rest_base);
  6905. }
  6906. Promise.all(newTermNames.map(this.findOrCreateTerm)).then(newTerms => {
  6907. const newAvailableTerms = this.state.availableTerms.concat(newTerms);
  6908. this.setState({
  6909. availableTerms: newAvailableTerms
  6910. });
  6911. return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms), this.props.taxonomy.rest_base);
  6912. });
  6913. }
  6914. searchTerms(search = '') {
  6915. Object(external_lodash_["invoke"])(this.searchRequest, ['abort']);
  6916. if (search.length >= 3) {
  6917. this.searchRequest = this.fetchTerms({
  6918. search
  6919. });
  6920. }
  6921. }
  6922. appendTerm(newTerm) {
  6923. const {
  6924. onUpdateTerms,
  6925. taxonomy,
  6926. terms = [],
  6927. slug,
  6928. speak
  6929. } = this.props;
  6930. if (terms.includes(newTerm.id)) {
  6931. return;
  6932. }
  6933. const newTerms = [...terms, newTerm.id];
  6934. const termAddedMessage = Object(external_wp_i18n_["sprintf"])(
  6935. /* translators: %s: term name. */
  6936. Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term')));
  6937. speak(termAddedMessage, 'assertive');
  6938. this.setState({
  6939. availableTerms: [...this.state.availableTerms, newTerm]
  6940. });
  6941. onUpdateTerms(newTerms, taxonomy.rest_base);
  6942. }
  6943. render() {
  6944. const {
  6945. slug,
  6946. taxonomy,
  6947. hasAssignAction
  6948. } = this.props;
  6949. if (!hasAssignAction) {
  6950. return null;
  6951. }
  6952. const {
  6953. loading,
  6954. availableTerms,
  6955. selectedTerms
  6956. } = this.state;
  6957. const termNames = availableTerms.map(term => term.name);
  6958. const newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Add new tag') : Object(external_wp_i18n_["__"])('Add new Term'));
  6959. const singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term'));
  6960. const termAddedLabel = Object(external_wp_i18n_["sprintf"])(
  6961. /* translators: %s: term name. */
  6962. Object(external_wp_i18n_["_x"])('%s added', 'term'), singularName);
  6963. const termRemovedLabel = Object(external_wp_i18n_["sprintf"])(
  6964. /* translators: %s: term name. */
  6965. Object(external_wp_i18n_["_x"])('%s removed', 'term'), singularName);
  6966. const removeTermLabel = Object(external_wp_i18n_["sprintf"])(
  6967. /* translators: %s: term name. */
  6968. Object(external_wp_i18n_["_x"])('Remove %s', 'term'), singularName);
  6969. return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["FormTokenField"], {
  6970. value: selectedTerms,
  6971. suggestions: termNames,
  6972. onChange: this.onChange,
  6973. onInputChange: this.searchTerms,
  6974. maxSuggestions: MAX_TERMS_SUGGESTIONS,
  6975. disabled: loading,
  6976. label: newTermLabel,
  6977. messages: {
  6978. added: termAddedLabel,
  6979. removed: termRemovedLabel,
  6980. remove: removeTermLabel
  6981. }
  6982. }), Object(external_wp_element_["createElement"])(MostUsedTerms, {
  6983. taxonomy: taxonomy,
  6984. onSelect: this.appendTerm
  6985. }));
  6986. }
  6987. }
  6988. /* harmony default export */ var flat_term_selector = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, {
  6989. slug
  6990. }) => {
  6991. const {
  6992. getCurrentPost
  6993. } = select(store);
  6994. const {
  6995. getTaxonomy
  6996. } = select(external_wp_coreData_["store"]);
  6997. const taxonomy = getTaxonomy(slug);
  6998. return {
  6999. hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false,
  7000. hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false,
  7001. terms: taxonomy ? select(store).getEditedPostAttribute(taxonomy.rest_base) : [],
  7002. taxonomy
  7003. };
  7004. }), Object(external_wp_data_["withDispatch"])(dispatch => {
  7005. return {
  7006. onUpdateTerms(terms, restBase) {
  7007. dispatch(store).editPost({
  7008. [restBase]: terms
  7009. });
  7010. }
  7011. };
  7012. }), external_wp_components_["withSpokenMessages"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType'))(flat_term_selector_FlatTermSelector));
  7013. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
  7014. /**
  7015. * External dependencies
  7016. */
  7017. /**
  7018. * WordPress dependencies
  7019. */
  7020. /**
  7021. * Internal dependencies
  7022. */
  7023. const TagsPanel = () => {
  7024. const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", {
  7025. className: "editor-post-publish-panel__link",
  7026. key: "label"
  7027. }, Object(external_wp_i18n_["__"])('Add tags'))];
  7028. return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
  7029. initialOpen: false,
  7030. title: panelBodyTitle
  7031. }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), Object(external_wp_element_["createElement"])(flat_term_selector, {
  7032. slug: 'post_tag'
  7033. }));
  7034. };
  7035. class maybe_tags_panel_MaybeTagsPanel extends external_wp_element_["Component"] {
  7036. constructor(props) {
  7037. super(props);
  7038. this.state = {
  7039. hadTagsWhenOpeningThePanel: props.hasTags
  7040. };
  7041. }
  7042. /*
  7043. * We only want to show the tag panel if the post didn't have
  7044. * any tags when the user hit the Publish button.
  7045. *
  7046. * We can't use the prop.hasTags because it'll change to true
  7047. * if the user adds a new tag within the pre-publish panel.
  7048. * This would force a re-render and a new prop.hasTags check,
  7049. * hiding this panel and keeping the user from adding
  7050. * more than one tag.
  7051. */
  7052. render() {
  7053. if (!this.state.hadTagsWhenOpeningThePanel) {
  7054. return Object(external_wp_element_["createElement"])(TagsPanel, null);
  7055. }
  7056. return null;
  7057. }
  7058. }
  7059. /* harmony default export */ var maybe_tags_panel = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => {
  7060. const postType = select('core/editor').getCurrentPostType();
  7061. const tagsTaxonomy = select('core').getTaxonomy('post_tag');
  7062. const tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base);
  7063. return {
  7064. areTagsFetched: tagsTaxonomy !== undefined,
  7065. isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, type => type === postType),
  7066. hasTags: tags && tags.length
  7067. };
  7068. }), Object(external_wp_compose_["ifCondition"])(({
  7069. areTagsFetched,
  7070. isPostTypeSupported
  7071. }) => isPostTypeSupported && areTagsFetched))(maybe_tags_panel_MaybeTagsPanel));
  7072. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
  7073. /**
  7074. * External dependencies
  7075. */
  7076. /**
  7077. * WordPress dependencies
  7078. */
  7079. /**
  7080. * Internal dependencies
  7081. */
  7082. const getSuggestion = (supportedFormats, suggestedPostFormat) => {
  7083. const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id));
  7084. return Object(external_lodash_["find"])(formats, format => format.id === suggestedPostFormat);
  7085. };
  7086. const PostFormatSuggestion = ({
  7087. suggestedPostFormat,
  7088. suggestionText,
  7089. onUpdatePostFormat
  7090. }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7091. isLink: true,
  7092. onClick: () => onUpdatePostFormat(suggestedPostFormat)
  7093. }, suggestionText);
  7094. function PostFormatPanel() {
  7095. const {
  7096. currentPostFormat,
  7097. suggestion
  7098. } = Object(external_wp_data_["useSelect"])(select => {
  7099. const {
  7100. getEditedPostAttribute,
  7101. getSuggestedPostFormat
  7102. } = select('core/editor');
  7103. const supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []);
  7104. return {
  7105. currentPostFormat: getEditedPostAttribute('format'),
  7106. suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat())
  7107. };
  7108. }, []);
  7109. const {
  7110. editPost
  7111. } = Object(external_wp_data_["useDispatch"])('core/editor');
  7112. const onUpdatePostFormat = format => editPost({
  7113. format
  7114. });
  7115. const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", {
  7116. className: "editor-post-publish-panel__link",
  7117. key: "label"
  7118. }, Object(external_wp_i18n_["__"])('Use a post format'))];
  7119. if (!suggestion || suggestion.id === currentPostFormat) {
  7120. return null;
  7121. }
  7122. return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
  7123. initialOpen: false,
  7124. title: panelBodyTitle
  7125. }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_element_["createElement"])(PostFormatSuggestion, {
  7126. onUpdatePostFormat: onUpdatePostFormat,
  7127. suggestedPostFormat: suggestion.id,
  7128. suggestionText: Object(external_wp_i18n_["sprintf"])(
  7129. /* translators: %s: post format */
  7130. Object(external_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption)
  7131. })));
  7132. }
  7133. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js
  7134. /**
  7135. * External dependencies
  7136. */
  7137. /**
  7138. * WordPress dependencies
  7139. */
  7140. /**
  7141. * Internal dependencies
  7142. */
  7143. function PostPublishPanelPrepublish({
  7144. children
  7145. }) {
  7146. const {
  7147. isBeingScheduled,
  7148. isRequestingSiteIcon,
  7149. hasPublishAction,
  7150. siteIconUrl,
  7151. siteTitle,
  7152. siteHome
  7153. } = Object(external_wp_data_["useSelect"])(select => {
  7154. const {
  7155. isResolving
  7156. } = select('core/data');
  7157. const {
  7158. getCurrentPost,
  7159. isEditedPostBeingScheduled
  7160. } = select('core/editor');
  7161. const {
  7162. getEntityRecord
  7163. } = select('core');
  7164. const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
  7165. return {
  7166. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7167. isBeingScheduled: isEditedPostBeingScheduled(),
  7168. isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
  7169. siteIconUrl: siteData.site_icon_url,
  7170. siteTitle: siteData.name,
  7171. siteHome: siteData.home && Object(external_wp_url_["filterURLForDisplay"])(siteData.home)
  7172. };
  7173. }, []);
  7174. let siteIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], {
  7175. className: "components-site-icon",
  7176. size: "36px",
  7177. icon: wordpress["a" /* default */]
  7178. });
  7179. if (siteIconUrl) {
  7180. siteIcon = Object(external_wp_element_["createElement"])("img", {
  7181. alt: Object(external_wp_i18n_["__"])('Site Icon'),
  7182. className: "components-site-icon",
  7183. src: siteIconUrl
  7184. });
  7185. }
  7186. if (isRequestingSiteIcon) {
  7187. siteIcon = null;
  7188. }
  7189. let prePublishTitle, prePublishBodyText;
  7190. if (!hasPublishAction) {
  7191. prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to submit for review?');
  7192. prePublishBodyText = Object(external_wp_i18n_["__"])('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.');
  7193. } else if (isBeingScheduled) {
  7194. prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to schedule?');
  7195. prePublishBodyText = Object(external_wp_i18n_["__"])('Your work will be published at the specified date and time.');
  7196. } else {
  7197. prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to publish?');
  7198. prePublishBodyText = Object(external_wp_i18n_["__"])('Double-check your settings before publishing.');
  7199. }
  7200. return Object(external_wp_element_["createElement"])("div", {
  7201. className: "editor-post-publish-panel__prepublish"
  7202. }, Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("strong", null, prePublishTitle)), Object(external_wp_element_["createElement"])("p", null, prePublishBodyText), Object(external_wp_element_["createElement"])("div", {
  7203. className: "components-site-card"
  7204. }, siteIcon, Object(external_wp_element_["createElement"])("div", {
  7205. className: "components-site-info"
  7206. }, Object(external_wp_element_["createElement"])("span", {
  7207. className: "components-site-name"
  7208. }, siteTitle || Object(external_wp_i18n_["__"])('(Untitled)')), Object(external_wp_element_["createElement"])("span", {
  7209. className: "components-site-home"
  7210. }, siteHome))), hasPublishAction && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
  7211. initialOpen: false,
  7212. title: [Object(external_wp_i18n_["__"])('Visibility:'), Object(external_wp_element_["createElement"])("span", {
  7213. className: "editor-post-publish-panel__link",
  7214. key: "label"
  7215. }, Object(external_wp_element_["createElement"])(post_visibility_label, null))]
  7216. }, Object(external_wp_element_["createElement"])(post_visibility, null)), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
  7217. initialOpen: false,
  7218. title: [Object(external_wp_i18n_["__"])('Publish:'), Object(external_wp_element_["createElement"])("span", {
  7219. className: "editor-post-publish-panel__link",
  7220. key: "label"
  7221. }, Object(external_wp_element_["createElement"])(post_schedule_label, null))]
  7222. }, Object(external_wp_element_["createElement"])(PostSchedule, null))), Object(external_wp_element_["createElement"])(PostFormatPanel, null), Object(external_wp_element_["createElement"])(maybe_tags_panel, null), children);
  7223. }
  7224. /* harmony default export */ var prepublish = (PostPublishPanelPrepublish);
  7225. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js
  7226. /**
  7227. * External dependencies
  7228. */
  7229. /**
  7230. * WordPress dependencies
  7231. */
  7232. /**
  7233. * Internal dependencies
  7234. */
  7235. const POSTNAME = '%postname%';
  7236. /**
  7237. * Returns URL for a future post.
  7238. *
  7239. * @param {Object} post Post object.
  7240. *
  7241. * @return {string} PostPublish URL.
  7242. */
  7243. const getFuturePostUrl = post => {
  7244. const {
  7245. slug
  7246. } = post;
  7247. if (post.permalink_template.includes(POSTNAME)) {
  7248. return post.permalink_template.replace(POSTNAME, slug);
  7249. }
  7250. return post.permalink_template;
  7251. };
  7252. function postpublish_CopyButton({
  7253. text,
  7254. onCopy,
  7255. children
  7256. }) {
  7257. const ref = Object(external_wp_compose_["useCopyToClipboard"])(text, onCopy);
  7258. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7259. isSecondary: true,
  7260. ref: ref
  7261. }, children);
  7262. }
  7263. class postpublish_PostPublishPanelPostpublish extends external_wp_element_["Component"] {
  7264. constructor() {
  7265. super(...arguments);
  7266. this.state = {
  7267. showCopyConfirmation: false
  7268. };
  7269. this.onCopy = this.onCopy.bind(this);
  7270. this.onSelectInput = this.onSelectInput.bind(this);
  7271. this.postLink = Object(external_wp_element_["createRef"])();
  7272. }
  7273. componentDidMount() {
  7274. if (this.props.focusOnMount) {
  7275. this.postLink.current.focus();
  7276. }
  7277. }
  7278. componentWillUnmount() {
  7279. clearTimeout(this.dismissCopyConfirmation);
  7280. }
  7281. onCopy() {
  7282. this.setState({
  7283. showCopyConfirmation: true
  7284. });
  7285. clearTimeout(this.dismissCopyConfirmation);
  7286. this.dismissCopyConfirmation = setTimeout(() => {
  7287. this.setState({
  7288. showCopyConfirmation: false
  7289. });
  7290. }, 4000);
  7291. }
  7292. onSelectInput(event) {
  7293. event.target.select();
  7294. }
  7295. render() {
  7296. const {
  7297. children,
  7298. isScheduled,
  7299. post,
  7300. postType
  7301. } = this.props;
  7302. const postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']);
  7303. const viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']);
  7304. const link = post.status === 'future' ? getFuturePostUrl(post) : post.link;
  7305. const postPublishNonLinkHeader = isScheduled ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('is now scheduled. It will go live on'), ' ', Object(external_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_wp_i18n_["__"])('is now live.');
  7306. return Object(external_wp_element_["createElement"])("div", {
  7307. className: "post-publish-panel__postpublish"
  7308. }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
  7309. className: "post-publish-panel__postpublish-header"
  7310. }, Object(external_wp_element_["createElement"])("a", {
  7311. ref: this.postLink,
  7312. href: link
  7313. }, Object(external_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_wp_i18n_["__"])('(no title)')), ' ', postPublishNonLinkHeader), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])("p", {
  7314. className: "post-publish-panel__postpublish-subheader"
  7315. }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('What’s next?'))), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
  7316. className: "post-publish-panel__postpublish-post-address",
  7317. readOnly: true,
  7318. label: Object(external_wp_i18n_["sprintf"])(
  7319. /* translators: %s: post type singular name */
  7320. Object(external_wp_i18n_["__"])('%s address'), postLabel),
  7321. value: Object(external_wp_url_["safeDecodeURIComponent"])(link),
  7322. onFocus: this.onSelectInput
  7323. }), Object(external_wp_element_["createElement"])("div", {
  7324. className: "post-publish-panel__postpublish-buttons"
  7325. }, !isScheduled && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7326. isSecondary: true,
  7327. href: link
  7328. }, viewPostLabel), Object(external_wp_element_["createElement"])(postpublish_CopyButton, {
  7329. text: link,
  7330. onCopy: this.onCopy
  7331. }, this.state.showCopyConfirmation ? Object(external_wp_i18n_["__"])('Copied!') : Object(external_wp_i18n_["__"])('Copy Link')))), children);
  7332. }
  7333. }
  7334. /* harmony default export */ var postpublish = (Object(external_wp_data_["withSelect"])(select => {
  7335. const {
  7336. getEditedPostAttribute,
  7337. getCurrentPost,
  7338. isCurrentPostScheduled
  7339. } = select('core/editor');
  7340. const {
  7341. getPostType
  7342. } = select('core');
  7343. return {
  7344. post: getCurrentPost(),
  7345. postType: getPostType(getEditedPostAttribute('type')),
  7346. isScheduled: isCurrentPostScheduled()
  7347. };
  7348. })(postpublish_PostPublishPanelPostpublish));
  7349. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js
  7350. /**
  7351. * External dependencies
  7352. */
  7353. /**
  7354. * WordPress dependencies
  7355. */
  7356. /**
  7357. * Internal dependencies
  7358. */
  7359. class post_publish_panel_PostPublishPanel extends external_wp_element_["Component"] {
  7360. constructor() {
  7361. super(...arguments);
  7362. this.onSubmit = this.onSubmit.bind(this);
  7363. }
  7364. componentDidUpdate(prevProps) {
  7365. // Automatically collapse the publish sidebar when a post
  7366. // is published and the user makes an edit.
  7367. if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) {
  7368. this.props.onClose();
  7369. }
  7370. }
  7371. onSubmit() {
  7372. const {
  7373. onClose,
  7374. hasPublishAction,
  7375. isPostTypeViewable
  7376. } = this.props;
  7377. if (!hasPublishAction || !isPostTypeViewable) {
  7378. onClose();
  7379. }
  7380. }
  7381. render() {
  7382. const {
  7383. forceIsDirty,
  7384. forceIsSaving,
  7385. isBeingScheduled,
  7386. isPublished,
  7387. isPublishSidebarEnabled,
  7388. isScheduled,
  7389. isSaving,
  7390. onClose,
  7391. onTogglePublishSidebar,
  7392. PostPublishExtension,
  7393. PrePublishExtension,
  7394. ...additionalProps
  7395. } = this.props;
  7396. const propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']);
  7397. const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
  7398. const isPrePublish = !isPublishedOrScheduled && !isSaving;
  7399. const isPostPublish = isPublishedOrScheduled && !isSaving;
  7400. return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
  7401. className: "editor-post-publish-panel"
  7402. }, propsForPanel), Object(external_wp_element_["createElement"])("div", {
  7403. className: "editor-post-publish-panel__header"
  7404. }, isPostPublish ? Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7405. onClick: onClose,
  7406. icon: close_small["a" /* default */],
  7407. label: Object(external_wp_i18n_["__"])('Close panel')
  7408. }) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
  7409. className: "editor-post-publish-panel__header-publish-button"
  7410. }, Object(external_wp_element_["createElement"])(post_publish_button, {
  7411. focusOnMount: true,
  7412. onSubmit: this.onSubmit,
  7413. forceIsDirty: forceIsDirty,
  7414. forceIsSaving: forceIsSaving
  7415. })), Object(external_wp_element_["createElement"])("div", {
  7416. className: "editor-post-publish-panel__header-cancel-button"
  7417. }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7418. onClick: onClose,
  7419. isSecondary: true
  7420. }, Object(external_wp_i18n_["__"])('Cancel'))))), Object(external_wp_element_["createElement"])("div", {
  7421. className: "editor-post-publish-panel__content"
  7422. }, isPrePublish && Object(external_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_wp_element_["createElement"])(postpublish, {
  7423. focusOnMount: true
  7424. }, PostPublishExtension && Object(external_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)), Object(external_wp_element_["createElement"])("div", {
  7425. className: "editor-post-publish-panel__footer"
  7426. }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  7427. label: Object(external_wp_i18n_["__"])('Always show pre-publish checks.'),
  7428. checked: isPublishSidebarEnabled,
  7429. onChange: onTogglePublishSidebar
  7430. })));
  7431. }
  7432. }
  7433. /* harmony default export */ var post_publish_panel = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  7434. const {
  7435. getPostType
  7436. } = select('core');
  7437. const {
  7438. getCurrentPost,
  7439. getEditedPostAttribute,
  7440. isCurrentPostPublished,
  7441. isCurrentPostScheduled,
  7442. isEditedPostBeingScheduled,
  7443. isEditedPostDirty,
  7444. isSavingPost
  7445. } = select('core/editor');
  7446. const {
  7447. isPublishSidebarEnabled
  7448. } = select('core/editor');
  7449. const postType = getPostType(getEditedPostAttribute('type'));
  7450. return {
  7451. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7452. isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
  7453. isBeingScheduled: isEditedPostBeingScheduled(),
  7454. isDirty: isEditedPostDirty(),
  7455. isPublished: isCurrentPostPublished(),
  7456. isPublishSidebarEnabled: isPublishSidebarEnabled(),
  7457. isSaving: isSavingPost(),
  7458. isScheduled: isCurrentPostScheduled()
  7459. };
  7460. }), Object(external_wp_data_["withDispatch"])((dispatch, {
  7461. isPublishSidebarEnabled
  7462. }) => {
  7463. const {
  7464. disablePublishSidebar,
  7465. enablePublishSidebar
  7466. } = dispatch('core/editor');
  7467. return {
  7468. onTogglePublishSidebar: () => {
  7469. if (isPublishSidebarEnabled) {
  7470. disablePublishSidebar();
  7471. } else {
  7472. enablePublishSidebar();
  7473. }
  7474. }
  7475. };
  7476. }), external_wp_components_["withFocusReturn"], external_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel));
  7477. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  7478. var build_module_icon = __webpack_require__("iClF");
  7479. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js
  7480. /**
  7481. * WordPress dependencies
  7482. */
  7483. const cloud = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  7484. xmlns: "http://www.w3.org/2000/svg",
  7485. viewBox: "0 0 24 24"
  7486. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  7487. d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
  7488. }));
  7489. /* harmony default export */ var library_cloud = (cloud);
  7490. // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  7491. var library_check = __webpack_require__("RMJe");
  7492. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js
  7493. /**
  7494. * WordPress dependencies
  7495. */
  7496. const cloudUpload = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  7497. xmlns: "http://www.w3.org/2000/svg",
  7498. viewBox: "0 0 24 24"
  7499. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  7500. d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
  7501. }));
  7502. /* harmony default export */ var cloud_upload = (cloudUpload);
  7503. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js
  7504. /**
  7505. * WordPress dependencies
  7506. */
  7507. function PostSwitchToDraftButton({
  7508. isSaving,
  7509. isPublished,
  7510. isScheduled,
  7511. onClick
  7512. }) {
  7513. const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('small', '<');
  7514. if (!isPublished && !isScheduled) {
  7515. return null;
  7516. }
  7517. const onSwitch = () => {
  7518. let alertMessage;
  7519. if (isPublished) {
  7520. alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unpublish this post?');
  7521. } else if (isScheduled) {
  7522. alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unschedule this post?');
  7523. } // eslint-disable-next-line no-alert
  7524. if (window.confirm(alertMessage)) {
  7525. onClick();
  7526. }
  7527. };
  7528. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7529. className: "editor-post-switch-to-draft",
  7530. onClick: onSwitch,
  7531. disabled: isSaving,
  7532. isTertiary: true
  7533. }, isMobileViewport ? Object(external_wp_i18n_["__"])('Draft') : Object(external_wp_i18n_["__"])('Switch to draft'));
  7534. }
  7535. /* harmony default export */ var post_switch_to_draft_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  7536. const {
  7537. isSavingPost,
  7538. isCurrentPostPublished,
  7539. isCurrentPostScheduled
  7540. } = select('core/editor');
  7541. return {
  7542. isSaving: isSavingPost(),
  7543. isPublished: isCurrentPostPublished(),
  7544. isScheduled: isCurrentPostScheduled()
  7545. };
  7546. }), Object(external_wp_data_["withDispatch"])(dispatch => {
  7547. const {
  7548. editPost,
  7549. savePost
  7550. } = dispatch('core/editor');
  7551. return {
  7552. onClick: () => {
  7553. editPost({
  7554. status: 'draft'
  7555. });
  7556. savePost();
  7557. }
  7558. };
  7559. })])(PostSwitchToDraftButton));
  7560. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
  7561. /**
  7562. * External dependencies
  7563. */
  7564. /**
  7565. * WordPress dependencies
  7566. */
  7567. /**
  7568. * Internal dependencies
  7569. */
  7570. /**
  7571. * Component showing whether the post is saved or not and providing save
  7572. * buttons.
  7573. *
  7574. * @param {Object} props Component props.
  7575. * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
  7576. * as dirty.
  7577. * @param {?boolean} props.forceIsSaving Whether to force the post to be marked
  7578. * as being saved.
  7579. * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
  7580. * @return {import('@wordpress/element').WPComponent} The component.
  7581. */
  7582. function PostSavedState({
  7583. forceIsDirty,
  7584. forceIsSaving,
  7585. showIconLabels = false
  7586. }) {
  7587. const [forceSavedMessage, setForceSavedMessage] = Object(external_wp_element_["useState"])(false);
  7588. const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('small');
  7589. const {
  7590. isAutosaving,
  7591. isDirty,
  7592. isNew,
  7593. isPending,
  7594. isPublished,
  7595. isSaveable,
  7596. isSaving,
  7597. isScheduled,
  7598. hasPublishAction
  7599. } = Object(external_wp_data_["useSelect"])(select => {
  7600. var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2;
  7601. const {
  7602. isEditedPostNew,
  7603. isCurrentPostPublished,
  7604. isCurrentPostScheduled,
  7605. isEditedPostDirty,
  7606. isSavingPost,
  7607. isEditedPostSaveable,
  7608. getCurrentPost,
  7609. isAutosavingPost,
  7610. getEditedPostAttribute
  7611. } = select('core/editor');
  7612. return {
  7613. isAutosaving: isAutosavingPost(),
  7614. isDirty: forceIsDirty || isEditedPostDirty(),
  7615. isNew: isEditedPostNew(),
  7616. isPending: 'pending' === getEditedPostAttribute('status'),
  7617. isPublished: isCurrentPostPublished(),
  7618. isSaving: forceIsSaving || isSavingPost(),
  7619. isSaveable: isEditedPostSaveable(),
  7620. isScheduled: isCurrentPostScheduled(),
  7621. hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
  7622. };
  7623. }, [forceIsDirty, forceIsSaving]);
  7624. const {
  7625. savePost
  7626. } = Object(external_wp_data_["useDispatch"])('core/editor');
  7627. const wasSaving = Object(external_wp_compose_["usePrevious"])(isSaving);
  7628. Object(external_wp_element_["useEffect"])(() => {
  7629. let timeoutId;
  7630. if (wasSaving && !isSaving) {
  7631. setForceSavedMessage(true);
  7632. timeoutId = setTimeout(() => {
  7633. setForceSavedMessage(false);
  7634. }, 1000);
  7635. }
  7636. return () => clearTimeout(timeoutId);
  7637. }, [isSaving]);
  7638. if (isSaving) {
  7639. // TODO: Classes generation should be common across all return
  7640. // paths of this function, including proper naming convention for
  7641. // the "Save Draft" button.
  7642. const classes = classnames_default()('editor-post-saved-state', 'is-saving', Object(external_wp_components_["__unstableGetAnimateClassName"])({
  7643. type: 'loading'
  7644. }), {
  7645. 'is-autosaving': isAutosaving
  7646. });
  7647. return Object(external_wp_element_["createElement"])("span", {
  7648. className: classes
  7649. }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
  7650. icon: library_cloud
  7651. }), isAutosaving ? Object(external_wp_i18n_["__"])('Autosaving') : Object(external_wp_i18n_["__"])('Saving'));
  7652. }
  7653. if (isPublished || isScheduled) {
  7654. return Object(external_wp_element_["createElement"])(post_switch_to_draft_button, null);
  7655. }
  7656. if (!isSaveable) {
  7657. return null;
  7658. }
  7659. if (forceSavedMessage || !isNew && !isDirty) {
  7660. return Object(external_wp_element_["createElement"])("span", {
  7661. className: "editor-post-saved-state is-saved"
  7662. }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
  7663. icon: library_check["a" /* default */]
  7664. }), Object(external_wp_i18n_["__"])('Saved'));
  7665. } // Once the post has been submitted for review this button
  7666. // is not needed for the contributor role.
  7667. if (!hasPublishAction && isPending) {
  7668. return null;
  7669. }
  7670. /* translators: button label text should, if possible, be under 16 characters. */
  7671. const label = isPending ? Object(external_wp_i18n_["__"])('Save as pending') : Object(external_wp_i18n_["__"])('Save draft');
  7672. /* translators: button label text should, if possible, be under 16 characters. */
  7673. const shortLabel = Object(external_wp_i18n_["__"])('Save');
  7674. if (!isLargeViewport) {
  7675. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7676. className: "editor-post-save-draft",
  7677. label: label,
  7678. onClick: () => savePost(),
  7679. shortcut: external_wp_keycodes_["displayShortcut"].primary('s'),
  7680. icon: cloud_upload
  7681. }, showIconLabels && shortLabel);
  7682. }
  7683. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  7684. className: "editor-post-save-draft",
  7685. onClick: () => savePost(),
  7686. shortcut: external_wp_keycodes_["displayShortcut"].primary('s'),
  7687. isTertiary: true
  7688. }, label);
  7689. }
  7690. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js
  7691. /**
  7692. * External dependencies
  7693. */
  7694. /**
  7695. * WordPress dependencies
  7696. */
  7697. function PostScheduleCheck({
  7698. hasPublishAction,
  7699. children
  7700. }) {
  7701. if (!hasPublishAction) {
  7702. return null;
  7703. }
  7704. return children;
  7705. }
  7706. /* harmony default export */ var post_schedule_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  7707. const {
  7708. getCurrentPost,
  7709. getCurrentPostType
  7710. } = select('core/editor');
  7711. return {
  7712. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  7713. postType: getCurrentPostType()
  7714. };
  7715. })])(PostScheduleCheck));
  7716. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js
  7717. /**
  7718. * Internal dependencies
  7719. */
  7720. function PostSlugCheck({
  7721. children
  7722. }) {
  7723. return Object(external_wp_element_["createElement"])(post_type_support_check, {
  7724. supportKeys: "slug"
  7725. }, children);
  7726. }
  7727. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js
  7728. /**
  7729. * WordPress dependencies
  7730. */
  7731. /**
  7732. * Internal dependencies
  7733. */
  7734. class post_slug_PostSlug extends external_wp_element_["Component"] {
  7735. constructor({
  7736. postSlug,
  7737. postTitle,
  7738. postID
  7739. }) {
  7740. super(...arguments);
  7741. this.state = {
  7742. editedSlug: Object(external_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID
  7743. };
  7744. this.setSlug = this.setSlug.bind(this);
  7745. }
  7746. setSlug(event) {
  7747. const {
  7748. postSlug,
  7749. onUpdateSlug
  7750. } = this.props;
  7751. const {
  7752. value
  7753. } = event.target;
  7754. const editedSlug = cleanForSlug(value);
  7755. if (editedSlug === postSlug) {
  7756. return;
  7757. }
  7758. onUpdateSlug(editedSlug);
  7759. }
  7760. render() {
  7761. const {
  7762. instanceId
  7763. } = this.props;
  7764. const {
  7765. editedSlug
  7766. } = this.state;
  7767. const inputId = 'editor-post-slug-' + instanceId;
  7768. return Object(external_wp_element_["createElement"])(PostSlugCheck, null, Object(external_wp_element_["createElement"])("label", {
  7769. htmlFor: inputId
  7770. }, Object(external_wp_i18n_["__"])('Slug')), Object(external_wp_element_["createElement"])("input", {
  7771. type: "text",
  7772. id: inputId,
  7773. value: editedSlug,
  7774. onChange: event => this.setState({
  7775. editedSlug: event.target.value
  7776. }),
  7777. onBlur: this.setSlug,
  7778. className: "editor-post-slug__input"
  7779. }));
  7780. }
  7781. }
  7782. /* harmony default export */ var post_slug = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  7783. const {
  7784. getCurrentPost,
  7785. getEditedPostAttribute
  7786. } = select('core/editor');
  7787. const {
  7788. id
  7789. } = getCurrentPost();
  7790. return {
  7791. postSlug: getEditedPostAttribute('slug'),
  7792. postTitle: getEditedPostAttribute('title'),
  7793. postID: id
  7794. };
  7795. }), Object(external_wp_data_["withDispatch"])(dispatch => {
  7796. const {
  7797. editPost
  7798. } = dispatch('core/editor');
  7799. return {
  7800. onUpdateSlug(slug) {
  7801. editPost({
  7802. slug
  7803. });
  7804. }
  7805. };
  7806. }), external_wp_compose_["withInstanceId"]])(post_slug_PostSlug));
  7807. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js
  7808. /**
  7809. * External dependencies
  7810. */
  7811. /**
  7812. * WordPress dependencies
  7813. */
  7814. function PostStickyCheck({
  7815. hasStickyAction,
  7816. postType,
  7817. children
  7818. }) {
  7819. if (postType !== 'post' || !hasStickyAction) {
  7820. return null;
  7821. }
  7822. return children;
  7823. }
  7824. /* harmony default export */ var post_sticky_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  7825. const post = select('core/editor').getCurrentPost();
  7826. return {
  7827. hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false),
  7828. postType: select('core/editor').getCurrentPostType()
  7829. };
  7830. })])(PostStickyCheck));
  7831. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js
  7832. /**
  7833. * WordPress dependencies
  7834. */
  7835. /**
  7836. * Internal dependencies
  7837. */
  7838. function PostSticky({
  7839. onUpdateSticky,
  7840. postSticky = false
  7841. }) {
  7842. return Object(external_wp_element_["createElement"])(post_sticky_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  7843. label: Object(external_wp_i18n_["__"])('Stick to the top of the blog'),
  7844. checked: postSticky,
  7845. onChange: () => onUpdateSticky(!postSticky)
  7846. }));
  7847. }
  7848. /* harmony default export */ var post_sticky = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  7849. return {
  7850. postSticky: select('core/editor').getEditedPostAttribute('sticky')
  7851. };
  7852. }), Object(external_wp_data_["withDispatch"])(dispatch => {
  7853. return {
  7854. onUpdateSticky(postSticky) {
  7855. dispatch('core/editor').editPost({
  7856. sticky: postSticky
  7857. });
  7858. }
  7859. };
  7860. })])(PostSticky));
  7861. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
  7862. /**
  7863. * External dependencies
  7864. */
  7865. /**
  7866. * WordPress dependencies
  7867. */
  7868. /**
  7869. * Internal dependencies
  7870. */
  7871. /**
  7872. * Module Constants
  7873. */
  7874. const hierarchical_term_selector_DEFAULT_QUERY = {
  7875. per_page: -1,
  7876. orderby: 'name',
  7877. order: 'asc',
  7878. _fields: 'id,name,parent'
  7879. };
  7880. const MIN_TERMS_COUNT_FOR_FILTER = 8;
  7881. class hierarchical_term_selector_HierarchicalTermSelector extends external_wp_element_["Component"] {
  7882. constructor() {
  7883. super(...arguments);
  7884. this.findTerm = this.findTerm.bind(this);
  7885. this.onChange = this.onChange.bind(this);
  7886. this.onChangeFormName = this.onChangeFormName.bind(this);
  7887. this.onChangeFormParent = this.onChangeFormParent.bind(this);
  7888. this.onAddTerm = this.onAddTerm.bind(this);
  7889. this.onToggleForm = this.onToggleForm.bind(this);
  7890. this.setFilterValue = this.setFilterValue.bind(this);
  7891. this.sortBySelected = this.sortBySelected.bind(this);
  7892. this.state = {
  7893. loading: true,
  7894. availableTermsTree: [],
  7895. availableTerms: [],
  7896. adding: false,
  7897. formName: '',
  7898. formParent: '',
  7899. showForm: false,
  7900. filterValue: '',
  7901. filteredTermsTree: []
  7902. };
  7903. }
  7904. onChange(termId) {
  7905. const {
  7906. onUpdateTerms,
  7907. terms = [],
  7908. taxonomy
  7909. } = this.props;
  7910. const hasTerm = terms.indexOf(termId) !== -1;
  7911. const newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [...terms, termId];
  7912. onUpdateTerms(newTerms, taxonomy.rest_base);
  7913. }
  7914. onChangeFormName(event) {
  7915. const newValue = event.target.value.trim() === '' ? '' : event.target.value;
  7916. this.setState({
  7917. formName: newValue
  7918. });
  7919. }
  7920. onChangeFormParent(newParent) {
  7921. this.setState({
  7922. formParent: newParent
  7923. });
  7924. }
  7925. onToggleForm() {
  7926. this.setState(state => ({
  7927. showForm: !state.showForm
  7928. }));
  7929. }
  7930. findTerm(terms, parent, name) {
  7931. return Object(external_lodash_["find"])(terms, term => {
  7932. return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
  7933. });
  7934. }
  7935. onAddTerm(event) {
  7936. event.preventDefault();
  7937. const {
  7938. onUpdateTerms,
  7939. taxonomy,
  7940. terms,
  7941. slug
  7942. } = this.props;
  7943. const {
  7944. formName,
  7945. formParent,
  7946. adding,
  7947. availableTerms
  7948. } = this.state;
  7949. if (formName === '' || adding) {
  7950. return;
  7951. } // check if the term we are adding already exists
  7952. const existingTerm = this.findTerm(availableTerms, formParent, formName);
  7953. if (existingTerm) {
  7954. // if the term we are adding exists but is not selected select it
  7955. if (!Object(external_lodash_["some"])(terms, term => term === existingTerm.id)) {
  7956. onUpdateTerms([...terms, existingTerm.id], taxonomy.rest_base);
  7957. }
  7958. this.setState({
  7959. formName: '',
  7960. formParent: ''
  7961. });
  7962. return;
  7963. }
  7964. this.setState({
  7965. adding: true
  7966. });
  7967. this.addRequest = external_wp_apiFetch_default()({
  7968. path: `/wp/v2/${taxonomy.rest_base}`,
  7969. method: 'POST',
  7970. data: {
  7971. name: formName,
  7972. parent: formParent ? formParent : undefined
  7973. }
  7974. }); // Tries to create a term or fetch it if it already exists
  7975. const findOrCreatePromise = this.addRequest.catch(error => {
  7976. const errorCode = error.code;
  7977. if (errorCode === 'term_exists') {
  7978. // search the new category created since last fetch
  7979. this.addRequest = external_wp_apiFetch_default()({
  7980. path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...hierarchical_term_selector_DEFAULT_QUERY,
  7981. parent: formParent || 0,
  7982. search: formName
  7983. })
  7984. });
  7985. return this.addRequest.then(searchResult => {
  7986. return this.findTerm(searchResult, formParent, formName);
  7987. });
  7988. }
  7989. return Promise.reject(error);
  7990. });
  7991. findOrCreatePromise.then(term => {
  7992. const hasTerm = !!Object(external_lodash_["find"])(this.state.availableTerms, availableTerm => availableTerm.id === term.id);
  7993. const newAvailableTerms = hasTerm ? this.state.availableTerms : [term, ...this.state.availableTerms];
  7994. const termAddedMessage = Object(external_wp_i18n_["sprintf"])(
  7995. /* translators: %s: taxonomy name */
  7996. Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_wp_i18n_["__"])('Category') : Object(external_wp_i18n_["__"])('Term')));
  7997. this.props.speak(termAddedMessage, 'assertive');
  7998. this.addRequest = null;
  7999. this.setState({
  8000. adding: false,
  8001. formName: '',
  8002. formParent: '',
  8003. availableTerms: newAvailableTerms,
  8004. availableTermsTree: this.sortBySelected(buildTermsTree(newAvailableTerms))
  8005. });
  8006. onUpdateTerms([...terms, term.id], taxonomy.rest_base);
  8007. }, xhr => {
  8008. if (xhr.statusText === 'abort') {
  8009. return;
  8010. }
  8011. this.addRequest = null;
  8012. this.setState({
  8013. adding: false
  8014. });
  8015. });
  8016. }
  8017. componentDidMount() {
  8018. this.fetchTerms();
  8019. }
  8020. componentWillUnmount() {
  8021. Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']);
  8022. Object(external_lodash_["invoke"])(this.addRequest, ['abort']);
  8023. }
  8024. componentDidUpdate(prevProps) {
  8025. if (this.props.taxonomy !== prevProps.taxonomy) {
  8026. this.fetchTerms();
  8027. }
  8028. }
  8029. fetchTerms() {
  8030. const {
  8031. taxonomy
  8032. } = this.props;
  8033. if (!taxonomy) {
  8034. return;
  8035. }
  8036. this.fetchRequest = external_wp_apiFetch_default()({
  8037. path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, hierarchical_term_selector_DEFAULT_QUERY)
  8038. });
  8039. this.fetchRequest.then(terms => {
  8040. // resolve
  8041. const availableTermsTree = this.sortBySelected(buildTermsTree(terms));
  8042. this.fetchRequest = null;
  8043. this.setState({
  8044. loading: false,
  8045. availableTermsTree,
  8046. availableTerms: terms
  8047. });
  8048. }, xhr => {
  8049. // reject
  8050. if (xhr.statusText === 'abort') {
  8051. return;
  8052. }
  8053. this.fetchRequest = null;
  8054. this.setState({
  8055. loading: false
  8056. });
  8057. });
  8058. }
  8059. sortBySelected(termsTree) {
  8060. const {
  8061. terms
  8062. } = this.props;
  8063. const treeHasSelection = termTree => {
  8064. if (terms.indexOf(termTree.id) !== -1) {
  8065. return true;
  8066. }
  8067. if (undefined === termTree.children) {
  8068. return false;
  8069. }
  8070. const anyChildIsSelected = termTree.children.map(treeHasSelection).filter(child => child).length > 0;
  8071. if (anyChildIsSelected) {
  8072. return true;
  8073. }
  8074. return false;
  8075. };
  8076. const termOrChildIsSelected = (termA, termB) => {
  8077. const termASelected = treeHasSelection(termA);
  8078. const termBSelected = treeHasSelection(termB);
  8079. if (termASelected === termBSelected) {
  8080. return 0;
  8081. }
  8082. if (termASelected && !termBSelected) {
  8083. return -1;
  8084. }
  8085. if (!termASelected && termBSelected) {
  8086. return 1;
  8087. }
  8088. return 0;
  8089. };
  8090. termsTree.sort(termOrChildIsSelected);
  8091. return termsTree;
  8092. }
  8093. setFilterValue(event) {
  8094. const {
  8095. availableTermsTree
  8096. } = this.state;
  8097. const filterValue = event.target.value;
  8098. const filteredTermsTree = availableTermsTree.map(this.getFilterMatcher(filterValue)).filter(term => term);
  8099. const getResultCount = terms => {
  8100. let count = 0;
  8101. for (let i = 0; i < terms.length; i++) {
  8102. count++;
  8103. if (undefined !== terms[i].children) {
  8104. count += getResultCount(terms[i].children);
  8105. }
  8106. }
  8107. return count;
  8108. };
  8109. this.setState({
  8110. filterValue,
  8111. filteredTermsTree
  8112. });
  8113. const resultCount = getResultCount(filteredTermsTree);
  8114. const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])(
  8115. /* translators: %d: number of results */
  8116. Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount);
  8117. this.props.debouncedSpeak(resultsFoundMessage, 'assertive');
  8118. }
  8119. getFilterMatcher(filterValue) {
  8120. const matchTermsForFilter = originalTerm => {
  8121. if ('' === filterValue) {
  8122. return originalTerm;
  8123. } // Shallow clone, because we'll be filtering the term's children and
  8124. // don't want to modify the original term.
  8125. const term = { ...originalTerm
  8126. }; // Map and filter the children, recursive so we deal with grandchildren
  8127. // and any deeper levels.
  8128. if (term.children.length > 0) {
  8129. term.children = term.children.map(matchTermsForFilter).filter(child => child);
  8130. } // If the term's name contains the filterValue, or it has children
  8131. // (i.e. some child matched at some point in the tree) then return it.
  8132. if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
  8133. return term;
  8134. } // Otherwise, return false. After mapping, the list of terms will need
  8135. // to have false values filtered out.
  8136. return false;
  8137. };
  8138. return matchTermsForFilter;
  8139. }
  8140. renderTerms(renderedTerms) {
  8141. const {
  8142. terms = []
  8143. } = this.props;
  8144. return renderedTerms.map(term => {
  8145. return Object(external_wp_element_["createElement"])("div", {
  8146. key: term.id,
  8147. className: "editor-post-taxonomies__hierarchical-terms-choice"
  8148. }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
  8149. checked: terms.indexOf(term.id) !== -1,
  8150. onChange: () => {
  8151. const termId = parseInt(term.id, 10);
  8152. this.onChange(termId);
  8153. },
  8154. label: Object(external_lodash_["unescape"])(term.name)
  8155. }), !!term.children.length && Object(external_wp_element_["createElement"])("div", {
  8156. className: "editor-post-taxonomies__hierarchical-terms-subchoices"
  8157. }, this.renderTerms(term.children)));
  8158. });
  8159. }
  8160. render() {
  8161. const {
  8162. slug,
  8163. taxonomy,
  8164. instanceId,
  8165. hasCreateAction,
  8166. hasAssignAction
  8167. } = this.props;
  8168. if (!hasAssignAction) {
  8169. return null;
  8170. }
  8171. const {
  8172. availableTermsTree,
  8173. availableTerms,
  8174. filteredTermsTree,
  8175. formName,
  8176. formParent,
  8177. loading,
  8178. showForm,
  8179. filterValue
  8180. } = this.state;
  8181. const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory);
  8182. const newTermButtonLabel = labelWithFallback('add_new_item', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term'));
  8183. const newTermLabel = labelWithFallback('new_item_name', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term'));
  8184. const parentSelectLabel = labelWithFallback('parent_item', Object(external_wp_i18n_["__"])('Parent Category'), Object(external_wp_i18n_["__"])('Parent Term'));
  8185. const noParentOption = `— ${parentSelectLabel} —`;
  8186. const newTermSubmitLabel = newTermButtonLabel;
  8187. const inputId = `editor-post-taxonomies__hierarchical-terms-input-${instanceId}`;
  8188. const filterInputId = `editor-post-taxonomies__hierarchical-terms-filter-${instanceId}`;
  8189. const filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_wp_i18n_["__"])('Search Terms'));
  8190. const groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_wp_i18n_["__"])('Terms'));
  8191. const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
  8192. return [showFilter && Object(external_wp_element_["createElement"])("label", {
  8193. key: "filter-label",
  8194. htmlFor: filterInputId
  8195. }, filterLabel), showFilter && Object(external_wp_element_["createElement"])("input", {
  8196. type: "search",
  8197. id: filterInputId,
  8198. value: filterValue,
  8199. onChange: this.setFilterValue,
  8200. className: "editor-post-taxonomies__hierarchical-terms-filter",
  8201. key: "term-filter-input"
  8202. }), Object(external_wp_element_["createElement"])("div", {
  8203. className: "editor-post-taxonomies__hierarchical-terms-list",
  8204. key: "term-list",
  8205. tabIndex: "0",
  8206. role: "group",
  8207. "aria-label": groupLabel
  8208. }, this.renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  8209. key: "term-add-button",
  8210. onClick: this.onToggleForm,
  8211. className: "editor-post-taxonomies__hierarchical-terms-add",
  8212. "aria-expanded": showForm,
  8213. isLink: true
  8214. }, newTermButtonLabel), showForm && Object(external_wp_element_["createElement"])("form", {
  8215. onSubmit: this.onAddTerm,
  8216. key: "hierarchical-terms-form"
  8217. }, Object(external_wp_element_["createElement"])("label", {
  8218. htmlFor: inputId,
  8219. className: "editor-post-taxonomies__hierarchical-terms-label"
  8220. }, newTermLabel), Object(external_wp_element_["createElement"])("input", {
  8221. type: "text",
  8222. id: inputId,
  8223. className: "editor-post-taxonomies__hierarchical-terms-input",
  8224. value: formName,
  8225. onChange: this.onChangeFormName,
  8226. required: true
  8227. }), !!availableTerms.length && Object(external_wp_element_["createElement"])(external_wp_components_["TreeSelect"], {
  8228. label: parentSelectLabel,
  8229. noOptionLabel: noParentOption,
  8230. onChange: this.onChangeFormParent,
  8231. selectedId: formParent,
  8232. tree: availableTermsTree
  8233. }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  8234. isSecondary: true,
  8235. type: "submit",
  8236. className: "editor-post-taxonomies__hierarchical-terms-submit"
  8237. }, newTermSubmitLabel))];
  8238. }
  8239. }
  8240. /* harmony default export */ var hierarchical_term_selector = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
  8241. slug
  8242. }) => {
  8243. const {
  8244. getCurrentPost
  8245. } = select('core/editor');
  8246. const {
  8247. getTaxonomy
  8248. } = select('core');
  8249. const taxonomy = getTaxonomy(slug);
  8250. return {
  8251. hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false,
  8252. hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false,
  8253. terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [],
  8254. taxonomy
  8255. };
  8256. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  8257. onUpdateTerms(terms, restBase) {
  8258. dispatch('core/editor').editPost({
  8259. [restBase]: terms
  8260. });
  8261. }
  8262. })), external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType')])(hierarchical_term_selector_HierarchicalTermSelector));
  8263. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
  8264. /**
  8265. * External dependencies
  8266. */
  8267. /**
  8268. * WordPress dependencies
  8269. */
  8270. /**
  8271. * Internal dependencies
  8272. */
  8273. function PostTaxonomies({
  8274. postType,
  8275. taxonomies,
  8276. taxonomyWrapper = external_lodash_["identity"]
  8277. }) {
  8278. const availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType));
  8279. const visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui);
  8280. return visibleTaxonomies.map(taxonomy => {
  8281. const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
  8282. return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], {
  8283. key: `taxonomy-${taxonomy.slug}`
  8284. }, taxonomyWrapper(Object(external_wp_element_["createElement"])(TaxonomyComponent, {
  8285. slug: taxonomy.slug
  8286. }), taxonomy));
  8287. });
  8288. }
  8289. /* harmony default export */ var post_taxonomies = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  8290. return {
  8291. postType: select('core/editor').getCurrentPostType(),
  8292. taxonomies: select('core').getTaxonomies({
  8293. per_page: -1
  8294. })
  8295. };
  8296. })])(PostTaxonomies));
  8297. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js
  8298. /**
  8299. * External dependencies
  8300. */
  8301. /**
  8302. * WordPress dependencies
  8303. */
  8304. function PostTaxonomiesCheck({
  8305. postType,
  8306. taxonomies,
  8307. children
  8308. }) {
  8309. const hasTaxonomies = Object(external_lodash_["some"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType));
  8310. if (!hasTaxonomies) {
  8311. return null;
  8312. }
  8313. return children;
  8314. }
  8315. /* harmony default export */ var post_taxonomies_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  8316. return {
  8317. postType: select('core/editor').getCurrentPostType(),
  8318. taxonomies: select('core').getTaxonomies({
  8319. per_page: -1
  8320. })
  8321. };
  8322. })])(PostTaxonomiesCheck));
  8323. // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
  8324. var lib = __webpack_require__("O6Fj");
  8325. var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
  8326. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js
  8327. /**
  8328. * External dependencies
  8329. */
  8330. /**
  8331. * WordPress dependencies
  8332. */
  8333. function PostTextEditor() {
  8334. const postContent = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostContent(), []);
  8335. const {
  8336. editPost,
  8337. resetEditorBlocks
  8338. } = Object(external_wp_data_["useDispatch"])('core/editor');
  8339. const [value, setValue] = Object(external_wp_element_["useState"])(postContent);
  8340. const [isDirty, setIsDirty] = Object(external_wp_element_["useState"])(false);
  8341. const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTextEditor);
  8342. if (!isDirty && value !== postContent) {
  8343. setValue(postContent);
  8344. }
  8345. /**
  8346. * Handles a textarea change event to notify the onChange prop callback and
  8347. * reflect the new value in the component's own state. This marks the start
  8348. * of the user's edits, if not already changed, preventing future props
  8349. * changes to value from replacing the rendered value. This is expected to
  8350. * be followed by a reset to dirty state via `stopEditing`.
  8351. *
  8352. * @see stopEditing
  8353. *
  8354. * @param {Event} event Change event.
  8355. */
  8356. const onChange = event => {
  8357. const newValue = event.target.value;
  8358. editPost({
  8359. content: newValue
  8360. });
  8361. setValue(newValue);
  8362. setIsDirty(true);
  8363. };
  8364. /**
  8365. * Function called when the user has completed their edits, responsible for
  8366. * ensuring that changes, if made, are surfaced to the onPersist prop
  8367. * callback and resetting dirty state.
  8368. */
  8369. const stopEditing = () => {
  8370. if (isDirty) {
  8371. const blocks = Object(external_wp_blocks_["parse"])(value);
  8372. resetEditorBlocks(blocks);
  8373. setIsDirty(false);
  8374. }
  8375. };
  8376. return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
  8377. as: "label",
  8378. htmlFor: `post-content-${instanceId}`
  8379. }, Object(external_wp_i18n_["__"])('Type text or HTML')), Object(external_wp_element_["createElement"])(lib_default.a, {
  8380. autoComplete: "off",
  8381. dir: "auto",
  8382. value: value,
  8383. onChange: onChange,
  8384. onBlur: stopEditing,
  8385. className: "editor-post-text-editor",
  8386. id: `post-content-${instanceId}`,
  8387. placeholder: Object(external_wp_i18n_["__"])('Start writing with text or HTML')
  8388. }));
  8389. }
  8390. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js
  8391. /**
  8392. * External dependencies
  8393. */
  8394. /**
  8395. * WordPress dependencies
  8396. */
  8397. /**
  8398. * Internal dependencies
  8399. */
  8400. /**
  8401. * Constants
  8402. */
  8403. const REGEXP_NEWLINES = /[\r\n]+/g;
  8404. function PostTitle() {
  8405. const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTitle);
  8406. const ref = Object(external_wp_element_["useRef"])();
  8407. const [isSelected, setIsSelected] = Object(external_wp_element_["useState"])(false);
  8408. const {
  8409. editPost
  8410. } = Object(external_wp_data_["useDispatch"])('core/editor');
  8411. const {
  8412. insertDefaultBlock,
  8413. clearSelectedBlock,
  8414. insertBlocks
  8415. } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
  8416. const {
  8417. isCleanNewPost,
  8418. title,
  8419. placeholder,
  8420. isFocusMode,
  8421. hasFixedToolbar
  8422. } = Object(external_wp_data_["useSelect"])(select => {
  8423. const {
  8424. getEditedPostAttribute,
  8425. isCleanNewPost: _isCleanNewPost
  8426. } = select('core/editor');
  8427. const {
  8428. getSettings
  8429. } = select(external_wp_blockEditor_["store"]);
  8430. const {
  8431. titlePlaceholder,
  8432. focusMode,
  8433. hasFixedToolbar: _hasFixedToolbar
  8434. } = getSettings();
  8435. return {
  8436. isCleanNewPost: _isCleanNewPost(),
  8437. title: getEditedPostAttribute('title'),
  8438. placeholder: titlePlaceholder,
  8439. isFocusMode: focusMode,
  8440. hasFixedToolbar: _hasFixedToolbar
  8441. };
  8442. });
  8443. Object(external_wp_element_["useEffect"])(() => {
  8444. if (!ref.current) {
  8445. return;
  8446. }
  8447. const {
  8448. ownerDocument
  8449. } = ref.current;
  8450. const {
  8451. activeElement,
  8452. body
  8453. } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should
  8454. // only happen for a new post, which means we focus the title on new
  8455. // post so the author can start typing right away, without needing to
  8456. // click anything.
  8457. if (isCleanNewPost && (!activeElement || body === activeElement)) {
  8458. ref.current.focus();
  8459. }
  8460. }, [isCleanNewPost]);
  8461. function onEnterPress() {
  8462. insertDefaultBlock(undefined, undefined, 0);
  8463. }
  8464. function onInsertBlockAfter(blocks) {
  8465. insertBlocks(blocks, 0);
  8466. }
  8467. function onUpdate(newTitle) {
  8468. editPost({
  8469. title: newTitle
  8470. });
  8471. }
  8472. function onSelect() {
  8473. setIsSelected(true);
  8474. clearSelectedBlock();
  8475. }
  8476. function onUnselect() {
  8477. setIsSelected(false);
  8478. }
  8479. function onChange(event) {
  8480. onUpdate(event.target.value.replace(REGEXP_NEWLINES, ' '));
  8481. }
  8482. function onKeyDown(event) {
  8483. if (event.keyCode === external_wp_keycodes_["ENTER"]) {
  8484. event.preventDefault();
  8485. onEnterPress();
  8486. }
  8487. }
  8488. function onPaste(event) {
  8489. const clipboardData = event.clipboardData;
  8490. let plainText = '';
  8491. let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
  8492. // otherwise throw an invalid argument error, so we try the standard
  8493. // arguments first, then fallback to `Text` if they fail.
  8494. try {
  8495. plainText = clipboardData.getData('text/plain');
  8496. html = clipboardData.getData('text/html');
  8497. } catch (error1) {
  8498. try {
  8499. html = clipboardData.getData('Text');
  8500. } catch (error2) {
  8501. // Some browsers like UC Browser paste plain text by default and
  8502. // don't support clipboardData at all, so allow default
  8503. // behaviour.
  8504. return;
  8505. }
  8506. } // Allows us to ask for this information when we get a report.
  8507. window.console.log('Received HTML:\n\n', html);
  8508. window.console.log('Received plain text:\n\n', plainText);
  8509. const content = Object(external_wp_blocks_["pasteHandler"])({
  8510. HTML: html,
  8511. plainText
  8512. });
  8513. if (typeof content !== 'string' && content.length) {
  8514. event.preventDefault();
  8515. const [firstBlock] = content;
  8516. if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) {
  8517. onUpdate(firstBlock.attributes.content);
  8518. onInsertBlockAfter(content.slice(1));
  8519. } else {
  8520. onInsertBlockAfter(content);
  8521. }
  8522. }
  8523. } // The wp-block className is important for editor styles.
  8524. // This same block is used in both the visual and the code editor.
  8525. const className = classnames_default()('wp-block editor-post-title editor-post-title__block', {
  8526. 'is-selected': isSelected,
  8527. 'is-focus-mode': isFocusMode,
  8528. 'has-fixed-toolbar': hasFixedToolbar
  8529. });
  8530. const decodedPlaceholder = Object(external_wp_htmlEntities_["decodeEntities"])(placeholder);
  8531. return Object(external_wp_element_["createElement"])(post_type_support_check, {
  8532. supportKeys: "title"
  8533. }, Object(external_wp_element_["createElement"])("div", {
  8534. className: className
  8535. }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
  8536. as: "label",
  8537. htmlFor: `post-title-${instanceId}`
  8538. }, decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title')), Object(external_wp_element_["createElement"])(lib_default.a, {
  8539. ref: ref,
  8540. id: `post-title-${instanceId}`,
  8541. className: "editor-post-title__input",
  8542. value: title,
  8543. onChange: onChange,
  8544. placeholder: decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title'),
  8545. onFocus: onSelect,
  8546. onBlur: onUnselect,
  8547. onKeyDown: onKeyDown,
  8548. onKeyPress: onUnselect,
  8549. onPaste: onPaste
  8550. })));
  8551. }
  8552. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js
  8553. /**
  8554. * WordPress dependencies
  8555. */
  8556. function PostTrash({
  8557. isNew,
  8558. postId,
  8559. postType,
  8560. ...props
  8561. }) {
  8562. if (isNew || !postId) {
  8563. return null;
  8564. }
  8565. const onClick = () => props.trashPost(postId, postType);
  8566. return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
  8567. className: "editor-post-trash",
  8568. isDestructive: true,
  8569. isTertiary: true,
  8570. onClick: onClick
  8571. }, Object(external_wp_i18n_["__"])('Move to trash'));
  8572. }
  8573. /* harmony default export */ var post_trash = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  8574. const {
  8575. isEditedPostNew,
  8576. getCurrentPostId,
  8577. getCurrentPostType
  8578. } = select('core/editor');
  8579. return {
  8580. isNew: isEditedPostNew(),
  8581. postId: getCurrentPostId(),
  8582. postType: getCurrentPostType()
  8583. };
  8584. }), Object(external_wp_data_["withDispatch"])(dispatch => ({
  8585. trashPost: dispatch('core/editor').trashPost
  8586. }))])(PostTrash));
  8587. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js
  8588. /**
  8589. * WordPress dependencies
  8590. */
  8591. function PostTrashCheck({
  8592. isNew,
  8593. postId,
  8594. canUserDelete,
  8595. children
  8596. }) {
  8597. if (isNew || !postId || !canUserDelete) {
  8598. return null;
  8599. }
  8600. return children;
  8601. }
  8602. /* harmony default export */ var post_trash_check = (Object(external_wp_data_["withSelect"])(select => {
  8603. const {
  8604. isEditedPostNew,
  8605. getCurrentPostId,
  8606. getCurrentPostType
  8607. } = select('core/editor');
  8608. const {
  8609. getPostType,
  8610. canUser
  8611. } = select('core');
  8612. const postId = getCurrentPostId();
  8613. const postType = getPostType(getCurrentPostType());
  8614. const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase
  8615. return {
  8616. isNew: isEditedPostNew(),
  8617. postId,
  8618. canUserDelete: postId && resource ? canUser('delete', resource, postId) : false
  8619. };
  8620. })(PostTrashCheck));
  8621. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js
  8622. /**
  8623. * External dependencies
  8624. */
  8625. /**
  8626. * WordPress dependencies
  8627. */
  8628. function PostVisibilityCheck({
  8629. hasPublishAction,
  8630. render
  8631. }) {
  8632. const canEdit = hasPublishAction;
  8633. return render({
  8634. canEdit
  8635. });
  8636. }
  8637. /* harmony default export */ var post_visibility_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
  8638. const {
  8639. getCurrentPost,
  8640. getCurrentPostType
  8641. } = select('core/editor');
  8642. return {
  8643. hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
  8644. postType: getCurrentPostType()
  8645. };
  8646. })])(PostVisibilityCheck));
  8647. // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
  8648. /**
  8649. * WordPress dependencies
  8650. */
  8651. const info_info = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
  8652. xmlns: "http://www.w3.org/2000/svg",
  8653. viewBox: "0 0 24 24"
  8654. }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
  8655. d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
  8656. }));
  8657. /* harmony default export */ var library_info = (info_info);
  8658. // EXTERNAL MODULE: external ["wp","wordcount"]
  8659. var external_wp_wordcount_ = __webpack_require__("7fqt");
  8660. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js
  8661. /**
  8662. * WordPress dependencies
  8663. */
  8664. function WordCount() {
  8665. const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content'));
  8666. /*
  8667. * translators: If your word count is based on single characters (e.g. East Asian characters),
  8668. * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
  8669. * Do not translate into your own language.
  8670. */
  8671. const wordCountType = Object(external_wp_i18n_["_x"])('words', 'Word count type. Do not translate!');
  8672. return Object(external_wp_element_["createElement"])("span", {
  8673. className: "word-count"
  8674. }, Object(external_wp_wordcount_["count"])(content, wordCountType));
  8675. }
  8676. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js
  8677. /**
  8678. * WordPress dependencies
  8679. */
  8680. function CharacterCount() {
  8681. const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content'));
  8682. return Object(external_wp_wordcount_["count"])(content, 'characters_including_spaces');
  8683. }
  8684. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js
  8685. /**
  8686. * WordPress dependencies
  8687. */
  8688. /**
  8689. * Internal dependencies
  8690. */
  8691. function TableOfContentsPanel({
  8692. hasOutlineItemsDisabled,
  8693. onRequestClose
  8694. }) {
  8695. const {
  8696. headingCount,
  8697. paragraphCount,
  8698. numberOfBlocks
  8699. } = Object(external_wp_data_["useSelect"])(select => {
  8700. const {
  8701. getGlobalBlockCount
  8702. } = select(external_wp_blockEditor_["store"]);
  8703. return {
  8704. headingCount: getGlobalBlockCount('core/heading'),
  8705. paragraphCount: getGlobalBlockCount('core/paragraph'),
  8706. numberOfBlocks: getGlobalBlockCount()
  8707. };
  8708. }, []);
  8709. return (
  8710. /*
  8711. * Disable reason: The `list` ARIA role is redundant but
  8712. * Safari+VoiceOver won't announce the list otherwise.
  8713. */
  8714. /* eslint-disable jsx-a11y/no-redundant-roles */
  8715. Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
  8716. className: "table-of-contents__wrapper",
  8717. role: "note",
  8718. "aria-label": Object(external_wp_i18n_["__"])('Document Statistics'),
  8719. tabIndex: "0"
  8720. }, Object(external_wp_element_["createElement"])("ul", {
  8721. role: "list",
  8722. className: "table-of-contents__counts"
  8723. }, Object(external_wp_element_["createElement"])("li", {
  8724. className: "table-of-contents__count"
  8725. }, Object(external_wp_i18n_["__"])('Characters'), Object(external_wp_element_["createElement"])("span", {
  8726. className: "table-of-contents__number"
  8727. }, Object(external_wp_element_["createElement"])(CharacterCount, null))), Object(external_wp_element_["createElement"])("li", {
  8728. className: "table-of-contents__count"
  8729. }, Object(external_wp_i18n_["__"])('Words'), Object(external_wp_element_["createElement"])(WordCount, null)), Object(external_wp_element_["createElement"])("li", {
  8730. className: "table-of-contents__count"
  8731. }, Object(external_wp_i18n_["__"])('Headings'), Object(external_wp_element_["createElement"])("span", {
  8732. className: "table-of-contents__number"
  8733. }, headingCount)), Object(external_wp_element_["createElement"])("li", {
  8734. className: "table-of-contents__count"
  8735. }, Object(external_wp_i18n_["__"])('Paragraphs'), Object(external_wp_element_["createElement"])("span", {
  8736. className: "table-of-contents__number"
  8737. }, paragraphCount)), Object(external_wp_element_["createElement"])("li", {
  8738. className: "table-of-contents__count"
  8739. }, Object(external_wp_i18n_["__"])('Blocks'), Object(external_wp_element_["createElement"])("span", {
  8740. className: "table-of-contents__number"
  8741. }, numberOfBlocks)))), headingCount > 0 && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("hr", null), Object(external_wp_element_["createElement"])("h2", {
  8742. className: "table-of-contents__title"
  8743. }, Object(external_wp_i18n_["__"])('Document Outline')), Object(external_wp_element_["createElement"])(document_outline, {
  8744. onSelect: onRequestClose,
  8745. hasOutlineItemsDisabled: hasOutlineItemsDisabled
  8746. })))
  8747. /* eslint-enable jsx-a11y/no-redundant-roles */
  8748. );
  8749. }
  8750. /* harmony default export */ var panel = (TableOfContentsPanel);
  8751. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js
  8752. /**
  8753. * WordPress dependencies
  8754. */
  8755. /**
  8756. * Internal dependencies
  8757. */
  8758. function TableOfContents({
  8759. hasOutlineItemsDisabled,
  8760. repositionDropdown,
  8761. ...props
  8762. }, ref) {
  8763. const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(external_wp_blockEditor_["store"]).getBlockCount(), []);
  8764. return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], {
  8765. position: repositionDropdown ? 'middle right right' : 'bottom',
  8766. className: "table-of-contents",
  8767. contentClassName: "table-of-contents__popover",
  8768. renderToggle: ({
  8769. isOpen,
  8770. onToggle
  8771. }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, {
  8772. ref: ref,
  8773. onClick: hasBlocks ? onToggle : undefined,
  8774. icon: library_info,
  8775. "aria-expanded": isOpen,
  8776. "aria-haspopup": "true"
  8777. /* translators: button label text should, if possible, be under 16 characters. */
  8778. ,
  8779. label: Object(external_wp_i18n_["__"])('Details'),
  8780. tooltipPosition: "bottom",
  8781. "aria-disabled": !hasBlocks
  8782. })),
  8783. renderContent: ({
  8784. onClose
  8785. }) => Object(external_wp_element_["createElement"])(panel, {
  8786. onRequestClose: onClose,
  8787. hasOutlineItemsDisabled: hasOutlineItemsDisabled
  8788. })
  8789. });
  8790. }
  8791. /* harmony default export */ var table_of_contents = (Object(external_wp_element_["forwardRef"])(TableOfContents));
  8792. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js
  8793. /**
  8794. * WordPress dependencies
  8795. */
  8796. /**
  8797. * Warns the user if there are unsaved changes before leaving the editor.
  8798. * Compatible with Post Editor and Site Editor.
  8799. *
  8800. * @return {WPComponent} The component.
  8801. */
  8802. function UnsavedChangesWarning() {
  8803. const isDirty = Object(external_wp_data_["useSelect"])(select => {
  8804. return () => {
  8805. const {
  8806. __experimentalGetDirtyEntityRecords
  8807. } = select('core');
  8808. const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
  8809. return dirtyEntityRecords.length > 0;
  8810. };
  8811. }, []);
  8812. /**
  8813. * Warns the user if there are unsaved changes before leaving the editor.
  8814. *
  8815. * @param {Event} event `beforeunload` event.
  8816. *
  8817. * @return {?string} Warning prompt message, if unsaved changes exist.
  8818. */
  8819. const warnIfUnsavedChanges = event => {
  8820. // We need to call the selector directly in the listener to avoid race
  8821. // conditions with `BrowserURL` where `componentDidUpdate` gets the
  8822. // new value of `isEditedPostDirty` before this component does,
  8823. // causing this component to incorrectly think a trashed post is still dirty.
  8824. if (isDirty()) {
  8825. event.returnValue = Object(external_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.');
  8826. return event.returnValue;
  8827. }
  8828. };
  8829. Object(external_wp_element_["useEffect"])(() => {
  8830. window.addEventListener('beforeunload', warnIfUnsavedChanges);
  8831. return () => {
  8832. window.removeEventListener('beforeunload', warnIfUnsavedChanges);
  8833. };
  8834. }, []);
  8835. return null;
  8836. }
  8837. // EXTERNAL MODULE: external ["wp","reusableBlocks"]
  8838. var external_wp_reusableBlocks_ = __webpack_require__("diJD");
  8839. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js
  8840. /**
  8841. * WordPress dependencies
  8842. */
  8843. /**
  8844. * Internal dependencies
  8845. */
  8846. const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => Object(external_wp_data_["withRegistry"])(props => {
  8847. const {
  8848. useSubRegistry = true,
  8849. registry,
  8850. ...additionalProps
  8851. } = props;
  8852. if (!useSubRegistry) {
  8853. return Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps);
  8854. }
  8855. const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null);
  8856. Object(external_wp_element_["useEffect"])(() => {
  8857. const newRegistry = Object(external_wp_data_["createRegistry"])({
  8858. 'core/block-editor': external_wp_blockEditor_["storeConfig"]
  8859. }, registry);
  8860. newRegistry.registerStore('core/editor', storeConfig);
  8861. setSubRegistry(newRegistry);
  8862. }, [registry]);
  8863. if (!subRegistry) {
  8864. return null;
  8865. }
  8866. return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], {
  8867. value: subRegistry
  8868. }, Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps));
  8869. }), 'withRegistryProvider');
  8870. /* harmony default export */ var with_registry_provider = (withRegistryProvider);
  8871. // EXTERNAL MODULE: external ["wp","mediaUtils"]
  8872. var external_wp_mediaUtils_ = __webpack_require__("6aBm");
  8873. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
  8874. /**
  8875. * External dependencies
  8876. */
  8877. /**
  8878. * WordPress dependencies
  8879. */
  8880. /**
  8881. * Upload a media file when the file upload button is activated.
  8882. * Wrapper around mediaUpload() that injects the current post ID.
  8883. *
  8884. * @param {Object} $0 Parameters object passed to the function.
  8885. * @param {?Object} $0.additionalData Additional data to include in the request.
  8886. * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
  8887. * @param {Array} $0.filesList List of files.
  8888. * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
  8889. * @param {Function} $0.onError Function called when an error happens.
  8890. * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
  8891. */
  8892. function mediaUpload({
  8893. additionalData = {},
  8894. allowedTypes,
  8895. filesList,
  8896. maxUploadFileSize,
  8897. onError = external_lodash_["noop"],
  8898. onFileChange
  8899. }) {
  8900. const {
  8901. getCurrentPostId,
  8902. getEditorSettings
  8903. } = Object(external_wp_data_["select"])('core/editor');
  8904. const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
  8905. maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
  8906. Object(external_wp_mediaUtils_["uploadMedia"])({
  8907. allowedTypes,
  8908. filesList,
  8909. onFileChange,
  8910. additionalData: {
  8911. post: getCurrentPostId(),
  8912. ...additionalData
  8913. },
  8914. maxUploadFileSize,
  8915. onError: ({
  8916. message
  8917. }) => onError(message),
  8918. wpAllowedMimeTypes
  8919. });
  8920. }
  8921. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js
  8922. /**
  8923. * External dependencies
  8924. */
  8925. /**
  8926. * WordPress dependencies
  8927. */
  8928. /**
  8929. * Internal dependencies
  8930. */
  8931. /**
  8932. * React hook used to compute the block editor settings to use for the post editor.
  8933. *
  8934. * @param {Object} settings EditorProvider settings prop.
  8935. * @param {boolean} hasTemplate Whether template mode is enabled.
  8936. *
  8937. * @return {Object} Block Editor Settings.
  8938. */
  8939. function useBlockEditorSettings(settings, hasTemplate) {
  8940. const {
  8941. reusableBlocks,
  8942. hasUploadPermissions,
  8943. canUseUnfilteredHTML,
  8944. isTitleSelected
  8945. } = Object(external_wp_data_["useSelect"])(select => {
  8946. const {
  8947. canUserUseUnfilteredHTML,
  8948. isPostTitleSelected
  8949. } = select(store);
  8950. const {
  8951. canUser
  8952. } = select(external_wp_coreData_["store"]);
  8953. return {
  8954. canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
  8955. reusableBlocks: select(external_wp_coreData_["store"]).getEntityRecords('postType', 'wp_block',
  8956. /**
  8957. * Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.
  8958. * Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661
  8959. */
  8960. {
  8961. per_page: external_wp_element_["Platform"].select({
  8962. web: -1,
  8963. native: 100
  8964. })
  8965. }),
  8966. hasUploadPermissions: Object(external_lodash_["defaultTo"])(canUser('create', 'media'), true),
  8967. // This selector is only defined on mobile.
  8968. isTitleSelected: isPostTitleSelected && isPostTitleSelected()
  8969. };
  8970. }, []);
  8971. const {
  8972. undo
  8973. } = Object(external_wp_data_["useDispatch"])(store);
  8974. return Object(external_wp_element_["useMemo"])(() => ({ ...Object(external_lodash_["pick"])(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalGlobalStylesUserEntityId', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock']),
  8975. mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
  8976. __experimentalReusableBlocks: reusableBlocks,
  8977. __experimentalFetchLinkSuggestions: (search, searchOptions) => Object(external_wp_coreData_["__experimentalFetchLinkSuggestions"])(search, searchOptions, settings),
  8978. __experimentalFetchRemoteUrlData: url => Object(external_wp_coreData_["__experimentalFetchRemoteUrlData"])(url),
  8979. __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
  8980. __experimentalUndo: undo,
  8981. __experimentalShouldInsertAtTheTop: isTitleSelected,
  8982. outlineMode: hasTemplate
  8983. }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, isTitleSelected, hasTemplate]);
  8984. }
  8985. /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings);
  8986. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
  8987. /**
  8988. * WordPress dependencies
  8989. */
  8990. /**
  8991. * Internal dependencies
  8992. */
  8993. function EditorProvider({
  8994. __unstableTemplate,
  8995. post,
  8996. settings,
  8997. recovery,
  8998. initialEdits,
  8999. children
  9000. }) {
  9001. const defaultBlockContext = Object(external_wp_element_["useMemo"])(() => {
  9002. if (post.type === 'wp_template') {
  9003. return {};
  9004. }
  9005. return {
  9006. postId: post.id,
  9007. postType: post.type
  9008. };
  9009. }, [post.id, post.type]);
  9010. const {
  9011. selection,
  9012. isReady
  9013. } = Object(external_wp_data_["useSelect"])(select => {
  9014. const {
  9015. getEditorSelection,
  9016. __unstableIsEditorReady
  9017. } = select(store);
  9018. return {
  9019. isReady: __unstableIsEditorReady(),
  9020. selection: getEditorSelection()
  9021. };
  9022. }, []);
  9023. const {
  9024. id,
  9025. type
  9026. } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post;
  9027. const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('postType', type, {
  9028. id
  9029. });
  9030. const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate);
  9031. const {
  9032. updatePostLock,
  9033. setupEditor,
  9034. updateEditorSettings,
  9035. __experimentalTearDownEditor
  9036. } = Object(external_wp_data_["useDispatch"])(store);
  9037. const {
  9038. createWarningNotice
  9039. } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); // Iniitialize and tear down the editor.
  9040. // Ideally this should be synced on each change and not just something you do once.
  9041. Object(external_wp_element_["useLayoutEffect"])(() => {
  9042. // Assume that we don't need to initialize in the case of an error recovery.
  9043. if (recovery) {
  9044. return;
  9045. }
  9046. updatePostLock(settings.postLock);
  9047. setupEditor(post, initialEdits, settings.template);
  9048. if (settings.autosave) {
  9049. createWarningNotice(Object(external_wp_i18n_["__"])('There is an autosave of this post that is more recent than the version below.'), {
  9050. id: 'autosave-exists',
  9051. actions: [{
  9052. label: Object(external_wp_i18n_["__"])('View the autosave'),
  9053. url: settings.autosave.editLink
  9054. }]
  9055. });
  9056. }
  9057. return () => {
  9058. __experimentalTearDownEditor();
  9059. };
  9060. }, []); // Synchronize the editor settings as they change
  9061. Object(external_wp_element_["useEffect"])(() => {
  9062. updateEditorSettings(settings);
  9063. }, [settings]);
  9064. if (!isReady) {
  9065. return null;
  9066. }
  9067. return Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], {
  9068. kind: "root",
  9069. type: "site"
  9070. }, Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], {
  9071. kind: "postType",
  9072. type: post.type,
  9073. id: post.id
  9074. }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockContextProvider"], {
  9075. value: defaultBlockContext
  9076. }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorProvider"], {
  9077. value: blocks,
  9078. onChange: onChange,
  9079. onInput: onInput,
  9080. selection: selection,
  9081. settings: editorSettings,
  9082. useSubRegistry: false
  9083. }, children, Object(external_wp_element_["createElement"])(external_wp_reusableBlocks_["ReusableBlocksMenuItems"], null)))));
  9084. }
  9085. /* harmony default export */ var provider = (with_registry_provider(EditorProvider));
  9086. // EXTERNAL MODULE: external ["wp","serverSideRender"]
  9087. var external_wp_serverSideRender_ = __webpack_require__("JREk");
  9088. var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_);
  9089. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js
  9090. // Block Creation Components
  9091. /**
  9092. * WordPress dependencies
  9093. */
  9094. function deprecateComponent(name, Wrapped, staticsToHoist = []) {
  9095. const Component = Object(external_wp_element_["forwardRef"])((props, ref) => {
  9096. external_wp_deprecated_default()('wp.editor.' + name, {
  9097. since: '5.3',
  9098. alternative: 'wp.blockEditor.' + name
  9099. });
  9100. return Object(external_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({
  9101. ref: ref
  9102. }, props));
  9103. });
  9104. staticsToHoist.forEach(staticName => {
  9105. Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]);
  9106. });
  9107. return Component;
  9108. }
  9109. function deprecateFunction(name, func) {
  9110. return (...args) => {
  9111. external_wp_deprecated_default()('wp.editor.' + name, {
  9112. since: '5.3',
  9113. alternative: 'wp.blockEditor.' + name
  9114. });
  9115. return func(...args);
  9116. };
  9117. }
  9118. const RichText = deprecateComponent('RichText', external_wp_blockEditor_["RichText"], ['Content']);
  9119. RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_["RichText"].isEmpty);
  9120. const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_["Autocomplete"]);
  9121. const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_["AlignmentToolbar"]);
  9122. const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_["BlockAlignmentToolbar"]);
  9123. const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_["BlockControls"], ['Slot']);
  9124. const deprecated_BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_["BlockEdit"]);
  9125. const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_["BlockEditorKeyboardShortcuts"]);
  9126. const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_["BlockFormatControls"], ['Slot']);
  9127. const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_["BlockIcon"]);
  9128. const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_["BlockInspector"]);
  9129. const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_["BlockList"]);
  9130. const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_["BlockMover"]);
  9131. const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_["BlockNavigationDropdown"]);
  9132. const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_["BlockSelectionClearer"]);
  9133. const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_["BlockSettingsMenu"]);
  9134. const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_["BlockTitle"]);
  9135. const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_["BlockToolbar"]);
  9136. const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_["ColorPalette"]);
  9137. const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_["ContrastChecker"]);
  9138. const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_["CopyHandler"]);
  9139. const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_["DefaultBlockAppender"]);
  9140. const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_["FontSizePicker"]);
  9141. const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_["Inserter"]);
  9142. const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
  9143. const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']);
  9144. const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_["InspectorControls"], ['Slot']);
  9145. const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_["PanelColorSettings"]);
  9146. const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_["PlainText"]);
  9147. const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_["RichTextShortcut"]);
  9148. const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_["RichTextToolbarButton"]);
  9149. const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_["__unstableRichTextInputEvent"]);
  9150. const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_["MediaPlaceholder"]);
  9151. const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_["MediaUpload"]);
  9152. const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_["MediaUploadCheck"]);
  9153. const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_["MultiSelectScrollIntoView"]);
  9154. const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_["NavigableToolbar"]);
  9155. const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_["ObserveTyping"]);
  9156. const PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_wp_blockEditor_["PreserveScrollInReorder"]);
  9157. const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_["SkipToSelectedBlock"]);
  9158. const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_["URLInput"]);
  9159. const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_["URLInputButton"]);
  9160. const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_["URLPopover"]);
  9161. const Warning = deprecateComponent('Warning', external_wp_blockEditor_["Warning"]);
  9162. const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_["WritingFlow"]);
  9163. const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_["createCustomColorsHOC"]);
  9164. const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_["getColorClassName"]);
  9165. const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_["getColorObjectByAttributeValues"]);
  9166. const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_["getColorObjectByColorValue"]);
  9167. const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_["getFontSize"]);
  9168. const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_["getFontSizeClass"]);
  9169. const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_["withColorContext"]);
  9170. const withColors = deprecateFunction('withColors', external_wp_blockEditor_["withColors"]);
  9171. const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_["withFontSizes"]);
  9172. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js
  9173. // Block Creation Components
  9174. // Post Related Components
  9175. // State Related Components
  9176. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js
  9177. /**
  9178. * Internal dependencies
  9179. */
  9180. // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js
  9181. /**
  9182. * WordPress dependencies
  9183. */
  9184. /**
  9185. * Internal dependencies
  9186. */
  9187. /*
  9188. * Backward compatibility
  9189. */
  9190. /***/ }),
  9191. /***/ "RMJe":
  9192. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9193. "use strict";
  9194. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  9195. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  9196. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  9197. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  9198. /**
  9199. * WordPress dependencies
  9200. */
  9201. const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  9202. xmlns: "http://www.w3.org/2000/svg",
  9203. viewBox: "0 0 24 24"
  9204. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  9205. d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"
  9206. }));
  9207. /* harmony default export */ __webpack_exports__["a"] = (check);
  9208. /***/ }),
  9209. /***/ "Rk8H":
  9210. /***/ (function(module, exports, __webpack_require__) {
  9211. // Load in dependencies
  9212. var computedStyle = __webpack_require__("jTPX");
  9213. /**
  9214. * Calculate the `line-height` of a given node
  9215. * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
  9216. * @returns {Number} `line-height` of the element in pixels
  9217. */
  9218. function lineHeight(node) {
  9219. // Grab the line-height via style
  9220. var lnHeightStr = computedStyle(node, 'line-height');
  9221. var lnHeight = parseFloat(lnHeightStr, 10);
  9222. // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
  9223. if (lnHeightStr === lnHeight + '') {
  9224. // Save the old lineHeight style and update the em unit to the element
  9225. var _lnHeightStyle = node.style.lineHeight;
  9226. node.style.lineHeight = lnHeightStr + 'em';
  9227. // Calculate the em based height
  9228. lnHeightStr = computedStyle(node, 'line-height');
  9229. lnHeight = parseFloat(lnHeightStr, 10);
  9230. // Revert the lineHeight style
  9231. if (_lnHeightStyle) {
  9232. node.style.lineHeight = _lnHeightStyle;
  9233. } else {
  9234. delete node.style.lineHeight;
  9235. }
  9236. }
  9237. // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
  9238. // DEV: `em` units are converted to `pt` in IE6
  9239. // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
  9240. if (lnHeightStr.indexOf('pt') !== -1) {
  9241. lnHeight *= 4;
  9242. lnHeight /= 3;
  9243. // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
  9244. } else if (lnHeightStr.indexOf('mm') !== -1) {
  9245. lnHeight *= 96;
  9246. lnHeight /= 25.4;
  9247. // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
  9248. } else if (lnHeightStr.indexOf('cm') !== -1) {
  9249. lnHeight *= 96;
  9250. lnHeight /= 2.54;
  9251. // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
  9252. } else if (lnHeightStr.indexOf('in') !== -1) {
  9253. lnHeight *= 96;
  9254. // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
  9255. } else if (lnHeightStr.indexOf('pc') !== -1) {
  9256. lnHeight *= 16;
  9257. }
  9258. // Continue our computation
  9259. lnHeight = Math.round(lnHeight);
  9260. // If the line-height is "normal", calculate by font-size
  9261. if (lnHeightStr === 'normal') {
  9262. // Create a temporary node
  9263. var nodeName = node.nodeName;
  9264. var _node = document.createElement(nodeName);
  9265. _node.innerHTML = '&nbsp;';
  9266. // If we have a text area, reset it to only 1 row
  9267. // https://github.com/twolfson/line-height/issues/4
  9268. if (nodeName.toUpperCase() === 'TEXTAREA') {
  9269. _node.setAttribute('rows', '1');
  9270. }
  9271. // Set the font-size of the element
  9272. var fontSizeStr = computedStyle(node, 'font-size');
  9273. _node.style.fontSize = fontSizeStr;
  9274. // Remove default padding/border which can affect offset height
  9275. // https://github.com/twolfson/line-height/issues/4
  9276. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
  9277. _node.style.padding = '0px';
  9278. _node.style.border = '0px';
  9279. // Append it to the body
  9280. var body = document.body;
  9281. body.appendChild(_node);
  9282. // Assume the line height of the element is the height
  9283. var height = _node.offsetHeight;
  9284. lnHeight = height;
  9285. // Remove our child from the DOM
  9286. body.removeChild(_node);
  9287. }
  9288. // Return the calculated height
  9289. return lnHeight;
  9290. }
  9291. // Export lineHeight
  9292. module.exports = lineHeight;
  9293. /***/ }),
  9294. /***/ "RxS6":
  9295. /***/ (function(module, exports) {
  9296. (function() { module.exports = window["wp"]["keycodes"]; }());
  9297. /***/ }),
  9298. /***/ "TSYQ":
  9299. /***/ (function(module, exports, __webpack_require__) {
  9300. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9301. Copyright (c) 2018 Jed Watson.
  9302. Licensed under the MIT License (MIT), see
  9303. http://jedwatson.github.io/classnames
  9304. */
  9305. /* global define */
  9306. (function () {
  9307. 'use strict';
  9308. var hasOwn = {}.hasOwnProperty;
  9309. function classNames() {
  9310. var classes = [];
  9311. for (var i = 0; i < arguments.length; i++) {
  9312. var arg = arguments[i];
  9313. if (!arg) continue;
  9314. var argType = typeof arg;
  9315. if (argType === 'string' || argType === 'number') {
  9316. classes.push(arg);
  9317. } else if (Array.isArray(arg)) {
  9318. if (arg.length) {
  9319. var inner = classNames.apply(null, arg);
  9320. if (inner) {
  9321. classes.push(inner);
  9322. }
  9323. }
  9324. } else if (argType === 'object') {
  9325. if (arg.toString === Object.prototype.toString) {
  9326. for (var key in arg) {
  9327. if (hasOwn.call(arg, key) && arg[key]) {
  9328. classes.push(key);
  9329. }
  9330. }
  9331. } else {
  9332. classes.push(arg.toString());
  9333. }
  9334. }
  9335. }
  9336. return classes.join(' ');
  9337. }
  9338. if ( true && module.exports) {
  9339. classNames.default = classNames;
  9340. module.exports = classNames;
  9341. } else if (true) {
  9342. // register as 'classnames', consistent with npm package name
  9343. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  9344. return classNames;
  9345. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  9346. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  9347. } else {}
  9348. }());
  9349. /***/ }),
  9350. /***/ "Tqx9":
  9351. /***/ (function(module, exports) {
  9352. (function() { module.exports = window["wp"]["primitives"]; }());
  9353. /***/ }),
  9354. /***/ "WbBG":
  9355. /***/ (function(module, exports, __webpack_require__) {
  9356. "use strict";
  9357. /**
  9358. * Copyright (c) 2013-present, Facebook, Inc.
  9359. *
  9360. * This source code is licensed under the MIT license found in the
  9361. * LICENSE file in the root directory of this source tree.
  9362. */
  9363. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  9364. module.exports = ReactPropTypesSecret;
  9365. /***/ }),
  9366. /***/ "YLtl":
  9367. /***/ (function(module, exports) {
  9368. (function() { module.exports = window["lodash"]; }());
  9369. /***/ }),
  9370. /***/ "axFQ":
  9371. /***/ (function(module, exports) {
  9372. (function() { module.exports = window["wp"]["blockEditor"]; }());
  9373. /***/ }),
  9374. /***/ "bWcr":
  9375. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9376. "use strict";
  9377. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  9378. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  9379. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  9380. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  9381. /**
  9382. * WordPress dependencies
  9383. */
  9384. const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  9385. xmlns: "http://www.w3.org/2000/svg",
  9386. viewBox: "0 0 24 24"
  9387. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  9388. 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"
  9389. }));
  9390. /* harmony default export */ __webpack_exports__["a"] = (closeSmall);
  9391. /***/ }),
  9392. /***/ "cDcd":
  9393. /***/ (function(module, exports) {
  9394. (function() { module.exports = window["React"]; }());
  9395. /***/ }),
  9396. /***/ "diJD":
  9397. /***/ (function(module, exports) {
  9398. (function() { module.exports = window["wp"]["reusableBlocks"]; }());
  9399. /***/ }),
  9400. /***/ "g56x":
  9401. /***/ (function(module, exports) {
  9402. (function() { module.exports = window["wp"]["hooks"]; }());
  9403. /***/ }),
  9404. /***/ "hF7m":
  9405. /***/ (function(module, exports) {
  9406. (function() { module.exports = window["wp"]["keyboardShortcuts"]; }());
  9407. /***/ }),
  9408. /***/ "iClF":
  9409. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9410. "use strict";
  9411. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  9412. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  9413. /**
  9414. * WordPress dependencies
  9415. */
  9416. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  9417. /**
  9418. * Return an SVG icon.
  9419. *
  9420. * @param {IconProps} props icon is the SVG component to render
  9421. * size is a number specifiying the icon size in pixels
  9422. * Other props will be passed to wrapped SVG component
  9423. *
  9424. * @return {JSX.Element} Icon component
  9425. */
  9426. function Icon({
  9427. icon,
  9428. size = 24,
  9429. ...props
  9430. }) {
  9431. return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, {
  9432. width: size,
  9433. height: size,
  9434. ...props
  9435. });
  9436. }
  9437. /* harmony default export */ __webpack_exports__["a"] = (Icon);
  9438. /***/ }),
  9439. /***/ "jTPX":
  9440. /***/ (function(module, exports) {
  9441. // This code has been refactored for 140 bytes
  9442. // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
  9443. var computedStyle = function (el, prop, getComputedStyle) {
  9444. getComputedStyle = window.getComputedStyle;
  9445. // In one fell swoop
  9446. return (
  9447. // If we have getComputedStyle
  9448. getComputedStyle ?
  9449. // Query it
  9450. // TODO: From CSS-Query notes, we might need (node, null) for FF
  9451. getComputedStyle(el) :
  9452. // Otherwise, we are in IE and use currentStyle
  9453. el.currentStyle
  9454. )[
  9455. // Switch to camelCase for CSSOM
  9456. // DEV: Grabbed from jQuery
  9457. // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
  9458. // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
  9459. prop.replace(/-(\w)/gi, function (word, letter) {
  9460. return letter.toUpperCase();
  9461. })
  9462. ];
  9463. };
  9464. module.exports = computedStyle;
  9465. /***/ }),
  9466. /***/ "jZUy":
  9467. /***/ (function(module, exports) {
  9468. (function() { module.exports = window["wp"]["coreData"]; }());
  9469. /***/ }),
  9470. /***/ "l3Sj":
  9471. /***/ (function(module, exports) {
  9472. (function() { module.exports = window["wp"]["i18n"]; }());
  9473. /***/ }),
  9474. /***/ "onLe":
  9475. /***/ (function(module, exports) {
  9476. (function() { module.exports = window["wp"]["notices"]; }());
  9477. /***/ }),
  9478. /***/ "pPDe":
  9479. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9480. "use strict";
  9481. var LEAF_KEY, hasWeakMap;
  9482. /**
  9483. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  9484. *
  9485. * @type {Object}
  9486. */
  9487. LEAF_KEY = {};
  9488. /**
  9489. * Whether environment supports WeakMap.
  9490. *
  9491. * @type {boolean}
  9492. */
  9493. hasWeakMap = typeof WeakMap !== 'undefined';
  9494. /**
  9495. * Returns the first argument as the sole entry in an array.
  9496. *
  9497. * @param {*} value Value to return.
  9498. *
  9499. * @return {Array} Value returned as entry in array.
  9500. */
  9501. function arrayOf( value ) {
  9502. return [ value ];
  9503. }
  9504. /**
  9505. * Returns true if the value passed is object-like, or false otherwise. A value
  9506. * is object-like if it can support property assignment, e.g. object or array.
  9507. *
  9508. * @param {*} value Value to test.
  9509. *
  9510. * @return {boolean} Whether value is object-like.
  9511. */
  9512. function isObjectLike( value ) {
  9513. return !! value && 'object' === typeof value;
  9514. }
  9515. /**
  9516. * Creates and returns a new cache object.
  9517. *
  9518. * @return {Object} Cache object.
  9519. */
  9520. function createCache() {
  9521. var cache = {
  9522. clear: function() {
  9523. cache.head = null;
  9524. },
  9525. };
  9526. return cache;
  9527. }
  9528. /**
  9529. * Returns true if entries within the two arrays are strictly equal by
  9530. * reference from a starting index.
  9531. *
  9532. * @param {Array} a First array.
  9533. * @param {Array} b Second array.
  9534. * @param {number} fromIndex Index from which to start comparison.
  9535. *
  9536. * @return {boolean} Whether arrays are shallowly equal.
  9537. */
  9538. function isShallowEqual( a, b, fromIndex ) {
  9539. var i;
  9540. if ( a.length !== b.length ) {
  9541. return false;
  9542. }
  9543. for ( i = fromIndex; i < a.length; i++ ) {
  9544. if ( a[ i ] !== b[ i ] ) {
  9545. return false;
  9546. }
  9547. }
  9548. return true;
  9549. }
  9550. /**
  9551. * Returns a memoized selector function. The getDependants function argument is
  9552. * called before the memoized selector and is expected to return an immutable
  9553. * reference or array of references on which the selector depends for computing
  9554. * its own return value. The memoize cache is preserved only as long as those
  9555. * dependant references remain the same. If getDependants returns a different
  9556. * reference(s), the cache is cleared and the selector value regenerated.
  9557. *
  9558. * @param {Function} selector Selector function.
  9559. * @param {Function} getDependants Dependant getter returning an immutable
  9560. * reference or array of reference used in
  9561. * cache bust consideration.
  9562. *
  9563. * @return {Function} Memoized selector.
  9564. */
  9565. /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
  9566. var rootCache, getCache;
  9567. // Use object source as dependant if getter not provided
  9568. if ( ! getDependants ) {
  9569. getDependants = arrayOf;
  9570. }
  9571. /**
  9572. * Returns the root cache. If WeakMap is supported, this is assigned to the
  9573. * root WeakMap cache set, otherwise it is a shared instance of the default
  9574. * cache object.
  9575. *
  9576. * @return {(WeakMap|Object)} Root cache object.
  9577. */
  9578. function getRootCache() {
  9579. return rootCache;
  9580. }
  9581. /**
  9582. * Returns the cache for a given dependants array. When possible, a WeakMap
  9583. * will be used to create a unique cache for each set of dependants. This
  9584. * is feasible due to the nature of WeakMap in allowing garbage collection
  9585. * to occur on entries where the key object is no longer referenced. Since
  9586. * WeakMap requires the key to be an object, this is only possible when the
  9587. * dependant is object-like. The root cache is created as a hierarchy where
  9588. * each top-level key is the first entry in a dependants set, the value a
  9589. * WeakMap where each key is the next dependant, and so on. This continues
  9590. * so long as the dependants are object-like. If no dependants are object-
  9591. * like, then the cache is shared across all invocations.
  9592. *
  9593. * @see isObjectLike
  9594. *
  9595. * @param {Array} dependants Selector dependants.
  9596. *
  9597. * @return {Object} Cache object.
  9598. */
  9599. function getWeakMapCache( dependants ) {
  9600. var caches = rootCache,
  9601. isUniqueByDependants = true,
  9602. i, dependant, map, cache;
  9603. for ( i = 0; i < dependants.length; i++ ) {
  9604. dependant = dependants[ i ];
  9605. // Can only compose WeakMap from object-like key.
  9606. if ( ! isObjectLike( dependant ) ) {
  9607. isUniqueByDependants = false;
  9608. break;
  9609. }
  9610. // Does current segment of cache already have a WeakMap?
  9611. if ( caches.has( dependant ) ) {
  9612. // Traverse into nested WeakMap.
  9613. caches = caches.get( dependant );
  9614. } else {
  9615. // Create, set, and traverse into a new one.
  9616. map = new WeakMap();
  9617. caches.set( dependant, map );
  9618. caches = map;
  9619. }
  9620. }
  9621. // We use an arbitrary (but consistent) object as key for the last item
  9622. // in the WeakMap to serve as our running cache.
  9623. if ( ! caches.has( LEAF_KEY ) ) {
  9624. cache = createCache();
  9625. cache.isUniqueByDependants = isUniqueByDependants;
  9626. caches.set( LEAF_KEY, cache );
  9627. }
  9628. return caches.get( LEAF_KEY );
  9629. }
  9630. // Assign cache handler by availability of WeakMap
  9631. getCache = hasWeakMap ? getWeakMapCache : getRootCache;
  9632. /**
  9633. * Resets root memoization cache.
  9634. */
  9635. function clear() {
  9636. rootCache = hasWeakMap ? new WeakMap() : createCache();
  9637. }
  9638. // eslint-disable-next-line jsdoc/check-param-names
  9639. /**
  9640. * The augmented selector call, considering first whether dependants have
  9641. * changed before passing it to underlying memoize function.
  9642. *
  9643. * @param {Object} source Source object for derivation.
  9644. * @param {...*} extraArgs Additional arguments to pass to selector.
  9645. *
  9646. * @return {*} Selector result.
  9647. */
  9648. function callSelector( /* source, ...extraArgs */ ) {
  9649. var len = arguments.length,
  9650. cache, node, i, args, dependants;
  9651. // Create copy of arguments (avoid leaking deoptimization).
  9652. args = new Array( len );
  9653. for ( i = 0; i < len; i++ ) {
  9654. args[ i ] = arguments[ i ];
  9655. }
  9656. dependants = getDependants.apply( null, args );
  9657. cache = getCache( dependants );
  9658. // If not guaranteed uniqueness by dependants (primitive type or lack
  9659. // of WeakMap support), shallow compare against last dependants and, if
  9660. // references have changed, destroy cache to recalculate result.
  9661. if ( ! cache.isUniqueByDependants ) {
  9662. if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
  9663. cache.clear();
  9664. }
  9665. cache.lastDependants = dependants;
  9666. }
  9667. node = cache.head;
  9668. while ( node ) {
  9669. // Check whether node arguments match arguments
  9670. if ( ! isShallowEqual( node.args, args, 1 ) ) {
  9671. node = node.next;
  9672. continue;
  9673. }
  9674. // At this point we can assume we've found a match
  9675. // Surface matched node to head if not already
  9676. if ( node !== cache.head ) {
  9677. // Adjust siblings to point to each other.
  9678. node.prev.next = node.next;
  9679. if ( node.next ) {
  9680. node.next.prev = node.prev;
  9681. }
  9682. node.next = cache.head;
  9683. node.prev = null;
  9684. cache.head.prev = node;
  9685. cache.head = node;
  9686. }
  9687. // Return immediately
  9688. return node.val;
  9689. }
  9690. // No cached value found. Continue to insertion phase:
  9691. node = {
  9692. // Generate the result from original function
  9693. val: selector.apply( null, args ),
  9694. };
  9695. // Avoid including the source object in the cache.
  9696. args[ 0 ] = null;
  9697. node.args = args;
  9698. // Don't need to check whether node is already head, since it would
  9699. // have been returned above already if it was
  9700. // Shift existing head down list
  9701. if ( cache.head ) {
  9702. cache.head.prev = node;
  9703. node.next = cache.head;
  9704. }
  9705. cache.head = node;
  9706. return node.val;
  9707. }
  9708. callSelector.getDependants = getDependants;
  9709. callSelector.clear = clear;
  9710. clear();
  9711. return callSelector;
  9712. });
  9713. /***/ }),
  9714. /***/ "qRz9":
  9715. /***/ (function(module, exports) {
  9716. (function() { module.exports = window["wp"]["richText"]; }());
  9717. /***/ }),
  9718. /***/ "rmEH":
  9719. /***/ (function(module, exports) {
  9720. (function() { module.exports = window["wp"]["htmlEntities"]; }());
  9721. /***/ }),
  9722. /***/ "tI+e":
  9723. /***/ (function(module, exports) {
  9724. (function() { module.exports = window["wp"]["components"]; }());
  9725. /***/ }),
  9726. /***/ "w95h":
  9727. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9728. "use strict";
  9729. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  9730. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  9731. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  9732. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  9733. /**
  9734. * WordPress dependencies
  9735. */
  9736. const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  9737. xmlns: "http://www.w3.org/2000/svg",
  9738. viewBox: "0 0 24 24"
  9739. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  9740. 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"
  9741. }));
  9742. /* harmony default export */ __webpack_exports__["a"] = (close);
  9743. /***/ }),
  9744. /***/ "wduq":
  9745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9746. "use strict";
  9747. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
  9748. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
  9749. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
  9750. /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
  9751. /**
  9752. * WordPress dependencies
  9753. */
  9754. const wordpress = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
  9755. xmlns: "http://www.w3.org/2000/svg",
  9756. viewBox: "-2 -2 24 24"
  9757. }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
  9758. 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"
  9759. }));
  9760. /* harmony default export */ __webpack_exports__["a"] = (wordpress);
  9761. /***/ }),
  9762. /***/ "wx14":
  9763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9764. "use strict";
  9765. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
  9766. function _extends() {
  9767. _extends = Object.assign || function (target) {
  9768. for (var i = 1; i < arguments.length; i++) {
  9769. var source = arguments[i];
  9770. for (var key in source) {
  9771. if (Object.prototype.hasOwnProperty.call(source, key)) {
  9772. target[key] = source[key];
  9773. }
  9774. }
  9775. }
  9776. return target;
  9777. };
  9778. return _extends.apply(this, arguments);
  9779. }
  9780. /***/ }),
  9781. /***/ "ywyh":
  9782. /***/ (function(module, exports) {
  9783. (function() { module.exports = window["wp"]["apiFetch"]; }());
  9784. /***/ })
  9785. /******/ });