edit-site.js 578 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 6411:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. autosize 4.0.4
  7. license: MIT
  8. http://www.jacklmoore.com/autosize
  9. */
  10. (function (global, factory) {
  11. if (true) {
  12. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  13. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  14. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  15. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16. } else { var mod; }
  17. })(this, function (module, exports) {
  18. 'use strict';
  19. var map = typeof Map === "function" ? new Map() : function () {
  20. var keys = [];
  21. var values = [];
  22. return {
  23. has: function has(key) {
  24. return keys.indexOf(key) > -1;
  25. },
  26. get: function get(key) {
  27. return values[keys.indexOf(key)];
  28. },
  29. set: function set(key, value) {
  30. if (keys.indexOf(key) === -1) {
  31. keys.push(key);
  32. values.push(value);
  33. }
  34. },
  35. delete: function _delete(key) {
  36. var index = keys.indexOf(key);
  37. if (index > -1) {
  38. keys.splice(index, 1);
  39. values.splice(index, 1);
  40. }
  41. }
  42. };
  43. }();
  44. var createEvent = function createEvent(name) {
  45. return new Event(name, { bubbles: true });
  46. };
  47. try {
  48. new Event('test');
  49. } catch (e) {
  50. // IE does not support `new Event()`
  51. createEvent = function createEvent(name) {
  52. var evt = document.createEvent('Event');
  53. evt.initEvent(name, true, false);
  54. return evt;
  55. };
  56. }
  57. function assign(ta) {
  58. if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
  59. var heightOffset = null;
  60. var clientWidth = null;
  61. var cachedHeight = null;
  62. function init() {
  63. var style = window.getComputedStyle(ta, null);
  64. if (style.resize === 'vertical') {
  65. ta.style.resize = 'none';
  66. } else if (style.resize === 'both') {
  67. ta.style.resize = 'horizontal';
  68. }
  69. if (style.boxSizing === 'content-box') {
  70. heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
  71. } else {
  72. heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
  73. }
  74. // Fix when a textarea is not on document body and heightOffset is Not a Number
  75. if (isNaN(heightOffset)) {
  76. heightOffset = 0;
  77. }
  78. update();
  79. }
  80. function changeOverflow(value) {
  81. {
  82. // Chrome/Safari-specific fix:
  83. // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
  84. // made available by removing the scrollbar. The following forces the necessary text reflow.
  85. var width = ta.style.width;
  86. ta.style.width = '0px';
  87. // Force reflow:
  88. /* jshint ignore:start */
  89. ta.offsetWidth;
  90. /* jshint ignore:end */
  91. ta.style.width = width;
  92. }
  93. ta.style.overflowY = value;
  94. }
  95. function getParentOverflows(el) {
  96. var arr = [];
  97. while (el && el.parentNode && el.parentNode instanceof Element) {
  98. if (el.parentNode.scrollTop) {
  99. arr.push({
  100. node: el.parentNode,
  101. scrollTop: el.parentNode.scrollTop
  102. });
  103. }
  104. el = el.parentNode;
  105. }
  106. return arr;
  107. }
  108. function resize() {
  109. if (ta.scrollHeight === 0) {
  110. // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
  111. return;
  112. }
  113. var overflows = getParentOverflows(ta);
  114. var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
  115. ta.style.height = '';
  116. ta.style.height = ta.scrollHeight + heightOffset + 'px';
  117. // used to check if an update is actually necessary on window.resize
  118. clientWidth = ta.clientWidth;
  119. // prevents scroll-position jumping
  120. overflows.forEach(function (el) {
  121. el.node.scrollTop = el.scrollTop;
  122. });
  123. if (docTop) {
  124. document.documentElement.scrollTop = docTop;
  125. }
  126. }
  127. function update() {
  128. resize();
  129. var styleHeight = Math.round(parseFloat(ta.style.height));
  130. var computed = window.getComputedStyle(ta, null);
  131. // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
  132. var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
  133. // The actual height not matching the style height (set via the resize method) indicates that
  134. // the max-height has been exceeded, in which case the overflow should be allowed.
  135. if (actualHeight < styleHeight) {
  136. if (computed.overflowY === 'hidden') {
  137. changeOverflow('scroll');
  138. resize();
  139. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  140. }
  141. } else {
  142. // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
  143. if (computed.overflowY !== 'hidden') {
  144. changeOverflow('hidden');
  145. resize();
  146. actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
  147. }
  148. }
  149. if (cachedHeight !== actualHeight) {
  150. cachedHeight = actualHeight;
  151. var evt = createEvent('autosize:resized');
  152. try {
  153. ta.dispatchEvent(evt);
  154. } catch (err) {
  155. // Firefox will throw an error on dispatchEvent for a detached element
  156. // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
  157. }
  158. }
  159. }
  160. var pageResize = function pageResize() {
  161. if (ta.clientWidth !== clientWidth) {
  162. update();
  163. }
  164. };
  165. var destroy = function (style) {
  166. window.removeEventListener('resize', pageResize, false);
  167. ta.removeEventListener('input', update, false);
  168. ta.removeEventListener('keyup', update, false);
  169. ta.removeEventListener('autosize:destroy', destroy, false);
  170. ta.removeEventListener('autosize:update', update, false);
  171. Object.keys(style).forEach(function (key) {
  172. ta.style[key] = style[key];
  173. });
  174. map.delete(ta);
  175. }.bind(ta, {
  176. height: ta.style.height,
  177. resize: ta.style.resize,
  178. overflowY: ta.style.overflowY,
  179. overflowX: ta.style.overflowX,
  180. wordWrap: ta.style.wordWrap
  181. });
  182. ta.addEventListener('autosize:destroy', destroy, false);
  183. // IE9 does not fire onpropertychange or oninput for deletions,
  184. // so binding to onkeyup to catch most of those events.
  185. // There is no way that I know of to detect something like 'cut' in IE9.
  186. if ('onpropertychange' in ta && 'oninput' in ta) {
  187. ta.addEventListener('keyup', update, false);
  188. }
  189. window.addEventListener('resize', pageResize, false);
  190. ta.addEventListener('input', update, false);
  191. ta.addEventListener('autosize:update', update, false);
  192. ta.style.overflowX = 'hidden';
  193. ta.style.wordWrap = 'break-word';
  194. map.set(ta, {
  195. destroy: destroy,
  196. update: update
  197. });
  198. init();
  199. }
  200. function destroy(ta) {
  201. var methods = map.get(ta);
  202. if (methods) {
  203. methods.destroy();
  204. }
  205. }
  206. function update(ta) {
  207. var methods = map.get(ta);
  208. if (methods) {
  209. methods.update();
  210. }
  211. }
  212. var autosize = null;
  213. // Do nothing in Node.js environment and IE8 (or lower)
  214. if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
  215. autosize = function autosize(el) {
  216. return el;
  217. };
  218. autosize.destroy = function (el) {
  219. return el;
  220. };
  221. autosize.update = function (el) {
  222. return el;
  223. };
  224. } else {
  225. autosize = function autosize(el, options) {
  226. if (el) {
  227. Array.prototype.forEach.call(el.length ? el : [el], function (x) {
  228. return assign(x, options);
  229. });
  230. }
  231. return el;
  232. };
  233. autosize.destroy = function (el) {
  234. if (el) {
  235. Array.prototype.forEach.call(el.length ? el : [el], destroy);
  236. }
  237. return el;
  238. };
  239. autosize.update = function (el) {
  240. if (el) {
  241. Array.prototype.forEach.call(el.length ? el : [el], update);
  242. }
  243. return el;
  244. };
  245. }
  246. exports.default = autosize;
  247. module.exports = exports['default'];
  248. });
  249. /***/ }),
  250. /***/ 4403:
  251. /***/ (function(module, exports) {
  252. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  253. Copyright (c) 2018 Jed Watson.
  254. Licensed under the MIT License (MIT), see
  255. http://jedwatson.github.io/classnames
  256. */
  257. /* global define */
  258. (function () {
  259. 'use strict';
  260. var hasOwn = {}.hasOwnProperty;
  261. var nativeCodeString = '[native code]';
  262. function classNames() {
  263. var classes = [];
  264. for (var i = 0; i < arguments.length; i++) {
  265. var arg = arguments[i];
  266. if (!arg) continue;
  267. var argType = typeof arg;
  268. if (argType === 'string' || argType === 'number') {
  269. classes.push(arg);
  270. } else if (Array.isArray(arg)) {
  271. if (arg.length) {
  272. var inner = classNames.apply(null, arg);
  273. if (inner) {
  274. classes.push(inner);
  275. }
  276. }
  277. } else if (argType === 'object') {
  278. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  279. classes.push(arg.toString());
  280. continue;
  281. }
  282. for (var key in arg) {
  283. if (hasOwn.call(arg, key) && arg[key]) {
  284. classes.push(key);
  285. }
  286. }
  287. }
  288. }
  289. return classes.join(' ');
  290. }
  291. if ( true && module.exports) {
  292. classNames.default = classNames;
  293. module.exports = classNames;
  294. } else if (true) {
  295. // register as 'classnames', consistent with npm package name
  296. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  297. return classNames;
  298. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  299. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  300. } else {}
  301. }());
  302. /***/ }),
  303. /***/ 4827:
  304. /***/ (function(module) {
  305. // This code has been refactored for 140 bytes
  306. // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
  307. var computedStyle = function (el, prop, getComputedStyle) {
  308. getComputedStyle = window.getComputedStyle;
  309. // In one fell swoop
  310. return (
  311. // If we have getComputedStyle
  312. getComputedStyle ?
  313. // Query it
  314. // TODO: From CSS-Query notes, we might need (node, null) for FF
  315. getComputedStyle(el) :
  316. // Otherwise, we are in IE and use currentStyle
  317. el.currentStyle
  318. )[
  319. // Switch to camelCase for CSSOM
  320. // DEV: Grabbed from jQuery
  321. // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
  322. // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
  323. prop.replace(/-(\w)/gi, function (word, letter) {
  324. return letter.toUpperCase();
  325. })
  326. ];
  327. };
  328. module.exports = computedStyle;
  329. /***/ }),
  330. /***/ 8981:
  331. /***/ (function(module, exports) {
  332. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//download.js v4.2, by dandavis; 2008-2016. [MIT] see http://danml.com/download.html for tests/usage
  333. // v1 landed a FF+Chrome compat way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime
  334. // v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs
  335. // v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling.
  336. // v4 adds AMD/UMD, commonJS, and plain browser support
  337. // v4.1 adds url download capability via solo URL argument (same domain/CORS only)
  338. // v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors
  339. // https://github.com/rndme/download
  340. (function (root, factory) {
  341. if (true) {
  342. // AMD. Register as an anonymous module.
  343. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  344. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  345. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  346. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  347. } else {}
  348. }(this, function () {
  349. return function download(data, strFileName, strMimeType) {
  350. var self = window, // this script is only for browsers anyway...
  351. defaultMime = "application/octet-stream", // this default mime also triggers iframe downloads
  352. mimeType = strMimeType || defaultMime,
  353. payload = data,
  354. url = !strFileName && !strMimeType && payload,
  355. anchor = document.createElement("a"),
  356. toString = function(a){return String(a);},
  357. myBlob = (self.Blob || self.MozBlob || self.WebKitBlob || toString),
  358. fileName = strFileName || "download",
  359. blob,
  360. reader;
  361. myBlob= myBlob.call ? myBlob.bind(self) : Blob ;
  362. if(String(this)==="true"){ //reverse arguments, allowing download.bind(true, "text/xml", "export.xml") to act as a callback
  363. payload=[payload, mimeType];
  364. mimeType=payload[0];
  365. payload=payload[1];
  366. }
  367. if(url && url.length< 2048){ // if no filename and no mime, assume a url was passed as the only argument
  368. fileName = url.split("/").pop().split("?")[0];
  369. anchor.href = url; // assign href prop to temp anchor
  370. if(anchor.href.indexOf(url) !== -1){ // if the browser determines that it's a potentially valid url path:
  371. var ajax=new XMLHttpRequest();
  372. ajax.open( "GET", url, true);
  373. ajax.responseType = 'blob';
  374. ajax.onload= function(e){
  375. download(e.target.response, fileName, defaultMime);
  376. };
  377. setTimeout(function(){ ajax.send();}, 0); // allows setting custom ajax headers using the return:
  378. return ajax;
  379. } // end if valid url?
  380. } // end if url?
  381. //go ahead and download dataURLs right away
  382. if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(payload)){
  383. if(payload.length > (1024*1024*1.999) && myBlob !== toString ){
  384. payload=dataUrlToBlob(payload);
  385. mimeType=payload.type || defaultMime;
  386. }else{
  387. return navigator.msSaveBlob ? // IE10 can't do a[download], only Blobs:
  388. navigator.msSaveBlob(dataUrlToBlob(payload), fileName) :
  389. saver(payload) ; // everyone else can save dataURLs un-processed
  390. }
  391. }else{//not data url, is it a string with special needs?
  392. if(/([\x80-\xff])/.test(payload)){
  393. var i=0, tempUiArr= new Uint8Array(payload.length), mx=tempUiArr.length;
  394. for(i;i<mx;++i) tempUiArr[i]= payload.charCodeAt(i);
  395. payload=new myBlob([tempUiArr], {type: mimeType});
  396. }
  397. }
  398. blob = payload instanceof myBlob ?
  399. payload :
  400. new myBlob([payload], {type: mimeType}) ;
  401. function dataUrlToBlob(strUrl) {
  402. var parts= strUrl.split(/[:;,]/),
  403. type= parts[1],
  404. decoder= parts[2] == "base64" ? atob : decodeURIComponent,
  405. binData= decoder( parts.pop() ),
  406. mx= binData.length,
  407. i= 0,
  408. uiArr= new Uint8Array(mx);
  409. for(i;i<mx;++i) uiArr[i]= binData.charCodeAt(i);
  410. return new myBlob([uiArr], {type: type});
  411. }
  412. function saver(url, winMode){
  413. if ('download' in anchor) { //html5 A[download]
  414. anchor.href = url;
  415. anchor.setAttribute("download", fileName);
  416. anchor.className = "download-js-link";
  417. anchor.innerHTML = "downloading...";
  418. anchor.style.display = "none";
  419. document.body.appendChild(anchor);
  420. setTimeout(function() {
  421. anchor.click();
  422. document.body.removeChild(anchor);
  423. if(winMode===true){setTimeout(function(){ self.URL.revokeObjectURL(anchor.href);}, 250 );}
  424. }, 66);
  425. return true;
  426. }
  427. // handle non-a[download] safari as best we can:
  428. if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
  429. if(/^data:/.test(url)) url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
  430. if(!window.open(url)){ // popup blocked, offer direct download:
  431. if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; }
  432. }
  433. return true;
  434. }
  435. //do iframe dataURL download (old ch+FF):
  436. var f = document.createElement("iframe");
  437. document.body.appendChild(f);
  438. if(!winMode && /^data:/.test(url)){ // force a mime that will download:
  439. url="data:"+url.replace(/^data:([\w\/\-\+]+)/, defaultMime);
  440. }
  441. f.src=url;
  442. setTimeout(function(){ document.body.removeChild(f); }, 333);
  443. }//end saver
  444. if (navigator.msSaveBlob) { // IE10+ : (has Blob, but not a[download] or URL)
  445. return navigator.msSaveBlob(blob, fileName);
  446. }
  447. if(self.URL){ // simple fast and modern way using Blob and URL:
  448. saver(self.URL.createObjectURL(blob), true);
  449. }else{
  450. // handle non-Blob()+non-URL browsers:
  451. if(typeof blob === "string" || blob.constructor===toString ){
  452. try{
  453. return saver( "data:" + mimeType + ";base64," + self.btoa(blob) );
  454. }catch(y){
  455. return saver( "data:" + mimeType + "," + encodeURIComponent(blob) );
  456. }
  457. }
  458. // Blob but not URL support:
  459. reader=new FileReader();
  460. reader.onload=function(e){
  461. saver(this.result);
  462. };
  463. reader.readAsDataURL(blob);
  464. }
  465. return true;
  466. }; /* end download() */
  467. }));
  468. /***/ }),
  469. /***/ 9894:
  470. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  471. // Load in dependencies
  472. var computedStyle = __webpack_require__(4827);
  473. /**
  474. * Calculate the `line-height` of a given node
  475. * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
  476. * @returns {Number} `line-height` of the element in pixels
  477. */
  478. function lineHeight(node) {
  479. // Grab the line-height via style
  480. var lnHeightStr = computedStyle(node, 'line-height');
  481. var lnHeight = parseFloat(lnHeightStr, 10);
  482. // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
  483. if (lnHeightStr === lnHeight + '') {
  484. // Save the old lineHeight style and update the em unit to the element
  485. var _lnHeightStyle = node.style.lineHeight;
  486. node.style.lineHeight = lnHeightStr + 'em';
  487. // Calculate the em based height
  488. lnHeightStr = computedStyle(node, 'line-height');
  489. lnHeight = parseFloat(lnHeightStr, 10);
  490. // Revert the lineHeight style
  491. if (_lnHeightStyle) {
  492. node.style.lineHeight = _lnHeightStyle;
  493. } else {
  494. delete node.style.lineHeight;
  495. }
  496. }
  497. // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
  498. // DEV: `em` units are converted to `pt` in IE6
  499. // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
  500. if (lnHeightStr.indexOf('pt') !== -1) {
  501. lnHeight *= 4;
  502. lnHeight /= 3;
  503. // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
  504. } else if (lnHeightStr.indexOf('mm') !== -1) {
  505. lnHeight *= 96;
  506. lnHeight /= 25.4;
  507. // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
  508. } else if (lnHeightStr.indexOf('cm') !== -1) {
  509. lnHeight *= 96;
  510. lnHeight /= 2.54;
  511. // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
  512. } else if (lnHeightStr.indexOf('in') !== -1) {
  513. lnHeight *= 96;
  514. // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
  515. } else if (lnHeightStr.indexOf('pc') !== -1) {
  516. lnHeight *= 16;
  517. }
  518. // Continue our computation
  519. lnHeight = Math.round(lnHeight);
  520. // If the line-height is "normal", calculate by font-size
  521. if (lnHeightStr === 'normal') {
  522. // Create a temporary node
  523. var nodeName = node.nodeName;
  524. var _node = document.createElement(nodeName);
  525. _node.innerHTML = '&nbsp;';
  526. // If we have a text area, reset it to only 1 row
  527. // https://github.com/twolfson/line-height/issues/4
  528. if (nodeName.toUpperCase() === 'TEXTAREA') {
  529. _node.setAttribute('rows', '1');
  530. }
  531. // Set the font-size of the element
  532. var fontSizeStr = computedStyle(node, 'font-size');
  533. _node.style.fontSize = fontSizeStr;
  534. // Remove default padding/border which can affect offset height
  535. // https://github.com/twolfson/line-height/issues/4
  536. // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
  537. _node.style.padding = '0px';
  538. _node.style.border = '0px';
  539. // Append it to the body
  540. var body = document.body;
  541. body.appendChild(_node);
  542. // Assume the line height of the element is the height
  543. var height = _node.offsetHeight;
  544. lnHeight = height;
  545. // Remove our child from the DOM
  546. body.removeChild(_node);
  547. }
  548. // Return the calculated height
  549. return lnHeight;
  550. }
  551. // Export lineHeight
  552. module.exports = lineHeight;
  553. /***/ }),
  554. /***/ 5372:
  555. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  556. "use strict";
  557. /**
  558. * Copyright (c) 2013-present, Facebook, Inc.
  559. *
  560. * This source code is licensed under the MIT license found in the
  561. * LICENSE file in the root directory of this source tree.
  562. */
  563. var ReactPropTypesSecret = __webpack_require__(9567);
  564. function emptyFunction() {}
  565. function emptyFunctionWithReset() {}
  566. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  567. module.exports = function() {
  568. function shim(props, propName, componentName, location, propFullName, secret) {
  569. if (secret === ReactPropTypesSecret) {
  570. // It is still safe when called from React.
  571. return;
  572. }
  573. var err = new Error(
  574. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  575. 'Use PropTypes.checkPropTypes() to call them. ' +
  576. 'Read more at http://fb.me/use-check-prop-types'
  577. );
  578. err.name = 'Invariant Violation';
  579. throw err;
  580. };
  581. shim.isRequired = shim;
  582. function getShim() {
  583. return shim;
  584. };
  585. // Important!
  586. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  587. var ReactPropTypes = {
  588. array: shim,
  589. bigint: shim,
  590. bool: shim,
  591. func: shim,
  592. number: shim,
  593. object: shim,
  594. string: shim,
  595. symbol: shim,
  596. any: shim,
  597. arrayOf: getShim,
  598. element: shim,
  599. elementType: shim,
  600. instanceOf: getShim,
  601. node: shim,
  602. objectOf: getShim,
  603. oneOf: getShim,
  604. oneOfType: getShim,
  605. shape: getShim,
  606. exact: getShim,
  607. checkPropTypes: emptyFunctionWithReset,
  608. resetWarningCache: emptyFunction
  609. };
  610. ReactPropTypes.PropTypes = ReactPropTypes;
  611. return ReactPropTypes;
  612. };
  613. /***/ }),
  614. /***/ 2652:
  615. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  616. /**
  617. * Copyright (c) 2013-present, Facebook, Inc.
  618. *
  619. * This source code is licensed under the MIT license found in the
  620. * LICENSE file in the root directory of this source tree.
  621. */
  622. if (false) { var throwOnDirectAccess, ReactIs; } else {
  623. // By explicitly using `prop-types` you are opting into new production behavior.
  624. // http://fb.me/prop-types-in-prod
  625. module.exports = __webpack_require__(5372)();
  626. }
  627. /***/ }),
  628. /***/ 9567:
  629. /***/ (function(module) {
  630. "use strict";
  631. /**
  632. * Copyright (c) 2013-present, Facebook, Inc.
  633. *
  634. * This source code is licensed under the MIT license found in the
  635. * LICENSE file in the root directory of this source tree.
  636. */
  637. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  638. module.exports = ReactPropTypesSecret;
  639. /***/ }),
  640. /***/ 5438:
  641. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  642. "use strict";
  643. var __extends = (this && this.__extends) || (function () {
  644. var extendStatics = Object.setPrototypeOf ||
  645. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  646. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  647. return function (d, b) {
  648. extendStatics(d, b);
  649. function __() { this.constructor = d; }
  650. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  651. };
  652. })();
  653. var __assign = (this && this.__assign) || Object.assign || function(t) {
  654. for (var s, i = 1, n = arguments.length; i < n; i++) {
  655. s = arguments[i];
  656. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  657. t[p] = s[p];
  658. }
  659. return t;
  660. };
  661. var __rest = (this && this.__rest) || function (s, e) {
  662. var t = {};
  663. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  664. t[p] = s[p];
  665. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  666. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
  667. t[p[i]] = s[p[i]];
  668. return t;
  669. };
  670. exports.__esModule = true;
  671. var React = __webpack_require__(9196);
  672. var PropTypes = __webpack_require__(2652);
  673. var autosize = __webpack_require__(6411);
  674. var _getLineHeight = __webpack_require__(9894);
  675. var getLineHeight = _getLineHeight;
  676. var RESIZED = "autosize:resized";
  677. /**
  678. * A light replacement for built-in textarea component
  679. * which automaticaly adjusts its height to match the content
  680. */
  681. var TextareaAutosizeClass = /** @class */ (function (_super) {
  682. __extends(TextareaAutosizeClass, _super);
  683. function TextareaAutosizeClass() {
  684. var _this = _super !== null && _super.apply(this, arguments) || this;
  685. _this.state = {
  686. lineHeight: null
  687. };
  688. _this.textarea = null;
  689. _this.onResize = function (e) {
  690. if (_this.props.onResize) {
  691. _this.props.onResize(e);
  692. }
  693. };
  694. _this.updateLineHeight = function () {
  695. if (_this.textarea) {
  696. _this.setState({
  697. lineHeight: getLineHeight(_this.textarea)
  698. });
  699. }
  700. };
  701. _this.onChange = function (e) {
  702. var onChange = _this.props.onChange;
  703. _this.currentValue = e.currentTarget.value;
  704. onChange && onChange(e);
  705. };
  706. return _this;
  707. }
  708. TextareaAutosizeClass.prototype.componentDidMount = function () {
  709. var _this = this;
  710. var _a = this.props, maxRows = _a.maxRows, async = _a.async;
  711. if (typeof maxRows === "number") {
  712. this.updateLineHeight();
  713. }
  714. if (typeof maxRows === "number" || async) {
  715. /*
  716. the defer is needed to:
  717. - force "autosize" to activate the scrollbar when this.props.maxRows is passed
  718. - support StyledComponents (see #71)
  719. */
  720. setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
  721. }
  722. else {
  723. this.textarea && autosize(this.textarea);
  724. }
  725. if (this.textarea) {
  726. this.textarea.addEventListener(RESIZED, this.onResize);
  727. }
  728. };
  729. TextareaAutosizeClass.prototype.componentWillUnmount = function () {
  730. if (this.textarea) {
  731. this.textarea.removeEventListener(RESIZED, this.onResize);
  732. autosize.destroy(this.textarea);
  733. }
  734. };
  735. TextareaAutosizeClass.prototype.render = function () {
  736. var _this = this;
  737. 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;
  738. var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
  739. return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
  740. _this.textarea = element;
  741. if (typeof _this.props.innerRef === 'function') {
  742. _this.props.innerRef(element);
  743. }
  744. else if (_this.props.innerRef) {
  745. _this.props.innerRef.current = element;
  746. }
  747. } }), children));
  748. };
  749. TextareaAutosizeClass.prototype.componentDidUpdate = function () {
  750. this.textarea && autosize.update(this.textarea);
  751. };
  752. TextareaAutosizeClass.defaultProps = {
  753. rows: 1,
  754. async: false
  755. };
  756. TextareaAutosizeClass.propTypes = {
  757. rows: PropTypes.number,
  758. maxRows: PropTypes.number,
  759. onResize: PropTypes.func,
  760. innerRef: PropTypes.any,
  761. async: PropTypes.bool
  762. };
  763. return TextareaAutosizeClass;
  764. }(React.Component));
  765. exports.TextareaAutosize = React.forwardRef(function (props, ref) {
  766. return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
  767. });
  768. /***/ }),
  769. /***/ 773:
  770. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  771. "use strict";
  772. var __webpack_unused_export__;
  773. __webpack_unused_export__ = true;
  774. var TextareaAutosize_1 = __webpack_require__(5438);
  775. exports.Z = TextareaAutosize_1.TextareaAutosize;
  776. /***/ }),
  777. /***/ 9196:
  778. /***/ (function(module) {
  779. "use strict";
  780. module.exports = window["React"];
  781. /***/ })
  782. /******/ });
  783. /************************************************************************/
  784. /******/ // The module cache
  785. /******/ var __webpack_module_cache__ = {};
  786. /******/
  787. /******/ // The require function
  788. /******/ function __webpack_require__(moduleId) {
  789. /******/ // Check if module is in cache
  790. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  791. /******/ if (cachedModule !== undefined) {
  792. /******/ return cachedModule.exports;
  793. /******/ }
  794. /******/ // Create a new module (and put it into the cache)
  795. /******/ var module = __webpack_module_cache__[moduleId] = {
  796. /******/ // no module.id needed
  797. /******/ // no module.loaded needed
  798. /******/ exports: {}
  799. /******/ };
  800. /******/
  801. /******/ // Execute the module function
  802. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  803. /******/
  804. /******/ // Return the exports of the module
  805. /******/ return module.exports;
  806. /******/ }
  807. /******/
  808. /************************************************************************/
  809. /******/ /* webpack/runtime/compat get default export */
  810. /******/ !function() {
  811. /******/ // getDefaultExport function for compatibility with non-harmony modules
  812. /******/ __webpack_require__.n = function(module) {
  813. /******/ var getter = module && module.__esModule ?
  814. /******/ function() { return module['default']; } :
  815. /******/ function() { return module; };
  816. /******/ __webpack_require__.d(getter, { a: getter });
  817. /******/ return getter;
  818. /******/ };
  819. /******/ }();
  820. /******/
  821. /******/ /* webpack/runtime/define property getters */
  822. /******/ !function() {
  823. /******/ // define getter functions for harmony exports
  824. /******/ __webpack_require__.d = function(exports, definition) {
  825. /******/ for(var key in definition) {
  826. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  827. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  828. /******/ }
  829. /******/ }
  830. /******/ };
  831. /******/ }();
  832. /******/
  833. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  834. /******/ !function() {
  835. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  836. /******/ }();
  837. /******/
  838. /******/ /* webpack/runtime/make namespace object */
  839. /******/ !function() {
  840. /******/ // define __esModule on exports
  841. /******/ __webpack_require__.r = function(exports) {
  842. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  843. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  844. /******/ }
  845. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  846. /******/ };
  847. /******/ }();
  848. /******/
  849. /************************************************************************/
  850. var __webpack_exports__ = {};
  851. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  852. !function() {
  853. "use strict";
  854. // ESM COMPAT FLAG
  855. __webpack_require__.r(__webpack_exports__);
  856. // EXPORTS
  857. __webpack_require__.d(__webpack_exports__, {
  858. "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; },
  859. "PluginSidebar": function() { return /* reexport */ PluginSidebarEditSite; },
  860. "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; },
  861. "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; },
  862. "__experimentalNavigationToggle": function() { return /* reexport */ navigation_toggle; },
  863. "initializeEditor": function() { return /* binding */ initializeEditor; },
  864. "reinitializeEditor": function() { return /* binding */ reinitializeEditor; }
  865. });
  866. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
  867. var actions_namespaceObject = {};
  868. __webpack_require__.r(actions_namespaceObject);
  869. __webpack_require__.d(actions_namespaceObject, {
  870. "disableComplementaryArea": function() { return disableComplementaryArea; },
  871. "enableComplementaryArea": function() { return enableComplementaryArea; },
  872. "pinItem": function() { return pinItem; },
  873. "setDefaultComplementaryArea": function() { return setDefaultComplementaryArea; },
  874. "setFeatureDefaults": function() { return setFeatureDefaults; },
  875. "setFeatureValue": function() { return setFeatureValue; },
  876. "toggleFeature": function() { return toggleFeature; },
  877. "unpinItem": function() { return unpinItem; }
  878. });
  879. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  880. var selectors_namespaceObject = {};
  881. __webpack_require__.r(selectors_namespaceObject);
  882. __webpack_require__.d(selectors_namespaceObject, {
  883. "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
  884. "isFeatureActive": function() { return isFeatureActive; },
  885. "isItemPinned": function() { return isItemPinned; }
  886. });
  887. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
  888. var store_actions_namespaceObject = {};
  889. __webpack_require__.r(store_actions_namespaceObject);
  890. __webpack_require__.d(store_actions_namespaceObject, {
  891. "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; },
  892. "addTemplate": function() { return addTemplate; },
  893. "closeGeneralSidebar": function() { return closeGeneralSidebar; },
  894. "openGeneralSidebar": function() { return openGeneralSidebar; },
  895. "openNavigationPanelToMenu": function() { return openNavigationPanelToMenu; },
  896. "removeTemplate": function() { return removeTemplate; },
  897. "revertTemplate": function() { return revertTemplate; },
  898. "setHomeTemplateId": function() { return setHomeTemplateId; },
  899. "setIsInserterOpened": function() { return setIsInserterOpened; },
  900. "setIsListViewOpened": function() { return setIsListViewOpened; },
  901. "setIsNavigationPanelOpened": function() { return setIsNavigationPanelOpened; },
  902. "setNavigationPanelActiveMenu": function() { return setNavigationPanelActiveMenu; },
  903. "setPage": function() { return setPage; },
  904. "setTemplate": function() { return setTemplate; },
  905. "setTemplatePart": function() { return setTemplatePart; },
  906. "switchEditorMode": function() { return switchEditorMode; },
  907. "toggleFeature": function() { return actions_toggleFeature; },
  908. "updateSettings": function() { return updateSettings; }
  909. });
  910. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
  911. var store_selectors_namespaceObject = {};
  912. __webpack_require__.r(store_selectors_namespaceObject);
  913. __webpack_require__.d(store_selectors_namespaceObject, {
  914. "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
  915. "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; },
  916. "__unstableGetPreference": function() { return __unstableGetPreference; },
  917. "getCanUserCreateMedia": function() { return getCanUserCreateMedia; },
  918. "getCurrentTemplateNavigationPanelSubMenu": function() { return getCurrentTemplateNavigationPanelSubMenu; },
  919. "getCurrentTemplateTemplateParts": function() { return getCurrentTemplateTemplateParts; },
  920. "getEditedPostId": function() { return getEditedPostId; },
  921. "getEditedPostType": function() { return getEditedPostType; },
  922. "getEditorMode": function() { return getEditorMode; },
  923. "getHomeTemplateId": function() { return getHomeTemplateId; },
  924. "getNavigationPanelActiveMenu": function() { return getNavigationPanelActiveMenu; },
  925. "getPage": function() { return getPage; },
  926. "getReusableBlocks": function() { return getReusableBlocks; },
  927. "getSettings": function() { return getSettings; },
  928. "isFeatureActive": function() { return selectors_isFeatureActive; },
  929. "isInserterOpened": function() { return isInserterOpened; },
  930. "isListViewOpened": function() { return isListViewOpened; },
  931. "isNavigationOpened": function() { return isNavigationOpened; }
  932. });
  933. ;// CONCATENATED MODULE: external ["wp","element"]
  934. var external_wp_element_namespaceObject = window["wp"]["element"];
  935. ;// CONCATENATED MODULE: external ["wp","blocks"]
  936. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  937. ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
  938. var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
  939. ;// CONCATENATED MODULE: external ["wp","data"]
  940. var external_wp_data_namespaceObject = window["wp"]["data"];
  941. ;// CONCATENATED MODULE: external ["wp","coreData"]
  942. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  943. ;// CONCATENATED MODULE: external ["wp","editor"]
  944. var external_wp_editor_namespaceObject = window["wp"]["editor"];
  945. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  946. function extends_extends() {
  947. extends_extends = Object.assign ? Object.assign.bind() : function (target) {
  948. for (var i = 1; i < arguments.length; i++) {
  949. var source = arguments[i];
  950. for (var key in source) {
  951. if (Object.prototype.hasOwnProperty.call(source, key)) {
  952. target[key] = source[key];
  953. }
  954. }
  955. }
  956. return target;
  957. };
  958. return extends_extends.apply(this, arguments);
  959. }
  960. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  961. var classnames = __webpack_require__(4403);
  962. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  963. ;// CONCATENATED MODULE: external ["wp","components"]
  964. var external_wp_components_namespaceObject = window["wp"]["components"];
  965. ;// CONCATENATED MODULE: external ["wp","i18n"]
  966. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  967. ;// CONCATENATED MODULE: external ["wp","primitives"]
  968. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  969. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  970. /**
  971. * WordPress dependencies
  972. */
  973. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  974. xmlns: "http://www.w3.org/2000/svg",
  975. viewBox: "0 0 24 24"
  976. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  977. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  978. }));
  979. /* harmony default export */ var library_check = (check);
  980. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
  981. /**
  982. * WordPress dependencies
  983. */
  984. const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  985. xmlns: "http://www.w3.org/2000/svg",
  986. viewBox: "0 0 24 24"
  987. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  988. d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
  989. }));
  990. /* harmony default export */ var star_filled = (starFilled);
  991. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
  992. /**
  993. * WordPress dependencies
  994. */
  995. const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  996. xmlns: "http://www.w3.org/2000/svg",
  997. viewBox: "0 0 24 24"
  998. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  999. fillRule: "evenodd",
  1000. d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
  1001. clipRule: "evenodd"
  1002. }));
  1003. /* harmony default export */ var star_empty = (starEmpty);
  1004. ;// CONCATENATED MODULE: external ["wp","viewport"]
  1005. var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
  1006. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  1007. /**
  1008. * WordPress dependencies
  1009. */
  1010. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1011. xmlns: "http://www.w3.org/2000/svg",
  1012. viewBox: "0 0 24 24"
  1013. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1014. 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"
  1015. }));
  1016. /* harmony default export */ var close_small = (closeSmall);
  1017. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  1018. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  1019. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  1020. ;// CONCATENATED MODULE: external ["wp","preferences"]
  1021. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  1022. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
  1023. /**
  1024. * WordPress dependencies
  1025. */
  1026. /**
  1027. * Set a default complementary area.
  1028. *
  1029. * @param {string} scope Complementary area scope.
  1030. * @param {string} area Area identifier.
  1031. *
  1032. * @return {Object} Action object.
  1033. */
  1034. const setDefaultComplementaryArea = (scope, area) => ({
  1035. type: 'SET_DEFAULT_COMPLEMENTARY_AREA',
  1036. scope,
  1037. area
  1038. });
  1039. /**
  1040. * Enable the complementary area.
  1041. *
  1042. * @param {string} scope Complementary area scope.
  1043. * @param {string} area Area identifier.
  1044. */
  1045. const enableComplementaryArea = (scope, area) => _ref => {
  1046. let {
  1047. registry,
  1048. dispatch
  1049. } = _ref;
  1050. // Return early if there's no area.
  1051. if (!area) {
  1052. return;
  1053. }
  1054. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  1055. if (!isComplementaryAreaVisible) {
  1056. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true);
  1057. }
  1058. dispatch({
  1059. type: 'ENABLE_COMPLEMENTARY_AREA',
  1060. scope,
  1061. area
  1062. });
  1063. };
  1064. /**
  1065. * Disable the complementary area.
  1066. *
  1067. * @param {string} scope Complementary area scope.
  1068. */
  1069. const disableComplementaryArea = scope => _ref2 => {
  1070. let {
  1071. registry
  1072. } = _ref2;
  1073. const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible');
  1074. if (isComplementaryAreaVisible) {
  1075. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false);
  1076. }
  1077. };
  1078. /**
  1079. * Pins an item.
  1080. *
  1081. * @param {string} scope Item scope.
  1082. * @param {string} item Item identifier.
  1083. *
  1084. * @return {Object} Action object.
  1085. */
  1086. const pinItem = (scope, item) => _ref3 => {
  1087. let {
  1088. registry
  1089. } = _ref3;
  1090. // Return early if there's no item.
  1091. if (!item) {
  1092. return;
  1093. }
  1094. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
  1095. if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
  1096. return;
  1097. }
  1098. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  1099. [item]: true
  1100. });
  1101. };
  1102. /**
  1103. * Unpins an item.
  1104. *
  1105. * @param {string} scope Item scope.
  1106. * @param {string} item Item identifier.
  1107. */
  1108. const unpinItem = (scope, item) => _ref4 => {
  1109. let {
  1110. registry
  1111. } = _ref4;
  1112. // Return early if there's no item.
  1113. if (!item) {
  1114. return;
  1115. }
  1116. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  1117. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  1118. [item]: false
  1119. });
  1120. };
  1121. /**
  1122. * Returns an action object used in signalling that a feature should be toggled.
  1123. *
  1124. * @param {string} scope The feature scope (e.g. core/edit-post).
  1125. * @param {string} featureName The feature name.
  1126. */
  1127. function toggleFeature(scope, featureName) {
  1128. return function (_ref5) {
  1129. let {
  1130. registry
  1131. } = _ref5;
  1132. external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
  1133. since: '6.0',
  1134. alternative: `dispatch( 'core/preferences' ).toggle`
  1135. });
  1136. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
  1137. };
  1138. }
  1139. /**
  1140. * Returns an action object used in signalling that a feature should be set to
  1141. * a true or false value
  1142. *
  1143. * @param {string} scope The feature scope (e.g. core/edit-post).
  1144. * @param {string} featureName The feature name.
  1145. * @param {boolean} value The value to set.
  1146. *
  1147. * @return {Object} Action object.
  1148. */
  1149. function setFeatureValue(scope, featureName, value) {
  1150. return function (_ref6) {
  1151. let {
  1152. registry
  1153. } = _ref6;
  1154. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
  1155. since: '6.0',
  1156. alternative: `dispatch( 'core/preferences' ).set`
  1157. });
  1158. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
  1159. };
  1160. }
  1161. /**
  1162. * Returns an action object used in signalling that defaults should be set for features.
  1163. *
  1164. * @param {string} scope The feature scope (e.g. core/edit-post).
  1165. * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
  1166. *
  1167. * @return {Object} Action object.
  1168. */
  1169. function setFeatureDefaults(scope, defaults) {
  1170. return function (_ref7) {
  1171. let {
  1172. registry
  1173. } = _ref7;
  1174. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
  1175. since: '6.0',
  1176. alternative: `dispatch( 'core/preferences' ).setDefaults`
  1177. });
  1178. registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
  1179. };
  1180. }
  1181. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  1182. /**
  1183. * WordPress dependencies
  1184. */
  1185. /**
  1186. * Returns the complementary area that is active in a given scope.
  1187. *
  1188. * @param {Object} state Global application state.
  1189. * @param {string} scope Item scope.
  1190. *
  1191. * @return {string | null | undefined} The complementary area that is active in the given scope.
  1192. */
  1193. const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  1194. var _state$complementaryA;
  1195. const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
  1196. // visibility, this is the vanilla default. Other code relies on this
  1197. // nuance in the return value.
  1198. if (isComplementaryAreaVisible === undefined) {
  1199. return undefined;
  1200. } // Return `null` to indicate the user hid the complementary area.
  1201. if (!isComplementaryAreaVisible) {
  1202. return null;
  1203. }
  1204. return state === null || state === void 0 ? void 0 : (_state$complementaryA = state.complementaryAreas) === null || _state$complementaryA === void 0 ? void 0 : _state$complementaryA[scope];
  1205. });
  1206. /**
  1207. * Returns a boolean indicating if an item is pinned or not.
  1208. *
  1209. * @param {Object} state Global application state.
  1210. * @param {string} scope Scope.
  1211. * @param {string} item Item to check.
  1212. *
  1213. * @return {boolean} True if the item is pinned and false otherwise.
  1214. */
  1215. const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
  1216. var _pinnedItems$item;
  1217. const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  1218. return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
  1219. });
  1220. /**
  1221. * Returns a boolean indicating whether a feature is active for a particular
  1222. * scope.
  1223. *
  1224. * @param {Object} state The store state.
  1225. * @param {string} scope The scope of the feature (e.g. core/edit-post).
  1226. * @param {string} featureName The name of the feature.
  1227. *
  1228. * @return {boolean} Is the feature enabled?
  1229. */
  1230. const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
  1231. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
  1232. since: '6.0',
  1233. alternative: `select( 'core/preferences' ).get( scope, featureName )`
  1234. });
  1235. return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
  1236. });
  1237. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js
  1238. /**
  1239. * WordPress dependencies
  1240. */
  1241. function complementaryAreas() {
  1242. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1243. let action = arguments.length > 1 ? arguments[1] : undefined;
  1244. switch (action.type) {
  1245. case 'SET_DEFAULT_COMPLEMENTARY_AREA':
  1246. {
  1247. const {
  1248. scope,
  1249. area
  1250. } = action; // If there's already an area, don't overwrite it.
  1251. if (state[scope]) {
  1252. return state;
  1253. }
  1254. return { ...state,
  1255. [scope]: area
  1256. };
  1257. }
  1258. case 'ENABLE_COMPLEMENTARY_AREA':
  1259. {
  1260. const {
  1261. scope,
  1262. area
  1263. } = action;
  1264. return { ...state,
  1265. [scope]: area
  1266. };
  1267. }
  1268. }
  1269. return state;
  1270. }
  1271. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  1272. complementaryAreas
  1273. }));
  1274. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
  1275. /**
  1276. * The identifier for the data store.
  1277. *
  1278. * @type {string}
  1279. */
  1280. const STORE_NAME = 'core/interface';
  1281. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
  1282. /**
  1283. * WordPress dependencies
  1284. */
  1285. /**
  1286. * Internal dependencies
  1287. */
  1288. /**
  1289. * Store definition for the interface namespace.
  1290. *
  1291. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  1292. *
  1293. * @type {Object}
  1294. */
  1295. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  1296. reducer: reducer,
  1297. actions: actions_namespaceObject,
  1298. selectors: selectors_namespaceObject
  1299. }); // Once we build a more generic persistence plugin that works across types of stores
  1300. // we'd be able to replace this with a register call.
  1301. (0,external_wp_data_namespaceObject.register)(store);
  1302. ;// CONCATENATED MODULE: external ["wp","plugins"]
  1303. var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
  1304. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
  1305. /**
  1306. * WordPress dependencies
  1307. */
  1308. /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  1309. return {
  1310. icon: ownProps.icon || context.icon,
  1311. identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
  1312. };
  1313. }));
  1314. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
  1315. /**
  1316. * WordPress dependencies
  1317. */
  1318. /**
  1319. * Internal dependencies
  1320. */
  1321. function ComplementaryAreaToggle(_ref) {
  1322. let {
  1323. as = external_wp_components_namespaceObject.Button,
  1324. scope,
  1325. identifier,
  1326. icon,
  1327. selectedIcon,
  1328. name,
  1329. ...props
  1330. } = _ref;
  1331. const ComponentToUse = as;
  1332. const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
  1333. const {
  1334. enableComplementaryArea,
  1335. disableComplementaryArea
  1336. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1337. return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, extends_extends({
  1338. icon: selectedIcon && isSelected ? selectedIcon : icon,
  1339. onClick: () => {
  1340. if (isSelected) {
  1341. disableComplementaryArea(scope);
  1342. } else {
  1343. enableComplementaryArea(scope, identifier);
  1344. }
  1345. }
  1346. }, props));
  1347. }
  1348. /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
  1349. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
  1350. /**
  1351. * External dependencies
  1352. */
  1353. /**
  1354. * WordPress dependencies
  1355. */
  1356. /**
  1357. * Internal dependencies
  1358. */
  1359. const ComplementaryAreaHeader = _ref => {
  1360. let {
  1361. smallScreenTitle,
  1362. children,
  1363. className,
  1364. toggleButtonProps
  1365. } = _ref;
  1366. const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({
  1367. icon: close_small
  1368. }, toggleButtonProps));
  1369. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  1370. className: "components-panel__header interface-complementary-area-header__small"
  1371. }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
  1372. className: "interface-complementary-area-header__small-title"
  1373. }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
  1374. className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
  1375. tabIndex: -1
  1376. }, children, toggleButton));
  1377. };
  1378. /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
  1379. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
  1380. /**
  1381. * WordPress dependencies
  1382. */
  1383. const noop = () => {};
  1384. function ActionItemSlot(_ref) {
  1385. let {
  1386. name,
  1387. as: Component = external_wp_components_namespaceObject.ButtonGroup,
  1388. fillProps = {},
  1389. bubblesVirtually,
  1390. ...props
  1391. } = _ref;
  1392. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  1393. name: name,
  1394. bubblesVirtually: bubblesVirtually,
  1395. fillProps: fillProps
  1396. }, fills => {
  1397. if (!external_wp_element_namespaceObject.Children.toArray(fills).length) {
  1398. return null;
  1399. } // Special handling exists for backward compatibility.
  1400. // It ensures that menu items created by plugin authors aren't
  1401. // duplicated with automatically injected menu items coming
  1402. // from pinnable plugin sidebars.
  1403. // @see https://github.com/WordPress/gutenberg/issues/14457
  1404. const initializedByPlugins = [];
  1405. external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
  1406. let {
  1407. props: {
  1408. __unstableExplicitMenuItem,
  1409. __unstableTarget
  1410. }
  1411. } = _ref2;
  1412. if (__unstableTarget && __unstableExplicitMenuItem) {
  1413. initializedByPlugins.push(__unstableTarget);
  1414. }
  1415. });
  1416. const children = external_wp_element_namespaceObject.Children.map(fills, child => {
  1417. if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
  1418. return null;
  1419. }
  1420. return child;
  1421. });
  1422. return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
  1423. });
  1424. }
  1425. function ActionItem(_ref3) {
  1426. let {
  1427. name,
  1428. as: Component = external_wp_components_namespaceObject.Button,
  1429. onClick,
  1430. ...props
  1431. } = _ref3;
  1432. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  1433. name: name
  1434. }, _ref4 => {
  1435. let {
  1436. onClick: fpOnClick
  1437. } = _ref4;
  1438. return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({
  1439. onClick: onClick || fpOnClick ? function () {
  1440. (onClick || noop)(...arguments);
  1441. (fpOnClick || noop)(...arguments);
  1442. } : undefined
  1443. }, props));
  1444. });
  1445. }
  1446. ActionItem.Slot = ActionItemSlot;
  1447. /* harmony default export */ var action_item = (ActionItem);
  1448. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
  1449. /**
  1450. * WordPress dependencies
  1451. */
  1452. /**
  1453. * Internal dependencies
  1454. */
  1455. const PluginsMenuItem = _ref => {
  1456. let {
  1457. // Menu item is marked with unstable prop for backward compatibility.
  1458. // They are removed so they don't leak to DOM elements.
  1459. // @see https://github.com/WordPress/gutenberg/issues/14457
  1460. __unstableExplicitMenuItem,
  1461. __unstableTarget,
  1462. ...restProps
  1463. } = _ref;
  1464. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, restProps);
  1465. };
  1466. function ComplementaryAreaMoreMenuItem(_ref2) {
  1467. let {
  1468. scope,
  1469. target,
  1470. __unstableExplicitMenuItem,
  1471. ...props
  1472. } = _ref2;
  1473. return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, extends_extends({
  1474. as: toggleProps => {
  1475. return (0,external_wp_element_namespaceObject.createElement)(action_item, extends_extends({
  1476. __unstableExplicitMenuItem: __unstableExplicitMenuItem,
  1477. __unstableTarget: `${scope}/${target}`,
  1478. as: PluginsMenuItem,
  1479. name: `${scope}/plugin-more-menu`
  1480. }, toggleProps));
  1481. },
  1482. role: "menuitemcheckbox",
  1483. selectedIcon: library_check,
  1484. name: target,
  1485. scope: scope
  1486. }, props));
  1487. }
  1488. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
  1489. /**
  1490. * External dependencies
  1491. */
  1492. /**
  1493. * WordPress dependencies
  1494. */
  1495. function PinnedItems(_ref) {
  1496. let {
  1497. scope,
  1498. ...props
  1499. } = _ref;
  1500. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, extends_extends({
  1501. name: `PinnedItems/${scope}`
  1502. }, props));
  1503. }
  1504. function PinnedItemsSlot(_ref2) {
  1505. let {
  1506. scope,
  1507. className,
  1508. ...props
  1509. } = _ref2;
  1510. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({
  1511. name: `PinnedItems/${scope}`
  1512. }, props), fills => (fills === null || fills === void 0 ? void 0 : fills.length) > 0 && (0,external_wp_element_namespaceObject.createElement)("div", {
  1513. className: classnames_default()(className, 'interface-pinned-items')
  1514. }, fills));
  1515. }
  1516. PinnedItems.Slot = PinnedItemsSlot;
  1517. /* harmony default export */ var pinned_items = (PinnedItems);
  1518. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
  1519. /**
  1520. * External dependencies
  1521. */
  1522. /**
  1523. * WordPress dependencies
  1524. */
  1525. /**
  1526. * Internal dependencies
  1527. */
  1528. function ComplementaryAreaSlot(_ref) {
  1529. let {
  1530. scope,
  1531. ...props
  1532. } = _ref;
  1533. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, extends_extends({
  1534. name: `ComplementaryArea/${scope}`
  1535. }, props));
  1536. }
  1537. function ComplementaryAreaFill(_ref2) {
  1538. let {
  1539. scope,
  1540. children,
  1541. className
  1542. } = _ref2;
  1543. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  1544. name: `ComplementaryArea/${scope}`
  1545. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  1546. className: className
  1547. }, children));
  1548. }
  1549. function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
  1550. const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  1551. const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  1552. const {
  1553. enableComplementaryArea,
  1554. disableComplementaryArea
  1555. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1556. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1557. // If the complementary area is active and the editor is switching from a big to a small window size.
  1558. if (isActive && isSmall && !previousIsSmall.current) {
  1559. // Disable the complementary area.
  1560. disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
  1561. shouldOpenWhenNotSmall.current = true;
  1562. } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
  1563. // and we are going from a small to big window size.
  1564. shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
  1565. // Remove the flag indicating the complementary area should be enabled.
  1566. shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
  1567. enableComplementaryArea(scope, identifier);
  1568. } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
  1569. // remove the flag.
  1570. shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
  1571. shouldOpenWhenNotSmall.current = false;
  1572. }
  1573. if (isSmall !== previousIsSmall.current) {
  1574. previousIsSmall.current = isSmall;
  1575. }
  1576. }, [isActive, isSmall, scope, identifier, activeArea]);
  1577. }
  1578. function ComplementaryArea(_ref3) {
  1579. let {
  1580. children,
  1581. className,
  1582. closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
  1583. identifier,
  1584. header,
  1585. headerClassName,
  1586. icon,
  1587. isPinnable = true,
  1588. panelClassName,
  1589. scope,
  1590. name,
  1591. smallScreenTitle,
  1592. title,
  1593. toggleShortcut,
  1594. isActiveByDefault,
  1595. showIconLabels = false
  1596. } = _ref3;
  1597. const {
  1598. isActive,
  1599. isPinned,
  1600. activeArea,
  1601. isSmall,
  1602. isLarge
  1603. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  1604. const {
  1605. getActiveComplementaryArea,
  1606. isItemPinned
  1607. } = select(store);
  1608. const _activeArea = getActiveComplementaryArea(scope);
  1609. return {
  1610. isActive: _activeArea === identifier,
  1611. isPinned: isItemPinned(scope, identifier),
  1612. activeArea: _activeArea,
  1613. isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
  1614. isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
  1615. };
  1616. }, [identifier, scope]);
  1617. useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
  1618. const {
  1619. enableComplementaryArea,
  1620. disableComplementaryArea,
  1621. pinItem,
  1622. unpinItem
  1623. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1624. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1625. if (isActiveByDefault && activeArea === undefined && !isSmall) {
  1626. enableComplementaryArea(scope, identifier);
  1627. }
  1628. }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
  1629. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
  1630. scope: scope
  1631. }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  1632. scope: scope,
  1633. identifier: identifier,
  1634. isPressed: isActive && (!showIconLabels || isLarge),
  1635. "aria-expanded": isActive,
  1636. label: title,
  1637. icon: showIconLabels ? library_check : icon,
  1638. showTooltip: !showIconLabels,
  1639. variant: showIconLabels ? 'tertiary' : undefined
  1640. })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
  1641. target: name,
  1642. scope: scope,
  1643. icon: icon
  1644. }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
  1645. className: classnames_default()('interface-complementary-area', className),
  1646. scope: scope
  1647. }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
  1648. className: headerClassName,
  1649. closeLabel: closeLabel,
  1650. onClose: () => disableComplementaryArea(scope),
  1651. smallScreenTitle: smallScreenTitle,
  1652. toggleButtonProps: {
  1653. label: closeLabel,
  1654. shortcut: toggleShortcut,
  1655. scope,
  1656. identifier
  1657. }
  1658. }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  1659. className: "interface-complementary-area__pin-unpin-item",
  1660. icon: isPinned ? star_filled : star_empty,
  1661. label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
  1662. onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
  1663. isPressed: isPinned,
  1664. "aria-expanded": isPinned
  1665. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  1666. className: panelClassName
  1667. }, children)));
  1668. }
  1669. const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
  1670. ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
  1671. /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
  1672. ;// CONCATENATED MODULE: external ["wp","compose"]
  1673. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  1674. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
  1675. /**
  1676. * External dependencies
  1677. */
  1678. /**
  1679. * WordPress dependencies
  1680. */
  1681. function useHTMLClass(className) {
  1682. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1683. const element = document && document.querySelector(`html:not(.${className})`);
  1684. if (!element) {
  1685. return;
  1686. }
  1687. element.classList.toggle(className);
  1688. return () => {
  1689. element.classList.toggle(className);
  1690. };
  1691. }, [className]);
  1692. }
  1693. function InterfaceSkeleton(_ref, ref) {
  1694. let {
  1695. footer,
  1696. header,
  1697. sidebar,
  1698. secondarySidebar,
  1699. notices,
  1700. content,
  1701. drawer,
  1702. actions,
  1703. labels,
  1704. className,
  1705. shortcuts
  1706. } = _ref;
  1707. const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
  1708. useHTMLClass('interface-interface-skeleton__html-container');
  1709. const defaultLabels = {
  1710. /* translators: accessibility text for the nav bar landmark region. */
  1711. drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
  1712. /* translators: accessibility text for the top bar landmark region. */
  1713. header: (0,external_wp_i18n_namespaceObject.__)('Header'),
  1714. /* translators: accessibility text for the content landmark region. */
  1715. body: (0,external_wp_i18n_namespaceObject.__)('Content'),
  1716. /* translators: accessibility text for the secondary sidebar landmark region. */
  1717. secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
  1718. /* translators: accessibility text for the settings landmark region. */
  1719. sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  1720. /* translators: accessibility text for the publish landmark region. */
  1721. actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
  1722. /* translators: accessibility text for the footer landmark region. */
  1723. footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
  1724. };
  1725. const mergedLabels = { ...defaultLabels,
  1726. ...labels
  1727. };
  1728. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, navigateRegionsProps, {
  1729. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
  1730. className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
  1731. }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1732. className: "interface-interface-skeleton__drawer",
  1733. role: "region",
  1734. "aria-label": mergedLabels.drawer,
  1735. tabIndex: "-1"
  1736. }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
  1737. className: "interface-interface-skeleton__editor"
  1738. }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
  1739. className: "interface-interface-skeleton__header",
  1740. role: "region",
  1741. "aria-label": mergedLabels.header,
  1742. tabIndex: "-1"
  1743. }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
  1744. className: "interface-interface-skeleton__body"
  1745. }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1746. className: "interface-interface-skeleton__secondary-sidebar",
  1747. role: "region",
  1748. "aria-label": mergedLabels.secondarySidebar,
  1749. tabIndex: "-1"
  1750. }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
  1751. className: "interface-interface-skeleton__notices"
  1752. }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
  1753. className: "interface-interface-skeleton__content",
  1754. role: "region",
  1755. "aria-label": mergedLabels.body,
  1756. tabIndex: "-1"
  1757. }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1758. className: "interface-interface-skeleton__sidebar",
  1759. role: "region",
  1760. "aria-label": mergedLabels.sidebar,
  1761. tabIndex: "-1"
  1762. }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
  1763. className: "interface-interface-skeleton__actions",
  1764. role: "region",
  1765. "aria-label": mergedLabels.actions,
  1766. tabIndex: "-1"
  1767. }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1768. className: "interface-interface-skeleton__footer",
  1769. role: "region",
  1770. "aria-label": mergedLabels.footer,
  1771. tabIndex: "-1"
  1772. }, footer));
  1773. }
  1774. /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
  1775. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  1776. /**
  1777. * WordPress dependencies
  1778. */
  1779. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1780. xmlns: "http://www.w3.org/2000/svg",
  1781. viewBox: "0 0 24 24"
  1782. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1783. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  1784. }));
  1785. /* harmony default export */ var more_vertical = (moreVertical);
  1786. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
  1787. /**
  1788. * External dependencies
  1789. */
  1790. /**
  1791. * WordPress dependencies
  1792. */
  1793. function MoreMenuDropdown(_ref) {
  1794. let {
  1795. as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
  1796. className,
  1797. /* translators: button label text should, if possible, be under 16 characters. */
  1798. label = (0,external_wp_i18n_namespaceObject.__)('Options'),
  1799. popoverProps,
  1800. toggleProps,
  1801. children
  1802. } = _ref;
  1803. return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
  1804. className: classnames_default()('interface-more-menu-dropdown', className),
  1805. icon: more_vertical,
  1806. label: label,
  1807. popoverProps: {
  1808. position: 'bottom left',
  1809. ...popoverProps,
  1810. className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
  1811. },
  1812. toggleProps: {
  1813. tooltipPosition: 'bottom',
  1814. ...toggleProps
  1815. }
  1816. }, onClose => children(onClose));
  1817. }
  1818. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js
  1819. /**
  1820. * WordPress dependencies
  1821. */
  1822. function PreferencesModal(_ref) {
  1823. let {
  1824. closeModal,
  1825. children
  1826. } = _ref;
  1827. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  1828. className: "interface-preferences-modal",
  1829. title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
  1830. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  1831. onRequestClose: closeModal
  1832. }, children);
  1833. }
  1834. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  1835. /**
  1836. * WordPress dependencies
  1837. */
  1838. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  1839. /**
  1840. * Return an SVG icon.
  1841. *
  1842. * @param {IconProps} props icon is the SVG component to render
  1843. * size is a number specifiying the icon size in pixels
  1844. * Other props will be passed to wrapped SVG component
  1845. *
  1846. * @return {JSX.Element} Icon component
  1847. */
  1848. function Icon(_ref) {
  1849. let {
  1850. icon,
  1851. size = 24,
  1852. ...props
  1853. } = _ref;
  1854. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  1855. width: size,
  1856. height: size,
  1857. ...props
  1858. });
  1859. }
  1860. /* harmony default export */ var icon = (Icon);
  1861. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
  1862. /**
  1863. * WordPress dependencies
  1864. */
  1865. const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1866. xmlns: "http://www.w3.org/2000/svg",
  1867. viewBox: "0 0 24 24"
  1868. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1869. d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
  1870. }));
  1871. /* harmony default export */ var chevron_left = (chevronLeft);
  1872. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
  1873. /**
  1874. * WordPress dependencies
  1875. */
  1876. const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1877. xmlns: "http://www.w3.org/2000/svg",
  1878. viewBox: "0 0 24 24"
  1879. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1880. d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
  1881. }));
  1882. /* harmony default export */ var chevron_right = (chevronRight);
  1883. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js
  1884. /**
  1885. * WordPress dependencies
  1886. */
  1887. const PREFERENCES_MENU = 'preferences-menu';
  1888. function PreferencesModalTabs(_ref) {
  1889. let {
  1890. sections
  1891. } = _ref;
  1892. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components
  1893. // between small and large viewports.
  1894. const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
  1895. /**
  1896. * Create helper objects from `sections` for easier data handling.
  1897. * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
  1898. * is used for easier access to active tab's content.
  1899. */
  1900. const {
  1901. tabs,
  1902. sectionsContentMap
  1903. } = (0,external_wp_element_namespaceObject.useMemo)(() => {
  1904. let mappedTabs = {
  1905. tabs: [],
  1906. sectionsContentMap: {}
  1907. };
  1908. if (sections.length) {
  1909. mappedTabs = sections.reduce((accumulator, _ref2) => {
  1910. let {
  1911. name,
  1912. tabLabel: title,
  1913. content
  1914. } = _ref2;
  1915. accumulator.tabs.push({
  1916. name,
  1917. title
  1918. });
  1919. accumulator.sectionsContentMap[name] = content;
  1920. return accumulator;
  1921. }, {
  1922. tabs: [],
  1923. sectionsContentMap: {}
  1924. });
  1925. }
  1926. return mappedTabs;
  1927. }, [sections]);
  1928. const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
  1929. let modalContent; // We render different components based on the viewport size.
  1930. if (isLargeViewport) {
  1931. modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
  1932. className: "interface-preferences__tabs",
  1933. tabs: tabs,
  1934. initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
  1935. onSelect: setActiveMenu,
  1936. orientation: "vertical"
  1937. }, getCurrentTab);
  1938. } else {
  1939. modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
  1940. initialPath: "/",
  1941. className: "interface-preferences__provider"
  1942. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
  1943. path: "/"
  1944. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  1945. isBorderless: true,
  1946. size: "small"
  1947. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => {
  1948. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
  1949. key: tab.name,
  1950. path: tab.name,
  1951. as: external_wp_components_namespaceObject.__experimentalItem,
  1952. isAction: true
  1953. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  1954. justify: "space-between"
  1955. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  1956. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
  1957. }))));
  1958. }))))), sections.length && sections.map(section => {
  1959. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
  1960. key: `${section.name}-menu`,
  1961. path: section.name
  1962. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  1963. isBorderless: true,
  1964. size: "large"
  1965. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
  1966. isBorderless: false,
  1967. justify: "left",
  1968. size: "small",
  1969. gap: "6"
  1970. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
  1971. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
  1972. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
  1973. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  1974. size: "16"
  1975. }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
  1976. }));
  1977. }
  1978. return modalContent;
  1979. }
  1980. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js
  1981. const Section = _ref => {
  1982. let {
  1983. description,
  1984. title,
  1985. children
  1986. } = _ref;
  1987. return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
  1988. className: "interface-preferences-modal__section"
  1989. }, (0,external_wp_element_namespaceObject.createElement)("legend", {
  1990. className: "interface-preferences-modal__section-legend"
  1991. }, (0,external_wp_element_namespaceObject.createElement)("h2", {
  1992. className: "interface-preferences-modal__section-title"
  1993. }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", {
  1994. className: "interface-preferences-modal__section-description"
  1995. }, description)), children);
  1996. };
  1997. /* harmony default export */ var preferences_modal_section = (Section);
  1998. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js
  1999. /**
  2000. * WordPress dependencies
  2001. */
  2002. function BaseOption(_ref) {
  2003. let {
  2004. help,
  2005. label,
  2006. isChecked,
  2007. onChange,
  2008. children
  2009. } = _ref;
  2010. return (0,external_wp_element_namespaceObject.createElement)("div", {
  2011. className: "interface-preferences-modal__option"
  2012. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
  2013. __nextHasNoMarginBottom: true,
  2014. help: help,
  2015. label: label,
  2016. checked: isChecked,
  2017. onChange: onChange
  2018. }), children);
  2019. }
  2020. /* harmony default export */ var preferences_modal_base_option = (BaseOption);
  2021. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
  2022. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
  2023. ;// CONCATENATED MODULE: external ["wp","url"]
  2024. var external_wp_url_namespaceObject = window["wp"]["url"];
  2025. ;// CONCATENATED MODULE: external ["wp","hooks"]
  2026. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  2027. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  2028. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  2029. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/components.js
  2030. /**
  2031. * WordPress dependencies
  2032. */
  2033. (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-site/components/media-upload', () => external_wp_mediaUtils_namespaceObject.MediaUpload);
  2034. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  2035. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  2036. ;// CONCATENATED MODULE: ./node_modules/history/index.js
  2037. /**
  2038. * Actions represent the type of change to a location value.
  2039. *
  2040. * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
  2041. */
  2042. var Action;
  2043. (function (Action) {
  2044. /**
  2045. * A POP indicates a change to an arbitrary index in the history stack, such
  2046. * as a back or forward navigation. It does not describe the direction of the
  2047. * navigation, only that the current index changed.
  2048. *
  2049. * Note: This is the default action for newly created history objects.
  2050. */
  2051. Action["Pop"] = "POP";
  2052. /**
  2053. * A PUSH indicates a new entry being added to the history stack, such as when
  2054. * a link is clicked and a new page loads. When this happens, all subsequent
  2055. * entries in the stack are lost.
  2056. */
  2057. Action["Push"] = "PUSH";
  2058. /**
  2059. * A REPLACE indicates the entry at the current index in the history stack
  2060. * being replaced by a new one.
  2061. */
  2062. Action["Replace"] = "REPLACE";
  2063. })(Action || (Action = {}));
  2064. var readOnly = false ? 0 : function (obj) {
  2065. return obj;
  2066. };
  2067. function warning(cond, message) {
  2068. if (!cond) {
  2069. // eslint-disable-next-line no-console
  2070. if (typeof console !== 'undefined') console.warn(message);
  2071. try {
  2072. // Welcome to debugging history!
  2073. //
  2074. // This error is thrown as a convenience so you can more easily
  2075. // find the source for a warning that appears in the console by
  2076. // enabling "pause on exceptions" in your JavaScript debugger.
  2077. throw new Error(message); // eslint-disable-next-line no-empty
  2078. } catch (e) {}
  2079. }
  2080. }
  2081. var BeforeUnloadEventType = 'beforeunload';
  2082. var HashChangeEventType = 'hashchange';
  2083. var PopStateEventType = 'popstate';
  2084. /**
  2085. * Browser history stores the location in regular URLs. This is the standard for
  2086. * most web apps, but it requires some configuration on the server to ensure you
  2087. * serve the same app at multiple URLs.
  2088. *
  2089. * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
  2090. */
  2091. function createBrowserHistory(options) {
  2092. if (options === void 0) {
  2093. options = {};
  2094. }
  2095. var _options = options,
  2096. _options$window = _options.window,
  2097. window = _options$window === void 0 ? document.defaultView : _options$window;
  2098. var globalHistory = window.history;
  2099. function getIndexAndLocation() {
  2100. var _window$location = window.location,
  2101. pathname = _window$location.pathname,
  2102. search = _window$location.search,
  2103. hash = _window$location.hash;
  2104. var state = globalHistory.state || {};
  2105. return [state.idx, readOnly({
  2106. pathname: pathname,
  2107. search: search,
  2108. hash: hash,
  2109. state: state.usr || null,
  2110. key: state.key || 'default'
  2111. })];
  2112. }
  2113. var blockedPopTx = null;
  2114. function handlePop() {
  2115. if (blockedPopTx) {
  2116. blockers.call(blockedPopTx);
  2117. blockedPopTx = null;
  2118. } else {
  2119. var nextAction = Action.Pop;
  2120. var _getIndexAndLocation = getIndexAndLocation(),
  2121. nextIndex = _getIndexAndLocation[0],
  2122. nextLocation = _getIndexAndLocation[1];
  2123. if (blockers.length) {
  2124. if (nextIndex != null) {
  2125. var delta = index - nextIndex;
  2126. if (delta) {
  2127. // Revert the POP
  2128. blockedPopTx = {
  2129. action: nextAction,
  2130. location: nextLocation,
  2131. retry: function retry() {
  2132. go(delta * -1);
  2133. }
  2134. };
  2135. go(delta);
  2136. }
  2137. } else {
  2138. // Trying to POP to a location with no index. We did not create
  2139. // this location, so we can't effectively block the navigation.
  2140. false ? 0 : void 0;
  2141. }
  2142. } else {
  2143. applyTx(nextAction);
  2144. }
  2145. }
  2146. }
  2147. window.addEventListener(PopStateEventType, handlePop);
  2148. var action = Action.Pop;
  2149. var _getIndexAndLocation2 = getIndexAndLocation(),
  2150. index = _getIndexAndLocation2[0],
  2151. location = _getIndexAndLocation2[1];
  2152. var listeners = createEvents();
  2153. var blockers = createEvents();
  2154. if (index == null) {
  2155. index = 0;
  2156. globalHistory.replaceState(extends_extends({}, globalHistory.state, {
  2157. idx: index
  2158. }), '');
  2159. }
  2160. function createHref(to) {
  2161. return typeof to === 'string' ? to : createPath(to);
  2162. } // state defaults to `null` because `window.history.state` does
  2163. function getNextLocation(to, state) {
  2164. if (state === void 0) {
  2165. state = null;
  2166. }
  2167. return readOnly(extends_extends({
  2168. pathname: location.pathname,
  2169. hash: '',
  2170. search: ''
  2171. }, typeof to === 'string' ? parsePath(to) : to, {
  2172. state: state,
  2173. key: createKey()
  2174. }));
  2175. }
  2176. function getHistoryStateAndUrl(nextLocation, index) {
  2177. return [{
  2178. usr: nextLocation.state,
  2179. key: nextLocation.key,
  2180. idx: index
  2181. }, createHref(nextLocation)];
  2182. }
  2183. function allowTx(action, location, retry) {
  2184. return !blockers.length || (blockers.call({
  2185. action: action,
  2186. location: location,
  2187. retry: retry
  2188. }), false);
  2189. }
  2190. function applyTx(nextAction) {
  2191. action = nextAction;
  2192. var _getIndexAndLocation3 = getIndexAndLocation();
  2193. index = _getIndexAndLocation3[0];
  2194. location = _getIndexAndLocation3[1];
  2195. listeners.call({
  2196. action: action,
  2197. location: location
  2198. });
  2199. }
  2200. function push(to, state) {
  2201. var nextAction = Action.Push;
  2202. var nextLocation = getNextLocation(to, state);
  2203. function retry() {
  2204. push(to, state);
  2205. }
  2206. if (allowTx(nextAction, nextLocation, retry)) {
  2207. var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),
  2208. historyState = _getHistoryStateAndUr[0],
  2209. url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading
  2210. // try...catch because iOS limits us to 100 pushState calls :/
  2211. try {
  2212. globalHistory.pushState(historyState, '', url);
  2213. } catch (error) {
  2214. // They are going to lose state here, but there is no real
  2215. // way to warn them about it since the page will refresh...
  2216. window.location.assign(url);
  2217. }
  2218. applyTx(nextAction);
  2219. }
  2220. }
  2221. function replace(to, state) {
  2222. var nextAction = Action.Replace;
  2223. var nextLocation = getNextLocation(to, state);
  2224. function retry() {
  2225. replace(to, state);
  2226. }
  2227. if (allowTx(nextAction, nextLocation, retry)) {
  2228. var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),
  2229. historyState = _getHistoryStateAndUr2[0],
  2230. url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading
  2231. globalHistory.replaceState(historyState, '', url);
  2232. applyTx(nextAction);
  2233. }
  2234. }
  2235. function go(delta) {
  2236. globalHistory.go(delta);
  2237. }
  2238. var history = {
  2239. get action() {
  2240. return action;
  2241. },
  2242. get location() {
  2243. return location;
  2244. },
  2245. createHref: createHref,
  2246. push: push,
  2247. replace: replace,
  2248. go: go,
  2249. back: function back() {
  2250. go(-1);
  2251. },
  2252. forward: function forward() {
  2253. go(1);
  2254. },
  2255. listen: function listen(listener) {
  2256. return listeners.push(listener);
  2257. },
  2258. block: function block(blocker) {
  2259. var unblock = blockers.push(blocker);
  2260. if (blockers.length === 1) {
  2261. window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
  2262. }
  2263. return function () {
  2264. unblock(); // Remove the beforeunload listener so the document may
  2265. // still be salvageable in the pagehide event.
  2266. // See https://html.spec.whatwg.org/#unloading-documents
  2267. if (!blockers.length) {
  2268. window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
  2269. }
  2270. };
  2271. }
  2272. };
  2273. return history;
  2274. }
  2275. /**
  2276. * Hash history stores the location in window.location.hash. This makes it ideal
  2277. * for situations where you don't want to send the location to the server for
  2278. * some reason, either because you do cannot configure it or the URL space is
  2279. * reserved for something else.
  2280. *
  2281. * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
  2282. */
  2283. function createHashHistory(options) {
  2284. if (options === void 0) {
  2285. options = {};
  2286. }
  2287. var _options2 = options,
  2288. _options2$window = _options2.window,
  2289. window = _options2$window === void 0 ? document.defaultView : _options2$window;
  2290. var globalHistory = window.history;
  2291. function getIndexAndLocation() {
  2292. var _parsePath = parsePath(window.location.hash.substr(1)),
  2293. _parsePath$pathname = _parsePath.pathname,
  2294. pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,
  2295. _parsePath$search = _parsePath.search,
  2296. search = _parsePath$search === void 0 ? '' : _parsePath$search,
  2297. _parsePath$hash = _parsePath.hash,
  2298. hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;
  2299. var state = globalHistory.state || {};
  2300. return [state.idx, readOnly({
  2301. pathname: pathname,
  2302. search: search,
  2303. hash: hash,
  2304. state: state.usr || null,
  2305. key: state.key || 'default'
  2306. })];
  2307. }
  2308. var blockedPopTx = null;
  2309. function handlePop() {
  2310. if (blockedPopTx) {
  2311. blockers.call(blockedPopTx);
  2312. blockedPopTx = null;
  2313. } else {
  2314. var nextAction = Action.Pop;
  2315. var _getIndexAndLocation4 = getIndexAndLocation(),
  2316. nextIndex = _getIndexAndLocation4[0],
  2317. nextLocation = _getIndexAndLocation4[1];
  2318. if (blockers.length) {
  2319. if (nextIndex != null) {
  2320. var delta = index - nextIndex;
  2321. if (delta) {
  2322. // Revert the POP
  2323. blockedPopTx = {
  2324. action: nextAction,
  2325. location: nextLocation,
  2326. retry: function retry() {
  2327. go(delta * -1);
  2328. }
  2329. };
  2330. go(delta);
  2331. }
  2332. } else {
  2333. // Trying to POP to a location with no index. We did not create
  2334. // this location, so we can't effectively block the navigation.
  2335. false ? 0 : void 0;
  2336. }
  2337. } else {
  2338. applyTx(nextAction);
  2339. }
  2340. }
  2341. }
  2342. window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge
  2343. // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event
  2344. window.addEventListener(HashChangeEventType, function () {
  2345. var _getIndexAndLocation5 = getIndexAndLocation(),
  2346. nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.
  2347. if (createPath(nextLocation) !== createPath(location)) {
  2348. handlePop();
  2349. }
  2350. });
  2351. var action = Action.Pop;
  2352. var _getIndexAndLocation6 = getIndexAndLocation(),
  2353. index = _getIndexAndLocation6[0],
  2354. location = _getIndexAndLocation6[1];
  2355. var listeners = createEvents();
  2356. var blockers = createEvents();
  2357. if (index == null) {
  2358. index = 0;
  2359. globalHistory.replaceState(_extends({}, globalHistory.state, {
  2360. idx: index
  2361. }), '');
  2362. }
  2363. function getBaseHref() {
  2364. var base = document.querySelector('base');
  2365. var href = '';
  2366. if (base && base.getAttribute('href')) {
  2367. var url = window.location.href;
  2368. var hashIndex = url.indexOf('#');
  2369. href = hashIndex === -1 ? url : url.slice(0, hashIndex);
  2370. }
  2371. return href;
  2372. }
  2373. function createHref(to) {
  2374. return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));
  2375. }
  2376. function getNextLocation(to, state) {
  2377. if (state === void 0) {
  2378. state = null;
  2379. }
  2380. return readOnly(_extends({
  2381. pathname: location.pathname,
  2382. hash: '',
  2383. search: ''
  2384. }, typeof to === 'string' ? parsePath(to) : to, {
  2385. state: state,
  2386. key: createKey()
  2387. }));
  2388. }
  2389. function getHistoryStateAndUrl(nextLocation, index) {
  2390. return [{
  2391. usr: nextLocation.state,
  2392. key: nextLocation.key,
  2393. idx: index
  2394. }, createHref(nextLocation)];
  2395. }
  2396. function allowTx(action, location, retry) {
  2397. return !blockers.length || (blockers.call({
  2398. action: action,
  2399. location: location,
  2400. retry: retry
  2401. }), false);
  2402. }
  2403. function applyTx(nextAction) {
  2404. action = nextAction;
  2405. var _getIndexAndLocation7 = getIndexAndLocation();
  2406. index = _getIndexAndLocation7[0];
  2407. location = _getIndexAndLocation7[1];
  2408. listeners.call({
  2409. action: action,
  2410. location: location
  2411. });
  2412. }
  2413. function push(to, state) {
  2414. var nextAction = Action.Push;
  2415. var nextLocation = getNextLocation(to, state);
  2416. function retry() {
  2417. push(to, state);
  2418. }
  2419. false ? 0 : void 0;
  2420. if (allowTx(nextAction, nextLocation, retry)) {
  2421. var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),
  2422. historyState = _getHistoryStateAndUr3[0],
  2423. url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading
  2424. // try...catch because iOS limits us to 100 pushState calls :/
  2425. try {
  2426. globalHistory.pushState(historyState, '', url);
  2427. } catch (error) {
  2428. // They are going to lose state here, but there is no real
  2429. // way to warn them about it since the page will refresh...
  2430. window.location.assign(url);
  2431. }
  2432. applyTx(nextAction);
  2433. }
  2434. }
  2435. function replace(to, state) {
  2436. var nextAction = Action.Replace;
  2437. var nextLocation = getNextLocation(to, state);
  2438. function retry() {
  2439. replace(to, state);
  2440. }
  2441. false ? 0 : void 0;
  2442. if (allowTx(nextAction, nextLocation, retry)) {
  2443. var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),
  2444. historyState = _getHistoryStateAndUr4[0],
  2445. url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading
  2446. globalHistory.replaceState(historyState, '', url);
  2447. applyTx(nextAction);
  2448. }
  2449. }
  2450. function go(delta) {
  2451. globalHistory.go(delta);
  2452. }
  2453. var history = {
  2454. get action() {
  2455. return action;
  2456. },
  2457. get location() {
  2458. return location;
  2459. },
  2460. createHref: createHref,
  2461. push: push,
  2462. replace: replace,
  2463. go: go,
  2464. back: function back() {
  2465. go(-1);
  2466. },
  2467. forward: function forward() {
  2468. go(1);
  2469. },
  2470. listen: function listen(listener) {
  2471. return listeners.push(listener);
  2472. },
  2473. block: function block(blocker) {
  2474. var unblock = blockers.push(blocker);
  2475. if (blockers.length === 1) {
  2476. window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
  2477. }
  2478. return function () {
  2479. unblock(); // Remove the beforeunload listener so the document may
  2480. // still be salvageable in the pagehide event.
  2481. // See https://html.spec.whatwg.org/#unloading-documents
  2482. if (!blockers.length) {
  2483. window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
  2484. }
  2485. };
  2486. }
  2487. };
  2488. return history;
  2489. }
  2490. /**
  2491. * Memory history stores the current location in memory. It is designed for use
  2492. * in stateful non-browser environments like tests and React Native.
  2493. *
  2494. * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory
  2495. */
  2496. function createMemoryHistory(options) {
  2497. if (options === void 0) {
  2498. options = {};
  2499. }
  2500. var _options3 = options,
  2501. _options3$initialEntr = _options3.initialEntries,
  2502. initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,
  2503. initialIndex = _options3.initialIndex;
  2504. var entries = initialEntries.map(function (entry) {
  2505. var location = readOnly(_extends({
  2506. pathname: '/',
  2507. search: '',
  2508. hash: '',
  2509. state: null,
  2510. key: createKey()
  2511. }, typeof entry === 'string' ? parsePath(entry) : entry));
  2512. false ? 0 : void 0;
  2513. return location;
  2514. });
  2515. var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
  2516. var action = Action.Pop;
  2517. var location = entries[index];
  2518. var listeners = createEvents();
  2519. var blockers = createEvents();
  2520. function createHref(to) {
  2521. return typeof to === 'string' ? to : createPath(to);
  2522. }
  2523. function getNextLocation(to, state) {
  2524. if (state === void 0) {
  2525. state = null;
  2526. }
  2527. return readOnly(_extends({
  2528. pathname: location.pathname,
  2529. search: '',
  2530. hash: ''
  2531. }, typeof to === 'string' ? parsePath(to) : to, {
  2532. state: state,
  2533. key: createKey()
  2534. }));
  2535. }
  2536. function allowTx(action, location, retry) {
  2537. return !blockers.length || (blockers.call({
  2538. action: action,
  2539. location: location,
  2540. retry: retry
  2541. }), false);
  2542. }
  2543. function applyTx(nextAction, nextLocation) {
  2544. action = nextAction;
  2545. location = nextLocation;
  2546. listeners.call({
  2547. action: action,
  2548. location: location
  2549. });
  2550. }
  2551. function push(to, state) {
  2552. var nextAction = Action.Push;
  2553. var nextLocation = getNextLocation(to, state);
  2554. function retry() {
  2555. push(to, state);
  2556. }
  2557. false ? 0 : void 0;
  2558. if (allowTx(nextAction, nextLocation, retry)) {
  2559. index += 1;
  2560. entries.splice(index, entries.length, nextLocation);
  2561. applyTx(nextAction, nextLocation);
  2562. }
  2563. }
  2564. function replace(to, state) {
  2565. var nextAction = Action.Replace;
  2566. var nextLocation = getNextLocation(to, state);
  2567. function retry() {
  2568. replace(to, state);
  2569. }
  2570. false ? 0 : void 0;
  2571. if (allowTx(nextAction, nextLocation, retry)) {
  2572. entries[index] = nextLocation;
  2573. applyTx(nextAction, nextLocation);
  2574. }
  2575. }
  2576. function go(delta) {
  2577. var nextIndex = clamp(index + delta, 0, entries.length - 1);
  2578. var nextAction = Action.Pop;
  2579. var nextLocation = entries[nextIndex];
  2580. function retry() {
  2581. go(delta);
  2582. }
  2583. if (allowTx(nextAction, nextLocation, retry)) {
  2584. index = nextIndex;
  2585. applyTx(nextAction, nextLocation);
  2586. }
  2587. }
  2588. var history = {
  2589. get index() {
  2590. return index;
  2591. },
  2592. get action() {
  2593. return action;
  2594. },
  2595. get location() {
  2596. return location;
  2597. },
  2598. createHref: createHref,
  2599. push: push,
  2600. replace: replace,
  2601. go: go,
  2602. back: function back() {
  2603. go(-1);
  2604. },
  2605. forward: function forward() {
  2606. go(1);
  2607. },
  2608. listen: function listen(listener) {
  2609. return listeners.push(listener);
  2610. },
  2611. block: function block(blocker) {
  2612. return blockers.push(blocker);
  2613. }
  2614. };
  2615. return history;
  2616. } ////////////////////////////////////////////////////////////////////////////////
  2617. // UTILS
  2618. ////////////////////////////////////////////////////////////////////////////////
  2619. function clamp(n, lowerBound, upperBound) {
  2620. return Math.min(Math.max(n, lowerBound), upperBound);
  2621. }
  2622. function promptBeforeUnload(event) {
  2623. // Cancel the event.
  2624. event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.
  2625. event.returnValue = '';
  2626. }
  2627. function createEvents() {
  2628. var handlers = [];
  2629. return {
  2630. get length() {
  2631. return handlers.length;
  2632. },
  2633. push: function push(fn) {
  2634. handlers.push(fn);
  2635. return function () {
  2636. handlers = handlers.filter(function (handler) {
  2637. return handler !== fn;
  2638. });
  2639. };
  2640. },
  2641. call: function call(arg) {
  2642. handlers.forEach(function (fn) {
  2643. return fn && fn(arg);
  2644. });
  2645. }
  2646. };
  2647. }
  2648. function createKey() {
  2649. return Math.random().toString(36).substr(2, 8);
  2650. }
  2651. /**
  2652. * Creates a string URL path from the given pathname, search, and hash components.
  2653. *
  2654. * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath
  2655. */
  2656. function createPath(_ref) {
  2657. var _ref$pathname = _ref.pathname,
  2658. pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
  2659. _ref$search = _ref.search,
  2660. search = _ref$search === void 0 ? '' : _ref$search,
  2661. _ref$hash = _ref.hash,
  2662. hash = _ref$hash === void 0 ? '' : _ref$hash;
  2663. if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;
  2664. if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;
  2665. return pathname;
  2666. }
  2667. /**
  2668. * Parses a string URL path into its separate pathname, search, and hash components.
  2669. *
  2670. * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
  2671. */
  2672. function parsePath(path) {
  2673. var parsedPath = {};
  2674. if (path) {
  2675. var hashIndex = path.indexOf('#');
  2676. if (hashIndex >= 0) {
  2677. parsedPath.hash = path.substr(hashIndex);
  2678. path = path.substr(0, hashIndex);
  2679. }
  2680. var searchIndex = path.indexOf('?');
  2681. if (searchIndex >= 0) {
  2682. parsedPath.search = path.substr(searchIndex);
  2683. path = path.substr(0, searchIndex);
  2684. }
  2685. if (path) {
  2686. parsedPath.pathname = path;
  2687. }
  2688. }
  2689. return parsedPath;
  2690. }
  2691. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/history.js
  2692. /**
  2693. * External dependencies
  2694. */
  2695. /**
  2696. * WordPress dependencies
  2697. */
  2698. const history_history = createBrowserHistory();
  2699. const originalHistoryPush = history_history.push;
  2700. const originalHistoryReplace = history_history.replace;
  2701. function push(params, state) {
  2702. return originalHistoryPush.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state);
  2703. }
  2704. function replace(params, state) {
  2705. return originalHistoryReplace.call(history_history, (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params), state);
  2706. }
  2707. history_history.push = push;
  2708. history_history.replace = replace;
  2709. /* harmony default export */ var utils_history = (history_history);
  2710. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/index.js
  2711. /**
  2712. * WordPress dependencies
  2713. */
  2714. /**
  2715. * Internal dependencies
  2716. */
  2717. const RoutesContext = (0,external_wp_element_namespaceObject.createContext)();
  2718. const HistoryContext = (0,external_wp_element_namespaceObject.createContext)();
  2719. function useLocation() {
  2720. return (0,external_wp_element_namespaceObject.useContext)(RoutesContext);
  2721. }
  2722. function useHistory() {
  2723. return (0,external_wp_element_namespaceObject.useContext)(HistoryContext);
  2724. }
  2725. function getLocationWithParams(location) {
  2726. const searchParams = new URLSearchParams(location.search);
  2727. return { ...location,
  2728. params: Object.fromEntries(searchParams.entries())
  2729. };
  2730. }
  2731. function Routes(_ref) {
  2732. let {
  2733. children
  2734. } = _ref;
  2735. const [location, setLocation] = (0,external_wp_element_namespaceObject.useState)(() => getLocationWithParams(utils_history.location));
  2736. (0,external_wp_element_namespaceObject.useEffect)(() => {
  2737. return utils_history.listen(_ref2 => {
  2738. let {
  2739. location: updatedLocation
  2740. } = _ref2;
  2741. setLocation(getLocationWithParams(updatedLocation));
  2742. });
  2743. }, []);
  2744. return (0,external_wp_element_namespaceObject.createElement)(HistoryContext.Provider, {
  2745. value: utils_history
  2746. }, (0,external_wp_element_namespaceObject.createElement)(RoutesContext.Provider, {
  2747. value: location
  2748. }, children(location)));
  2749. }
  2750. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/link.js
  2751. /**
  2752. * WordPress dependencies
  2753. */
  2754. /**
  2755. * Internal dependencies
  2756. */
  2757. function useLink() {
  2758. let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2759. let state = arguments.length > 1 ? arguments[1] : undefined;
  2760. let shouldReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  2761. const history = useHistory();
  2762. function onClick(event) {
  2763. event.preventDefault();
  2764. if (shouldReplace) {
  2765. history.replace(params, state);
  2766. } else {
  2767. history.push(params, state);
  2768. }
  2769. }
  2770. return {
  2771. href: (0,external_wp_url_namespaceObject.addQueryArgs)(window.location.href, params),
  2772. onClick
  2773. };
  2774. }
  2775. function Link(_ref) {
  2776. let {
  2777. params = {},
  2778. state,
  2779. replace: shouldReplace = false,
  2780. children,
  2781. ...props
  2782. } = _ref;
  2783. const {
  2784. href,
  2785. onClick
  2786. } = useLink(params, state, shouldReplace);
  2787. return (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({
  2788. href: href,
  2789. onClick: onClick
  2790. }, props), children);
  2791. }
  2792. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/template-part-edit.js
  2793. /**
  2794. * WordPress dependencies
  2795. */
  2796. /**
  2797. * Internal dependencies
  2798. */
  2799. function EditTemplatePartMenuItem(_ref) {
  2800. let {
  2801. attributes
  2802. } = _ref;
  2803. const {
  2804. theme,
  2805. slug
  2806. } = attributes;
  2807. const {
  2808. params
  2809. } = useLocation();
  2810. const templatePart = (0,external_wp_data_namespaceObject.useSelect)(select => {
  2811. return select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template_part', // Ideally this should be an official public API.
  2812. `${theme}//${slug}`);
  2813. }, [theme, slug]);
  2814. const linkProps = useLink({
  2815. postId: templatePart === null || templatePart === void 0 ? void 0 : templatePart.id,
  2816. postType: templatePart === null || templatePart === void 0 ? void 0 : templatePart.type
  2817. }, {
  2818. fromTemplateId: params.postId
  2819. });
  2820. if (!templatePart) {
  2821. return null;
  2822. }
  2823. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
  2824. group: "other"
  2825. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, extends_extends({}, linkProps, {
  2826. onClick: event => {
  2827. linkProps.onClick(event);
  2828. }
  2829. }), (0,external_wp_i18n_namespaceObject.__)('Edit')));
  2830. }
  2831. const withEditBlockControls = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => props => {
  2832. const {
  2833. attributes,
  2834. name
  2835. } = props;
  2836. const isDisplayed = name === 'core/template-part' && attributes.slug;
  2837. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props), isDisplayed && (0,external_wp_element_namespaceObject.createElement)(EditTemplatePartMenuItem, {
  2838. attributes: attributes
  2839. }));
  2840. }, 'withEditBlockControls');
  2841. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-site/template-part-edit-button', withEditBlockControls);
  2842. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/hooks/index.js
  2843. /**
  2844. * Internal dependencies
  2845. */
  2846. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/constants.js
  2847. /**
  2848. * The identifier for the data store.
  2849. *
  2850. * @type {string}
  2851. */
  2852. const constants_STORE_NAME = 'core/edit-site';
  2853. const TEMPLATE_PART_AREA_HEADER = 'header';
  2854. const TEMPLATE_PART_AREA_FOOTER = 'footer';
  2855. const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar';
  2856. const TEMPLATE_PART_AREA_GENERAL = 'uncategorized';
  2857. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/constants.js
  2858. /**
  2859. * WordPress dependencies
  2860. */
  2861. /**
  2862. * Internal dependencies
  2863. */
  2864. const TEMPLATES_PRIMARY = ['index', 'singular', 'archive', 'single', 'page', 'home', '404', 'search'];
  2865. const TEMPLATES_SECONDARY = ['author', 'category', 'taxonomy', 'date', 'tag', 'attachment', 'single', 'front-page'];
  2866. const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY];
  2867. const TEMPLATES_GENERAL = ['page-home'];
  2868. const TEMPLATES_POSTS_PREFIXES = ['post-', 'author-', 'single-', 'tag-'];
  2869. const TEMPLATES_PAGES_PREFIXES = ['page-'];
  2870. const TEMPLATE_OVERRIDES = {
  2871. singular: ['single', 'page'],
  2872. index: ['archive', '404', 'search', 'singular', 'home'],
  2873. home: ['front-page']
  2874. };
  2875. const MENU_ROOT = 'root';
  2876. const MENU_TEMPLATE_PARTS = 'template-parts';
  2877. const MENU_TEMPLATES = 'templates';
  2878. const MENU_TEMPLATES_GENERAL = 'templates-general';
  2879. const MENU_TEMPLATES_PAGES = 'templates-pages';
  2880. const MENU_TEMPLATES_POSTS = 'templates-posts';
  2881. const MENU_TEMPLATES_UNUSED = 'templates-unused';
  2882. const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
  2883. const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
  2884. const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
  2885. const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';
  2886. const TEMPLATE_PARTS_SUB_MENUS = [{
  2887. area: TEMPLATE_PART_AREA_HEADER,
  2888. menu: MENU_TEMPLATE_PARTS_HEADERS,
  2889. title: (0,external_wp_i18n_namespaceObject.__)('headers')
  2890. }, {
  2891. area: TEMPLATE_PART_AREA_FOOTER,
  2892. menu: MENU_TEMPLATE_PARTS_FOOTERS,
  2893. title: (0,external_wp_i18n_namespaceObject.__)('footers')
  2894. }, {
  2895. area: TEMPLATE_PART_AREA_SIDEBAR,
  2896. menu: MENU_TEMPLATE_PARTS_SIDEBARS,
  2897. title: (0,external_wp_i18n_namespaceObject.__)('sidebars')
  2898. }, {
  2899. area: TEMPLATE_PART_AREA_GENERAL,
  2900. menu: MENU_TEMPLATE_PARTS_GENERAL,
  2901. title: (0,external_wp_i18n_namespaceObject.__)('general')
  2902. }];
  2903. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/reducer.js
  2904. /**
  2905. * WordPress dependencies
  2906. */
  2907. /**
  2908. * Internal dependencies
  2909. */
  2910. /**
  2911. * Reducer returning the editing canvas device type.
  2912. *
  2913. * @param {Object} state Current state.
  2914. * @param {Object} action Dispatched action.
  2915. *
  2916. * @return {Object} Updated state.
  2917. */
  2918. function deviceType() {
  2919. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop';
  2920. let action = arguments.length > 1 ? arguments[1] : undefined;
  2921. switch (action.type) {
  2922. case 'SET_PREVIEW_DEVICE_TYPE':
  2923. return action.deviceType;
  2924. }
  2925. return state;
  2926. }
  2927. /**
  2928. * Reducer returning the settings.
  2929. *
  2930. * @param {Object} state Current state.
  2931. * @param {Object} action Dispatched action.
  2932. *
  2933. * @return {Object} Updated state.
  2934. */
  2935. function settings() {
  2936. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2937. let action = arguments.length > 1 ? arguments[1] : undefined;
  2938. switch (action.type) {
  2939. case 'UPDATE_SETTINGS':
  2940. return { ...state,
  2941. ...action.settings
  2942. };
  2943. }
  2944. return state;
  2945. }
  2946. /**
  2947. * Reducer keeping track of the currently edited Post Type,
  2948. * Post Id and the context provided to fill the content of the block editor.
  2949. *
  2950. * @param {Object} state Current edited post.
  2951. * @param {Object} action Dispatched action.
  2952. *
  2953. * @return {Object} Updated state.
  2954. */
  2955. function editedPost() {
  2956. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2957. let action = arguments.length > 1 ? arguments[1] : undefined;
  2958. switch (action.type) {
  2959. case 'SET_TEMPLATE':
  2960. case 'SET_PAGE':
  2961. return {
  2962. type: 'wp_template',
  2963. id: action.templateId,
  2964. page: action.page
  2965. };
  2966. case 'SET_TEMPLATE_PART':
  2967. return {
  2968. type: 'wp_template_part',
  2969. id: action.templatePartId
  2970. };
  2971. }
  2972. return state;
  2973. }
  2974. /**
  2975. * Reducer for information about the site's homepage.
  2976. *
  2977. * @param {Object} state Current state.
  2978. * @param {Object} action Dispatched action.
  2979. *
  2980. * @return {Object} Updated state.
  2981. */
  2982. function homeTemplateId(state, action) {
  2983. switch (action.type) {
  2984. case 'SET_HOME_TEMPLATE':
  2985. return action.homeTemplateId;
  2986. }
  2987. return state;
  2988. }
  2989. /**
  2990. * Reducer for information about the navigation panel, such as its active menu
  2991. * and whether it should be opened or closed.
  2992. *
  2993. * Note: this reducer interacts with the inserter and list view panels reducers
  2994. * to make sure that only one of the three panels is open at the same time.
  2995. *
  2996. * @param {Object} state Current state.
  2997. * @param {Object} action Dispatched action.
  2998. */
  2999. function navigationPanel() {
  3000. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  3001. menu: MENU_ROOT,
  3002. isOpen: false
  3003. };
  3004. let action = arguments.length > 1 ? arguments[1] : undefined;
  3005. switch (action.type) {
  3006. case 'SET_NAVIGATION_PANEL_ACTIVE_MENU':
  3007. return { ...state,
  3008. menu: action.menu
  3009. };
  3010. case 'OPEN_NAVIGATION_PANEL_TO_MENU':
  3011. return { ...state,
  3012. isOpen: true,
  3013. menu: action.menu
  3014. };
  3015. case 'SET_IS_NAVIGATION_PANEL_OPENED':
  3016. return { ...state,
  3017. menu: !action.isOpen ? MENU_ROOT : state.menu,
  3018. // Set menu to root when closing panel.
  3019. isOpen: action.isOpen
  3020. };
  3021. case 'SET_IS_LIST_VIEW_OPENED':
  3022. return { ...state,
  3023. menu: state.isOpen && action.isOpen ? MENU_ROOT : state.menu,
  3024. // Set menu to root when closing panel.
  3025. isOpen: action.isOpen ? false : state.isOpen
  3026. };
  3027. case 'SET_IS_INSERTER_OPENED':
  3028. return { ...state,
  3029. menu: state.isOpen && action.value ? MENU_ROOT : state.menu,
  3030. // Set menu to root when closing panel.
  3031. isOpen: action.value ? false : state.isOpen
  3032. };
  3033. }
  3034. return state;
  3035. }
  3036. /**
  3037. * Reducer to set the block inserter panel open or closed.
  3038. *
  3039. * Note: this reducer interacts with the navigation and list view panels reducers
  3040. * to make sure that only one of the three panels is open at the same time.
  3041. *
  3042. * @param {boolean|Object} state Current state.
  3043. * @param {Object} action Dispatched action.
  3044. */
  3045. function blockInserterPanel() {
  3046. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3047. let action = arguments.length > 1 ? arguments[1] : undefined;
  3048. switch (action.type) {
  3049. case 'OPEN_NAVIGATION_PANEL_TO_MENU':
  3050. return false;
  3051. case 'SET_IS_NAVIGATION_PANEL_OPENED':
  3052. case 'SET_IS_LIST_VIEW_OPENED':
  3053. return action.isOpen ? false : state;
  3054. case 'SET_IS_INSERTER_OPENED':
  3055. return action.value;
  3056. }
  3057. return state;
  3058. }
  3059. /**
  3060. * Reducer to set the list view panel open or closed.
  3061. *
  3062. * Note: this reducer interacts with the navigation and inserter panels reducers
  3063. * to make sure that only one of the three panels is open at the same time.
  3064. *
  3065. * @param {Object} state Current state.
  3066. * @param {Object} action Dispatched action.
  3067. */
  3068. function listViewPanel() {
  3069. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  3070. let action = arguments.length > 1 ? arguments[1] : undefined;
  3071. switch (action.type) {
  3072. case 'OPEN_NAVIGATION_PANEL_TO_MENU':
  3073. return false;
  3074. case 'SET_IS_NAVIGATION_PANEL_OPENED':
  3075. return action.isOpen ? false : state;
  3076. case 'SET_IS_INSERTER_OPENED':
  3077. return action.value ? false : state;
  3078. case 'SET_IS_LIST_VIEW_OPENED':
  3079. return action.isOpen;
  3080. }
  3081. return state;
  3082. }
  3083. /* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  3084. deviceType,
  3085. settings,
  3086. editedPost,
  3087. homeTemplateId,
  3088. navigationPanel,
  3089. blockInserterPanel,
  3090. listViewPanel
  3091. }));
  3092. ;// CONCATENATED MODULE: external ["wp","apiFetch"]
  3093. var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
  3094. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
  3095. ;// CONCATENATED MODULE: external ["wp","notices"]
  3096. var external_wp_notices_namespaceObject = window["wp"]["notices"];
  3097. ;// CONCATENATED MODULE: external ["wp","a11y"]
  3098. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  3099. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-revertable.js
  3100. /**
  3101. * Check if a template is revertable to its original theme-provided template file.
  3102. *
  3103. * @param {Object} template The template entity to check.
  3104. * @return {boolean} Whether the template is revertable.
  3105. */
  3106. function isTemplateRevertable(template) {
  3107. if (!template) {
  3108. return false;
  3109. }
  3110. /* eslint-disable camelcase */
  3111. return (template === null || template === void 0 ? void 0 : template.source) === 'custom' && (template === null || template === void 0 ? void 0 : template.has_theme_file);
  3112. /* eslint-enable camelcase */
  3113. }
  3114. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/actions.js
  3115. /**
  3116. * WordPress dependencies
  3117. */
  3118. /**
  3119. * Internal dependencies
  3120. */
  3121. /**
  3122. * Dispatches an action that toggles a feature flag.
  3123. *
  3124. * @param {string} featureName Feature name.
  3125. */
  3126. function actions_toggleFeature(featureName) {
  3127. return function (_ref) {
  3128. let {
  3129. registry
  3130. } = _ref;
  3131. external_wp_deprecated_default()("select( 'core/edit-site' ).toggleFeature( featureName )", {
  3132. since: '6.0',
  3133. alternative: "select( 'core/preferences').toggle( 'core/edit-site', featureName )"
  3134. });
  3135. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-site', featureName);
  3136. };
  3137. }
  3138. /**
  3139. * Action that changes the width of the editing canvas.
  3140. *
  3141. * @param {string} deviceType
  3142. *
  3143. * @return {Object} Action object.
  3144. */
  3145. function __experimentalSetPreviewDeviceType(deviceType) {
  3146. return {
  3147. type: 'SET_PREVIEW_DEVICE_TYPE',
  3148. deviceType
  3149. };
  3150. }
  3151. /**
  3152. * Action that sets a template, optionally fetching it from REST API.
  3153. *
  3154. * @param {number} templateId The template ID.
  3155. * @param {string} templateSlug The template slug.
  3156. * @return {Object} Action object.
  3157. */
  3158. const setTemplate = (templateId, templateSlug) => async _ref2 => {
  3159. let {
  3160. dispatch,
  3161. registry
  3162. } = _ref2;
  3163. if (!templateSlug) {
  3164. const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', 'wp_template', templateId);
  3165. templateSlug = template === null || template === void 0 ? void 0 : template.slug;
  3166. }
  3167. dispatch({
  3168. type: 'SET_TEMPLATE',
  3169. templateId,
  3170. page: {
  3171. context: {
  3172. templateSlug
  3173. }
  3174. }
  3175. });
  3176. };
  3177. /**
  3178. * Action that adds a new template and sets it as the current template.
  3179. *
  3180. * @param {Object} template The template.
  3181. *
  3182. * @return {Object} Action object used to set the current template.
  3183. */
  3184. const addTemplate = template => async _ref3 => {
  3185. let {
  3186. dispatch,
  3187. registry
  3188. } = _ref3;
  3189. const newTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template);
  3190. if (template.content) {
  3191. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', 'wp_template', newTemplate.id, {
  3192. blocks: (0,external_wp_blocks_namespaceObject.parse)(template.content)
  3193. }, {
  3194. undoIgnore: true
  3195. });
  3196. }
  3197. dispatch({
  3198. type: 'SET_TEMPLATE',
  3199. templateId: newTemplate.id,
  3200. page: {
  3201. context: {
  3202. templateSlug: newTemplate.slug
  3203. }
  3204. }
  3205. });
  3206. };
  3207. /**
  3208. * Action that removes a template.
  3209. *
  3210. * @param {Object} template The template object.
  3211. */
  3212. const removeTemplate = template => async _ref4 => {
  3213. let {
  3214. registry
  3215. } = _ref4;
  3216. try {
  3217. await registry.dispatch(external_wp_coreData_namespaceObject.store).deleteEntityRecord('postType', template.type, template.id, {
  3218. force: true
  3219. });
  3220. const lastError = registry.select(external_wp_coreData_namespaceObject.store).getLastEntityDeleteError('postType', template.type, template.id);
  3221. if (lastError) {
  3222. throw lastError;
  3223. }
  3224. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)(
  3225. /* translators: The template/part's name. */
  3226. (0,external_wp_i18n_namespaceObject.__)('"%s" deleted.'), template.title.rendered), {
  3227. type: 'snackbar'
  3228. });
  3229. } catch (error) {
  3230. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while deleting the template.');
  3231. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
  3232. type: 'snackbar'
  3233. });
  3234. }
  3235. };
  3236. /**
  3237. * Action that sets a template part.
  3238. *
  3239. * @param {string} templatePartId The template part ID.
  3240. *
  3241. * @return {Object} Action object.
  3242. */
  3243. function setTemplatePart(templatePartId) {
  3244. return {
  3245. type: 'SET_TEMPLATE_PART',
  3246. templatePartId
  3247. };
  3248. }
  3249. /**
  3250. * Action that sets the home template ID to the template ID of the page resolved
  3251. * from a given path.
  3252. *
  3253. * @param {number} homeTemplateId The template ID for the homepage.
  3254. */
  3255. function setHomeTemplateId(homeTemplateId) {
  3256. return {
  3257. type: 'SET_HOME_TEMPLATE',
  3258. homeTemplateId
  3259. };
  3260. }
  3261. /**
  3262. * Resolves the template for a page and displays both. If no path is given, attempts
  3263. * to use the postId to generate a path like `?p=${ postId }`.
  3264. *
  3265. * @param {Object} page The page object.
  3266. * @param {string} page.type The page type.
  3267. * @param {string} page.slug The page slug.
  3268. * @param {string} page.path The page path.
  3269. * @param {Object} page.context The page context.
  3270. *
  3271. * @return {number} The resolved template ID for the page route.
  3272. */
  3273. const setPage = page => async _ref5 => {
  3274. var _page$context;
  3275. let {
  3276. dispatch,
  3277. registry
  3278. } = _ref5;
  3279. if (!page.path && (_page$context = page.context) !== null && _page$context !== void 0 && _page$context.postId) {
  3280. const entity = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', page.context.postType || 'post', page.context.postId); // If the entity is undefined for some reason, path will resolve to "/"
  3281. page.path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(entity === null || entity === void 0 ? void 0 : entity.link);
  3282. }
  3283. const template = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(page.path);
  3284. if (!template) {
  3285. return;
  3286. }
  3287. dispatch({
  3288. type: 'SET_PAGE',
  3289. page: template.slug ? { ...page,
  3290. context: { ...page.context,
  3291. templateSlug: template.slug
  3292. }
  3293. } : page,
  3294. templateId: template.id
  3295. });
  3296. return template.id;
  3297. };
  3298. /**
  3299. * Action that sets the active navigation panel menu.
  3300. *
  3301. * @param {string} menu Menu prop of active menu.
  3302. *
  3303. * @return {Object} Action object.
  3304. */
  3305. function setNavigationPanelActiveMenu(menu) {
  3306. return {
  3307. type: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',
  3308. menu
  3309. };
  3310. }
  3311. /**
  3312. * Opens the navigation panel and sets its active menu at the same time.
  3313. *
  3314. * @param {string} menu Identifies the menu to open.
  3315. */
  3316. function openNavigationPanelToMenu(menu) {
  3317. return {
  3318. type: 'OPEN_NAVIGATION_PANEL_TO_MENU',
  3319. menu
  3320. };
  3321. }
  3322. /**
  3323. * Sets whether the navigation panel should be open.
  3324. *
  3325. * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It
  3326. * does not toggle the state, but sets it directly.
  3327. */
  3328. function setIsNavigationPanelOpened(isOpen) {
  3329. return {
  3330. type: 'SET_IS_NAVIGATION_PANEL_OPENED',
  3331. isOpen
  3332. };
  3333. }
  3334. /**
  3335. * Opens or closes the inserter.
  3336. *
  3337. * @param {boolean|Object} value Whether the inserter should be
  3338. * opened (true) or closed (false).
  3339. * To specify an insertion point,
  3340. * use an object.
  3341. * @param {string} value.rootClientId The root client ID to insert at.
  3342. * @param {number} value.insertionIndex The index to insert at.
  3343. *
  3344. * @return {Object} Action object.
  3345. */
  3346. function setIsInserterOpened(value) {
  3347. return {
  3348. type: 'SET_IS_INSERTER_OPENED',
  3349. value
  3350. };
  3351. }
  3352. /**
  3353. * Returns an action object used to update the settings.
  3354. *
  3355. * @param {Object} settings New settings.
  3356. *
  3357. * @return {Object} Action object.
  3358. */
  3359. function updateSettings(settings) {
  3360. return {
  3361. type: 'UPDATE_SETTINGS',
  3362. settings
  3363. };
  3364. }
  3365. /**
  3366. * Sets whether the list view panel should be open.
  3367. *
  3368. * @param {boolean} isOpen If true, opens the list view. If false, closes it.
  3369. * It does not toggle the state, but sets it directly.
  3370. */
  3371. function setIsListViewOpened(isOpen) {
  3372. return {
  3373. type: 'SET_IS_LIST_VIEW_OPENED',
  3374. isOpen
  3375. };
  3376. }
  3377. /**
  3378. * Reverts a template to its original theme-provided file.
  3379. *
  3380. * @param {Object} template The template to revert.
  3381. * @param {Object} [options]
  3382. * @param {boolean} [options.allowUndo] Whether to allow the user to undo
  3383. * reverting the template. Default true.
  3384. */
  3385. const revertTemplate = function (template) {
  3386. let {
  3387. allowUndo = true
  3388. } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3389. return async _ref6 => {
  3390. let {
  3391. registry
  3392. } = _ref6;
  3393. if (!isTemplateRevertable(template)) {
  3394. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('This template is not revertable.'), {
  3395. type: 'snackbar'
  3396. });
  3397. return;
  3398. }
  3399. try {
  3400. var _fileTemplate$content;
  3401. const templateEntityConfig = registry.select(external_wp_coreData_namespaceObject.store).getEntityConfig('postType', template.type);
  3402. if (!templateEntityConfig) {
  3403. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
  3404. type: 'snackbar'
  3405. });
  3406. return;
  3407. }
  3408. const fileTemplatePath = (0,external_wp_url_namespaceObject.addQueryArgs)(`${templateEntityConfig.baseURL}/${template.id}`, {
  3409. context: 'edit',
  3410. source: 'theme'
  3411. });
  3412. const fileTemplate = await external_wp_apiFetch_default()({
  3413. path: fileTemplatePath
  3414. });
  3415. if (!fileTemplate) {
  3416. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice((0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error. Please reload.'), {
  3417. type: 'snackbar'
  3418. });
  3419. return;
  3420. }
  3421. const serializeBlocks = _ref7 => {
  3422. let {
  3423. blocks: blocksForSerialization = []
  3424. } = _ref7;
  3425. return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization);
  3426. };
  3427. const edited = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', template.type, template.id); // We are fixing up the undo level here to make sure we can undo
  3428. // the revert in the header toolbar correctly.
  3429. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, template.id, {
  3430. content: serializeBlocks,
  3431. // Required to make the `undo` behave correctly.
  3432. blocks: edited.blocks,
  3433. // Required to revert the blocks in the editor.
  3434. source: 'custom' // required to avoid turning the editor into a dirty state
  3435. }, {
  3436. undoIgnore: true // Required to merge this edit with the last undo level.
  3437. });
  3438. const blocks = (0,external_wp_blocks_namespaceObject.parse)(fileTemplate === null || fileTemplate === void 0 ? void 0 : (_fileTemplate$content = fileTemplate.content) === null || _fileTemplate$content === void 0 ? void 0 : _fileTemplate$content.raw);
  3439. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, fileTemplate.id, {
  3440. content: serializeBlocks,
  3441. blocks,
  3442. source: 'theme'
  3443. });
  3444. if (allowUndo) {
  3445. const undoRevert = () => {
  3446. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', template.type, edited.id, {
  3447. content: serializeBlocks,
  3448. blocks: edited.blocks,
  3449. source: 'custom'
  3450. });
  3451. };
  3452. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'), {
  3453. type: 'snackbar',
  3454. actions: [{
  3455. label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
  3456. onClick: undoRevert
  3457. }]
  3458. });
  3459. } else {
  3460. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template reverted.'));
  3461. }
  3462. } catch (error) {
  3463. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('Template revert failed. Please reload.');
  3464. registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(errorMessage, {
  3465. type: 'snackbar'
  3466. });
  3467. }
  3468. };
  3469. };
  3470. /**
  3471. * Action that opens an editor sidebar.
  3472. *
  3473. * @param {?string} name Sidebar name to be opened.
  3474. */
  3475. const openGeneralSidebar = name => _ref8 => {
  3476. let {
  3477. registry
  3478. } = _ref8;
  3479. registry.dispatch(store).enableComplementaryArea(constants_STORE_NAME, name);
  3480. };
  3481. /**
  3482. * Action that closes the sidebar.
  3483. */
  3484. const closeGeneralSidebar = () => _ref9 => {
  3485. let {
  3486. registry
  3487. } = _ref9;
  3488. registry.dispatch(store).disableComplementaryArea(constants_STORE_NAME);
  3489. };
  3490. const switchEditorMode = mode => _ref10 => {
  3491. let {
  3492. registry
  3493. } = _ref10;
  3494. registry.dispatch('core/preferences').set('core/edit-site', 'editorMode', mode); // Unselect blocks when we switch to a non visual mode.
  3495. if (mode !== 'visual') {
  3496. registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
  3497. }
  3498. if (mode === 'visual') {
  3499. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Visual editor selected'), 'assertive');
  3500. } else if (mode === 'mosaic') {
  3501. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Mosaic view selected'), 'assertive');
  3502. }
  3503. };
  3504. ;// CONCATENATED MODULE: external "lodash"
  3505. var external_lodash_namespaceObject = window["lodash"];
  3506. ;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js
  3507. /** @typedef {(...args: any[]) => *[]} GetDependants */
  3508. /** @typedef {() => void} Clear */
  3509. /**
  3510. * @typedef {{
  3511. * getDependants: GetDependants,
  3512. * clear: Clear
  3513. * }} EnhancedSelector
  3514. */
  3515. /**
  3516. * Internal cache entry.
  3517. *
  3518. * @typedef CacheNode
  3519. *
  3520. * @property {?CacheNode|undefined} [prev] Previous node.
  3521. * @property {?CacheNode|undefined} [next] Next node.
  3522. * @property {*[]} args Function arguments for cache entry.
  3523. * @property {*} val Function result.
  3524. */
  3525. /**
  3526. * @typedef Cache
  3527. *
  3528. * @property {Clear} clear Function to clear cache.
  3529. * @property {boolean} [isUniqueByDependants] Whether dependants are valid in
  3530. * considering cache uniqueness. A cache is unique if dependents are all arrays
  3531. * or objects.
  3532. * @property {CacheNode?} [head] Cache head.
  3533. * @property {*[]} [lastDependants] Dependants from previous invocation.
  3534. */
  3535. /**
  3536. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  3537. *
  3538. * @type {{}}
  3539. */
  3540. var LEAF_KEY = {};
  3541. /**
  3542. * Returns the first argument as the sole entry in an array.
  3543. *
  3544. * @template T
  3545. *
  3546. * @param {T} value Value to return.
  3547. *
  3548. * @return {[T]} Value returned as entry in array.
  3549. */
  3550. function arrayOf(value) {
  3551. return [value];
  3552. }
  3553. /**
  3554. * Returns true if the value passed is object-like, or false otherwise. A value
  3555. * is object-like if it can support property assignment, e.g. object or array.
  3556. *
  3557. * @param {*} value Value to test.
  3558. *
  3559. * @return {boolean} Whether value is object-like.
  3560. */
  3561. function isObjectLike(value) {
  3562. return !!value && 'object' === typeof value;
  3563. }
  3564. /**
  3565. * Creates and returns a new cache object.
  3566. *
  3567. * @return {Cache} Cache object.
  3568. */
  3569. function createCache() {
  3570. /** @type {Cache} */
  3571. var cache = {
  3572. clear: function () {
  3573. cache.head = null;
  3574. },
  3575. };
  3576. return cache;
  3577. }
  3578. /**
  3579. * Returns true if entries within the two arrays are strictly equal by
  3580. * reference from a starting index.
  3581. *
  3582. * @param {*[]} a First array.
  3583. * @param {*[]} b Second array.
  3584. * @param {number} fromIndex Index from which to start comparison.
  3585. *
  3586. * @return {boolean} Whether arrays are shallowly equal.
  3587. */
  3588. function isShallowEqual(a, b, fromIndex) {
  3589. var i;
  3590. if (a.length !== b.length) {
  3591. return false;
  3592. }
  3593. for (i = fromIndex; i < a.length; i++) {
  3594. if (a[i] !== b[i]) {
  3595. return false;
  3596. }
  3597. }
  3598. return true;
  3599. }
  3600. /**
  3601. * Returns a memoized selector function. The getDependants function argument is
  3602. * called before the memoized selector and is expected to return an immutable
  3603. * reference or array of references on which the selector depends for computing
  3604. * its own return value. The memoize cache is preserved only as long as those
  3605. * dependant references remain the same. If getDependants returns a different
  3606. * reference(s), the cache is cleared and the selector value regenerated.
  3607. *
  3608. * @template {(...args: *[]) => *} S
  3609. *
  3610. * @param {S} selector Selector function.
  3611. * @param {GetDependants=} getDependants Dependant getter returning an array of
  3612. * references used in cache bust consideration.
  3613. */
  3614. /* harmony default export */ function rememo(selector, getDependants) {
  3615. /** @type {WeakMap<*,*>} */
  3616. var rootCache;
  3617. /** @type {GetDependants} */
  3618. var normalizedGetDependants = getDependants ? getDependants : arrayOf;
  3619. /**
  3620. * Returns the cache for a given dependants array. When possible, a WeakMap
  3621. * will be used to create a unique cache for each set of dependants. This
  3622. * is feasible due to the nature of WeakMap in allowing garbage collection
  3623. * to occur on entries where the key object is no longer referenced. Since
  3624. * WeakMap requires the key to be an object, this is only possible when the
  3625. * dependant is object-like. The root cache is created as a hierarchy where
  3626. * each top-level key is the first entry in a dependants set, the value a
  3627. * WeakMap where each key is the next dependant, and so on. This continues
  3628. * so long as the dependants are object-like. If no dependants are object-
  3629. * like, then the cache is shared across all invocations.
  3630. *
  3631. * @see isObjectLike
  3632. *
  3633. * @param {*[]} dependants Selector dependants.
  3634. *
  3635. * @return {Cache} Cache object.
  3636. */
  3637. function getCache(dependants) {
  3638. var caches = rootCache,
  3639. isUniqueByDependants = true,
  3640. i,
  3641. dependant,
  3642. map,
  3643. cache;
  3644. for (i = 0; i < dependants.length; i++) {
  3645. dependant = dependants[i];
  3646. // Can only compose WeakMap from object-like key.
  3647. if (!isObjectLike(dependant)) {
  3648. isUniqueByDependants = false;
  3649. break;
  3650. }
  3651. // Does current segment of cache already have a WeakMap?
  3652. if (caches.has(dependant)) {
  3653. // Traverse into nested WeakMap.
  3654. caches = caches.get(dependant);
  3655. } else {
  3656. // Create, set, and traverse into a new one.
  3657. map = new WeakMap();
  3658. caches.set(dependant, map);
  3659. caches = map;
  3660. }
  3661. }
  3662. // We use an arbitrary (but consistent) object as key for the last item
  3663. // in the WeakMap to serve as our running cache.
  3664. if (!caches.has(LEAF_KEY)) {
  3665. cache = createCache();
  3666. cache.isUniqueByDependants = isUniqueByDependants;
  3667. caches.set(LEAF_KEY, cache);
  3668. }
  3669. return caches.get(LEAF_KEY);
  3670. }
  3671. /**
  3672. * Resets root memoization cache.
  3673. */
  3674. function clear() {
  3675. rootCache = new WeakMap();
  3676. }
  3677. /* eslint-disable jsdoc/check-param-names */
  3678. /**
  3679. * The augmented selector call, considering first whether dependants have
  3680. * changed before passing it to underlying memoize function.
  3681. *
  3682. * @param {*} source Source object for derivation.
  3683. * @param {...*} extraArgs Additional arguments to pass to selector.
  3684. *
  3685. * @return {*} Selector result.
  3686. */
  3687. /* eslint-enable jsdoc/check-param-names */
  3688. function callSelector(/* source, ...extraArgs */) {
  3689. var len = arguments.length,
  3690. cache,
  3691. node,
  3692. i,
  3693. args,
  3694. dependants;
  3695. // Create copy of arguments (avoid leaking deoptimization).
  3696. args = new Array(len);
  3697. for (i = 0; i < len; i++) {
  3698. args[i] = arguments[i];
  3699. }
  3700. dependants = normalizedGetDependants.apply(null, args);
  3701. cache = getCache(dependants);
  3702. // If not guaranteed uniqueness by dependants (primitive type), shallow
  3703. // compare against last dependants and, if references have changed,
  3704. // destroy cache to recalculate result.
  3705. if (!cache.isUniqueByDependants) {
  3706. if (
  3707. cache.lastDependants &&
  3708. !isShallowEqual(dependants, cache.lastDependants, 0)
  3709. ) {
  3710. cache.clear();
  3711. }
  3712. cache.lastDependants = dependants;
  3713. }
  3714. node = cache.head;
  3715. while (node) {
  3716. // Check whether node arguments match arguments
  3717. if (!isShallowEqual(node.args, args, 1)) {
  3718. node = node.next;
  3719. continue;
  3720. }
  3721. // At this point we can assume we've found a match
  3722. // Surface matched node to head if not already
  3723. if (node !== cache.head) {
  3724. // Adjust siblings to point to each other.
  3725. /** @type {CacheNode} */ (node.prev).next = node.next;
  3726. if (node.next) {
  3727. node.next.prev = node.prev;
  3728. }
  3729. node.next = cache.head;
  3730. node.prev = null;
  3731. /** @type {CacheNode} */ (cache.head).prev = node;
  3732. cache.head = node;
  3733. }
  3734. // Return immediately
  3735. return node.val;
  3736. }
  3737. // No cached value found. Continue to insertion phase:
  3738. node = /** @type {CacheNode} */ ({
  3739. // Generate the result from original function
  3740. val: selector.apply(null, args),
  3741. });
  3742. // Avoid including the source object in the cache.
  3743. args[0] = null;
  3744. node.args = args;
  3745. // Don't need to check whether node is already head, since it would
  3746. // have been returned above already if it was
  3747. // Shift existing head down list
  3748. if (cache.head) {
  3749. cache.head.prev = node;
  3750. node.next = cache.head;
  3751. }
  3752. cache.head = node;
  3753. return node.val;
  3754. }
  3755. callSelector.getDependants = normalizedGetDependants;
  3756. callSelector.clear = clear;
  3757. clear();
  3758. return /** @type {S & EnhancedSelector} */ (callSelector);
  3759. }
  3760. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/template-hierarchy.js
  3761. /**
  3762. * External dependencies
  3763. */
  3764. /**
  3765. * Internal dependencies
  3766. */
  3767. function isTemplateSuperseded(slug, existingSlugs, showOnFront) {
  3768. if (!TEMPLATE_OVERRIDES[slug]) {
  3769. return false;
  3770. } // `home` template is unused if it is superseded by `front-page`
  3771. // or "show on front" is set to show a page rather than blog posts.
  3772. if (slug === 'home' && showOnFront !== 'posts') {
  3773. return true;
  3774. }
  3775. return TEMPLATE_OVERRIDES[slug].every(overrideSlug => existingSlugs.includes(overrideSlug) || isTemplateSuperseded(overrideSlug, existingSlugs, showOnFront));
  3776. }
  3777. function getTemplateLocation(slug) {
  3778. const isTopLevelTemplate = TEMPLATES_TOP_LEVEL.includes(slug);
  3779. if (isTopLevelTemplate) {
  3780. return MENU_TEMPLATES;
  3781. }
  3782. const isGeneralTemplate = TEMPLATES_GENERAL.includes(slug);
  3783. if (isGeneralTemplate) {
  3784. return MENU_TEMPLATES_GENERAL;
  3785. }
  3786. const isPostsTemplate = TEMPLATES_POSTS_PREFIXES.some(prefix => slug.startsWith(prefix));
  3787. if (isPostsTemplate) {
  3788. return MENU_TEMPLATES_POSTS;
  3789. }
  3790. const isPagesTemplate = TEMPLATES_PAGES_PREFIXES.some(prefix => slug.startsWith(prefix));
  3791. if (isPagesTemplate) {
  3792. return MENU_TEMPLATES_PAGES;
  3793. }
  3794. return MENU_TEMPLATES_GENERAL;
  3795. }
  3796. function getUnusedTemplates(templates, showOnFront) {
  3797. const templateSlugs = map(templates, 'slug');
  3798. const supersededTemplates = templates.filter(_ref => {
  3799. let {
  3800. slug
  3801. } = _ref;
  3802. return isTemplateSuperseded(slug, templateSlugs, showOnFront);
  3803. });
  3804. return supersededTemplates;
  3805. }
  3806. function getTemplatesLocationMap(templates) {
  3807. return templates.reduce((obj, template) => {
  3808. obj[template.slug] = getTemplateLocation(template.slug);
  3809. return obj;
  3810. }, {});
  3811. }
  3812. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/selectors.js
  3813. /**
  3814. * External dependencies
  3815. */
  3816. /**
  3817. * WordPress dependencies
  3818. */
  3819. /**
  3820. * Internal dependencies
  3821. */
  3822. /**
  3823. * @typedef {'template'|'template_type'} TemplateType Template type.
  3824. */
  3825. /**
  3826. * Helper for getting a preference from the preferences store.
  3827. *
  3828. * This is only present so that `getSettings` doesn't need to be made a
  3829. * registry selector.
  3830. *
  3831. * It's unstable because the selector needs to be exported and so part of the
  3832. * public API to work.
  3833. */
  3834. const __unstableGetPreference = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, name) => select(external_wp_preferences_namespaceObject.store).get('core/edit-site', name));
  3835. /**
  3836. * Returns whether the given feature is enabled or not.
  3837. *
  3838. * @param {Object} state Global application state.
  3839. * @param {string} featureName Feature slug.
  3840. *
  3841. * @return {boolean} Is active.
  3842. */
  3843. function selectors_isFeatureActive(state, featureName) {
  3844. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive`, {
  3845. since: '6.0',
  3846. alternative: `select( 'core/preferences' ).get`
  3847. });
  3848. return !!__unstableGetPreference(state, featureName);
  3849. }
  3850. /**
  3851. * Returns the current editing canvas device type.
  3852. *
  3853. * @param {Object} state Global application state.
  3854. *
  3855. * @return {string} Device type.
  3856. */
  3857. function __experimentalGetPreviewDeviceType(state) {
  3858. return state.deviceType;
  3859. }
  3860. /**
  3861. * Returns whether the current user can create media or not.
  3862. *
  3863. * @param {Object} state Global application state.
  3864. *
  3865. * @return {Object} Whether the current user can create media or not.
  3866. */
  3867. const getCanUserCreateMedia = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => select(external_wp_coreData_namespaceObject.store).canUser('create', 'media'));
  3868. /**
  3869. * Returns any available Reusable blocks.
  3870. *
  3871. * @param {Object} state Global application state.
  3872. *
  3873. * @return {Array} The available reusable blocks.
  3874. */
  3875. const getReusableBlocks = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  3876. const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
  3877. return isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', {
  3878. per_page: -1
  3879. }) : [];
  3880. });
  3881. /**
  3882. * Returns the settings, taking into account active features and permissions.
  3883. *
  3884. * @param {Object} state Global application state.
  3885. * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.
  3886. *
  3887. * @return {Object} Settings.
  3888. */
  3889. const getSettings = rememo((state, setIsInserterOpen) => {
  3890. const settings = { ...state.settings,
  3891. outlineMode: true,
  3892. focusMode: !!__unstableGetPreference(state, 'focusMode'),
  3893. hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'),
  3894. keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'),
  3895. showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'),
  3896. __experimentalSetIsInserterOpened: setIsInserterOpen,
  3897. __experimentalReusableBlocks: getReusableBlocks(state),
  3898. __experimentalPreferPatternsOnRoot: 'wp_template' === getEditedPostType(state)
  3899. };
  3900. const canUserCreateMedia = getCanUserCreateMedia(state);
  3901. if (!canUserCreateMedia) {
  3902. return settings;
  3903. }
  3904. settings.mediaUpload = _ref => {
  3905. let {
  3906. onError,
  3907. ...rest
  3908. } = _ref;
  3909. (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({
  3910. wpAllowedMimeTypes: state.settings.allowedMimeTypes,
  3911. onError: _ref2 => {
  3912. let {
  3913. message
  3914. } = _ref2;
  3915. return onError(message);
  3916. },
  3917. ...rest
  3918. });
  3919. };
  3920. return settings;
  3921. }, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]);
  3922. /**
  3923. * Returns the current home template ID.
  3924. *
  3925. * @param {Object} state Global application state.
  3926. *
  3927. * @return {number?} Home template ID.
  3928. */
  3929. function getHomeTemplateId(state) {
  3930. return state.homeTemplateId;
  3931. }
  3932. function getCurrentEditedPost(state) {
  3933. return state.editedPost;
  3934. }
  3935. /**
  3936. * Returns the current edited post type (wp_template or wp_template_part).
  3937. *
  3938. * @param {Object} state Global application state.
  3939. *
  3940. * @return {TemplateType?} Template type.
  3941. */
  3942. function getEditedPostType(state) {
  3943. return getCurrentEditedPost(state).type;
  3944. }
  3945. /**
  3946. * Returns the ID of the currently edited template or template part.
  3947. *
  3948. * @param {Object} state Global application state.
  3949. *
  3950. * @return {string?} Post ID.
  3951. */
  3952. function getEditedPostId(state) {
  3953. return getCurrentEditedPost(state).id;
  3954. }
  3955. /**
  3956. * Returns the current page object.
  3957. *
  3958. * @param {Object} state Global application state.
  3959. *
  3960. * @return {Object} Page.
  3961. */
  3962. function getPage(state) {
  3963. return getCurrentEditedPost(state).page;
  3964. }
  3965. /**
  3966. * Returns the active menu in the navigation panel.
  3967. *
  3968. * @param {Object} state Global application state.
  3969. *
  3970. * @return {string} Active menu.
  3971. */
  3972. function getNavigationPanelActiveMenu(state) {
  3973. return state.navigationPanel.menu;
  3974. }
  3975. /**
  3976. * Returns the current template or template part's corresponding
  3977. * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.
  3978. *
  3979. * @param {Object} state Global application state.
  3980. *
  3981. * @return {string} The current template or template part's sub menu.
  3982. */
  3983. const getCurrentTemplateNavigationPanelSubMenu = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  3984. const templateType = getEditedPostType(state);
  3985. const templateId = getEditedPostId(state);
  3986. const template = templateId ? select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', templateType, templateId) : null;
  3987. if (!template) {
  3988. return MENU_ROOT;
  3989. }
  3990. if ('wp_template_part' === templateType) {
  3991. var _TEMPLATE_PARTS_SUB_M;
  3992. return ((_TEMPLATE_PARTS_SUB_M = TEMPLATE_PARTS_SUB_MENUS.find(submenu => submenu.area === (template === null || template === void 0 ? void 0 : template.area))) === null || _TEMPLATE_PARTS_SUB_M === void 0 ? void 0 : _TEMPLATE_PARTS_SUB_M.menu) || MENU_TEMPLATE_PARTS;
  3993. }
  3994. const templates = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template');
  3995. const showOnFront = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'site').show_on_front;
  3996. if (isTemplateSuperseded(template.slug, (0,external_lodash_namespaceObject.map)(templates, 'slug'), showOnFront)) {
  3997. return MENU_TEMPLATES_UNUSED;
  3998. }
  3999. return getTemplateLocation(template.slug);
  4000. });
  4001. /**
  4002. * Returns the current opened/closed state of the navigation panel.
  4003. *
  4004. * @param {Object} state Global application state.
  4005. *
  4006. * @return {boolean} True if the navigation panel should be open; false if closed.
  4007. */
  4008. function isNavigationOpened(state) {
  4009. return state.navigationPanel.isOpen;
  4010. }
  4011. /**
  4012. * Returns the current opened/closed state of the inserter panel.
  4013. *
  4014. * @param {Object} state Global application state.
  4015. *
  4016. * @return {boolean} True if the inserter panel should be open; false if closed.
  4017. */
  4018. function isInserterOpened(state) {
  4019. return !!state.blockInserterPanel;
  4020. }
  4021. /**
  4022. * Get the insertion point for the inserter.
  4023. *
  4024. * @param {Object} state Global application state.
  4025. *
  4026. * @return {Object} The root client ID, index to insert at and starting filter value.
  4027. */
  4028. function __experimentalGetInsertionPoint(state) {
  4029. const {
  4030. rootClientId,
  4031. insertionIndex,
  4032. filterValue
  4033. } = state.blockInserterPanel;
  4034. return {
  4035. rootClientId,
  4036. insertionIndex,
  4037. filterValue
  4038. };
  4039. }
  4040. /**
  4041. * Returns the current opened/closed state of the list view panel.
  4042. *
  4043. * @param {Object} state Global application state.
  4044. *
  4045. * @return {boolean} True if the list view panel should be open; false if closed.
  4046. */
  4047. function isListViewOpened(state) {
  4048. return state.listViewPanel;
  4049. }
  4050. /**
  4051. * Returns the template parts and their blocks for the current edited template.
  4052. *
  4053. * @param {Object} state Global application state.
  4054. * @return {Array} Template parts and their blocks in an array.
  4055. */
  4056. const getCurrentTemplateTemplateParts = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => {
  4057. var _template$blocks;
  4058. const templateType = getEditedPostType(state);
  4059. const templateId = getEditedPostId(state);
  4060. const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', templateType, templateId);
  4061. const templateParts = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template_part', {
  4062. per_page: -1
  4063. });
  4064. const templatePartsById = templateParts ? // Key template parts by their ID.
  4065. templateParts.reduce((newTemplateParts, part) => ({ ...newTemplateParts,
  4066. [part.id]: part
  4067. }), {}) : {};
  4068. return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => (0,external_wp_blocks_namespaceObject.isTemplatePart)(block)).map(block => {
  4069. const {
  4070. attributes: {
  4071. theme,
  4072. slug
  4073. }
  4074. } = block;
  4075. const templatePartId = `${theme}//${slug}`;
  4076. const templatePart = templatePartsById[templatePartId];
  4077. return {
  4078. templatePart,
  4079. block
  4080. };
  4081. }).filter(_ref3 => {
  4082. let {
  4083. templatePart
  4084. } = _ref3;
  4085. return !!templatePart;
  4086. });
  4087. });
  4088. /**
  4089. * Returns the current editing mode.
  4090. *
  4091. * @param {Object} state Global application state.
  4092. *
  4093. * @return {string} Editing mode.
  4094. */
  4095. function getEditorMode(state) {
  4096. return __unstableGetPreference(state, 'editorMode');
  4097. }
  4098. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/store/index.js
  4099. /**
  4100. * WordPress dependencies
  4101. */
  4102. /**
  4103. * Internal dependencies
  4104. */
  4105. const storeConfig = {
  4106. reducer: store_reducer,
  4107. actions: store_actions_namespaceObject,
  4108. selectors: store_selectors_namespaceObject
  4109. };
  4110. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig);
  4111. (0,external_wp_data_namespaceObject.register)(store_store);
  4112. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  4113. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  4114. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  4115. /**
  4116. * WordPress dependencies
  4117. */
  4118. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4119. xmlns: "http://www.w3.org/2000/svg",
  4120. viewBox: "0 0 24 24"
  4121. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4122. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  4123. }));
  4124. /* harmony default export */ var library_plus = (plus);
  4125. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
  4126. /**
  4127. * WordPress dependencies
  4128. */
  4129. const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4130. viewBox: "0 0 24 24",
  4131. xmlns: "http://www.w3.org/2000/svg"
  4132. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4133. d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
  4134. }));
  4135. /* harmony default export */ var list_view = (listView);
  4136. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up-down.js
  4137. /**
  4138. * WordPress dependencies
  4139. */
  4140. const chevronUpDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4141. xmlns: "http://www.w3.org/2000/svg",
  4142. viewBox: "0 0 24 24"
  4143. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4144. d: "m12 20-4.5-3.6-.9 1.2L12 22l5.5-4.4-.9-1.2L12 20zm0-16 4.5 3.6.9-1.2L12 2 6.5 6.4l.9 1.2L12 4z"
  4145. }));
  4146. /* harmony default export */ var chevron_up_down = (chevronUpDown);
  4147. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  4148. /**
  4149. * WordPress dependencies
  4150. */
  4151. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4152. xmlns: "http://www.w3.org/2000/svg",
  4153. viewBox: "0 0 24 24"
  4154. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4155. d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
  4156. }));
  4157. /* harmony default export */ var library_external = (external);
  4158. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  4159. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  4160. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/config.js
  4161. /**
  4162. * WordPress dependencies
  4163. */
  4164. const textFormattingShortcuts = [{
  4165. keyCombination: {
  4166. modifier: 'primary',
  4167. character: 'b'
  4168. },
  4169. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
  4170. }, {
  4171. keyCombination: {
  4172. modifier: 'primary',
  4173. character: 'i'
  4174. },
  4175. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
  4176. }, {
  4177. keyCombination: {
  4178. modifier: 'primary',
  4179. character: 'k'
  4180. },
  4181. description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
  4182. }, {
  4183. keyCombination: {
  4184. modifier: 'primaryShift',
  4185. character: 'k'
  4186. },
  4187. description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
  4188. }, {
  4189. keyCombination: {
  4190. character: '[['
  4191. },
  4192. description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page')
  4193. }, {
  4194. keyCombination: {
  4195. modifier: 'primary',
  4196. character: 'u'
  4197. },
  4198. description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
  4199. }, {
  4200. keyCombination: {
  4201. modifier: 'access',
  4202. character: 'd'
  4203. },
  4204. description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.')
  4205. }, {
  4206. keyCombination: {
  4207. modifier: 'access',
  4208. character: 'x'
  4209. },
  4210. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.')
  4211. }];
  4212. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/shortcut.js
  4213. /**
  4214. * External dependencies
  4215. */
  4216. /**
  4217. * WordPress dependencies
  4218. */
  4219. function KeyCombination(_ref) {
  4220. let {
  4221. keyCombination,
  4222. forceAriaLabel
  4223. } = _ref;
  4224. const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  4225. const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  4226. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  4227. className: "edit-site-keyboard-shortcut-help-modal__shortcut-key-combination",
  4228. "aria-label": forceAriaLabel || ariaLabel
  4229. }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
  4230. if (character === '+') {
  4231. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  4232. key: index
  4233. }, character);
  4234. }
  4235. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  4236. key: index,
  4237. className: "edit-site-keyboard-shortcut-help-modal__shortcut-key"
  4238. }, character);
  4239. }));
  4240. }
  4241. function Shortcut(_ref2) {
  4242. let {
  4243. description,
  4244. keyCombination,
  4245. aliases = [],
  4246. ariaLabel
  4247. } = _ref2;
  4248. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  4249. className: "edit-site-keyboard-shortcut-help-modal__shortcut-description"
  4250. }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
  4251. className: "edit-site-keyboard-shortcut-help-modal__shortcut-term"
  4252. }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  4253. keyCombination: keyCombination,
  4254. forceAriaLabel: ariaLabel
  4255. }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  4256. keyCombination: alias,
  4257. forceAriaLabel: ariaLabel,
  4258. key: index
  4259. }))));
  4260. }
  4261. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
  4262. /**
  4263. * WordPress dependencies
  4264. */
  4265. /**
  4266. * Internal dependencies
  4267. */
  4268. function DynamicShortcut(_ref) {
  4269. let {
  4270. name
  4271. } = _ref;
  4272. const {
  4273. keyCombination,
  4274. description,
  4275. aliases
  4276. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4277. const {
  4278. getShortcutKeyCombination,
  4279. getShortcutDescription,
  4280. getShortcutAliases
  4281. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  4282. return {
  4283. keyCombination: getShortcutKeyCombination(name),
  4284. aliases: getShortcutAliases(name),
  4285. description: getShortcutDescription(name)
  4286. };
  4287. }, [name]);
  4288. if (!keyCombination) {
  4289. return null;
  4290. }
  4291. return (0,external_wp_element_namespaceObject.createElement)(Shortcut, {
  4292. keyCombination: keyCombination,
  4293. description: description,
  4294. aliases: aliases
  4295. });
  4296. }
  4297. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcut-help-modal/index.js
  4298. /**
  4299. * External dependencies
  4300. */
  4301. /**
  4302. * WordPress dependencies
  4303. */
  4304. /**
  4305. * Internal dependencies
  4306. */
  4307. const ShortcutList = _ref => {
  4308. let {
  4309. shortcuts
  4310. } = _ref;
  4311. return (
  4312. /*
  4313. * Disable reason: The `list` ARIA role is redundant but
  4314. * Safari+VoiceOver won't announce the list otherwise.
  4315. */
  4316. /* eslint-disable jsx-a11y/no-redundant-roles */
  4317. (0,external_wp_element_namespaceObject.createElement)("ul", {
  4318. className: "edit-site-keyboard-shortcut-help-modal__shortcut-list",
  4319. role: "list"
  4320. }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
  4321. className: "edit-site-keyboard-shortcut-help-modal__shortcut",
  4322. key: index
  4323. }, typeof shortcut === 'string' ? (0,external_wp_element_namespaceObject.createElement)(DynamicShortcut, {
  4324. name: shortcut
  4325. }) : (0,external_wp_element_namespaceObject.createElement)(Shortcut, shortcut))))
  4326. /* eslint-enable jsx-a11y/no-redundant-roles */
  4327. );
  4328. };
  4329. const ShortcutSection = _ref2 => {
  4330. let {
  4331. title,
  4332. shortcuts,
  4333. className
  4334. } = _ref2;
  4335. return (0,external_wp_element_namespaceObject.createElement)("section", {
  4336. className: classnames_default()('edit-site-keyboard-shortcut-help-modal__section', className)
  4337. }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
  4338. className: "edit-site-keyboard-shortcut-help-modal__section-title"
  4339. }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
  4340. shortcuts: shortcuts
  4341. }));
  4342. };
  4343. const ShortcutCategorySection = _ref3 => {
  4344. let {
  4345. title,
  4346. categoryName,
  4347. additionalShortcuts = []
  4348. } = _ref3;
  4349. const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4350. return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
  4351. }, [categoryName]);
  4352. return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  4353. title: title,
  4354. shortcuts: categoryShortcuts.concat(additionalShortcuts)
  4355. });
  4356. };
  4357. function KeyboardShortcutHelpModal(_ref4) {
  4358. let {
  4359. isModalActive,
  4360. toggleModal
  4361. } = _ref4;
  4362. if (!isModalActive) {
  4363. return null;
  4364. }
  4365. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  4366. className: "edit-site-keyboard-shortcut-help-modal",
  4367. title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
  4368. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  4369. onRequestClose: toggleModal
  4370. }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  4371. className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts",
  4372. shortcuts: ['core/edit-site/keyboard-shortcuts']
  4373. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  4374. title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
  4375. categoryName: "global"
  4376. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  4377. title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
  4378. categoryName: "selection"
  4379. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  4380. title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
  4381. categoryName: "block",
  4382. additionalShortcuts: [{
  4383. keyCombination: {
  4384. character: '/'
  4385. },
  4386. description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
  4387. /* translators: The forward-slash character. e.g. '/'. */
  4388. ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
  4389. }]
  4390. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  4391. title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
  4392. shortcuts: textFormattingShortcuts
  4393. }));
  4394. }
  4395. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/enable-feature.js
  4396. /**
  4397. * WordPress dependencies
  4398. */
  4399. function EnableFeature(props) {
  4400. const {
  4401. featureName,
  4402. ...remainingProps
  4403. } = props;
  4404. const isChecked = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', featureName), [featureName]);
  4405. const {
  4406. toggle
  4407. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  4408. const onChange = () => toggle('core/edit-site', featureName);
  4409. return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, extends_extends({
  4410. onChange: onChange,
  4411. isChecked: isChecked
  4412. }, remainingProps));
  4413. }
  4414. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/preferences-modal/index.js
  4415. /**
  4416. * WordPress dependencies
  4417. */
  4418. /**
  4419. * Internal dependencies
  4420. */
  4421. function EditSitePreferencesModal(_ref) {
  4422. let {
  4423. isModalActive,
  4424. toggleModal
  4425. } = _ref;
  4426. const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
  4427. name: 'general',
  4428. tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
  4429. content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4430. title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
  4431. description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.')
  4432. }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
  4433. featureName: "focusMode",
  4434. help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
  4435. label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
  4436. }), (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
  4437. featureName: "showIconLabels",
  4438. label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'),
  4439. help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons.')
  4440. }), (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
  4441. featureName: "showListViewByDefault",
  4442. help: (0,external_wp_i18n_namespaceObject.__)('Opens the block list view sidebar by default.'),
  4443. label: (0,external_wp_i18n_namespaceObject.__)('Always open list view')
  4444. }))
  4445. }, {
  4446. name: 'blocks',
  4447. tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
  4448. content: (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4449. title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'),
  4450. description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.')
  4451. }, (0,external_wp_element_namespaceObject.createElement)(EnableFeature, {
  4452. featureName: "keepCaretInsideBlock",
  4453. help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
  4454. label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
  4455. }))
  4456. }]);
  4457. if (!isModalActive) {
  4458. return null;
  4459. }
  4460. return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, {
  4461. closeModal: toggleModal
  4462. }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, {
  4463. sections: sections
  4464. }));
  4465. }
  4466. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/tools-more-menu-group/index.js
  4467. /**
  4468. * External dependencies
  4469. */
  4470. /**
  4471. * WordPress dependencies
  4472. */
  4473. const {
  4474. Fill: ToolsMoreMenuGroup,
  4475. Slot
  4476. } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteToolsMoreMenuGroup');
  4477. ToolsMoreMenuGroup.Slot = _ref => {
  4478. let {
  4479. fillProps
  4480. } = _ref;
  4481. return (0,external_wp_element_namespaceObject.createElement)(Slot, {
  4482. fillProps: fillProps
  4483. }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && fills);
  4484. };
  4485. /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
  4486. // EXTERNAL MODULE: ./node_modules/downloadjs/download.js
  4487. var download = __webpack_require__(8981);
  4488. var download_default = /*#__PURE__*/__webpack_require__.n(download);
  4489. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/download.js
  4490. /**
  4491. * WordPress dependencies
  4492. */
  4493. const download_download = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4494. xmlns: "http://www.w3.org/2000/svg",
  4495. viewBox: "0 0 24 24"
  4496. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4497. d: "M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z"
  4498. }));
  4499. /* harmony default export */ var library_download = (download_download);
  4500. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/site-export.js
  4501. /**
  4502. * External dependencies
  4503. */
  4504. /**
  4505. * WordPress dependencies
  4506. */
  4507. function SiteExport() {
  4508. const {
  4509. createErrorNotice
  4510. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  4511. async function handleExport() {
  4512. try {
  4513. const response = await external_wp_apiFetch_default()({
  4514. path: '/wp-block-editor/v1/export',
  4515. parse: false,
  4516. headers: {
  4517. Accept: 'application/zip'
  4518. }
  4519. });
  4520. const blob = await response.blob();
  4521. const contentDisposition = response.headers.get('content-disposition');
  4522. const contentDispositionMatches = contentDisposition.match(/=(.+)\.zip/);
  4523. const fileName = contentDispositionMatches[1] ? contentDispositionMatches[1] : 'edit-site-export';
  4524. download_default()(blob, fileName + '.zip', 'application/zip');
  4525. } catch (errorResponse) {
  4526. let error = {};
  4527. try {
  4528. error = await errorResponse.json();
  4529. } catch (e) {}
  4530. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the site export.');
  4531. createErrorNotice(errorMessage, {
  4532. type: 'snackbar'
  4533. });
  4534. }
  4535. }
  4536. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4537. role: "menuitem",
  4538. icon: library_download,
  4539. onClick: handleExport,
  4540. info: (0,external_wp_i18n_namespaceObject.__)('Download your theme with updated templates and styles.')
  4541. }, (0,external_wp_i18n_namespaceObject._x)('Export', 'site exporter menu item'));
  4542. }
  4543. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/welcome-guide-menu-item.js
  4544. /**
  4545. * WordPress dependencies
  4546. */
  4547. function WelcomeGuideMenuItem() {
  4548. const {
  4549. toggle
  4550. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  4551. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4552. onClick: () => toggle('core/edit-site', 'welcomeGuide')
  4553. }, (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'));
  4554. }
  4555. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/copy-content-menu-item.js
  4556. /**
  4557. * WordPress dependencies
  4558. */
  4559. /**
  4560. * Internal dependencies
  4561. */
  4562. function CopyContentMenuItem() {
  4563. const {
  4564. createNotice
  4565. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  4566. const getText = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4567. return () => {
  4568. const {
  4569. getEditedPostId,
  4570. getEditedPostType
  4571. } = select(store_store);
  4572. const {
  4573. getEditedEntityRecord
  4574. } = select(external_wp_coreData_namespaceObject.store);
  4575. const record = getEditedEntityRecord('postType', getEditedPostType(), getEditedPostId());
  4576. if (record) {
  4577. if (typeof record.content === 'function') {
  4578. return record.content(record);
  4579. } else if (record.blocks) {
  4580. return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks);
  4581. } else if (record.content) {
  4582. return record.content;
  4583. }
  4584. }
  4585. return '';
  4586. };
  4587. }, []);
  4588. function onSuccess() {
  4589. createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
  4590. isDismissible: true,
  4591. type: 'snackbar'
  4592. });
  4593. }
  4594. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
  4595. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4596. ref: ref
  4597. }, (0,external_wp_i18n_namespaceObject.__)('Copy all blocks'));
  4598. }
  4599. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/mode-switcher/index.js
  4600. /**
  4601. * WordPress dependencies
  4602. */
  4603. /**
  4604. * Internal dependencies
  4605. */
  4606. /**
  4607. * Set of available mode options.
  4608. *
  4609. * @type {Array}
  4610. */
  4611. const MODES = [{
  4612. value: 'visual',
  4613. label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
  4614. }, {
  4615. value: 'text',
  4616. label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
  4617. }];
  4618. function ModeSwitcher() {
  4619. const {
  4620. shortcut,
  4621. mode
  4622. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  4623. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-mode'),
  4624. isRichEditingEnabled: select(store_store).getSettings().richEditingEnabled,
  4625. isCodeEditingEnabled: select(store_store).getSettings().codeEditingEnabled,
  4626. mode: select(store_store).getEditorMode()
  4627. }), []);
  4628. const {
  4629. switchEditorMode
  4630. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4631. const choices = MODES.map(choice => {
  4632. if (choice.value !== mode) {
  4633. return { ...choice,
  4634. shortcut
  4635. };
  4636. }
  4637. return choice;
  4638. });
  4639. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4640. label: (0,external_wp_i18n_namespaceObject.__)('Editor')
  4641. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
  4642. choices: choices,
  4643. value: mode,
  4644. onSelect: switchEditorMode
  4645. }));
  4646. }
  4647. /* harmony default export */ var mode_switcher = (ModeSwitcher);
  4648. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/more-menu/index.js
  4649. /**
  4650. * WordPress dependencies
  4651. */
  4652. /**
  4653. * Internal dependencies
  4654. */
  4655. function MoreMenu(_ref) {
  4656. let {
  4657. showIconLabels
  4658. } = _ref;
  4659. const [isModalActive, toggleModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false);
  4660. const [isPreferencesModalActive, togglePreferencesModal] = (0,external_wp_element_namespaceObject.useReducer)(isActive => !isActive, false);
  4661. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/keyboard-shortcuts', toggleModal);
  4662. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
  4663. toggleProps: {
  4664. showTooltip: !showIconLabels,
  4665. ...(showIconLabels && {
  4666. variant: 'tertiary'
  4667. })
  4668. }
  4669. }, _ref2 => {
  4670. let {
  4671. onClose
  4672. } = _ref2;
  4673. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4674. label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
  4675. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4676. scope: "core/edit-site",
  4677. name: "fixedToolbar",
  4678. label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
  4679. info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
  4680. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
  4681. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
  4682. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4683. scope: "core/edit-site",
  4684. name: "focusMode",
  4685. label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
  4686. info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
  4687. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
  4688. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
  4689. }), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, {
  4690. name: "core/edit-site/plugin-more-menu",
  4691. label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
  4692. as: external_wp_components_namespaceObject.MenuGroup,
  4693. fillProps: {
  4694. onClick: onClose
  4695. }
  4696. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4697. label: (0,external_wp_i18n_namespaceObject.__)('Tools')
  4698. }, (0,external_wp_element_namespaceObject.createElement)(SiteExport, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4699. onClick: toggleModal,
  4700. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
  4701. }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4702. icon: library_external,
  4703. role: "menuitem",
  4704. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/site-editor/'),
  4705. target: "_blank",
  4706. rel: "noopener noreferrer"
  4707. }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  4708. as: "span"
  4709. },
  4710. /* translators: accessibility text */
  4711. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
  4712. fillProps: {
  4713. onClose
  4714. }
  4715. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4716. onClick: togglePreferencesModal
  4717. }, (0,external_wp_i18n_namespaceObject.__)('Preferences'))));
  4718. }), (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcutHelpModal, {
  4719. isModalActive: isModalActive,
  4720. toggleModal: toggleModal
  4721. }), (0,external_wp_element_namespaceObject.createElement)(EditSitePreferencesModal, {
  4722. isModalActive: isPreferencesModalActive,
  4723. toggleModal: togglePreferencesModal
  4724. }));
  4725. }
  4726. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/save-button/index.js
  4727. /**
  4728. * External dependencies
  4729. */
  4730. /**
  4731. * WordPress dependencies
  4732. */
  4733. function SaveButton(_ref) {
  4734. let {
  4735. openEntitiesSavedStates,
  4736. isEntitiesSavedStatesOpen
  4737. } = _ref;
  4738. const {
  4739. isDirty,
  4740. isSaving
  4741. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4742. const {
  4743. __experimentalGetDirtyEntityRecords,
  4744. isSavingEntityRecord
  4745. } = select(external_wp_coreData_namespaceObject.store);
  4746. const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
  4747. return {
  4748. isDirty: dirtyEntityRecords.length > 0,
  4749. isSaving: (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key))
  4750. };
  4751. }, []);
  4752. const disabled = !isDirty || isSaving;
  4753. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  4754. variant: "primary",
  4755. className: "edit-site-save-button__button",
  4756. "aria-disabled": disabled,
  4757. "aria-expanded": isEntitiesSavedStatesOpen,
  4758. isBusy: isSaving,
  4759. onClick: disabled ? undefined : openEntitiesSavedStates
  4760. }, (0,external_wp_i18n_namespaceObject.__)('Save'));
  4761. }
  4762. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
  4763. /**
  4764. * WordPress dependencies
  4765. */
  4766. const undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4767. xmlns: "http://www.w3.org/2000/svg",
  4768. viewBox: "0 0 24 24"
  4769. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4770. 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"
  4771. }));
  4772. /* harmony default export */ var library_undo = (undo);
  4773. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
  4774. /**
  4775. * WordPress dependencies
  4776. */
  4777. const redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4778. xmlns: "http://www.w3.org/2000/svg",
  4779. viewBox: "0 0 24 24"
  4780. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4781. 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"
  4782. }));
  4783. /* harmony default export */ var library_redo = (redo);
  4784. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/undo.js
  4785. /**
  4786. * WordPress dependencies
  4787. */
  4788. function UndoButton(props, ref) {
  4789. const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasUndo(), []);
  4790. const {
  4791. undo
  4792. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  4793. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({}, props, {
  4794. ref: ref,
  4795. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo,
  4796. label: (0,external_wp_i18n_namespaceObject.__)('Undo'),
  4797. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this
  4798. // button, because it will remove focus for keyboard users.
  4799. // See: https://github.com/WordPress/gutenberg/issues/3486
  4800. ,
  4801. "aria-disabled": !hasUndo,
  4802. onClick: hasUndo ? undo : undefined
  4803. }));
  4804. }
  4805. /* harmony default export */ var undo_redo_undo = ((0,external_wp_element_namespaceObject.forwardRef)(UndoButton));
  4806. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/undo-redo/redo.js
  4807. /**
  4808. * WordPress dependencies
  4809. */
  4810. function RedoButton(props, ref) {
  4811. const shortcut = (0,external_wp_keycodes_namespaceObject.isAppleOS)() ? external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') : external_wp_keycodes_namespaceObject.displayShortcut.primary('y');
  4812. const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).hasRedo(), []);
  4813. const {
  4814. redo
  4815. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  4816. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({}, props, {
  4817. ref: ref,
  4818. icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo,
  4819. label: (0,external_wp_i18n_namespaceObject.__)('Redo'),
  4820. shortcut: shortcut // If there are no undo levels we don't want to actually disable this
  4821. // button, because it will remove focus for keyboard users.
  4822. // See: https://github.com/WordPress/gutenberg/issues/3486
  4823. ,
  4824. "aria-disabled": !hasRedo,
  4825. onClick: hasRedo ? redo : undefined
  4826. }));
  4827. }
  4828. /* harmony default export */ var undo_redo_redo = ((0,external_wp_element_namespaceObject.forwardRef)(RedoButton));
  4829. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
  4830. /**
  4831. * WordPress dependencies
  4832. */
  4833. const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4834. viewBox: "0 0 24 24",
  4835. xmlns: "http://www.w3.org/2000/svg"
  4836. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4837. d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
  4838. }));
  4839. /* harmony default export */ var chevron_down = (chevronDown);
  4840. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/document-actions/index.js
  4841. /**
  4842. * External dependencies
  4843. */
  4844. /**
  4845. * WordPress dependencies
  4846. */
  4847. function getBlockDisplayText(block) {
  4848. if (block) {
  4849. const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(block.name);
  4850. return blockType ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, block.attributes) : null;
  4851. }
  4852. return null;
  4853. }
  4854. function useSecondaryText() {
  4855. const {
  4856. getBlock
  4857. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
  4858. const activeEntityBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).__experimentalGetActiveBlockIdByBlockNames(['core/template-part']), []);
  4859. if (activeEntityBlockId) {
  4860. return {
  4861. label: getBlockDisplayText(getBlock(activeEntityBlockId)),
  4862. isActive: true
  4863. };
  4864. }
  4865. return {};
  4866. }
  4867. /**
  4868. * @param {Object} props Props for the DocumentActions component.
  4869. * @param {string} props.entityTitle The title to display.
  4870. * @param {string} props.entityLabel A label to use for entity-related options.
  4871. * E.g. "template" would be used for "edit
  4872. * template" and "show template details".
  4873. * @param {boolean} props.isLoaded Whether the data is available.
  4874. * @param {Function} props.children React component to use for the
  4875. * information dropdown area. Should be a
  4876. * function which accepts dropdown props.
  4877. * @param {boolean} props.showIconLabels Whether buttons display icons or text labels.
  4878. */
  4879. function DocumentActions(_ref) {
  4880. let {
  4881. entityTitle,
  4882. entityLabel,
  4883. isLoaded,
  4884. children: dropdownContent,
  4885. showIconLabels
  4886. } = _ref;
  4887. const {
  4888. label
  4889. } = useSecondaryText(); // Use internal state instead of a ref to make sure that the component
  4890. // re-renders when the popover's anchor updates.
  4891. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  4892. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  4893. // Use the title wrapper as the popover anchor so that the dropdown is
  4894. // centered over the whole title area rather than just one part of it.
  4895. anchor: popoverAnchor
  4896. }), [popoverAnchor]); // Return a simple loading indicator until we have information to show.
  4897. if (!isLoaded) {
  4898. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4899. className: "edit-site-document-actions"
  4900. }, (0,external_wp_i18n_namespaceObject.__)('Loading…'));
  4901. } // Return feedback that the template does not seem to exist.
  4902. if (!entityTitle) {
  4903. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4904. className: "edit-site-document-actions"
  4905. }, (0,external_wp_i18n_namespaceObject.__)('Template not found'));
  4906. }
  4907. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4908. className: classnames_default()('edit-site-document-actions', {
  4909. 'has-secondary-label': !!label
  4910. })
  4911. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  4912. ref: setPopoverAnchor,
  4913. className: "edit-site-document-actions__title-wrapper"
  4914. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  4915. size: "body",
  4916. className: "edit-site-document-actions__title",
  4917. as: "h1"
  4918. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  4919. as: "span"
  4920. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  4921. /* translators: %s: the entity being edited, like "template"*/
  4922. (0,external_wp_i18n_namespaceObject.__)('Editing %s: '), entityLabel)), entityTitle), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  4923. size: "body",
  4924. className: "edit-site-document-actions__secondary-item"
  4925. }, label !== null && label !== void 0 ? label : ''), dropdownContent && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  4926. popoverProps: popoverProps,
  4927. position: "bottom center",
  4928. renderToggle: _ref2 => {
  4929. let {
  4930. isOpen,
  4931. onToggle
  4932. } = _ref2;
  4933. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  4934. className: "edit-site-document-actions__get-info",
  4935. icon: chevron_down,
  4936. "aria-expanded": isOpen,
  4937. "aria-haspopup": "true",
  4938. onClick: onToggle,
  4939. variant: showIconLabels ? 'tertiary' : undefined,
  4940. label: (0,external_wp_i18n_namespaceObject.sprintf)(
  4941. /* translators: %s: the entity to see details about, like "template"*/
  4942. (0,external_wp_i18n_namespaceObject.__)('Show %s details'), entityLabel)
  4943. }, showIconLabels && (0,external_wp_i18n_namespaceObject.__)('Details'));
  4944. },
  4945. contentClassName: "edit-site-document-actions__info-dropdown",
  4946. renderContent: dropdownContent
  4947. })));
  4948. }
  4949. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/template-areas.js
  4950. /**
  4951. * WordPress dependencies
  4952. */
  4953. /**
  4954. * Internal dependencies
  4955. */
  4956. function TemplatePartItemMore(_ref) {
  4957. var _templatePart$title;
  4958. let {
  4959. onClose,
  4960. templatePart,
  4961. closeTemplateDetailsDropdown
  4962. } = _ref;
  4963. const {
  4964. revertTemplate
  4965. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4966. const {
  4967. params
  4968. } = useLocation();
  4969. const editLinkProps = useLink({
  4970. postId: templatePart.id,
  4971. postType: templatePart.type
  4972. }, {
  4973. fromTemplateId: params.postId
  4974. });
  4975. function editTemplatePart(event) {
  4976. editLinkProps.onClick(event);
  4977. onClose();
  4978. closeTemplateDetailsDropdown();
  4979. }
  4980. function clearCustomizations() {
  4981. revertTemplate(templatePart);
  4982. onClose();
  4983. closeTemplateDetailsDropdown();
  4984. }
  4985. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, extends_extends({}, editLinkProps, {
  4986. onClick: editTemplatePart
  4987. }), (0,external_wp_i18n_namespaceObject.sprintf)(
  4988. /* translators: %s: template part title */
  4989. (0,external_wp_i18n_namespaceObject.__)('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), isTemplateRevertable(templatePart) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4990. info: (0,external_wp_i18n_namespaceObject.__)('Use the template part as supplied by the theme.'),
  4991. onClick: clearCustomizations
  4992. }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))));
  4993. }
  4994. function TemplatePartItem(_ref2) {
  4995. let {
  4996. templatePart,
  4997. clientId,
  4998. closeTemplateDetailsDropdown
  4999. } = _ref2;
  5000. const {
  5001. selectBlock,
  5002. toggleBlockHighlight
  5003. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  5004. const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5005. const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas();
  5006. return defaultAreas.find(defaultArea => defaultArea.area === templatePart.area);
  5007. }, [templatePart.area]);
  5008. const highlightBlock = () => toggleBlockHighlight(clientId, true);
  5009. const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
  5010. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5011. role: "menuitem",
  5012. className: "edit-site-template-details__template-areas-item"
  5013. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  5014. role: "button",
  5015. icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
  5016. iconPosition: "left",
  5017. onClick: () => {
  5018. selectBlock(clientId);
  5019. },
  5020. onMouseOver: highlightBlock,
  5021. onMouseLeave: cancelHighlightBlock,
  5022. onFocus: highlightBlock,
  5023. onBlur: cancelHighlightBlock
  5024. }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
  5025. icon: more_vertical,
  5026. label: (0,external_wp_i18n_namespaceObject.__)('More options'),
  5027. className: "edit-site-template-details__template-areas-item-more"
  5028. }, _ref3 => {
  5029. let {
  5030. onClose
  5031. } = _ref3;
  5032. return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItemMore, {
  5033. onClose: onClose,
  5034. templatePart: templatePart,
  5035. closeTemplateDetailsDropdown: closeTemplateDetailsDropdown
  5036. });
  5037. }));
  5038. }
  5039. function TemplateAreas(_ref4) {
  5040. let {
  5041. closeTemplateDetailsDropdown
  5042. } = _ref4;
  5043. const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []);
  5044. if (!templateParts.length) {
  5045. return null;
  5046. }
  5047. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  5048. label: (0,external_wp_i18n_namespaceObject.__)('Areas'),
  5049. className: "edit-site-template-details__group edit-site-template-details__template-areas"
  5050. }, templateParts.map(_ref5 => {
  5051. let {
  5052. templatePart,
  5053. block
  5054. } = _ref5;
  5055. return (0,external_wp_element_namespaceObject.createElement)(TemplatePartItem, {
  5056. key: templatePart.slug,
  5057. clientId: block.clientId,
  5058. templatePart: templatePart,
  5059. closeTemplateDetailsDropdown: closeTemplateDetailsDropdown
  5060. });
  5061. }));
  5062. }
  5063. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/edit-template-title.js
  5064. /**
  5065. * WordPress dependencies
  5066. */
  5067. function EditTemplateTitle(_ref) {
  5068. let {
  5069. template
  5070. } = _ref;
  5071. const [forceEmpty, setForceEmpty] = (0,external_wp_element_namespaceObject.useState)(false);
  5072. const [title, setTitle] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', template.type, 'title', template.id);
  5073. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  5074. label: (0,external_wp_i18n_namespaceObject.__)('Title'),
  5075. value: forceEmpty ? '' : title,
  5076. help: template.type !== 'wp_template_part' ? (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".') : null,
  5077. onChange: newTitle => {
  5078. if (!newTitle && !forceEmpty) {
  5079. setForceEmpty(true);
  5080. return;
  5081. }
  5082. setForceEmpty(false);
  5083. setTitle(newTitle);
  5084. },
  5085. onBlur: () => setForceEmpty(false)
  5086. });
  5087. }
  5088. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/template-part-area-selector.js
  5089. /**
  5090. * WordPress dependencies
  5091. */
  5092. function TemplatePartAreaSelector(_ref) {
  5093. let {
  5094. id
  5095. } = _ref;
  5096. const [area, setArea] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', 'wp_template_part', 'area', id);
  5097. const definedAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
  5098. const areaOptions = definedAreas.map(_ref2 => {
  5099. let {
  5100. label,
  5101. area: _area
  5102. } = _ref2;
  5103. return {
  5104. label,
  5105. value: _area
  5106. };
  5107. });
  5108. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
  5109. label: (0,external_wp_i18n_namespaceObject.__)('Area'),
  5110. labelPosition: "top",
  5111. options: areaOptions,
  5112. value: area,
  5113. onChange: setArea
  5114. });
  5115. }
  5116. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-details/index.js
  5117. /**
  5118. * WordPress dependencies
  5119. */
  5120. /**
  5121. * Internal dependencies
  5122. */
  5123. function TemplateDetails(_ref) {
  5124. let {
  5125. template,
  5126. onClose
  5127. } = _ref;
  5128. const {
  5129. title,
  5130. description
  5131. } = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetTemplateInfo(template), []);
  5132. const {
  5133. revertTemplate
  5134. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5135. const browseAllLinkProps = useLink({
  5136. // TODO: We should update this to filter by template part's areas as well.
  5137. postType: template.type,
  5138. postId: undefined
  5139. });
  5140. const isTemplatePart = template.type === 'wp_template_part'; // Only user-created and non-default templates can change the name.
  5141. // But any user-created template part can be renamed.
  5142. const canEditTitle = isTemplatePart ? !template.has_theme_file : template.is_custom && !template.has_theme_file;
  5143. if (!template) {
  5144. return null;
  5145. }
  5146. const revert = () => {
  5147. revertTemplate(template);
  5148. onClose();
  5149. };
  5150. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5151. className: "edit-site-template-details"
  5152. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  5153. className: "edit-site-template-details__group",
  5154. spacing: 3
  5155. }, canEditTitle ? (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, {
  5156. template: template
  5157. }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  5158. size: 16,
  5159. weight: 600,
  5160. className: "edit-site-template-details__title",
  5161. as: "p"
  5162. }, title), description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  5163. size: "body",
  5164. className: "edit-site-template-details__description",
  5165. as: "p"
  5166. }, description)), isTemplatePart && (0,external_wp_element_namespaceObject.createElement)("div", {
  5167. className: "edit-site-template-details__group"
  5168. }, (0,external_wp_element_namespaceObject.createElement)(TemplatePartAreaSelector, {
  5169. id: template.id
  5170. })), (0,external_wp_element_namespaceObject.createElement)(TemplateAreas, {
  5171. closeTemplateDetailsDropdown: onClose
  5172. }), isTemplateRevertable(template) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  5173. className: "edit-site-template-details__group edit-site-template-details__revert"
  5174. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  5175. className: "edit-site-template-details__revert-button",
  5176. info: (0,external_wp_i18n_namespaceObject.__)('Use the template as supplied by the theme.'),
  5177. onClick: revert
  5178. }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, extends_extends({
  5179. className: "edit-site-template-details__show-all-button"
  5180. }, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? (0,external_wp_i18n_namespaceObject.__)('Browse all templates') : (0,external_wp_i18n_namespaceObject.__)('Browse all template parts')));
  5181. }
  5182. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/index.js
  5183. /**
  5184. * External dependencies
  5185. */
  5186. /**
  5187. * WordPress dependencies
  5188. */
  5189. /**
  5190. * Internal dependencies
  5191. */
  5192. const preventDefault = event => {
  5193. event.preventDefault();
  5194. };
  5195. function Header(_ref) {
  5196. var _window;
  5197. let {
  5198. openEntitiesSavedStates,
  5199. isEntitiesSavedStatesOpen,
  5200. showIconLabels
  5201. } = _ref;
  5202. const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
  5203. const {
  5204. deviceType,
  5205. entityTitle,
  5206. template,
  5207. templateType,
  5208. isInserterOpen,
  5209. isListViewOpen,
  5210. listViewShortcut,
  5211. isLoaded,
  5212. isVisualMode,
  5213. blockEditorMode,
  5214. homeUrl
  5215. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5216. var _getUnstableBase;
  5217. const {
  5218. __experimentalGetPreviewDeviceType,
  5219. getEditedPostType,
  5220. getEditedPostId,
  5221. isInserterOpened,
  5222. isListViewOpened,
  5223. getEditorMode
  5224. } = select(store_store);
  5225. const {
  5226. getEditedEntityRecord
  5227. } = select(external_wp_coreData_namespaceObject.store);
  5228. const {
  5229. __experimentalGetTemplateInfo: getTemplateInfo
  5230. } = select(external_wp_editor_namespaceObject.store);
  5231. const {
  5232. getShortcutRepresentation
  5233. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  5234. const {
  5235. __unstableGetEditorMode
  5236. } = select(external_wp_blockEditor_namespaceObject.store);
  5237. const postType = getEditedPostType();
  5238. const postId = getEditedPostId();
  5239. const record = getEditedEntityRecord('postType', postType, postId);
  5240. const _isLoaded = !!postId;
  5241. const {
  5242. getUnstableBase // Site index.
  5243. } = select(external_wp_coreData_namespaceObject.store);
  5244. return {
  5245. deviceType: __experimentalGetPreviewDeviceType(),
  5246. entityTitle: getTemplateInfo(record).title,
  5247. isLoaded: _isLoaded,
  5248. template: record,
  5249. templateType: postType,
  5250. isInserterOpen: isInserterOpened(),
  5251. isListViewOpen: isListViewOpened(),
  5252. listViewShortcut: getShortcutRepresentation('core/edit-site/toggle-list-view'),
  5253. isVisualMode: getEditorMode() === 'visual',
  5254. blockEditorMode: __unstableGetEditorMode(),
  5255. homeUrl: (_getUnstableBase = getUnstableBase()) === null || _getUnstableBase === void 0 ? void 0 : _getUnstableBase.home
  5256. };
  5257. }, []);
  5258. const {
  5259. __experimentalSetPreviewDeviceType: setPreviewDeviceType,
  5260. setIsInserterOpened,
  5261. setIsListViewOpened
  5262. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5263. const {
  5264. __unstableSetEditorMode
  5265. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  5266. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  5267. const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
  5268. if (isInserterOpen) {
  5269. // Focusing the inserter button closes the inserter popover.
  5270. inserterButton.current.focus();
  5271. } else {
  5272. setIsInserterOpened(true);
  5273. }
  5274. }, [isInserterOpen, setIsInserterOpened]);
  5275. const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
  5276. const isFocusMode = templateType === 'wp_template_part';
  5277. /* translators: button label text should, if possible, be under 16 characters. */
  5278. const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button');
  5279. const shortLabel = !isInserterOpen ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close');
  5280. const isZoomedOutViewExperimentEnabled = ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableZoomedOutView) && isVisualMode;
  5281. const isZoomedOutView = blockEditorMode === 'zoom-out';
  5282. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5283. className: "edit-site-header"
  5284. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
  5285. className: "edit-site-header_start",
  5286. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document tools')
  5287. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  5288. className: "edit-site-header__toolbar"
  5289. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  5290. ref: inserterButton,
  5291. as: external_wp_components_namespaceObject.Button,
  5292. className: "edit-site-header-toolbar__inserter-toggle",
  5293. variant: "primary",
  5294. isPressed: isInserterOpen,
  5295. onMouseDown: preventDefault,
  5296. onClick: openInserter,
  5297. disabled: !isVisualMode,
  5298. icon: library_plus,
  5299. label: showIconLabels ? shortLabel : longLabel,
  5300. showTooltip: !showIconLabels
  5301. }), isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  5302. as: external_wp_blockEditor_namespaceObject.ToolSelector,
  5303. showTooltip: !showIconLabels,
  5304. variant: showIconLabels ? 'tertiary' : undefined,
  5305. disabled: !isVisualMode
  5306. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  5307. as: undo_redo_undo,
  5308. showTooltip: !showIconLabels,
  5309. variant: showIconLabels ? 'tertiary' : undefined
  5310. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  5311. as: undo_redo_redo,
  5312. showTooltip: !showIconLabels,
  5313. variant: showIconLabels ? 'tertiary' : undefined
  5314. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  5315. as: external_wp_components_namespaceObject.Button,
  5316. className: "edit-site-header-toolbar__list-view-toggle",
  5317. disabled: !isVisualMode && isZoomedOutView,
  5318. icon: list_view,
  5319. isPressed: isListViewOpen
  5320. /* translators: button label text should, if possible, be under 16 characters. */
  5321. ,
  5322. label: (0,external_wp_i18n_namespaceObject.__)('List View'),
  5323. onClick: toggleListView,
  5324. shortcut: listViewShortcut,
  5325. showTooltip: !showIconLabels,
  5326. variant: showIconLabels ? 'tertiary' : undefined
  5327. }), isZoomedOutViewExperimentEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  5328. as: external_wp_components_namespaceObject.Button,
  5329. className: "edit-site-header-toolbar__zoom-out-view-toggle",
  5330. icon: chevron_up_down,
  5331. isPressed: isZoomedOutView
  5332. /* translators: button label text should, if possible, be under 16 characters. */
  5333. ,
  5334. label: (0,external_wp_i18n_namespaceObject.__)('Zoom-out View'),
  5335. onClick: () => {
  5336. setPreviewDeviceType('desktop');
  5337. setIsListViewOpened(false);
  5338. __unstableSetEditorMode(isZoomedOutView ? 'edit' : 'zoom-out');
  5339. }
  5340. })))), (0,external_wp_element_namespaceObject.createElement)("div", {
  5341. className: "edit-site-header_center"
  5342. }, (0,external_wp_element_namespaceObject.createElement)(DocumentActions, {
  5343. entityTitle: entityTitle,
  5344. entityLabel: templateType === 'wp_template_part' ? 'template part' : 'template',
  5345. isLoaded: isLoaded,
  5346. showIconLabels: showIconLabels
  5347. }, _ref2 => {
  5348. let {
  5349. onClose
  5350. } = _ref2;
  5351. return (0,external_wp_element_namespaceObject.createElement)(TemplateDetails, {
  5352. template: template,
  5353. onClose: onClose
  5354. });
  5355. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5356. className: "edit-site-header_end"
  5357. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  5358. className: "edit-site-header__actions"
  5359. }, !isFocusMode && (0,external_wp_element_namespaceObject.createElement)("div", {
  5360. className: classnames_default()('edit-site-header__actions__preview-options', {
  5361. 'is-zoomed-out': isZoomedOutView
  5362. })
  5363. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, {
  5364. deviceType: deviceType,
  5365. setDeviceType: setPreviewDeviceType
  5366. /* translators: button label text should, if possible, be under 16 characters. */
  5367. ,
  5368. viewLabel: (0,external_wp_i18n_namespaceObject.__)('View')
  5369. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  5370. href: homeUrl,
  5371. target: "_blank",
  5372. icon: library_external
  5373. }, (0,external_wp_i18n_namespaceObject.__)('View site'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  5374. as: "span"
  5375. },
  5376. /* translators: accessibility text */
  5377. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))))), (0,external_wp_element_namespaceObject.createElement)(SaveButton, {
  5378. openEntitiesSavedStates: openEntitiesSavedStates,
  5379. isEntitiesSavedStatesOpen: isEntitiesSavedStatesOpen
  5380. }), (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  5381. scope: "core/edit-site"
  5382. }), (0,external_wp_element_namespaceObject.createElement)(MoreMenu, {
  5383. showIconLabels: showIconLabels
  5384. }))));
  5385. }
  5386. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
  5387. /**
  5388. * WordPress dependencies
  5389. */
  5390. const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5391. xmlns: "http://www.w3.org/2000/svg",
  5392. viewBox: "0 0 24 24"
  5393. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5394. fillRule: "evenodd",
  5395. d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
  5396. clipRule: "evenodd"
  5397. }));
  5398. /* harmony default export */ var library_cog = (cog);
  5399. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/default-sidebar.js
  5400. /**
  5401. * WordPress dependencies
  5402. */
  5403. /**
  5404. * Internal dependencies
  5405. */
  5406. function default_sidebar_DefaultSidebar(_ref) {
  5407. let {
  5408. className,
  5409. identifier,
  5410. title,
  5411. icon,
  5412. children,
  5413. closeLabel,
  5414. header,
  5415. headerClassName,
  5416. panelClassName
  5417. } = _ref;
  5418. const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getSettings().showIconLabels, []);
  5419. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(complementary_area, {
  5420. className: className,
  5421. scope: "core/edit-site",
  5422. identifier: identifier,
  5423. title: title,
  5424. icon: icon,
  5425. closeLabel: closeLabel,
  5426. header: header,
  5427. headerClassName: headerClassName,
  5428. panelClassName: panelClassName,
  5429. showIconLabels: showIconLabels
  5430. }, children), (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
  5431. scope: "core/edit-site",
  5432. identifier: identifier,
  5433. icon: icon
  5434. }, title));
  5435. }
  5436. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/styles.js
  5437. /**
  5438. * WordPress dependencies
  5439. */
  5440. const styles = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5441. viewBox: "0 0 24 24",
  5442. xmlns: "http://www.w3.org/2000/svg"
  5443. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5444. d: "M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z"
  5445. }));
  5446. /* harmony default export */ var library_styles = (styles);
  5447. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/icon-with-current-color.js
  5448. /**
  5449. * External dependencies
  5450. */
  5451. /**
  5452. * WordPress dependencies
  5453. */
  5454. function IconWithCurrentColor(_ref) {
  5455. let {
  5456. className,
  5457. ...props
  5458. } = _ref;
  5459. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, extends_extends({
  5460. className: classnames_default()(className, 'edit-site-global-styles-icon-with-current-color')
  5461. }, props));
  5462. }
  5463. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/navigation-button.js
  5464. /**
  5465. * WordPress dependencies
  5466. */
  5467. /**
  5468. * Internal dependencies
  5469. */
  5470. function GenericNavigationButton(_ref) {
  5471. let {
  5472. icon,
  5473. children,
  5474. ...props
  5475. } = _ref;
  5476. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItem, props, icon && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  5477. justify: "flex-start"
  5478. }, (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, {
  5479. icon: icon,
  5480. size: 24
  5481. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, children)), !icon && children);
  5482. }
  5483. function NavigationButtonAsItem(props) {
  5484. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, extends_extends({
  5485. as: GenericNavigationButton
  5486. }, props));
  5487. }
  5488. function NavigationBackButtonAsItem(props) {
  5489. return createElement(NavigatorBackButton, _extends({
  5490. as: GenericNavigationButton
  5491. }, props));
  5492. }
  5493. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/typography.js
  5494. /**
  5495. * WordPress dependencies
  5496. */
  5497. const typography = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5498. xmlns: "http://www.w3.org/2000/svg",
  5499. viewBox: "0 0 24 24"
  5500. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5501. d: "M6.9 7L3 17.8h1.7l1-2.8h4.1l1 2.8h1.7L8.6 7H6.9zm-.7 6.6l1.5-4.3 1.5 4.3h-3zM21.6 17c-.1.1-.2.2-.3.2-.1.1-.2.1-.4.1s-.3-.1-.4-.2c-.1-.1-.1-.3-.1-.6V12c0-.5 0-1-.1-1.4-.1-.4-.3-.7-.5-1-.2-.2-.5-.4-.9-.5-.4 0-.8-.1-1.3-.1s-1 .1-1.4.2c-.4.1-.7.3-1 .4-.2.2-.4.3-.6.5-.1.2-.2.4-.2.7 0 .3.1.5.2.8.2.2.4.3.8.3.3 0 .6-.1.8-.3.2-.2.3-.4.3-.7 0-.3-.1-.5-.2-.7-.2-.2-.4-.3-.6-.4.2-.2.4-.3.7-.4.3-.1.6-.1.8-.1.3 0 .6 0 .8.1.2.1.4.3.5.5.1.2.2.5.2.9v1.1c0 .3-.1.5-.3.6-.2.2-.5.3-.9.4-.3.1-.7.3-1.1.4-.4.1-.8.3-1.1.5-.3.2-.6.4-.8.7-.2.3-.3.7-.3 1.2 0 .6.2 1.1.5 1.4.3.4.9.5 1.6.5.5 0 1-.1 1.4-.3.4-.2.8-.6 1.1-1.1 0 .4.1.7.3 1 .2.3.6.4 1.2.4.4 0 .7-.1.9-.2.2-.1.5-.3.7-.4h-.3zm-3-.9c-.2.4-.5.7-.8.8-.3.2-.6.2-.8.2-.4 0-.6-.1-.9-.3-.2-.2-.3-.6-.3-1.1 0-.5.1-.9.3-1.2s.5-.5.8-.7c.3-.2.7-.3 1-.5.3-.1.6-.3.7-.6v3.4z"
  5502. }));
  5503. /* harmony default export */ var library_typography = (typography);
  5504. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/color.js
  5505. /**
  5506. * WordPress dependencies
  5507. */
  5508. const color = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5509. viewBox: "0 0 24 24",
  5510. xmlns: "http://www.w3.org/2000/svg"
  5511. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5512. d: "M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z"
  5513. }));
  5514. /* harmony default export */ var library_color = (color);
  5515. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
  5516. /**
  5517. * WordPress dependencies
  5518. */
  5519. const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5520. xmlns: "http://www.w3.org/2000/svg",
  5521. viewBox: "0 0 24 24"
  5522. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5523. 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"
  5524. }));
  5525. /* harmony default export */ var library_layout = (layout);
  5526. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-utils.js
  5527. /**
  5528. * The fluid utilities must match the backend equivalent.
  5529. * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php
  5530. * ---------------------------------------------------------------
  5531. */
  5532. /**
  5533. * WordPress dependencies
  5534. */
  5535. /**
  5536. * @typedef {Object} FluidPreset
  5537. * @property {string|undefined} max A maximum font size value.
  5538. * @property {?string|undefined} min A minimum font size value.
  5539. */
  5540. /**
  5541. * @typedef {Object} Preset
  5542. * @property {?string|?number} size A default font size.
  5543. * @property {string} name A font size name, displayed in the UI.
  5544. * @property {string} slug A font size slug
  5545. * @property {boolean|FluidPreset|undefined} fluid A font size slug
  5546. */
  5547. /**
  5548. * Returns a font-size value based on a given font-size preset.
  5549. * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.
  5550. *
  5551. * @param {Preset} preset
  5552. * @param {Object} typographySettings
  5553. * @param {boolean} typographySettings.fluid Whether fluid typography is enabled.
  5554. *
  5555. * @return {string|*} A font-size value or the value of preset.size.
  5556. */
  5557. function getTypographyFontSizeValue(preset, typographySettings) {
  5558. var _preset$fluid, _preset$fluid2;
  5559. const {
  5560. size: defaultSize
  5561. } = preset;
  5562. /*
  5563. * Catches falsy values and 0/'0'.
  5564. * Fluid calculations cannot be performed on 0.
  5565. */
  5566. if (!defaultSize || '0' === defaultSize) {
  5567. return defaultSize;
  5568. }
  5569. if (true !== (typographySettings === null || typographySettings === void 0 ? void 0 : typographySettings.fluid)) {
  5570. return defaultSize;
  5571. } // A font size has explicitly bypassed fluid calculations.
  5572. if (false === (preset === null || preset === void 0 ? void 0 : preset.fluid)) {
  5573. return defaultSize;
  5574. }
  5575. const fluidFontSizeValue = (0,external_wp_blockEditor_namespaceObject.getComputedFluidTypographyValue)({
  5576. minimumFontSize: preset === null || preset === void 0 ? void 0 : (_preset$fluid = preset.fluid) === null || _preset$fluid === void 0 ? void 0 : _preset$fluid.min,
  5577. maximumFontSize: preset === null || preset === void 0 ? void 0 : (_preset$fluid2 = preset.fluid) === null || _preset$fluid2 === void 0 ? void 0 : _preset$fluid2.max,
  5578. fontSize: defaultSize
  5579. });
  5580. if (!!fluidFontSizeValue) {
  5581. return fluidFontSizeValue;
  5582. }
  5583. return defaultSize;
  5584. }
  5585. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/utils.js
  5586. /**
  5587. * External dependencies
  5588. */
  5589. /**
  5590. * Internal dependencies
  5591. */
  5592. /* Supporting data. */
  5593. const ROOT_BLOCK_NAME = 'root';
  5594. const ROOT_BLOCK_SELECTOR = 'body';
  5595. const ROOT_BLOCK_SUPPORTS = (/* unused pure expression or super */ null && (['background', 'backgroundColor', 'color', 'linkColor', 'buttonColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding']));
  5596. const PRESET_METADATA = [{
  5597. path: ['color', 'palette'],
  5598. valueKey: 'color',
  5599. cssVarInfix: 'color',
  5600. classes: [{
  5601. classSuffix: 'color',
  5602. propertyName: 'color'
  5603. }, {
  5604. classSuffix: 'background-color',
  5605. propertyName: 'background-color'
  5606. }, {
  5607. classSuffix: 'border-color',
  5608. propertyName: 'border-color'
  5609. }]
  5610. }, {
  5611. path: ['color', 'gradients'],
  5612. valueKey: 'gradient',
  5613. cssVarInfix: 'gradient',
  5614. classes: [{
  5615. classSuffix: 'gradient-background',
  5616. propertyName: 'background'
  5617. }]
  5618. }, {
  5619. path: ['color', 'duotone'],
  5620. cssVarInfix: 'duotone',
  5621. valueFunc: _ref => {
  5622. let {
  5623. slug
  5624. } = _ref;
  5625. return `url( '#wp-duotone-${slug}' )`;
  5626. },
  5627. classes: []
  5628. }, {
  5629. path: ['typography', 'fontSizes'],
  5630. valueFunc: (preset, _ref2) => {
  5631. let {
  5632. typography: typographySettings
  5633. } = _ref2;
  5634. return getTypographyFontSizeValue(preset, typographySettings);
  5635. },
  5636. valueKey: 'size',
  5637. cssVarInfix: 'font-size',
  5638. classes: [{
  5639. classSuffix: 'font-size',
  5640. propertyName: 'font-size'
  5641. }]
  5642. }, {
  5643. path: ['typography', 'fontFamilies'],
  5644. valueKey: 'fontFamily',
  5645. cssVarInfix: 'font-family',
  5646. classes: [{
  5647. classSuffix: 'font-family',
  5648. propertyName: 'font-family'
  5649. }]
  5650. }, {
  5651. path: ['spacing', 'spacingSizes'],
  5652. valueKey: 'size',
  5653. cssVarInfix: 'spacing',
  5654. valueFunc: _ref3 => {
  5655. let {
  5656. size
  5657. } = _ref3;
  5658. return size;
  5659. },
  5660. classes: []
  5661. }];
  5662. const STYLE_PATH_TO_CSS_VAR_INFIX = {
  5663. 'color.background': 'color',
  5664. 'color.text': 'color',
  5665. 'elements.link.color.text': 'color',
  5666. 'elements.button.color.text': 'color',
  5667. 'elements.button.backgroundColor': 'background-color',
  5668. 'elements.heading.color': 'color',
  5669. 'elements.heading.backgroundColor': 'background-color',
  5670. 'elements.heading.gradient': 'gradient',
  5671. 'color.gradient': 'gradient',
  5672. 'typography.fontSize': 'font-size',
  5673. 'typography.fontFamily': 'font-family'
  5674. };
  5675. function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
  5676. // Block presets take priority above root level presets.
  5677. const orderedPresetsByOrigin = [(0,external_lodash_namespaceObject.get)(features, ['blocks', blockName, ...presetPath]), (0,external_lodash_namespaceObject.get)(features, presetPath)];
  5678. for (const presetByOrigin of orderedPresetsByOrigin) {
  5679. if (presetByOrigin) {
  5680. // Preset origins ordered by priority.
  5681. const origins = ['custom', 'theme', 'default'];
  5682. for (const origin of origins) {
  5683. const presets = presetByOrigin[origin];
  5684. if (presets) {
  5685. const presetObject = (0,external_lodash_namespaceObject.find)(presets, preset => preset[presetProperty] === presetValueValue);
  5686. if (presetObject) {
  5687. if (presetProperty === 'slug') {
  5688. return presetObject;
  5689. } // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
  5690. const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug);
  5691. if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
  5692. return presetObject;
  5693. }
  5694. return undefined;
  5695. }
  5696. }
  5697. }
  5698. }
  5699. }
  5700. }
  5701. function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) {
  5702. if (!presetPropertyValue) {
  5703. return presetPropertyValue;
  5704. }
  5705. const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath];
  5706. const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', cssVarInfix]);
  5707. if (!metadata) {
  5708. // The property doesn't have preset data
  5709. // so the value should be returned as it is.
  5710. return presetPropertyValue;
  5711. }
  5712. const {
  5713. valueKey,
  5714. path
  5715. } = metadata;
  5716. const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue);
  5717. if (!presetObject) {
  5718. // Value wasn't found in the presets,
  5719. // so it must be a custom value.
  5720. return presetPropertyValue;
  5721. }
  5722. return `var:preset|${cssVarInfix}|${presetObject.slug}`;
  5723. }
  5724. function getValueFromPresetVariable(features, blockName, variable, _ref4) {
  5725. let [presetType, slug] = _ref4;
  5726. const metadata = (0,external_lodash_namespaceObject.find)(PRESET_METADATA, ['cssVarInfix', presetType]);
  5727. if (!metadata) {
  5728. return variable;
  5729. }
  5730. const presetObject = findInPresetsBy(features.settings, blockName, metadata.path, 'slug', slug);
  5731. if (presetObject) {
  5732. const {
  5733. valueKey
  5734. } = metadata;
  5735. const result = presetObject[valueKey];
  5736. return getValueFromVariable(features, blockName, result);
  5737. }
  5738. return variable;
  5739. }
  5740. function getValueFromCustomVariable(features, blockName, variable, path) {
  5741. var _get;
  5742. const result = (_get = (0,external_lodash_namespaceObject.get)(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(features.settings, ['custom', ...path]);
  5743. if (!result) {
  5744. return variable;
  5745. } // A variable may reference another variable so we need recursion until we find the value.
  5746. return getValueFromVariable(features, blockName, result);
  5747. }
  5748. /**
  5749. * Attempts to fetch the value of a theme.json CSS variable.
  5750. *
  5751. * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.
  5752. * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.
  5753. * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.
  5754. * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.
  5755. */
  5756. function getValueFromVariable(features, blockName, variable) {
  5757. if (!variable || typeof variable !== 'string') {
  5758. var _variable, _variable2;
  5759. if ((_variable = variable) !== null && _variable !== void 0 && _variable.ref && typeof ((_variable2 = variable) === null || _variable2 === void 0 ? void 0 : _variable2.ref) === 'string') {
  5760. var _variable3;
  5761. const refPath = variable.ref.split('.');
  5762. variable = (0,external_lodash_namespaceObject.get)(features, refPath); // Presence of another ref indicates a reference to another dynamic value.
  5763. // Pointing to another dynamic value is not supported.
  5764. if (!variable || !!((_variable3 = variable) !== null && _variable3 !== void 0 && _variable3.ref)) {
  5765. return variable;
  5766. }
  5767. } else {
  5768. return variable;
  5769. }
  5770. }
  5771. const USER_VALUE_PREFIX = 'var:';
  5772. const THEME_VALUE_PREFIX = 'var(--wp--';
  5773. const THEME_VALUE_SUFFIX = ')';
  5774. let parsedVar;
  5775. if (variable.startsWith(USER_VALUE_PREFIX)) {
  5776. parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|');
  5777. } else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
  5778. parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--');
  5779. } else {
  5780. // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`
  5781. return variable;
  5782. }
  5783. const [type, ...path] = parsedVar;
  5784. if (type === 'preset') {
  5785. return getValueFromPresetVariable(features, blockName, variable, path);
  5786. }
  5787. if (type === 'custom') {
  5788. return getValueFromCustomVariable(features, blockName, variable, path);
  5789. }
  5790. return variable;
  5791. }
  5792. /**
  5793. * Function that scopes a selector with another one. This works a bit like
  5794. * SCSS nesting except the `&` operator isn't supported.
  5795. *
  5796. * @example
  5797. * ```js
  5798. * const scope = '.a, .b .c';
  5799. * const selector = '> .x, .y';
  5800. * const merged = scopeSelector( scope, selector );
  5801. * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'
  5802. * ```
  5803. *
  5804. * @param {string} scope Selector to scope to.
  5805. * @param {string} selector Original selector.
  5806. *
  5807. * @return {string} Scoped selector.
  5808. */
  5809. function scopeSelector(scope, selector) {
  5810. const scopes = scope.split(',');
  5811. const selectors = selector.split(',');
  5812. const selectorsScoped = [];
  5813. scopes.forEach(outer => {
  5814. selectors.forEach(inner => {
  5815. selectorsScoped.push(`${outer.trim()} ${inner.trim()}`);
  5816. });
  5817. });
  5818. return selectorsScoped.join(', ');
  5819. }
  5820. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context.js
  5821. /**
  5822. * WordPress dependencies
  5823. */
  5824. const DEFAULT_GLOBAL_STYLES_CONTEXT = {
  5825. user: {},
  5826. base: {},
  5827. merged: {},
  5828. setUserConfig: () => {}
  5829. };
  5830. const GlobalStylesContext = (0,external_wp_element_namespaceObject.createContext)(DEFAULT_GLOBAL_STYLES_CONTEXT);
  5831. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/hooks.js
  5832. /**
  5833. * External dependencies
  5834. */
  5835. /**
  5836. * WordPress dependencies
  5837. */
  5838. /**
  5839. * Internal dependencies
  5840. */
  5841. const EMPTY_CONFIG = {
  5842. settings: {},
  5843. styles: {}
  5844. };
  5845. const useGlobalStylesReset = () => {
  5846. const {
  5847. user: config,
  5848. setUserConfig
  5849. } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
  5850. const canReset = !!config && !(0,external_lodash_namespaceObject.isEqual)(config, EMPTY_CONFIG);
  5851. return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(() => EMPTY_CONFIG), [setUserConfig])];
  5852. };
  5853. function useSetting(path, blockName) {
  5854. var _getSettingValueForCo;
  5855. let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
  5856. const {
  5857. merged: mergedConfig,
  5858. base: baseConfig,
  5859. user: userConfig,
  5860. setUserConfig
  5861. } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
  5862. const fullPath = !blockName ? `settings.${path}` : `settings.blocks.${blockName}.${path}`;
  5863. const setSetting = newValue => {
  5864. setUserConfig(currentConfig => {
  5865. // Deep clone `currentConfig` to avoid mutating it later.
  5866. const newUserConfig = JSON.parse(JSON.stringify(currentConfig));
  5867. const pathToSet = external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path] ? fullPath + '.custom' : fullPath;
  5868. (0,external_lodash_namespaceObject.set)(newUserConfig, pathToSet, newValue);
  5869. return newUserConfig;
  5870. });
  5871. };
  5872. const getSettingValueForContext = name => {
  5873. const currentPath = !name ? `settings.${path}` : `settings.blocks.${name}.${path}`;
  5874. const getSettingValue = configToUse => {
  5875. const result = (0,external_lodash_namespaceObject.get)(configToUse, currentPath);
  5876. if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_PATHS_WITH_MERGE[path]) {
  5877. var _ref, _result$custom;
  5878. return (_ref = (_result$custom = result === null || result === void 0 ? void 0 : result.custom) !== null && _result$custom !== void 0 ? _result$custom : result === null || result === void 0 ? void 0 : result.theme) !== null && _ref !== void 0 ? _ref : result === null || result === void 0 ? void 0 : result.default;
  5879. }
  5880. return result;
  5881. };
  5882. let result;
  5883. switch (source) {
  5884. case 'all':
  5885. result = getSettingValue(mergedConfig);
  5886. break;
  5887. case 'user':
  5888. result = getSettingValue(userConfig);
  5889. break;
  5890. case 'base':
  5891. result = getSettingValue(baseConfig);
  5892. break;
  5893. default:
  5894. throw 'Unsupported source';
  5895. }
  5896. return result;
  5897. }; // Unlike styles settings get inherited from top level settings.
  5898. const resultWithFallback = (_getSettingValueForCo = getSettingValueForContext(blockName)) !== null && _getSettingValueForCo !== void 0 ? _getSettingValueForCo : getSettingValueForContext();
  5899. return [resultWithFallback, setSetting];
  5900. }
  5901. function useStyle(path, blockName) {
  5902. var _get;
  5903. let source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'all';
  5904. const {
  5905. merged: mergedConfig,
  5906. base: baseConfig,
  5907. user: userConfig,
  5908. setUserConfig
  5909. } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
  5910. const finalPath = !blockName ? `styles.${path}` : `styles.blocks.${blockName}.${path}`;
  5911. const setStyle = newValue => {
  5912. setUserConfig(currentConfig => {
  5913. // Deep clone `currentConfig` to avoid mutating it later.
  5914. const newUserConfig = JSON.parse(JSON.stringify(currentConfig));
  5915. (0,external_lodash_namespaceObject.set)(newUserConfig, finalPath, getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue));
  5916. return newUserConfig;
  5917. });
  5918. };
  5919. let result;
  5920. switch (source) {
  5921. case 'all':
  5922. result = getValueFromVariable(mergedConfig, blockName, (_get = (0,external_lodash_namespaceObject.get)(userConfig, finalPath)) !== null && _get !== void 0 ? _get : (0,external_lodash_namespaceObject.get)(baseConfig, finalPath));
  5923. break;
  5924. case 'user':
  5925. result = getValueFromVariable(mergedConfig, blockName, (0,external_lodash_namespaceObject.get)(userConfig, finalPath));
  5926. break;
  5927. case 'base':
  5928. result = getValueFromVariable(baseConfig, blockName, (0,external_lodash_namespaceObject.get)(baseConfig, finalPath));
  5929. break;
  5930. default:
  5931. throw 'Unsupported source';
  5932. }
  5933. return [result, setStyle];
  5934. }
  5935. const hooks_ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'buttonColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'padding', 'contentSize', 'wideSize', 'blockGap'];
  5936. function getSupportedGlobalStylesPanels(name) {
  5937. var _blockType$supports, _blockType$supports$s, _blockType$supports2, _blockType$supports2$, _blockType$supports3, _blockType$supports3$, _blockType$supports3$2, _blockType$supports3$3;
  5938. if (!name) {
  5939. return hooks_ROOT_BLOCK_SUPPORTS;
  5940. }
  5941. const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
  5942. if (!blockType) {
  5943. return [];
  5944. }
  5945. const supportKeys = []; // Check for blockGap support.
  5946. // Block spacing support doesn't map directly to a single style property, so needs to be handled separately.
  5947. // Also, only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
  5948. if (blockType !== null && blockType !== void 0 && (_blockType$supports = blockType.supports) !== null && _blockType$supports !== void 0 && (_blockType$supports$s = _blockType$supports.spacing) !== null && _blockType$supports$s !== void 0 && _blockType$supports$s.blockGap && (blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.spacing) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalSkipSerialization) !== true && !(blockType !== null && blockType !== void 0 && (_blockType$supports3 = blockType.supports) !== null && _blockType$supports3 !== void 0 && (_blockType$supports3$ = _blockType$supports3.spacing) !== null && _blockType$supports3$ !== void 0 && (_blockType$supports3$2 = _blockType$supports3$.__experimentalSkipSerialization) !== null && _blockType$supports3$2 !== void 0 && (_blockType$supports3$3 = _blockType$supports3$2.some) !== null && _blockType$supports3$3 !== void 0 && _blockType$supports3$3.call(_blockType$supports3$2, spacingType => spacingType === 'blockGap'))) {
  5949. supportKeys.push('blockGap');
  5950. }
  5951. Object.keys(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY).forEach(styleName => {
  5952. if (!external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) {
  5953. return;
  5954. } // Opting out means that, for certain support keys like background color,
  5955. // blocks have to explicitly set the support value false. If the key is
  5956. // unset, we still enable it.
  5957. if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].requiresOptOut) {
  5958. if (external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support[0] in blockType.supports && (0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support) !== false) {
  5959. return supportKeys.push(styleName);
  5960. }
  5961. }
  5962. if ((0,external_lodash_namespaceObject.get)(blockType.supports, external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY[styleName].support, false)) {
  5963. return supportKeys.push(styleName);
  5964. }
  5965. });
  5966. return supportKeys;
  5967. }
  5968. function useColorsPerOrigin(name) {
  5969. const [customColors] = useSetting('color.palette.custom', name);
  5970. const [themeColors] = useSetting('color.palette.theme', name);
  5971. const [defaultColors] = useSetting('color.palette.default', name);
  5972. const [shouldDisplayDefaultColors] = useSetting('color.defaultPalette');
  5973. return (0,external_wp_element_namespaceObject.useMemo)(() => {
  5974. const result = [];
  5975. if (themeColors && themeColors.length) {
  5976. result.push({
  5977. name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'),
  5978. colors: themeColors
  5979. });
  5980. }
  5981. if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
  5982. result.push({
  5983. name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'),
  5984. colors: defaultColors
  5985. });
  5986. }
  5987. if (customColors && customColors.length) {
  5988. result.push({
  5989. name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'),
  5990. colors: customColors
  5991. });
  5992. }
  5993. return result;
  5994. }, [customColors, themeColors, defaultColors]);
  5995. }
  5996. function useGradientsPerOrigin(name) {
  5997. const [customGradients] = useSetting('color.gradients.custom', name);
  5998. const [themeGradients] = useSetting('color.gradients.theme', name);
  5999. const [defaultGradients] = useSetting('color.gradients.default', name);
  6000. const [shouldDisplayDefaultGradients] = useSetting('color.defaultGradients');
  6001. return (0,external_wp_element_namespaceObject.useMemo)(() => {
  6002. const result = [];
  6003. if (themeGradients && themeGradients.length) {
  6004. result.push({
  6005. name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'),
  6006. gradients: themeGradients
  6007. });
  6008. }
  6009. if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
  6010. result.push({
  6011. name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'),
  6012. gradients: defaultGradients
  6013. });
  6014. }
  6015. if (customGradients && customGradients.length) {
  6016. result.push({
  6017. name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'),
  6018. gradients: customGradients
  6019. });
  6020. }
  6021. return result;
  6022. }, [customGradients, themeGradients, defaultGradients]);
  6023. }
  6024. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/border-panel.js
  6025. /**
  6026. * WordPress dependencies
  6027. */
  6028. /**
  6029. * Internal dependencies
  6030. */
  6031. function useHasBorderPanel(name) {
  6032. const controls = [useHasBorderColorControl(name), useHasBorderRadiusControl(name), useHasBorderStyleControl(name), useHasBorderWidthControl(name)];
  6033. return controls.some(Boolean);
  6034. }
  6035. function useHasBorderColorControl(name) {
  6036. const supports = getSupportedGlobalStylesPanels(name);
  6037. return useSetting('border.color', name)[0] && supports.includes('borderColor');
  6038. }
  6039. function useHasBorderRadiusControl(name) {
  6040. const supports = getSupportedGlobalStylesPanels(name);
  6041. return useSetting('border.radius', name)[0] && supports.includes('borderRadius');
  6042. }
  6043. function useHasBorderStyleControl(name) {
  6044. const supports = getSupportedGlobalStylesPanels(name);
  6045. return useSetting('border.style', name)[0] && supports.includes('borderStyle');
  6046. }
  6047. function useHasBorderWidthControl(name) {
  6048. const supports = getSupportedGlobalStylesPanels(name);
  6049. return useSetting('border.width', name)[0] && supports.includes('borderWidth');
  6050. }
  6051. function applyFallbackStyle(border) {
  6052. if (!border) {
  6053. return border;
  6054. }
  6055. if (!border.style && (border.color || border.width)) {
  6056. return { ...border,
  6057. style: 'solid'
  6058. };
  6059. }
  6060. return border;
  6061. }
  6062. function applyAllFallbackStyles(border) {
  6063. if (!border) {
  6064. return border;
  6065. }
  6066. if ((0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(border)) {
  6067. return {
  6068. top: applyFallbackStyle(border.top),
  6069. right: applyFallbackStyle(border.right),
  6070. bottom: applyFallbackStyle(border.bottom),
  6071. left: applyFallbackStyle(border.left)
  6072. };
  6073. }
  6074. return applyFallbackStyle(border);
  6075. }
  6076. function BorderPanel(_ref) {
  6077. let {
  6078. name
  6079. } = _ref;
  6080. // To better reflect if the user has customized a value we need to
  6081. // ensure the style value being checked is from the `user` origin.
  6082. const [userBorderStyles] = useStyle('border', name, 'user');
  6083. const [border, setBorder] = useStyle('border', name);
  6084. const colors = useColorsPerOrigin(name);
  6085. const showBorderColor = useHasBorderColorControl(name);
  6086. const showBorderStyle = useHasBorderStyleControl(name);
  6087. const showBorderWidth = useHasBorderWidthControl(name); // Border radius.
  6088. const showBorderRadius = useHasBorderRadiusControl(name);
  6089. const [borderRadiusValues, setBorderRadius] = useStyle('border.radius', name);
  6090. const hasBorderRadius = () => {
  6091. const borderValues = userBorderStyles === null || userBorderStyles === void 0 ? void 0 : userBorderStyles.radius;
  6092. if (typeof borderValues === 'object') {
  6093. return Object.entries(borderValues).some(Boolean);
  6094. }
  6095. return !!borderValues;
  6096. };
  6097. const resetBorder = () => {
  6098. if (hasBorderRadius()) {
  6099. return setBorder({
  6100. radius: userBorderStyles.radius
  6101. });
  6102. }
  6103. setBorder(undefined);
  6104. };
  6105. const resetAll = (0,external_wp_element_namespaceObject.useCallback)(() => setBorder(undefined), [setBorder]);
  6106. const onBorderChange = (0,external_wp_element_namespaceObject.useCallback)(newBorder => {
  6107. // Ensure we have a visible border style when a border width or
  6108. // color is being selected.
  6109. const newBorderWithStyle = applyAllFallbackStyles(newBorder); // As we can't conditionally generate styles based on if other
  6110. // style properties have been set we need to force split border
  6111. // definitions for user set border styles. Border radius is derived
  6112. // from the same property i.e. `border.radius` if it is a string
  6113. // that is used. The longhand border radii styles are only generated
  6114. // if that property is an object.
  6115. //
  6116. // For borders (color, style, and width) those are all properties on
  6117. // the `border` style property. This means if the theme.json defined
  6118. // split borders and the user condenses them into a flat border or
  6119. // vice-versa we'd get both sets of styles which would conflict.
  6120. const updatedBorder = !(0,external_wp_components_namespaceObject.__experimentalHasSplitBorders)(newBorderWithStyle) ? {
  6121. top: newBorderWithStyle,
  6122. right: newBorderWithStyle,
  6123. bottom: newBorderWithStyle,
  6124. left: newBorderWithStyle
  6125. } : {
  6126. color: null,
  6127. style: null,
  6128. width: null,
  6129. ...newBorderWithStyle
  6130. }; // As radius is maintained separately to color, style, and width
  6131. // maintain its value. Undefined values here will be cleaned when
  6132. // global styles are saved.
  6133. setBorder({
  6134. radius: border === null || border === void 0 ? void 0 : border.radius,
  6135. ...updatedBorder
  6136. });
  6137. }, [setBorder]);
  6138. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
  6139. label: (0,external_wp_i18n_namespaceObject.__)('Border'),
  6140. resetAll: resetAll
  6141. }, (showBorderWidth || showBorderColor) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6142. hasValue: () => (0,external_wp_components_namespaceObject.__experimentalIsDefinedBorder)(userBorderStyles),
  6143. label: (0,external_wp_i18n_namespaceObject.__)('Border'),
  6144. onDeselect: () => resetBorder(),
  6145. isShownByDefault: true
  6146. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBorderBoxControl, {
  6147. colors: colors,
  6148. enableAlpha: true,
  6149. enableStyle: showBorderStyle,
  6150. onChange: onBorderChange,
  6151. popoverOffset: 40,
  6152. popoverPlacement: "left-start",
  6153. value: border,
  6154. __experimentalHasMultipleOrigins: true,
  6155. __experimentalIsRenderedInSidebar: true
  6156. })), showBorderRadius && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6157. hasValue: hasBorderRadius,
  6158. label: (0,external_wp_i18n_namespaceObject.__)('Radius'),
  6159. onDeselect: () => setBorderRadius(undefined),
  6160. isShownByDefault: true
  6161. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBorderRadiusControl, {
  6162. values: borderRadiusValues,
  6163. onChange: value => {
  6164. setBorderRadius(value || undefined);
  6165. }
  6166. })));
  6167. }
  6168. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-utils.js
  6169. /**
  6170. * Internal dependencies
  6171. */
  6172. function useHasColorPanel(name) {
  6173. const supports = getSupportedGlobalStylesPanels(name);
  6174. return supports.includes('color') || supports.includes('backgroundColor') || supports.includes('background') || supports.includes('linkColor');
  6175. }
  6176. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/position-center.js
  6177. /**
  6178. * WordPress dependencies
  6179. */
  6180. const positionCenter = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  6181. xmlns: "http://www.w3.org/2000/svg",
  6182. viewBox: "0 0 24 24"
  6183. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  6184. d: "M7 9v6h10V9H7zM5 19.8h14v-1.5H5v1.5zM5 4.3v1.5h14V4.3H5z"
  6185. }));
  6186. /* harmony default export */ var position_center = (positionCenter);
  6187. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/stretch-wide.js
  6188. /**
  6189. * WordPress dependencies
  6190. */
  6191. const stretchWide = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  6192. xmlns: "http://www.w3.org/2000/svg",
  6193. viewBox: "0 0 24 24"
  6194. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  6195. d: "M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"
  6196. }));
  6197. /* harmony default export */ var stretch_wide = (stretchWide);
  6198. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/dimensions-panel.js
  6199. /**
  6200. * External dependencies
  6201. */
  6202. /**
  6203. * WordPress dependencies
  6204. */
  6205. /**
  6206. * Internal dependencies
  6207. */
  6208. const AXIAL_SIDES = ['horizontal', 'vertical'];
  6209. function useHasDimensionsPanel(name) {
  6210. const hasContentSize = useHasContentSize(name);
  6211. const hasWideSize = useHasWideSize(name);
  6212. const hasPadding = useHasPadding(name);
  6213. const hasMargin = useHasMargin(name);
  6214. const hasGap = useHasGap(name);
  6215. return hasContentSize || hasWideSize || hasPadding || hasMargin || hasGap;
  6216. }
  6217. function useHasContentSize(name) {
  6218. const supports = getSupportedGlobalStylesPanels(name);
  6219. const [settings] = useSetting('layout.contentSize', name);
  6220. return settings && supports.includes('contentSize');
  6221. }
  6222. function useHasWideSize(name) {
  6223. const supports = getSupportedGlobalStylesPanels(name);
  6224. const [settings] = useSetting('layout.wideSize', name);
  6225. return settings && supports.includes('wideSize');
  6226. }
  6227. function useHasPadding(name) {
  6228. const supports = getSupportedGlobalStylesPanels(name);
  6229. const [settings] = useSetting('spacing.padding', name);
  6230. return settings && supports.includes('padding');
  6231. }
  6232. function useHasMargin(name) {
  6233. const supports = getSupportedGlobalStylesPanels(name);
  6234. const [settings] = useSetting('spacing.margin', name);
  6235. return settings && supports.includes('margin');
  6236. }
  6237. function useHasGap(name) {
  6238. const supports = getSupportedGlobalStylesPanels(name);
  6239. const [settings] = useSetting('spacing.blockGap', name);
  6240. return settings && supports.includes('blockGap');
  6241. }
  6242. function useHasSpacingPresets() {
  6243. const [settings] = useSetting('spacing.spacingSizes');
  6244. return settings && settings.length > 0;
  6245. }
  6246. function filterValuesBySides(values, sides) {
  6247. if (!sides) {
  6248. // If no custom side configuration all sides are opted into by default.
  6249. return values;
  6250. } // Only include sides opted into within filtered values.
  6251. const filteredValues = {};
  6252. sides.forEach(side => {
  6253. if (side === 'vertical') {
  6254. filteredValues.top = values.top;
  6255. filteredValues.bottom = values.bottom;
  6256. }
  6257. if (side === 'horizontal') {
  6258. filteredValues.left = values.left;
  6259. filteredValues.right = values.right;
  6260. }
  6261. filteredValues[side] = values[side];
  6262. });
  6263. return filteredValues;
  6264. }
  6265. function splitStyleValue(value) {
  6266. // Check for shorthand value (a string value).
  6267. if (value && typeof value === 'string') {
  6268. // Convert to value for individual sides for BoxControl.
  6269. return {
  6270. top: value,
  6271. right: value,
  6272. bottom: value,
  6273. left: value
  6274. };
  6275. }
  6276. return value;
  6277. }
  6278. function splitGapValue(value) {
  6279. // Check for shorthand value (a string value).
  6280. if (value && typeof value === 'string') {
  6281. // If the value is a string, treat it as a single side (top) for the spacing controls.
  6282. return {
  6283. top: value
  6284. };
  6285. }
  6286. if (value) {
  6287. return { ...value,
  6288. right: value === null || value === void 0 ? void 0 : value.left,
  6289. bottom: value === null || value === void 0 ? void 0 : value.top
  6290. };
  6291. }
  6292. return value;
  6293. } // Props for managing `layout.contentSize`.
  6294. function useContentSizeProps(name) {
  6295. const [contentSizeValue, setContentSizeValue] = useSetting('layout.contentSize', name);
  6296. const [userSetContentSizeValue] = useSetting('layout.contentSize', name, 'user');
  6297. const hasUserSetContentSizeValue = () => !!userSetContentSizeValue;
  6298. const resetContentSizeValue = () => setContentSizeValue('');
  6299. return {
  6300. contentSizeValue,
  6301. setContentSizeValue,
  6302. hasUserSetContentSizeValue,
  6303. resetContentSizeValue
  6304. };
  6305. } // Props for managing `layout.wideSize`.
  6306. function useWideSizeProps(name) {
  6307. const [wideSizeValue, setWideSizeValue] = useSetting('layout.wideSize', name);
  6308. const [userSetWideSizeValue] = useSetting('layout.wideSize', name, 'user');
  6309. const hasUserSetWideSizeValue = () => !!userSetWideSizeValue;
  6310. const resetWideSizeValue = () => setWideSizeValue('');
  6311. return {
  6312. wideSizeValue,
  6313. setWideSizeValue,
  6314. hasUserSetWideSizeValue,
  6315. resetWideSizeValue
  6316. };
  6317. } // Props for managing `spacing.padding`.
  6318. function usePaddingProps(name) {
  6319. const [rawPadding, setRawPadding] = useStyle('spacing.padding', name);
  6320. const paddingValues = splitStyleValue(rawPadding);
  6321. const paddingSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'padding');
  6322. const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side));
  6323. const setPaddingValues = newPaddingValues => {
  6324. const padding = filterValuesBySides(newPaddingValues, paddingSides);
  6325. setRawPadding(padding);
  6326. };
  6327. const resetPaddingValue = () => setPaddingValues({});
  6328. const [userSetPaddingValue] = useStyle('spacing.padding', name, 'user'); // The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
  6329. const hasPaddingValue = () => !!userSetPaddingValue;
  6330. return {
  6331. paddingValues,
  6332. paddingSides,
  6333. isAxialPadding,
  6334. setPaddingValues,
  6335. resetPaddingValue,
  6336. hasPaddingValue
  6337. };
  6338. } // Props for managing `spacing.margin`.
  6339. function useMarginProps(name) {
  6340. const [rawMargin, setRawMargin] = useStyle('spacing.margin', name);
  6341. const marginValues = splitStyleValue(rawMargin);
  6342. const marginSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'margin');
  6343. const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side));
  6344. const setMarginValues = newMarginValues => {
  6345. const margin = filterValuesBySides(newMarginValues, marginSides);
  6346. setRawMargin(margin);
  6347. };
  6348. const resetMarginValue = () => setMarginValues({});
  6349. const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length;
  6350. return {
  6351. marginValues,
  6352. marginSides,
  6353. isAxialMargin,
  6354. setMarginValues,
  6355. resetMarginValue,
  6356. hasMarginValue
  6357. };
  6358. } // Props for managing `spacing.blockGap`.
  6359. function useBlockGapProps(name) {
  6360. const [gapValue, setGapValue] = useStyle('spacing.blockGap', name);
  6361. const gapValues = splitGapValue(gapValue);
  6362. const gapSides = (0,external_wp_blockEditor_namespaceObject.__experimentalUseCustomSides)(name, 'blockGap');
  6363. const isAxialGap = gapSides && gapSides.some(side => AXIAL_SIDES.includes(side));
  6364. const resetGapValue = () => setGapValue(undefined);
  6365. const [userSetGapValue] = useStyle('spacing.blockGap', name, 'user');
  6366. const hasGapValue = () => !!userSetGapValue;
  6367. const setGapValues = nextBoxGapValue => {
  6368. if (!nextBoxGapValue) {
  6369. setGapValue(null);
  6370. } // If axial gap is not enabled, treat the 'top' value as the shorthand gap value.
  6371. if (!isAxialGap && nextBoxGapValue !== null && nextBoxGapValue !== void 0 && nextBoxGapValue.hasOwnProperty('top')) {
  6372. setGapValue(nextBoxGapValue.top);
  6373. } else {
  6374. setGapValue({
  6375. top: nextBoxGapValue === null || nextBoxGapValue === void 0 ? void 0 : nextBoxGapValue.top,
  6376. left: nextBoxGapValue === null || nextBoxGapValue === void 0 ? void 0 : nextBoxGapValue.left
  6377. });
  6378. }
  6379. };
  6380. return {
  6381. gapValue,
  6382. gapValues,
  6383. gapSides,
  6384. isAxialGap,
  6385. setGapValue,
  6386. setGapValues,
  6387. resetGapValue,
  6388. hasGapValue
  6389. };
  6390. }
  6391. function DimensionsPanel(_ref) {
  6392. let {
  6393. name
  6394. } = _ref;
  6395. const showContentSizeControl = useHasContentSize(name);
  6396. const showWideSizeControl = useHasWideSize(name);
  6397. const showPaddingControl = useHasPadding(name);
  6398. const showMarginControl = useHasMargin(name);
  6399. const showGapControl = useHasGap(name);
  6400. const showSpacingPresetsControl = useHasSpacingPresets();
  6401. const units = (0,external_wp_components_namespaceObject.__experimentalUseCustomUnits)({
  6402. availableUnits: useSetting('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw']
  6403. }); // Props for managing `layout.contentSize`.
  6404. const {
  6405. contentSizeValue,
  6406. setContentSizeValue,
  6407. hasUserSetContentSizeValue,
  6408. resetContentSizeValue
  6409. } = useContentSizeProps(name); // Props for managing `layout.wideSize`.
  6410. const {
  6411. wideSizeValue,
  6412. setWideSizeValue,
  6413. hasUserSetWideSizeValue,
  6414. resetWideSizeValue
  6415. } = useWideSizeProps(name); // Props for managing `spacing.padding`.
  6416. const {
  6417. paddingValues,
  6418. paddingSides,
  6419. isAxialPadding,
  6420. setPaddingValues,
  6421. resetPaddingValue,
  6422. hasPaddingValue
  6423. } = usePaddingProps(name); // Props for managing `spacing.margin`.
  6424. const {
  6425. marginValues,
  6426. marginSides,
  6427. isAxialMargin,
  6428. setMarginValues,
  6429. resetMarginValue,
  6430. hasMarginValue
  6431. } = useMarginProps(name); // Props for managing `spacing.blockGap`.
  6432. const {
  6433. gapValue,
  6434. gapValues,
  6435. gapSides,
  6436. isAxialGap,
  6437. setGapValue,
  6438. setGapValues,
  6439. resetGapValue,
  6440. hasGapValue
  6441. } = useBlockGapProps(name);
  6442. const resetAll = () => {
  6443. resetPaddingValue();
  6444. resetMarginValue();
  6445. resetGapValue();
  6446. resetContentSizeValue();
  6447. resetWideSizeValue();
  6448. };
  6449. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanel, {
  6450. label: (0,external_wp_i18n_namespaceObject.__)('Dimensions'),
  6451. resetAll: resetAll
  6452. }, (showContentSizeControl || showWideSizeControl) && (0,external_wp_element_namespaceObject.createElement)("span", {
  6453. className: "span-columns"
  6454. }, (0,external_wp_i18n_namespaceObject.__)('Set the width of the main content area.')), showContentSizeControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6455. className: "single-column",
  6456. label: (0,external_wp_i18n_namespaceObject.__)('Content size'),
  6457. hasValue: hasUserSetContentSizeValue,
  6458. onDeselect: resetContentSizeValue,
  6459. isShownByDefault: true
  6460. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  6461. alignment: "flex-end",
  6462. justify: "flex-start"
  6463. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
  6464. label: (0,external_wp_i18n_namespaceObject.__)('Content'),
  6465. labelPosition: "top",
  6466. __unstableInputWidth: "80px",
  6467. value: contentSizeValue || '',
  6468. onChange: nextContentSize => {
  6469. setContentSizeValue(nextContentSize);
  6470. },
  6471. units: units
  6472. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  6473. icon: position_center
  6474. })))), showWideSizeControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6475. className: "single-column",
  6476. label: (0,external_wp_i18n_namespaceObject.__)('Wide size'),
  6477. hasValue: hasUserSetWideSizeValue,
  6478. onDeselect: resetWideSizeValue,
  6479. isShownByDefault: true
  6480. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  6481. alignment: "flex-end",
  6482. justify: "flex-start"
  6483. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
  6484. label: (0,external_wp_i18n_namespaceObject.__)('Wide'),
  6485. labelPosition: "top",
  6486. __unstableInputWidth: "80px",
  6487. value: wideSizeValue || '',
  6488. onChange: nextWideSize => {
  6489. setWideSizeValue(nextWideSize);
  6490. },
  6491. units: units
  6492. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  6493. icon: stretch_wide
  6494. })))), showPaddingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6495. hasValue: hasPaddingValue,
  6496. label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
  6497. onDeselect: resetPaddingValue,
  6498. isShownByDefault: true,
  6499. className: classnames_default()({
  6500. 'tools-panel-item-spacing': showSpacingPresetsControl
  6501. })
  6502. }, !showSpacingPresetsControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
  6503. values: paddingValues,
  6504. onChange: setPaddingValues,
  6505. label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
  6506. sides: paddingSides,
  6507. units: units,
  6508. allowReset: false,
  6509. splitOnAxis: isAxialPadding
  6510. }), showSpacingPresetsControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalSpacingSizesControl, {
  6511. values: paddingValues,
  6512. onChange: setPaddingValues,
  6513. label: (0,external_wp_i18n_namespaceObject.__)('Padding'),
  6514. sides: paddingSides,
  6515. units: units,
  6516. allowReset: false,
  6517. splitOnAxis: isAxialPadding
  6518. })), showMarginControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6519. hasValue: hasMarginValue,
  6520. label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
  6521. onDeselect: resetMarginValue,
  6522. isShownByDefault: true,
  6523. className: classnames_default()({
  6524. 'tools-panel-item-spacing': showSpacingPresetsControl
  6525. })
  6526. }, !showSpacingPresetsControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
  6527. values: marginValues,
  6528. onChange: setMarginValues,
  6529. label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
  6530. sides: marginSides,
  6531. units: units,
  6532. allowReset: false,
  6533. splitOnAxis: isAxialMargin
  6534. }), showSpacingPresetsControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalSpacingSizesControl, {
  6535. values: marginValues,
  6536. onChange: setMarginValues,
  6537. label: (0,external_wp_i18n_namespaceObject.__)('Margin'),
  6538. sides: marginSides,
  6539. units: units,
  6540. allowReset: false,
  6541. splitOnAxis: isAxialMargin
  6542. })), showGapControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
  6543. hasValue: hasGapValue,
  6544. label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
  6545. onDeselect: resetGapValue,
  6546. isShownByDefault: true,
  6547. className: classnames_default()({
  6548. 'tools-panel-item-spacing': showSpacingPresetsControl
  6549. })
  6550. }, !showSpacingPresetsControl && (isAxialGap ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalBoxControl, {
  6551. label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
  6552. min: 0,
  6553. onChange: setGapValues,
  6554. units: units,
  6555. sides: gapSides,
  6556. values: gapValues,
  6557. allowReset: false,
  6558. splitOnAxis: isAxialGap
  6559. }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalUnitControl, {
  6560. label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
  6561. __unstableInputWidth: "80px",
  6562. min: 0,
  6563. onChange: setGapValue,
  6564. units: units,
  6565. value: gapValue
  6566. })), showSpacingPresetsControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalSpacingSizesControl, {
  6567. label: (0,external_wp_i18n_namespaceObject.__)('Block spacing'),
  6568. min: 0,
  6569. onChange: setGapValues,
  6570. sides: isAxialGap ? gapSides : ['top'] // Use 'top' as the shorthand property in non-axial configurations.
  6571. ,
  6572. values: gapValues,
  6573. allowReset: false,
  6574. splitOnAxis: isAxialGap
  6575. })));
  6576. }
  6577. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/typography-panel.js
  6578. /**
  6579. * WordPress dependencies
  6580. */
  6581. /**
  6582. * Internal dependencies
  6583. */
  6584. function useHasTypographyPanel(name) {
  6585. const hasLineHeight = useHasLineHeightControl(name);
  6586. const hasFontAppearance = useHasAppearanceControl(name);
  6587. const hasLetterSpacing = useHasLetterSpacingControl(name);
  6588. const supports = getSupportedGlobalStylesPanels(name);
  6589. return hasLineHeight || hasFontAppearance || hasLetterSpacing || supports.includes('fontSize');
  6590. }
  6591. function useHasLineHeightControl(name) {
  6592. const supports = getSupportedGlobalStylesPanels(name);
  6593. return useSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight');
  6594. }
  6595. function useHasAppearanceControl(name) {
  6596. const supports = getSupportedGlobalStylesPanels(name);
  6597. const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
  6598. const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
  6599. return hasFontStyles || hasFontWeights;
  6600. }
  6601. function useHasLetterSpacingControl(name, element) {
  6602. const setting = useSetting('typography.letterSpacing', name)[0];
  6603. if (!setting) {
  6604. return false;
  6605. }
  6606. if (!name && element === 'heading') {
  6607. return true;
  6608. }
  6609. const supports = getSupportedGlobalStylesPanels(name);
  6610. return supports.includes('letterSpacing');
  6611. }
  6612. function useHasTextTransformControl(name, element) {
  6613. const setting = useSetting('typography.textTransform', name)[0];
  6614. if (!setting) {
  6615. return false;
  6616. }
  6617. if (!name && element === 'heading') {
  6618. return true;
  6619. }
  6620. const supports = getSupportedGlobalStylesPanels(name);
  6621. return supports.includes('textTransform');
  6622. }
  6623. function TypographyPanel(_ref) {
  6624. let {
  6625. name,
  6626. element
  6627. } = _ref;
  6628. const [selectedLevel, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)('heading');
  6629. const supports = getSupportedGlobalStylesPanels(name);
  6630. let prefix = '';
  6631. if (element === 'heading') {
  6632. prefix = `elements.${selectedLevel}.`;
  6633. } else if (element && element !== 'text') {
  6634. prefix = `elements.${element}.`;
  6635. }
  6636. const [fluidTypography] = useSetting('typography.fluid', name);
  6637. const [fontSizes] = useSetting('typography.fontSizes', name); // Convert static font size values to fluid font sizes if fluidTypography is activated.
  6638. const fontSizesWithFluidValues = fontSizes.map(font => {
  6639. if (!!fluidTypography) {
  6640. font.size = getTypographyFontSizeValue(font, {
  6641. fluid: fluidTypography
  6642. });
  6643. }
  6644. return font;
  6645. });
  6646. const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0];
  6647. const [fontFamilies] = useSetting('typography.fontFamilies', name);
  6648. const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
  6649. const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
  6650. const hasLineHeightEnabled = useHasLineHeightControl(name);
  6651. const hasAppearanceControl = useHasAppearanceControl(name);
  6652. const hasLetterSpacingControl = useHasLetterSpacingControl(name, element);
  6653. const hasTextTransformControl = useHasTextTransformControl(name, element);
  6654. /* Disable font size controls when the option to style all headings is selected. */
  6655. let hasFontSizeEnabled = supports.includes('fontSize');
  6656. if (element === 'heading' && selectedLevel === 'heading') {
  6657. hasFontSizeEnabled = false;
  6658. }
  6659. const [fontFamily, setFontFamily] = useStyle(prefix + 'typography.fontFamily', name);
  6660. const [fontSize, setFontSize] = useStyle(prefix + 'typography.fontSize', name);
  6661. const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name);
  6662. const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name);
  6663. const [lineHeight, setLineHeight] = useStyle(prefix + 'typography.lineHeight', name);
  6664. const [letterSpacing, setLetterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
  6665. const [textTransform, setTextTransform] = useStyle(prefix + 'typography.textTransform', name);
  6666. const [backgroundColor] = useStyle(prefix + 'color.background', name);
  6667. const [gradientValue] = useStyle(prefix + 'color.gradient', name);
  6668. const [color] = useStyle(prefix + 'color.text', name);
  6669. const extraStyles = element === 'link' ? {
  6670. textDecoration: 'underline'
  6671. } : {};
  6672. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6673. className: "edit-site-typography-panel",
  6674. initialOpen: true
  6675. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  6676. className: "edit-site-typography-panel__preview",
  6677. style: {
  6678. fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
  6679. background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
  6680. color,
  6681. fontSize,
  6682. fontStyle,
  6683. fontWeight,
  6684. letterSpacing,
  6685. ...extraStyles
  6686. }
  6687. }, "Aa"), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
  6688. columns: 2,
  6689. rowGap: 16,
  6690. columnGap: 8
  6691. }, element === 'heading' && (0,external_wp_element_namespaceObject.createElement)("div", {
  6692. className: "edit-site-typography-panel__full-width-control"
  6693. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
  6694. label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'),
  6695. hideLabelFromVision: true,
  6696. value: selectedLevel,
  6697. onChange: setCurrentTab,
  6698. isBlock: true,
  6699. size: "__unstable-large",
  6700. __nextHasNoMarginBottom: true
  6701. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6702. value: "heading"
  6703. /* translators: 'All' refers to selecting all heading levels
  6704. and applying the same style to h1-h6. */
  6705. ,
  6706. label: (0,external_wp_i18n_namespaceObject.__)('All')
  6707. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6708. value: "h1",
  6709. label: (0,external_wp_i18n_namespaceObject.__)('H1')
  6710. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6711. value: "h2",
  6712. label: (0,external_wp_i18n_namespaceObject.__)('H2')
  6713. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6714. value: "h3",
  6715. label: (0,external_wp_i18n_namespaceObject.__)('H3')
  6716. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6717. value: "h4",
  6718. label: (0,external_wp_i18n_namespaceObject.__)('H4')
  6719. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6720. value: "h5",
  6721. label: (0,external_wp_i18n_namespaceObject.__)('H5')
  6722. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  6723. value: "h6",
  6724. label: (0,external_wp_i18n_namespaceObject.__)('H6')
  6725. }))), supports.includes('fontFamily') && (0,external_wp_element_namespaceObject.createElement)("div", {
  6726. className: "edit-site-typography-panel__full-width-control"
  6727. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontFamilyControl, {
  6728. fontFamilies: fontFamilies,
  6729. value: fontFamily,
  6730. onChange: setFontFamily,
  6731. size: "__unstable-large",
  6732. __nextHasNoMarginBottom: true
  6733. })), hasFontSizeEnabled && (0,external_wp_element_namespaceObject.createElement)("div", {
  6734. className: "edit-site-typography-panel__full-width-control"
  6735. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FontSizePicker, {
  6736. value: fontSize,
  6737. onChange: setFontSize,
  6738. fontSizes: fontSizesWithFluidValues,
  6739. disableCustomFontSizes: disableCustomFontSizes,
  6740. size: "__unstable-large",
  6741. __nextHasNoMarginBottom: true
  6742. })), hasAppearanceControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalFontAppearanceControl, {
  6743. value: {
  6744. fontStyle,
  6745. fontWeight
  6746. },
  6747. onChange: _ref2 => {
  6748. let {
  6749. fontStyle: newFontStyle,
  6750. fontWeight: newFontWeight
  6751. } = _ref2;
  6752. setFontStyle(newFontStyle);
  6753. setFontWeight(newFontWeight);
  6754. },
  6755. hasFontStyles: hasFontStyles,
  6756. hasFontWeights: hasFontWeights,
  6757. size: "__unstable-large",
  6758. __nextHasNoMarginBottom: true
  6759. }), hasLineHeightEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.LineHeightControl, {
  6760. __nextHasNoMarginBottom: true,
  6761. __unstableInputWidth: "auto",
  6762. value: lineHeight,
  6763. onChange: setLineHeight,
  6764. size: "__unstable-large"
  6765. }), hasLetterSpacingControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLetterSpacingControl, {
  6766. value: letterSpacing,
  6767. onChange: setLetterSpacing,
  6768. size: "__unstable-large",
  6769. __unstableInputWidth: "auto"
  6770. }), hasTextTransformControl && (0,external_wp_element_namespaceObject.createElement)("div", {
  6771. className: "edit-site-typography-panel__full-width-control"
  6772. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalTextTransformControl, {
  6773. value: textTransform,
  6774. onChange: setTextTransform,
  6775. showNone: true,
  6776. isBlock: true,
  6777. size: "__unstable-large",
  6778. __nextHasNoMarginBottom: true
  6779. }))));
  6780. }
  6781. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/context-menu.js
  6782. /**
  6783. * WordPress dependencies
  6784. */
  6785. /**
  6786. * Internal dependencies
  6787. */
  6788. function ContextMenu(_ref) {
  6789. let {
  6790. name,
  6791. parentMenu = ''
  6792. } = _ref;
  6793. const hasTypographyPanel = useHasTypographyPanel(name);
  6794. const hasColorPanel = useHasColorPanel(name);
  6795. const hasBorderPanel = useHasBorderPanel(name);
  6796. const hasDimensionsPanel = useHasDimensionsPanel(name);
  6797. const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
  6798. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, hasTypographyPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  6799. icon: library_typography,
  6800. path: parentMenu + '/typography',
  6801. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Typography styles')
  6802. }, (0,external_wp_i18n_namespaceObject.__)('Typography')), hasColorPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  6803. icon: library_color,
  6804. path: parentMenu + '/colors',
  6805. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors styles')
  6806. }, (0,external_wp_i18n_namespaceObject.__)('Colors')), hasLayoutPanel && (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  6807. icon: library_layout,
  6808. path: parentMenu + '/layout',
  6809. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Layout styles')
  6810. }, (0,external_wp_i18n_namespaceObject.__)('Layout')));
  6811. }
  6812. /* harmony default export */ var context_menu = (ContextMenu);
  6813. ;// CONCATENATED MODULE: external ["wp","styleEngine"]
  6814. var external_wp_styleEngine_namespaceObject = window["wp"]["styleEngine"];
  6815. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/use-global-styles-output.js
  6816. /**
  6817. * External dependencies
  6818. */
  6819. /**
  6820. * WordPress dependencies
  6821. */
  6822. /**
  6823. * Internal dependencies
  6824. */
  6825. // List of block support features that can have their related styles
  6826. // generated under their own feature level selector rather than the block's.
  6827. const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
  6828. __experimentalBorder: 'border',
  6829. color: 'color',
  6830. spacing: 'spacing',
  6831. typography: 'typography'
  6832. };
  6833. function compileStyleValue(uncompiledValue) {
  6834. var _uncompiledValue$star;
  6835. const VARIABLE_REFERENCE_PREFIX = 'var:';
  6836. const VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';
  6837. const VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';
  6838. if (uncompiledValue !== null && uncompiledValue !== void 0 && (_uncompiledValue$star = uncompiledValue.startsWith) !== null && _uncompiledValue$star !== void 0 && _uncompiledValue$star.call(uncompiledValue, VARIABLE_REFERENCE_PREFIX)) {
  6839. const variable = uncompiledValue.slice(VARIABLE_REFERENCE_PREFIX.length).split(VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).join(VARIABLE_PATH_SEPARATOR_TOKEN_STYLE);
  6840. return `var(--wp--${variable})`;
  6841. }
  6842. return uncompiledValue;
  6843. }
  6844. /**
  6845. * Transform given preset tree into a set of style declarations.
  6846. *
  6847. * @param {Object} blockPresets
  6848. * @param {Object} mergedSettings Merged theme.json settings.
  6849. *
  6850. * @return {Array<Object>} An array of style declarations.
  6851. */
  6852. function getPresetsDeclarations() {
  6853. let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  6854. let mergedSettings = arguments.length > 1 ? arguments[1] : undefined;
  6855. return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref) => {
  6856. let {
  6857. path,
  6858. valueKey,
  6859. valueFunc,
  6860. cssVarInfix
  6861. } = _ref;
  6862. const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []);
  6863. ['default', 'theme', 'custom'].forEach(origin => {
  6864. if (presetByOrigin[origin]) {
  6865. presetByOrigin[origin].forEach(value => {
  6866. if (valueKey && !valueFunc) {
  6867. declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${value[valueKey]}`);
  6868. } else if (valueFunc && typeof valueFunc === 'function') {
  6869. declarations.push(`--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(value.slug)}: ${valueFunc(value, mergedSettings)}`);
  6870. }
  6871. });
  6872. }
  6873. });
  6874. return declarations;
  6875. }, []);
  6876. }
  6877. /**
  6878. * Transform given preset tree into a set of preset class declarations.
  6879. *
  6880. * @param {string} blockSelector
  6881. * @param {Object} blockPresets
  6882. * @return {string} CSS declarations for the preset classes.
  6883. */
  6884. function getPresetsClasses(blockSelector) {
  6885. let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6886. return (0,external_lodash_namespaceObject.reduce)(PRESET_METADATA, (declarations, _ref2) => {
  6887. let {
  6888. path,
  6889. cssVarInfix,
  6890. classes
  6891. } = _ref2;
  6892. if (!classes) {
  6893. return declarations;
  6894. }
  6895. const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, path, []);
  6896. ['default', 'theme', 'custom'].forEach(origin => {
  6897. if (presetByOrigin[origin]) {
  6898. presetByOrigin[origin].forEach(_ref3 => {
  6899. let {
  6900. slug
  6901. } = _ref3;
  6902. classes.forEach(_ref4 => {
  6903. let {
  6904. classSuffix,
  6905. propertyName
  6906. } = _ref4;
  6907. const classSelectorToUse = `.has-${(0,external_lodash_namespaceObject.kebabCase)(slug)}-${classSuffix}`;
  6908. const selectorToUse = blockSelector.split(',') // Selector can be "h1, h2, h3"
  6909. .map(selector => `${selector}${classSelectorToUse}`).join(',');
  6910. const value = `var(--wp--preset--${cssVarInfix}--${(0,external_lodash_namespaceObject.kebabCase)(slug)})`;
  6911. declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`;
  6912. });
  6913. });
  6914. }
  6915. });
  6916. return declarations;
  6917. }, '');
  6918. }
  6919. function getPresetsSvgFilters() {
  6920. let blockPresets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  6921. return PRESET_METADATA.filter( // Duotone are the only type of filters for now.
  6922. metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
  6923. const presetByOrigin = (0,external_lodash_namespaceObject.get)(blockPresets, metadata.path, {});
  6924. return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstablePresetDuotoneFilter, {
  6925. preset: preset,
  6926. key: preset.slug
  6927. })));
  6928. });
  6929. }
  6930. function flattenTree() {
  6931. let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  6932. let prefix = arguments.length > 1 ? arguments[1] : undefined;
  6933. let token = arguments.length > 2 ? arguments[2] : undefined;
  6934. let result = [];
  6935. Object.keys(input).forEach(key => {
  6936. const newKey = prefix + (0,external_lodash_namespaceObject.kebabCase)(key.replace('/', '-'));
  6937. const newLeaf = input[key];
  6938. if (newLeaf instanceof Object) {
  6939. const newPrefix = newKey + token;
  6940. result = [...result, ...flattenTree(newLeaf, newPrefix, token)];
  6941. } else {
  6942. result.push(`${newKey}: ${newLeaf}`);
  6943. }
  6944. });
  6945. return result;
  6946. }
  6947. /**
  6948. * Transform given style tree into a set of style declarations.
  6949. *
  6950. * @param {Object} blockStyles Block styles.
  6951. *
  6952. * @param {string} selector The selector these declarations should attach to.
  6953. *
  6954. * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.
  6955. *
  6956. * @param {Object} tree A theme.json tree containing layout definitions.
  6957. *
  6958. * @return {Array} An array of style declarations.
  6959. */
  6960. function getStylesDeclarations() {
  6961. let blockStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  6962. let selector = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  6963. let useRootPaddingAlign = arguments.length > 2 ? arguments[2] : undefined;
  6964. let tree = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  6965. const isRoot = ROOT_BLOCK_SELECTOR === selector;
  6966. const output = (0,external_lodash_namespaceObject.reduce)(external_wp_blocks_namespaceObject.__EXPERIMENTAL_STYLE_PROPERTY, (declarations, _ref5, key) => {
  6967. let {
  6968. value,
  6969. properties,
  6970. useEngine,
  6971. rootOnly
  6972. } = _ref5;
  6973. if (rootOnly && !isRoot) {
  6974. return declarations;
  6975. }
  6976. const pathToValue = value;
  6977. if (pathToValue[0] === 'elements' || useEngine) {
  6978. return declarations;
  6979. }
  6980. const styleValue = (0,external_lodash_namespaceObject.get)(blockStyles, pathToValue); // Root-level padding styles don't currently support strings with CSS shorthand values.
  6981. // This may change: https://github.com/WordPress/gutenberg/issues/40132.
  6982. if (key === '--wp--style--root--padding' && (typeof styleValue === 'string' || !useRootPaddingAlign)) {
  6983. return declarations;
  6984. }
  6985. if (!!properties && typeof styleValue !== 'string') {
  6986. Object.entries(properties).forEach(entry => {
  6987. const [name, prop] = entry;
  6988. if (!(0,external_lodash_namespaceObject.get)(styleValue, [prop], false)) {
  6989. // Do not create a declaration
  6990. // for sub-properties that don't have any value.
  6991. return;
  6992. }
  6993. const cssProperty = name.startsWith('--') ? name : (0,external_lodash_namespaceObject.kebabCase)(name);
  6994. declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(styleValue, [prop]))}`);
  6995. });
  6996. } else if ((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue, false)) {
  6997. const cssProperty = key.startsWith('--') ? key : (0,external_lodash_namespaceObject.kebabCase)(key);
  6998. declarations.push(`${cssProperty}: ${compileStyleValue((0,external_lodash_namespaceObject.get)(blockStyles, pathToValue))}`);
  6999. }
  7000. return declarations;
  7001. }, []); // The goal is to move everything to server side generated engine styles
  7002. // This is temporary as we absorb more and more styles into the engine.
  7003. const extraRules = (0,external_wp_styleEngine_namespaceObject.getCSSRules)(blockStyles);
  7004. extraRules.forEach(rule => {
  7005. var _ruleValue;
  7006. // Don't output padding properties if padding variables are set.
  7007. if (isRoot && useRootPaddingAlign && rule.key.startsWith('padding')) {
  7008. return;
  7009. }
  7010. const cssProperty = rule.key.startsWith('--') ? rule.key : (0,external_lodash_namespaceObject.kebabCase)(rule.key);
  7011. let ruleValue = rule.value;
  7012. if (typeof ruleValue !== 'string' && (_ruleValue = ruleValue) !== null && _ruleValue !== void 0 && _ruleValue.ref) {
  7013. var _ruleValue2;
  7014. const refPath = ruleValue.ref.split('.');
  7015. ruleValue = (0,external_lodash_namespaceObject.get)(tree, refPath); // Presence of another ref indicates a reference to another dynamic value.
  7016. // Pointing to another dynamic value is not supported.
  7017. if (!ruleValue || !!((_ruleValue2 = ruleValue) !== null && _ruleValue2 !== void 0 && _ruleValue2.ref)) {
  7018. return;
  7019. }
  7020. } // Calculate fluid typography rules where available.
  7021. if (cssProperty === 'font-size') {
  7022. var _tree$settings;
  7023. /*
  7024. * getTypographyFontSizeValue() will check
  7025. * if fluid typography has been activated and also
  7026. * whether the incoming value can be converted to a fluid value.
  7027. * Values that already have a "clamp()" function will not pass the test,
  7028. * and therefore the original $value will be returned.
  7029. */
  7030. ruleValue = getTypographyFontSizeValue({
  7031. size: ruleValue
  7032. }, tree === null || tree === void 0 ? void 0 : (_tree$settings = tree.settings) === null || _tree$settings === void 0 ? void 0 : _tree$settings.typography);
  7033. }
  7034. output.push(`${cssProperty}: ${ruleValue}`);
  7035. });
  7036. return output;
  7037. }
  7038. /**
  7039. * Get generated CSS for layout styles by looking up layout definitions provided
  7040. * in theme.json, and outputting common layout styles, and specific blockGap values.
  7041. *
  7042. * @param {Object} props
  7043. * @param {Object} props.tree A theme.json tree containing layout definitions.
  7044. * @param {Object} props.style A style object containing spacing values.
  7045. * @param {string} props.selector Selector used to group together layout styling rules.
  7046. * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.
  7047. * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.
  7048. * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.
  7049. * @return {string} Generated CSS rules for the layout styles.
  7050. */
  7051. function getLayoutStyles(_ref6) {
  7052. var _style$spacing, _tree$settings2, _tree$settings2$layou, _tree$settings3, _tree$settings3$layou;
  7053. let {
  7054. tree,
  7055. style,
  7056. selector,
  7057. hasBlockGapSupport,
  7058. hasFallbackGapSupport,
  7059. fallbackGapValue
  7060. } = _ref6;
  7061. let ruleset = '';
  7062. let gapValue = hasBlockGapSupport ? (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap) : ''; // Ensure a fallback gap value for the root layout definitions,
  7063. // and use a fallback value if one is provided for the current block.
  7064. if (hasFallbackGapSupport) {
  7065. if (selector === ROOT_BLOCK_SELECTOR) {
  7066. gapValue = !gapValue ? '0.5em' : gapValue;
  7067. } else if (!hasBlockGapSupport && fallbackGapValue) {
  7068. gapValue = fallbackGapValue;
  7069. }
  7070. }
  7071. if (gapValue && tree !== null && tree !== void 0 && (_tree$settings2 = tree.settings) !== null && _tree$settings2 !== void 0 && (_tree$settings2$layou = _tree$settings2.layout) !== null && _tree$settings2$layou !== void 0 && _tree$settings2$layou.definitions) {
  7072. Object.values(tree.settings.layout.definitions).forEach(_ref7 => {
  7073. let {
  7074. className,
  7075. name,
  7076. spacingStyles
  7077. } = _ref7;
  7078. // Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
  7079. if (!hasBlockGapSupport && 'flex' !== name) {
  7080. return;
  7081. }
  7082. if (spacingStyles !== null && spacingStyles !== void 0 && spacingStyles.length) {
  7083. spacingStyles.forEach(spacingStyle => {
  7084. const declarations = [];
  7085. if (spacingStyle.rules) {
  7086. Object.entries(spacingStyle.rules).forEach(_ref8 => {
  7087. let [cssProperty, cssValue] = _ref8;
  7088. declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`);
  7089. });
  7090. }
  7091. if (declarations.length) {
  7092. let combinedSelector = '';
  7093. if (!hasBlockGapSupport) {
  7094. // For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.
  7095. combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''})` : `:where(${selector}.${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''})`;
  7096. } else {
  7097. combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `${selector} .${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}` : `${selector}.${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}`;
  7098. }
  7099. ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
  7100. }
  7101. });
  7102. }
  7103. }); // For backwards compatibility, ensure the legacy block gap CSS variable is still available.
  7104. if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) {
  7105. ruleset += `${selector} { --wp--style--block-gap: ${gapValue}; }`;
  7106. }
  7107. } // Output base styles
  7108. if (selector === ROOT_BLOCK_SELECTOR && tree !== null && tree !== void 0 && (_tree$settings3 = tree.settings) !== null && _tree$settings3 !== void 0 && (_tree$settings3$layou = _tree$settings3.layout) !== null && _tree$settings3$layou !== void 0 && _tree$settings3$layou.definitions) {
  7109. const validDisplayModes = ['block', 'flex', 'grid'];
  7110. Object.values(tree.settings.layout.definitions).forEach(_ref9 => {
  7111. let {
  7112. className,
  7113. displayMode,
  7114. baseStyles
  7115. } = _ref9;
  7116. if (displayMode && validDisplayModes.includes(displayMode)) {
  7117. ruleset += `${selector} .${className} { display:${displayMode}; }`;
  7118. }
  7119. if (baseStyles !== null && baseStyles !== void 0 && baseStyles.length) {
  7120. baseStyles.forEach(baseStyle => {
  7121. const declarations = [];
  7122. if (baseStyle.rules) {
  7123. Object.entries(baseStyle.rules).forEach(_ref10 => {
  7124. let [cssProperty, cssValue] = _ref10;
  7125. declarations.push(`${cssProperty}: ${cssValue}`);
  7126. });
  7127. }
  7128. if (declarations.length) {
  7129. const combinedSelector = `${selector} .${className}${(baseStyle === null || baseStyle === void 0 ? void 0 : baseStyle.selector) || ''}`;
  7130. ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
  7131. }
  7132. });
  7133. }
  7134. });
  7135. }
  7136. return ruleset;
  7137. }
  7138. const getNodesWithStyles = (tree, blockSelectors) => {
  7139. var _tree$styles$blocks, _tree$styles3;
  7140. const nodes = [];
  7141. if (!(tree !== null && tree !== void 0 && tree.styles)) {
  7142. return nodes;
  7143. }
  7144. const pickStyleKeys = treeToPickFrom => (0,external_lodash_namespaceObject.pickBy)(treeToPickFrom, (value, key) => ['border', 'color', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key)); // Top-level.
  7145. const styles = pickStyleKeys(tree.styles);
  7146. if (!!styles) {
  7147. nodes.push({
  7148. styles,
  7149. selector: ROOT_BLOCK_SELECTOR
  7150. });
  7151. }
  7152. Object.entries(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS).forEach(_ref11 => {
  7153. var _tree$styles;
  7154. let [name, selector] = _ref11;
  7155. if (!!((_tree$styles = tree.styles) !== null && _tree$styles !== void 0 && _tree$styles.elements[name])) {
  7156. var _tree$styles2;
  7157. nodes.push({
  7158. styles: (_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : _tree$styles2.elements[name],
  7159. selector
  7160. });
  7161. }
  7162. }); // Iterate over blocks: they can have styles & elements.
  7163. Object.entries((_tree$styles$blocks = (_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(_ref12 => {
  7164. var _blockSelectors$block, _node$elements;
  7165. let [blockName, node] = _ref12;
  7166. const blockStyles = pickStyleKeys(node);
  7167. if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
  7168. nodes.push({
  7169. duotoneSelector: blockSelectors[blockName].duotoneSelector,
  7170. fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
  7171. hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
  7172. selector: blockSelectors[blockName].selector,
  7173. styles: blockStyles,
  7174. featureSelectors: blockSelectors[blockName].featureSelectors
  7175. });
  7176. }
  7177. Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref13 => {
  7178. let [elementName, value] = _ref13;
  7179. if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS !== null && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS !== void 0 && external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName])) {
  7180. nodes.push({
  7181. styles: value,
  7182. selector: blockSelectors[blockName].selector.split(',').map(sel => {
  7183. const elementSelectors = external_wp_blocks_namespaceObject.__EXPERIMENTAL_ELEMENTS[elementName].split(',');
  7184. return elementSelectors.map(elementSelector => sel + ' ' + elementSelector);
  7185. }).join(',')
  7186. });
  7187. }
  7188. });
  7189. });
  7190. return nodes;
  7191. };
  7192. const getNodesWithSettings = (tree, blockSelectors) => {
  7193. var _tree$settings4, _tree$settings$blocks, _tree$settings5;
  7194. const nodes = [];
  7195. if (!(tree !== null && tree !== void 0 && tree.settings)) {
  7196. return nodes;
  7197. }
  7198. const pickPresets = treeToPickFrom => {
  7199. const presets = {};
  7200. PRESET_METADATA.forEach(_ref14 => {
  7201. let {
  7202. path
  7203. } = _ref14;
  7204. const value = (0,external_lodash_namespaceObject.get)(treeToPickFrom, path, false);
  7205. if (value !== false) {
  7206. (0,external_lodash_namespaceObject.set)(presets, path, value);
  7207. }
  7208. });
  7209. return presets;
  7210. }; // Top-level.
  7211. const presets = pickPresets(tree.settings);
  7212. const custom = (_tree$settings4 = tree.settings) === null || _tree$settings4 === void 0 ? void 0 : _tree$settings4.custom;
  7213. if (!(0,external_lodash_namespaceObject.isEmpty)(presets) || !!custom) {
  7214. nodes.push({
  7215. presets,
  7216. custom,
  7217. selector: ROOT_BLOCK_SELECTOR
  7218. });
  7219. } // Blocks.
  7220. Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref15 => {
  7221. let [blockName, node] = _ref15;
  7222. const blockPresets = pickPresets(node);
  7223. const blockCustom = node.custom;
  7224. if (!(0,external_lodash_namespaceObject.isEmpty)(blockPresets) || !!blockCustom) {
  7225. nodes.push({
  7226. presets: blockPresets,
  7227. custom: blockCustom,
  7228. selector: blockSelectors[blockName].selector
  7229. });
  7230. }
  7231. });
  7232. return nodes;
  7233. };
  7234. const toCustomProperties = (tree, blockSelectors) => {
  7235. const settings = getNodesWithSettings(tree, blockSelectors);
  7236. let ruleset = '';
  7237. settings.forEach(_ref16 => {
  7238. let {
  7239. presets,
  7240. custom,
  7241. selector
  7242. } = _ref16;
  7243. const declarations = getPresetsDeclarations(presets, tree === null || tree === void 0 ? void 0 : tree.settings);
  7244. const customProps = flattenTree(custom, '--wp--custom--', '--');
  7245. if (customProps.length > 0) {
  7246. declarations.push(...customProps);
  7247. }
  7248. if (declarations.length > 0) {
  7249. ruleset = ruleset + `${selector}{${declarations.join(';')};}`;
  7250. }
  7251. });
  7252. return ruleset;
  7253. };
  7254. const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport) {
  7255. var _tree$settings6, _tree$settings7;
  7256. let disableLayoutStyles = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  7257. const nodesWithStyles = getNodesWithStyles(tree, blockSelectors);
  7258. const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
  7259. const useRootPaddingAlign = tree === null || tree === void 0 ? void 0 : (_tree$settings6 = tree.settings) === null || _tree$settings6 === void 0 ? void 0 : _tree$settings6.useRootPaddingAwareAlignments;
  7260. const {
  7261. contentSize,
  7262. wideSize
  7263. } = (tree === null || tree === void 0 ? void 0 : (_tree$settings7 = tree.settings) === null || _tree$settings7 === void 0 ? void 0 : _tree$settings7.layout) || {};
  7264. /*
  7265. * Reset default browser margin on the root body element.
  7266. * This is set on the root selector **before** generating the ruleset
  7267. * from the `theme.json`. This is to ensure that if the `theme.json` declares
  7268. * `margin` in its `spacing` declaration for the `body` element then these
  7269. * user-generated values take precedence in the CSS cascade.
  7270. * @link https://github.com/WordPress/gutenberg/issues/36147.
  7271. */
  7272. let ruleset = 'body {margin: 0;';
  7273. if (contentSize) {
  7274. ruleset += ` --wp--style--global--content-size: ${contentSize};`;
  7275. }
  7276. if (wideSize) {
  7277. ruleset += ` --wp--style--global--wide-size: ${wideSize};`;
  7278. }
  7279. if (useRootPaddingAlign) {
  7280. ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
  7281. .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
  7282. .has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
  7283. .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
  7284. .has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
  7285. .has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
  7286. .has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
  7287. }
  7288. ruleset += '}';
  7289. nodesWithStyles.forEach(_ref17 => {
  7290. let {
  7291. selector,
  7292. duotoneSelector,
  7293. styles,
  7294. fallbackGapValue,
  7295. hasLayoutSupport,
  7296. featureSelectors
  7297. } = _ref17;
  7298. // Process styles for block support features with custom feature level
  7299. // CSS selectors set.
  7300. if (featureSelectors) {
  7301. Object.entries(featureSelectors).forEach(_ref18 => {
  7302. let [featureName, featureSelector] = _ref18;
  7303. if (styles !== null && styles !== void 0 && styles[featureName]) {
  7304. const featureStyles = {
  7305. [featureName]: styles[featureName]
  7306. };
  7307. const featureDeclarations = getStylesDeclarations(featureStyles);
  7308. delete styles[featureName];
  7309. if (!!featureDeclarations.length) {
  7310. ruleset = ruleset + `${featureSelector}{${featureDeclarations.join(';')} }`;
  7311. }
  7312. }
  7313. });
  7314. }
  7315. const duotoneStyles = {};
  7316. if (styles !== null && styles !== void 0 && styles.filter) {
  7317. duotoneStyles.filter = styles.filter;
  7318. delete styles.filter;
  7319. } // Process duotone styles (they use color.__experimentalDuotone selector).
  7320. if (duotoneSelector) {
  7321. const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
  7322. if (duotoneDeclarations.length > 0) {
  7323. ruleset = ruleset + `${duotoneSelector}{${duotoneDeclarations.join(';')};}`;
  7324. }
  7325. } // Process blockGap and layout styles.
  7326. if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) {
  7327. ruleset += getLayoutStyles({
  7328. tree,
  7329. style: styles,
  7330. selector,
  7331. hasBlockGapSupport,
  7332. hasFallbackGapSupport,
  7333. fallbackGapValue
  7334. });
  7335. } // Process the remaining block styles (they use either normal block class or __experimentalSelector).
  7336. const declarations = getStylesDeclarations(styles, selector, useRootPaddingAlign, tree);
  7337. if (declarations !== null && declarations !== void 0 && declarations.length) {
  7338. ruleset = ruleset + `${selector}{${declarations.join(';')};}`;
  7339. } // Check for pseudo selector in `styles` and handle separately.
  7340. const pseudoSelectorStyles = Object.entries(styles).filter(_ref19 => {
  7341. let [key] = _ref19;
  7342. return key.startsWith(':');
  7343. });
  7344. if (pseudoSelectorStyles !== null && pseudoSelectorStyles !== void 0 && pseudoSelectorStyles.length) {
  7345. pseudoSelectorStyles.forEach(_ref20 => {
  7346. let [pseudoKey, pseudoStyle] = _ref20;
  7347. const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
  7348. if (!(pseudoDeclarations !== null && pseudoDeclarations !== void 0 && pseudoDeclarations.length)) {
  7349. return;
  7350. } // `selector` maybe provided in a form
  7351. // where block level selectors have sub element
  7352. // selectors appended to them as a comma separated
  7353. // string.
  7354. // e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;
  7355. // Split and append pseudo selector to create
  7356. // the proper rules to target the elements.
  7357. const _selector = selector.split(',').map(sel => sel + pseudoKey).join(',');
  7358. const pseudoRule = `${_selector}{${pseudoDeclarations.join(';')};}`;
  7359. ruleset = ruleset + pseudoRule;
  7360. });
  7361. }
  7362. });
  7363. /* Add alignment / layout styles */
  7364. ruleset = ruleset + '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';
  7365. ruleset = ruleset + '.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';
  7366. ruleset = ruleset + '.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';
  7367. if (hasBlockGapSupport) {
  7368. var _tree$styles4, _tree$styles4$spacing;
  7369. // Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.
  7370. const gapValue = (0,external_wp_blockEditor_namespaceObject.__experimentalGetGapCSSValue)(tree === null || tree === void 0 ? void 0 : (_tree$styles4 = tree.styles) === null || _tree$styles4 === void 0 ? void 0 : (_tree$styles4$spacing = _tree$styles4.spacing) === null || _tree$styles4$spacing === void 0 ? void 0 : _tree$styles4$spacing.blockGap) || '0.5em';
  7371. ruleset = ruleset + '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
  7372. ruleset = ruleset + `.wp-site-blocks > * + * { margin-block-start: ${gapValue}; }`;
  7373. }
  7374. nodesWithSettings.forEach(_ref21 => {
  7375. let {
  7376. selector,
  7377. presets
  7378. } = _ref21;
  7379. if (ROOT_BLOCK_SELECTOR === selector) {
  7380. // Do not add extra specificity for top-level classes.
  7381. selector = '';
  7382. }
  7383. const classes = getPresetsClasses(selector, presets);
  7384. if (!(0,external_lodash_namespaceObject.isEmpty)(classes)) {
  7385. ruleset = ruleset + classes;
  7386. }
  7387. });
  7388. return ruleset;
  7389. };
  7390. function toSvgFilters(tree, blockSelectors) {
  7391. const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
  7392. return nodesWithSettings.flatMap(_ref22 => {
  7393. let {
  7394. presets
  7395. } = _ref22;
  7396. return getPresetsSvgFilters(presets);
  7397. });
  7398. }
  7399. const getBlockSelectors = blockTypes => {
  7400. const result = {};
  7401. blockTypes.forEach(blockType => {
  7402. var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$, _blockType$supports3, _blockType$supports4, _blockType$supports4$, _blockType$supports4$2;
  7403. const name = blockType.name;
  7404. const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-');
  7405. const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null;
  7406. const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports3 = blockType.supports) !== null && _blockType$supports3 !== void 0 && _blockType$supports3.__experimentalLayout);
  7407. const fallbackGapValue = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports4 = blockType.supports) === null || _blockType$supports4 === void 0 ? void 0 : (_blockType$supports4$ = _blockType$supports4.spacing) === null || _blockType$supports4$ === void 0 ? void 0 : (_blockType$supports4$2 = _blockType$supports4$.blockGap) === null || _blockType$supports4$2 === void 0 ? void 0 : _blockType$supports4$2.__experimentalDefault; // For each block support feature add any custom selectors.
  7408. const featureSelectors = {};
  7409. Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref23 => {
  7410. var _blockType$supports5, _blockType$supports5$;
  7411. let [featureKey, featureName] = _ref23;
  7412. const featureSelector = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports5 = blockType.supports) === null || _blockType$supports5 === void 0 ? void 0 : (_blockType$supports5$ = _blockType$supports5[featureKey]) === null || _blockType$supports5$ === void 0 ? void 0 : _blockType$supports5$.__experimentalSelector;
  7413. if (featureSelector) {
  7414. featureSelectors[featureName] = scopeSelector(selector, featureSelector);
  7415. }
  7416. });
  7417. result[name] = {
  7418. duotoneSelector,
  7419. fallbackGapValue,
  7420. featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined,
  7421. hasLayoutSupport,
  7422. name,
  7423. selector
  7424. };
  7425. });
  7426. return result;
  7427. };
  7428. /**
  7429. * If there is a separator block whose color is defined in theme.json via background,
  7430. * update the separator color to the same value by using border color.
  7431. *
  7432. * @param {Object} config Theme.json configuration file object.
  7433. * @return {Object} configTheme.json configuration file object updated.
  7434. */
  7435. function updateConfigWithSeparator(config) {
  7436. var _config$styles, _config$styles2, _config$styles2$block, _config$styles3, _config$styles3$block, _config$styles4, _config$styles4$block;
  7437. const needsSeparatorStyleUpdate = ((_config$styles = config.styles) === null || _config$styles === void 0 ? void 0 : _config$styles.blocks['core/separator']) && ((_config$styles2 = config.styles) === null || _config$styles2 === void 0 ? void 0 : (_config$styles2$block = _config$styles2.blocks['core/separator'].color) === null || _config$styles2$block === void 0 ? void 0 : _config$styles2$block.background) && !((_config$styles3 = config.styles) !== null && _config$styles3 !== void 0 && (_config$styles3$block = _config$styles3.blocks['core/separator'].color) !== null && _config$styles3$block !== void 0 && _config$styles3$block.text) && !((_config$styles4 = config.styles) !== null && _config$styles4 !== void 0 && (_config$styles4$block = _config$styles4.blocks['core/separator'].border) !== null && _config$styles4$block !== void 0 && _config$styles4$block.color);
  7438. if (needsSeparatorStyleUpdate) {
  7439. var _config$styles5;
  7440. return { ...config,
  7441. styles: { ...config.styles,
  7442. blocks: { ...config.styles.blocks,
  7443. 'core/separator': { ...config.styles.blocks['core/separator'],
  7444. color: { ...config.styles.blocks['core/separator'].color,
  7445. text: (_config$styles5 = config.styles) === null || _config$styles5 === void 0 ? void 0 : _config$styles5.blocks['core/separator'].color.background
  7446. }
  7447. }
  7448. }
  7449. }
  7450. };
  7451. }
  7452. return config;
  7453. }
  7454. function useGlobalStylesOutput() {
  7455. let {
  7456. merged: mergedConfig
  7457. } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
  7458. const [blockGap] = useSetting('spacing.blockGap');
  7459. const hasBlockGapSupport = blockGap !== null;
  7460. const hasFallbackGapSupport = !hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.
  7461. const disableLayoutStyles = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7462. const {
  7463. getSettings
  7464. } = select(external_wp_blockEditor_namespaceObject.store);
  7465. return !!getSettings().disableLayoutStyles;
  7466. });
  7467. return (0,external_wp_element_namespaceObject.useMemo)(() => {
  7468. var _mergedConfig, _mergedConfig2;
  7469. if (!((_mergedConfig = mergedConfig) !== null && _mergedConfig !== void 0 && _mergedConfig.styles) || !((_mergedConfig2 = mergedConfig) !== null && _mergedConfig2 !== void 0 && _mergedConfig2.settings)) {
  7470. return [];
  7471. }
  7472. mergedConfig = updateConfigWithSeparator(mergedConfig);
  7473. const blockSelectors = getBlockSelectors((0,external_wp_blocks_namespaceObject.getBlockTypes)());
  7474. const customProperties = toCustomProperties(mergedConfig, blockSelectors);
  7475. const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles);
  7476. const filters = toSvgFilters(mergedConfig, blockSelectors);
  7477. const stylesheets = [{
  7478. css: customProperties,
  7479. isGlobalStyles: true
  7480. }, {
  7481. css: globalStyles,
  7482. isGlobalStyles: true
  7483. }];
  7484. return [stylesheets, mergedConfig.settings, filters];
  7485. }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles]);
  7486. }
  7487. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/preview.js
  7488. /**
  7489. * WordPress dependencies
  7490. */
  7491. /**
  7492. * Internal dependencies
  7493. */
  7494. const firstFrame = {
  7495. start: {
  7496. opacity: 1,
  7497. display: 'block'
  7498. },
  7499. hover: {
  7500. opacity: 0,
  7501. display: 'none'
  7502. }
  7503. };
  7504. const secondFrame = {
  7505. hover: {
  7506. opacity: 1,
  7507. display: 'block'
  7508. },
  7509. start: {
  7510. opacity: 0,
  7511. display: 'none'
  7512. }
  7513. };
  7514. const normalizedWidth = 248;
  7515. const normalizedHeight = 152;
  7516. const normalizedColorSwatchSize = 32;
  7517. const StylesPreview = _ref => {
  7518. let {
  7519. label,
  7520. isFocused
  7521. } = _ref;
  7522. const [fontWeight] = useStyle('typography.fontWeight');
  7523. const [fontFamily = 'serif'] = useStyle('typography.fontFamily');
  7524. const [headingFontFamily = fontFamily] = useStyle('elements.h1.typography.fontFamily');
  7525. const [headingFontWeight = fontWeight] = useStyle('elements.h1.typography.fontWeight');
  7526. const [textColor = 'black'] = useStyle('color.text');
  7527. const [headingColor = textColor] = useStyle('elements.h1.color.text');
  7528. const [linkColor = 'blue'] = useStyle('elements.link.color.text');
  7529. const [backgroundColor = 'white'] = useStyle('color.background');
  7530. const [gradientValue] = useStyle('color.gradient');
  7531. const [styles] = useGlobalStylesOutput();
  7532. const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  7533. const [coreColors] = useSetting('color.palette.core');
  7534. const [themeColors] = useSetting('color.palette.theme');
  7535. const [customColors] = useSetting('color.palette.custom');
  7536. const [isHovered, setIsHovered] = (0,external_wp_element_namespaceObject.useState)(false);
  7537. const [containerResizeListener, {
  7538. width
  7539. }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  7540. const ratio = width ? width / normalizedWidth : 1;
  7541. const paletteColors = (themeColors !== null && themeColors !== void 0 ? themeColors : []).concat(customColors !== null && customColors !== void 0 ? customColors : []).concat(coreColors !== null && coreColors !== void 0 ? coreColors : []);
  7542. const highlightedColors = paletteColors.filter( // we exclude these two colors because they are already visible in the preview.
  7543. _ref2 => {
  7544. let {
  7545. color
  7546. } = _ref2;
  7547. return color !== backgroundColor && color !== headingColor;
  7548. }).slice(0, 2); // Reset leaked styles from WP common.css and remove main content layout padding and border.
  7549. const editorStyles = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7550. if (styles) {
  7551. return [...styles, {
  7552. css: 'body{min-width: 0;padding: 0;border: none;}',
  7553. isGlobalStyles: true
  7554. }];
  7555. }
  7556. return styles;
  7557. }, [styles]);
  7558. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
  7559. className: "edit-site-global-styles-preview__iframe",
  7560. head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  7561. styles: editorStyles
  7562. }),
  7563. style: {
  7564. height: normalizedHeight * ratio,
  7565. visibility: !width ? 'hidden' : 'visible'
  7566. },
  7567. onMouseEnter: () => setIsHovered(true),
  7568. onMouseLeave: () => setIsHovered(false),
  7569. tabIndex: -1
  7570. }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  7571. style: {
  7572. height: normalizedHeight * ratio,
  7573. width: '100%',
  7574. background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
  7575. cursor: 'pointer'
  7576. },
  7577. initial: "start",
  7578. animate: (isHovered || isFocused) && !disableMotion ? 'hover' : 'start'
  7579. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  7580. variants: firstFrame,
  7581. style: {
  7582. height: '100%',
  7583. overflow: 'hidden'
  7584. }
  7585. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7586. spacing: 10 * ratio,
  7587. justify: "center",
  7588. style: {
  7589. height: '100%',
  7590. overflow: 'hidden'
  7591. }
  7592. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  7593. style: {
  7594. fontFamily: headingFontFamily,
  7595. fontSize: 65 * ratio,
  7596. color: headingColor,
  7597. fontWeight: headingFontWeight
  7598. }
  7599. }, "Aa"), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  7600. spacing: 4 * ratio
  7601. }, highlightedColors.map(_ref3 => {
  7602. let {
  7603. slug,
  7604. color
  7605. } = _ref3;
  7606. return (0,external_wp_element_namespaceObject.createElement)("div", {
  7607. key: slug,
  7608. style: {
  7609. height: normalizedColorSwatchSize * ratio,
  7610. width: normalizedColorSwatchSize * ratio,
  7611. background: color,
  7612. borderRadius: normalizedColorSwatchSize * ratio / 2
  7613. }
  7614. });
  7615. })))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  7616. variants: secondFrame,
  7617. style: {
  7618. height: '100%',
  7619. overflow: 'hidden'
  7620. }
  7621. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  7622. spacing: 3 * ratio,
  7623. justify: "center",
  7624. style: {
  7625. height: '100%',
  7626. overflow: 'hidden',
  7627. padding: 10 * ratio,
  7628. boxSizing: 'border-box'
  7629. }
  7630. }, label && (0,external_wp_element_namespaceObject.createElement)("div", {
  7631. style: {
  7632. fontSize: 35 * ratio,
  7633. fontFamily: headingFontFamily,
  7634. color: headingColor,
  7635. fontWeight: headingFontWeight,
  7636. lineHeight: '1em'
  7637. }
  7638. }, label), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7639. spacing: 2 * ratio,
  7640. justify: "flex-start"
  7641. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  7642. style: {
  7643. fontFamily,
  7644. fontSize: 24 * ratio,
  7645. color: textColor
  7646. }
  7647. }, "Aa"), (0,external_wp_element_namespaceObject.createElement)("div", {
  7648. style: {
  7649. fontFamily,
  7650. fontSize: 24 * ratio,
  7651. color: linkColor
  7652. }
  7653. }, "Aa")), paletteColors && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7654. spacing: 0
  7655. }, paletteColors.slice(0, 4).map((_ref4, index) => {
  7656. let {
  7657. color
  7658. } = _ref4;
  7659. return (0,external_wp_element_namespaceObject.createElement)("div", {
  7660. key: index,
  7661. style: {
  7662. height: 10 * ratio,
  7663. width: 30 * ratio,
  7664. background: color,
  7665. flexGrow: 1
  7666. }
  7667. });
  7668. }))))));
  7669. };
  7670. /* harmony default export */ var preview = (StylesPreview);
  7671. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-root.js
  7672. /**
  7673. * WordPress dependencies
  7674. */
  7675. /**
  7676. * Internal dependencies
  7677. */
  7678. function ScreenRoot() {
  7679. const {
  7680. variations
  7681. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7682. return {
  7683. variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()
  7684. };
  7685. }, []);
  7686. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  7687. size: "small"
  7688. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  7689. spacing: 4
  7690. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardMedia, null, (0,external_wp_element_namespaceObject.createElement)(preview, null))), !!(variations !== null && variations !== void 0 && variations.length) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  7691. path: "/variations",
  7692. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Browse styles')
  7693. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7694. justify: "space-between"
  7695. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Browse styles')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, {
  7696. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
  7697. })))), (0,external_wp_element_namespaceObject.createElement)(context_menu, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardDivider, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
  7698. as: "p",
  7699. paddingTop: 2
  7700. /*
  7701. * 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).
  7702. * This is an ad hoc override for this particular instance only and should be reconsidered before making into a pattern.
  7703. */
  7704. ,
  7705. paddingX: "13px",
  7706. marginBottom: 4
  7707. }, (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks for the whole site.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  7708. path: "/blocks",
  7709. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Blocks styles')
  7710. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7711. justify: "space-between"
  7712. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Blocks')), (0,external_wp_element_namespaceObject.createElement)(IconWithCurrentColor, {
  7713. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
  7714. }))))));
  7715. }
  7716. /* harmony default export */ var screen_root = (ScreenRoot);
  7717. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/header.js
  7718. /**
  7719. * WordPress dependencies
  7720. */
  7721. function ScreenHeader(_ref) {
  7722. let {
  7723. title,
  7724. description
  7725. } = _ref;
  7726. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  7727. spacing: 0
  7728. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalView, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
  7729. marginBottom: 0,
  7730. paddingX: 4,
  7731. paddingY: 3
  7732. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7733. spacing: 2
  7734. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
  7735. style: // TODO: This style override is also used in ToolsPanelHeader.
  7736. // It should be supported out-of-the-box by Button.
  7737. {
  7738. minWidth: 24,
  7739. padding: 0
  7740. },
  7741. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
  7742. isSmall: true,
  7743. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
  7744. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  7745. level: 5
  7746. }, title))))), description && (0,external_wp_element_namespaceObject.createElement)("p", {
  7747. className: "edit-site-global-styles-header__description"
  7748. }, description));
  7749. }
  7750. /* harmony default export */ var header = (ScreenHeader);
  7751. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block-list.js
  7752. /**
  7753. * WordPress dependencies
  7754. */
  7755. /**
  7756. * Internal dependencies
  7757. */
  7758. function useSortedBlockTypes() {
  7759. const blockItems = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).getBlockTypes(), []); // Ensure core blocks are prioritized in the returned results,
  7760. // because third party blocks can be registered earlier than
  7761. // the core blocks (usually by using the `init` action),
  7762. // thus affecting the display order.
  7763. // We don't sort reusable blocks as they are handled differently.
  7764. const groupByType = (blocks, block) => {
  7765. const {
  7766. core,
  7767. noncore
  7768. } = blocks;
  7769. const type = block.name.startsWith('core/') ? core : noncore;
  7770. type.push(block);
  7771. return blocks;
  7772. };
  7773. const {
  7774. core: coreItems,
  7775. noncore: nonCoreItems
  7776. } = blockItems.reduce(groupByType, {
  7777. core: [],
  7778. noncore: []
  7779. });
  7780. return [...coreItems, ...nonCoreItems];
  7781. }
  7782. function BlockMenuItem(_ref) {
  7783. let {
  7784. block
  7785. } = _ref;
  7786. const hasTypographyPanel = useHasTypographyPanel(block.name);
  7787. const hasColorPanel = useHasColorPanel(block.name);
  7788. const hasBorderPanel = useHasBorderPanel(block.name);
  7789. const hasDimensionsPanel = useHasDimensionsPanel(block.name);
  7790. const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
  7791. const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel;
  7792. if (!hasBlockMenuItem) {
  7793. return null;
  7794. }
  7795. const navigationButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
  7796. (0,external_wp_i18n_namespaceObject.__)('%s block styles'), block.title);
  7797. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  7798. path: '/blocks/' + block.name,
  7799. "aria-label": navigationButtonLabel
  7800. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7801. justify: "flex-start"
  7802. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
  7803. icon: block.icon
  7804. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, block.title)));
  7805. }
  7806. function ScreenBlockList() {
  7807. const sortedBlockTypes = useSortedBlockTypes();
  7808. const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
  7809. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  7810. const isMatchingSearchTerm = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blocks_namespaceObject.store).isMatchingSearchTerm, []);
  7811. const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7812. if (!filterValue) {
  7813. return sortedBlockTypes;
  7814. }
  7815. return sortedBlockTypes.filter(blockType => isMatchingSearchTerm(blockType, filterValue));
  7816. }, [filterValue, sortedBlockTypes, isMatchingSearchTerm]);
  7817. const blockTypesListRef = (0,external_wp_element_namespaceObject.useRef)(); // Announce search results on change
  7818. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7819. if (!filterValue) {
  7820. return;
  7821. } // We extract the results from the wrapper div's `ref` because
  7822. // filtered items can contain items that will eventually not
  7823. // render and there is no reliable way to detect when a child
  7824. // will return `null`.
  7825. // TODO: We should find a better way of handling this as it's
  7826. // fragile and depends on the number of rendered elements of `BlockMenuItem`,
  7827. // which is now one.
  7828. // @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116
  7829. const count = blockTypesListRef.current.childElementCount;
  7830. const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  7831. /* translators: %d: number of results. */
  7832. (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
  7833. debouncedSpeak(resultsFoundMessage, count);
  7834. }, [filterValue, debouncedSpeak]);
  7835. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  7836. title: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
  7837. description: (0,external_wp_i18n_namespaceObject.__)('Customize the appearance of specific blocks and for the whole site.')
  7838. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
  7839. className: "edit-site-block-types-search",
  7840. onChange: setFilterValue,
  7841. value: filterValue,
  7842. label: (0,external_wp_i18n_namespaceObject.__)('Search for blocks'),
  7843. placeholder: (0,external_wp_i18n_namespaceObject.__)('Search')
  7844. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  7845. ref: blockTypesListRef,
  7846. className: "edit-site-block-types-item-list"
  7847. }, filteredBlockTypes.map(block => (0,external_wp_element_namespaceObject.createElement)(BlockMenuItem, {
  7848. block: block,
  7849. key: 'menu-itemblock-' + block.name
  7850. }))));
  7851. }
  7852. /* harmony default export */ var screen_block_list = (ScreenBlockList);
  7853. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-block.js
  7854. /**
  7855. * WordPress dependencies
  7856. */
  7857. /**
  7858. * Internal dependencies
  7859. */
  7860. function ScreenBlock(_ref) {
  7861. let {
  7862. name
  7863. } = _ref;
  7864. const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
  7865. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  7866. title: blockType.title
  7867. }), (0,external_wp_element_namespaceObject.createElement)(context_menu, {
  7868. parentMenu: '/blocks/' + name,
  7869. name: name
  7870. }));
  7871. }
  7872. /* harmony default export */ var screen_block = (ScreenBlock);
  7873. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/subtitle.js
  7874. /**
  7875. * WordPress dependencies
  7876. */
  7877. function Subtitle(_ref) {
  7878. let {
  7879. children
  7880. } = _ref;
  7881. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  7882. className: "edit-site-global-styles-subtitle",
  7883. level: 2
  7884. }, children);
  7885. }
  7886. /* harmony default export */ var subtitle = (Subtitle);
  7887. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography.js
  7888. /**
  7889. * WordPress dependencies
  7890. */
  7891. /**
  7892. * Internal dependencies
  7893. */
  7894. function Item(_ref) {
  7895. let {
  7896. name,
  7897. parentMenu,
  7898. element,
  7899. label
  7900. } = _ref;
  7901. const hasSupport = !name;
  7902. const prefix = element === 'text' || !element ? '' : `elements.${element}.`;
  7903. const extraStyles = element === 'link' ? {
  7904. textDecoration: 'underline'
  7905. } : {};
  7906. const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name);
  7907. const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name);
  7908. const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name);
  7909. const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
  7910. const [backgroundColor] = useStyle(prefix + 'color.background', name);
  7911. const [gradientValue] = useStyle(prefix + 'color.gradient', name);
  7912. const [color] = useStyle(prefix + 'color.text', name);
  7913. if (!hasSupport) {
  7914. return null;
  7915. }
  7916. const navigationButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: is a subset of Typography, e.g., 'text' or 'links'.
  7917. (0,external_wp_i18n_namespaceObject.__)('Typography %s styles'), label);
  7918. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  7919. path: parentMenu + '/typography/' + element,
  7920. "aria-label": navigationButtonLabel
  7921. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  7922. justify: "flex-start"
  7923. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  7924. className: "edit-site-global-styles-screen-typography__indicator",
  7925. style: {
  7926. fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
  7927. background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
  7928. color,
  7929. fontStyle,
  7930. fontWeight,
  7931. letterSpacing,
  7932. ...extraStyles
  7933. }
  7934. }, (0,external_wp_i18n_namespaceObject.__)('Aa')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, label)));
  7935. }
  7936. function ScreenTypography(_ref2) {
  7937. let {
  7938. name
  7939. } = _ref2;
  7940. const parentMenu = name === undefined ? '' : '/blocks/' + name;
  7941. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  7942. title: (0,external_wp_i18n_namespaceObject.__)('Typography'),
  7943. description: (0,external_wp_i18n_namespaceObject.__)('Manage the typography settings for different elements.')
  7944. }), !name && (0,external_wp_element_namespaceObject.createElement)("div", {
  7945. className: "edit-site-global-styles-screen-typography"
  7946. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  7947. spacing: 3
  7948. }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
  7949. isBordered: true,
  7950. isSeparated: true
  7951. }, (0,external_wp_element_namespaceObject.createElement)(Item, {
  7952. name: name,
  7953. parentMenu: parentMenu,
  7954. element: "text",
  7955. label: (0,external_wp_i18n_namespaceObject.__)('Text')
  7956. }), (0,external_wp_element_namespaceObject.createElement)(Item, {
  7957. name: name,
  7958. parentMenu: parentMenu,
  7959. element: "link",
  7960. label: (0,external_wp_i18n_namespaceObject.__)('Links')
  7961. }), (0,external_wp_element_namespaceObject.createElement)(Item, {
  7962. name: name,
  7963. parentMenu: parentMenu,
  7964. element: "heading",
  7965. label: (0,external_wp_i18n_namespaceObject.__)('Headings')
  7966. }), (0,external_wp_element_namespaceObject.createElement)(Item, {
  7967. name: name,
  7968. parentMenu: parentMenu,
  7969. element: "button",
  7970. label: (0,external_wp_i18n_namespaceObject.__)('Buttons')
  7971. })))), !!name && (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, {
  7972. name: name,
  7973. element: "text"
  7974. }));
  7975. }
  7976. /* harmony default export */ var screen_typography = (ScreenTypography);
  7977. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-typography-element.js
  7978. /**
  7979. * WordPress dependencies
  7980. */
  7981. /**
  7982. * Internal dependencies
  7983. */
  7984. const screen_typography_element_elements = {
  7985. text: {
  7986. description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts used on the site.'),
  7987. title: (0,external_wp_i18n_namespaceObject.__)('Text')
  7988. },
  7989. link: {
  7990. description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on the links.'),
  7991. title: (0,external_wp_i18n_namespaceObject.__)('Links')
  7992. },
  7993. heading: {
  7994. description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on headings.'),
  7995. title: (0,external_wp_i18n_namespaceObject.__)('Headings')
  7996. },
  7997. button: {
  7998. description: (0,external_wp_i18n_namespaceObject.__)('Manage the fonts and typography used on buttons.'),
  7999. title: (0,external_wp_i18n_namespaceObject.__)('Buttons')
  8000. }
  8001. };
  8002. function ScreenTypographyElement(_ref) {
  8003. let {
  8004. name,
  8005. element
  8006. } = _ref;
  8007. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8008. title: screen_typography_element_elements[element].title,
  8009. description: screen_typography_element_elements[element].description
  8010. }), (0,external_wp_element_namespaceObject.createElement)(TypographyPanel, {
  8011. name: name,
  8012. element: element
  8013. }));
  8014. }
  8015. /* harmony default export */ var screen_typography_element = (ScreenTypographyElement);
  8016. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-indicator-wrapper.js
  8017. /**
  8018. * External dependencies
  8019. */
  8020. /**
  8021. * WordPress dependencies
  8022. */
  8023. function ColorIndicatorWrapper(_ref) {
  8024. let {
  8025. className,
  8026. ...props
  8027. } = _ref;
  8028. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, extends_extends({
  8029. className: classnames_default()('edit-site-global-styles__color-indicator-wrapper', className)
  8030. }, props));
  8031. }
  8032. /* harmony default export */ var color_indicator_wrapper = (ColorIndicatorWrapper);
  8033. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/palette.js
  8034. /**
  8035. * WordPress dependencies
  8036. */
  8037. /**
  8038. * Internal dependencies
  8039. */
  8040. const EMPTY_COLORS = [];
  8041. function Palette(_ref) {
  8042. let {
  8043. name
  8044. } = _ref;
  8045. const [customColors] = useSetting('color.palette.custom');
  8046. const [themeColors] = useSetting('color.palette.theme');
  8047. const [defaultColors] = useSetting('color.palette.default');
  8048. const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name);
  8049. const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]);
  8050. const screenPath = !name ? '/colors/palette' : '/blocks/' + name + '/colors/palette';
  8051. const paletteButtonText = colors.length > 0 ? (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %d: Number of palette colors.
  8052. (0,external_wp_i18n_namespaceObject._n)('%d color', '%d colors', colors.length), colors.length) : (0,external_wp_i18n_namespaceObject.__)('Add custom colors');
  8053. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  8054. spacing: 3
  8055. }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Palette')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
  8056. isBordered: true,
  8057. isSeparated: true
  8058. }, (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  8059. path: screenPath,
  8060. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Color palettes')
  8061. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  8062. direction: colors.length === 0 ? 'row-reverse' : 'row'
  8063. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
  8064. isLayered: false,
  8065. offset: -8
  8066. }, colors.slice(0, 5).map(_ref2 => {
  8067. let {
  8068. color
  8069. } = _ref2;
  8070. return (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8071. key: color
  8072. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8073. colorValue: color
  8074. }));
  8075. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, paletteButtonText)))));
  8076. }
  8077. /* harmony default export */ var palette = (Palette);
  8078. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-colors.js
  8079. /**
  8080. * WordPress dependencies
  8081. */
  8082. /**
  8083. * Internal dependencies
  8084. */
  8085. function BackgroundColorItem(_ref) {
  8086. let {
  8087. name,
  8088. parentMenu
  8089. } = _ref;
  8090. const supports = getSupportedGlobalStylesPanels(name);
  8091. const hasSupport = supports.includes('backgroundColor') || supports.includes('background');
  8092. const [backgroundColor] = useStyle('color.background', name);
  8093. const [gradientValue] = useStyle('color.gradient', name);
  8094. if (!hasSupport) {
  8095. return null;
  8096. }
  8097. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  8098. path: parentMenu + '/colors/background',
  8099. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors background styles')
  8100. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  8101. justify: "flex-start"
  8102. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8103. expanded: false
  8104. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8105. colorValue: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
  8106. "data-testid": "background-color-indicator"
  8107. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  8108. className: "edit-site-global-styles__color-label"
  8109. }, (0,external_wp_i18n_namespaceObject.__)('Background'))));
  8110. }
  8111. function TextColorItem(_ref2) {
  8112. let {
  8113. name,
  8114. parentMenu
  8115. } = _ref2;
  8116. const supports = getSupportedGlobalStylesPanels(name);
  8117. const hasSupport = supports.includes('color');
  8118. const [color] = useStyle('color.text', name);
  8119. if (!hasSupport) {
  8120. return null;
  8121. }
  8122. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  8123. path: parentMenu + '/colors/text',
  8124. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors text styles')
  8125. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  8126. justify: "flex-start"
  8127. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8128. expanded: false
  8129. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8130. colorValue: color,
  8131. "data-testid": "text-color-indicator"
  8132. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  8133. className: "edit-site-global-styles__color-label"
  8134. }, (0,external_wp_i18n_namespaceObject.__)('Text'))));
  8135. }
  8136. function LinkColorItem(_ref3) {
  8137. let {
  8138. name,
  8139. parentMenu
  8140. } = _ref3;
  8141. const supports = getSupportedGlobalStylesPanels(name);
  8142. const hasSupport = supports.includes('linkColor');
  8143. const [color] = useStyle('elements.link.color.text', name);
  8144. const [colorHover] = useStyle('elements.link.:hover.color.text', name);
  8145. if (!hasSupport) {
  8146. return null;
  8147. }
  8148. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  8149. path: parentMenu + '/colors/link',
  8150. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors link styles')
  8151. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  8152. justify: "flex-start"
  8153. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
  8154. isLayered: false,
  8155. offset: -8
  8156. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8157. expanded: false
  8158. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8159. colorValue: color
  8160. })), (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8161. expanded: false
  8162. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8163. colorValue: colorHover
  8164. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  8165. className: "edit-site-global-styles__color-label"
  8166. }, (0,external_wp_i18n_namespaceObject.__)('Links'))));
  8167. }
  8168. function HeadingColorItem(_ref4) {
  8169. let {
  8170. name,
  8171. parentMenu
  8172. } = _ref4;
  8173. const supports = getSupportedGlobalStylesPanels(name);
  8174. const hasSupport = supports.includes('color');
  8175. const [color] = useStyle('elements.heading.color.text', name);
  8176. const [bgColor] = useStyle('elements.heading.color.background', name);
  8177. if (!hasSupport) {
  8178. return null;
  8179. }
  8180. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  8181. path: parentMenu + '/colors/heading',
  8182. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Colors heading styles')
  8183. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  8184. justify: "flex-start"
  8185. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
  8186. isLayered: false,
  8187. offset: -8
  8188. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8189. expanded: false
  8190. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8191. colorValue: bgColor
  8192. })), (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8193. expanded: false
  8194. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8195. colorValue: color
  8196. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_i18n_namespaceObject.__)('Headings'))));
  8197. }
  8198. function ButtonColorItem(_ref5) {
  8199. let {
  8200. name,
  8201. parentMenu
  8202. } = _ref5;
  8203. const supports = getSupportedGlobalStylesPanels(name);
  8204. const hasSupport = supports.includes('buttonColor');
  8205. const [color] = useStyle('elements.button.color.text', name);
  8206. const [bgColor] = useStyle('elements.button.color.background', name);
  8207. if (!hasSupport) {
  8208. return null;
  8209. }
  8210. return (0,external_wp_element_namespaceObject.createElement)(NavigationButtonAsItem, {
  8211. path: parentMenu + '/colors/button'
  8212. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  8213. justify: "flex-start"
  8214. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalZStack, {
  8215. isLayered: false,
  8216. offset: -8
  8217. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8218. expanded: false
  8219. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8220. colorValue: bgColor
  8221. })), (0,external_wp_element_namespaceObject.createElement)(color_indicator_wrapper, {
  8222. expanded: false
  8223. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ColorIndicator, {
  8224. colorValue: color
  8225. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  8226. className: "edit-site-global-styles__color-label"
  8227. }, (0,external_wp_i18n_namespaceObject.__)('Buttons'))));
  8228. }
  8229. function ScreenColors(_ref6) {
  8230. let {
  8231. name
  8232. } = _ref6;
  8233. const parentMenu = name === undefined ? '' : '/blocks/' + name;
  8234. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8235. title: (0,external_wp_i18n_namespaceObject.__)('Colors'),
  8236. description: (0,external_wp_i18n_namespaceObject.__)('Manage palettes and the default color of different global elements on the site.')
  8237. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  8238. className: "edit-site-global-styles-screen-colors"
  8239. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  8240. spacing: 10
  8241. }, (0,external_wp_element_namespaceObject.createElement)(palette, {
  8242. name: name
  8243. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  8244. spacing: 3
  8245. }, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Elements')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, {
  8246. isBordered: true,
  8247. isSeparated: true
  8248. }, (0,external_wp_element_namespaceObject.createElement)(BackgroundColorItem, {
  8249. name: name,
  8250. parentMenu: parentMenu
  8251. }), (0,external_wp_element_namespaceObject.createElement)(TextColorItem, {
  8252. name: name,
  8253. parentMenu: parentMenu
  8254. }), (0,external_wp_element_namespaceObject.createElement)(LinkColorItem, {
  8255. name: name,
  8256. parentMenu: parentMenu
  8257. }), (0,external_wp_element_namespaceObject.createElement)(HeadingColorItem, {
  8258. name: name,
  8259. parentMenu: parentMenu
  8260. }), (0,external_wp_element_namespaceObject.createElement)(ButtonColorItem, {
  8261. name: name,
  8262. parentMenu: parentMenu
  8263. }))))));
  8264. }
  8265. /* harmony default export */ var screen_colors = (ScreenColors);
  8266. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/color-palette-panel.js
  8267. /**
  8268. * WordPress dependencies
  8269. */
  8270. /**
  8271. * Internal dependencies
  8272. */
  8273. function ColorPalettePanel(_ref) {
  8274. let {
  8275. name
  8276. } = _ref;
  8277. const [themeColors, setThemeColors] = useSetting('color.palette.theme', name);
  8278. const [baseThemeColors] = useSetting('color.palette.theme', name, 'base');
  8279. const [defaultColors, setDefaultColors] = useSetting('color.palette.default', name);
  8280. const [baseDefaultColors] = useSetting('color.palette.default', name, 'base');
  8281. const [customColors, setCustomColors] = useSetting('color.palette.custom', name);
  8282. const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name);
  8283. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  8284. className: "edit-site-global-styles-color-palette-panel",
  8285. spacing: 10
  8286. }, !!themeColors && !!themeColors.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
  8287. canReset: themeColors !== baseThemeColors,
  8288. canOnlyChangeValues: true,
  8289. colors: themeColors,
  8290. onChange: setThemeColors,
  8291. paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme')
  8292. }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
  8293. canReset: defaultColors !== baseDefaultColors,
  8294. canOnlyChangeValues: true,
  8295. colors: defaultColors,
  8296. onChange: setDefaultColors,
  8297. paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default')
  8298. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
  8299. colors: customColors,
  8300. onChange: setCustomColors,
  8301. paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
  8302. emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom colors are empty! Add some colors to create your own color palette.'),
  8303. slugPrefix: "custom-"
  8304. }));
  8305. }
  8306. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/gradients-palette-panel.js
  8307. /**
  8308. * WordPress dependencies
  8309. */
  8310. /**
  8311. * Internal dependencies
  8312. */
  8313. const gradients_palette_panel_noop = () => {};
  8314. function GradientPalettePanel(_ref) {
  8315. let {
  8316. name
  8317. } = _ref;
  8318. const [themeGradients, setThemeGradients] = useSetting('color.gradients.theme', name);
  8319. const [baseThemeGradients] = useSetting('color.gradients.theme', name, 'base');
  8320. const [defaultGradients, setDefaultGradients] = useSetting('color.gradients.default', name);
  8321. const [baseDefaultGradients] = useSetting('color.gradients.default', name, 'base');
  8322. const [customGradients, setCustomGradients] = useSetting('color.gradients.custom', name);
  8323. const [defaultPaletteEnabled] = useSetting('color.defaultGradients', name);
  8324. const [customDuotone] = useSetting('color.duotone.custom') || [];
  8325. const [defaultDuotone] = useSetting('color.duotone.default') || [];
  8326. const [themeDuotone] = useSetting('color.duotone.theme') || [];
  8327. const [defaultDuotoneEnabled] = useSetting('color.defaultDuotone');
  8328. const duotonePalette = [...(customDuotone || []), ...(themeDuotone || []), ...(defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [])];
  8329. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
  8330. className: "edit-site-global-styles-gradient-palette-panel",
  8331. spacing: 10
  8332. }, !!themeGradients && !!themeGradients.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
  8333. canReset: themeGradients !== baseThemeGradients,
  8334. canOnlyChangeValues: true,
  8335. gradients: themeGradients,
  8336. onChange: setThemeGradients,
  8337. paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Theme')
  8338. }), !!defaultGradients && !!defaultGradients.length && !!defaultPaletteEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
  8339. canReset: defaultGradients !== baseDefaultGradients,
  8340. canOnlyChangeValues: true,
  8341. gradients: defaultGradients,
  8342. onChange: setDefaultGradients,
  8343. paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Default')
  8344. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalPaletteEdit, {
  8345. gradients: customGradients,
  8346. onChange: setCustomGradients,
  8347. paletteLabel: (0,external_wp_i18n_namespaceObject.__)('Custom'),
  8348. emptyMessage: (0,external_wp_i18n_namespaceObject.__)('Custom gradients are empty! Add some gradients to create your own palette.'),
  8349. slugPrefix: "custom-"
  8350. }), !!duotonePalette && !!duotonePalette.length && (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(subtitle, null, (0,external_wp_i18n_namespaceObject.__)('Duotone')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalSpacer, {
  8351. margin: 3
  8352. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DuotonePicker, {
  8353. duotonePalette: duotonePalette,
  8354. disableCustomDuotone: true,
  8355. disableCustomColors: true,
  8356. clearable: false,
  8357. onChange: gradients_palette_panel_noop
  8358. })));
  8359. }
  8360. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-color-palette.js
  8361. /**
  8362. * WordPress dependencies
  8363. */
  8364. /**
  8365. * Internal dependencies
  8366. */
  8367. function ScreenColorPalette(_ref) {
  8368. let {
  8369. name
  8370. } = _ref;
  8371. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8372. title: (0,external_wp_i18n_namespaceObject.__)('Palette'),
  8373. description: (0,external_wp_i18n_namespaceObject.__)('Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.')
  8374. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
  8375. tabs: [{
  8376. name: 'solid',
  8377. title: 'Solid',
  8378. value: 'solid'
  8379. }, {
  8380. name: 'gradient',
  8381. title: 'Gradient',
  8382. value: 'gradient'
  8383. }]
  8384. }, tab => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, tab.value === 'solid' && (0,external_wp_element_namespaceObject.createElement)(ColorPalettePanel, {
  8385. name: name
  8386. }), tab.value === 'gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientPalettePanel, {
  8387. name: name
  8388. }))));
  8389. }
  8390. /* harmony default export */ var screen_color_palette = (ScreenColorPalette);
  8391. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-background-color.js
  8392. /**
  8393. * WordPress dependencies
  8394. */
  8395. /**
  8396. * Internal dependencies
  8397. */
  8398. function ScreenBackgroundColor(_ref) {
  8399. let {
  8400. name
  8401. } = _ref;
  8402. const supports = getSupportedGlobalStylesPanels(name);
  8403. const [solids] = useSetting('color.palette', name);
  8404. const [gradients] = useSetting('color.gradients', name);
  8405. const [areCustomSolidsEnabled] = useSetting('color.custom', name);
  8406. const [areCustomGradientsEnabled] = useSetting('color.customGradient', name);
  8407. const colorsPerOrigin = useColorsPerOrigin(name);
  8408. const gradientsPerOrigin = useGradientsPerOrigin(name);
  8409. const [isBackgroundEnabled] = useSetting('color.background', name);
  8410. const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
  8411. const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled);
  8412. const [backgroundColor, setBackgroundColor] = useStyle('color.background', name);
  8413. const [userBackgroundColor] = useStyle('color.background', name, 'user');
  8414. const [gradient, setGradient] = useStyle('color.gradient', name);
  8415. const [userGradient] = useStyle('color.gradient', name, 'user');
  8416. if (!hasBackgroundColor && !hasGradientColor) {
  8417. return null;
  8418. }
  8419. let backgroundSettings = {};
  8420. if (hasBackgroundColor) {
  8421. backgroundSettings = {
  8422. colorValue: backgroundColor,
  8423. onColorChange: setBackgroundColor
  8424. };
  8425. if (backgroundColor) {
  8426. backgroundSettings.clearable = backgroundColor === userBackgroundColor;
  8427. }
  8428. }
  8429. let gradientSettings = {};
  8430. if (hasGradientColor) {
  8431. gradientSettings = {
  8432. gradientValue: gradient,
  8433. onGradientChange: setGradient
  8434. };
  8435. if (gradient) {
  8436. gradientSettings.clearable = gradient === userGradient;
  8437. }
  8438. }
  8439. const controlProps = { ...backgroundSettings,
  8440. ...gradientSettings
  8441. };
  8442. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8443. title: (0,external_wp_i18n_namespaceObject.__)('Background'),
  8444. description: (0,external_wp_i18n_namespaceObject.__)('Set a background color or gradient for the whole site.')
  8445. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, extends_extends({
  8446. className: "edit-site-screen-background-color__control",
  8447. colors: colorsPerOrigin,
  8448. gradients: gradientsPerOrigin,
  8449. disableCustomColors: !areCustomSolidsEnabled,
  8450. disableCustomGradients: !areCustomGradientsEnabled,
  8451. __experimentalHasMultipleOrigins: true,
  8452. showTitle: false,
  8453. enableAlpha: true,
  8454. __experimentalIsRenderedInSidebar: true
  8455. }, controlProps)));
  8456. }
  8457. /* harmony default export */ var screen_background_color = (ScreenBackgroundColor);
  8458. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-text-color.js
  8459. /**
  8460. * WordPress dependencies
  8461. */
  8462. /**
  8463. * Internal dependencies
  8464. */
  8465. function ScreenTextColor(_ref) {
  8466. let {
  8467. name
  8468. } = _ref;
  8469. const supports = getSupportedGlobalStylesPanels(name);
  8470. const [solids] = useSetting('color.palette', name);
  8471. const [areCustomSolidsEnabled] = useSetting('color.custom', name);
  8472. const [isTextEnabled] = useSetting('color.text', name);
  8473. const colorsPerOrigin = useColorsPerOrigin(name);
  8474. const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled);
  8475. const [color, setColor] = useStyle('color.text', name);
  8476. const [userColor] = useStyle('color.text', name, 'user');
  8477. if (!hasTextColor) {
  8478. return null;
  8479. }
  8480. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8481. title: (0,external_wp_i18n_namespaceObject.__)('Text'),
  8482. description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for text across the site.')
  8483. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
  8484. className: "edit-site-screen-text-color__control",
  8485. colors: colorsPerOrigin,
  8486. disableCustomColors: !areCustomSolidsEnabled,
  8487. __experimentalHasMultipleOrigins: true,
  8488. showTitle: false,
  8489. enableAlpha: true,
  8490. __experimentalIsRenderedInSidebar: true,
  8491. colorValue: color,
  8492. onColorChange: setColor,
  8493. clearable: color === userColor
  8494. }));
  8495. }
  8496. /* harmony default export */ var screen_text_color = (ScreenTextColor);
  8497. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-link-color.js
  8498. /**
  8499. * WordPress dependencies
  8500. */
  8501. /**
  8502. * Internal dependencies
  8503. */
  8504. function ScreenLinkColor(_ref) {
  8505. let {
  8506. name
  8507. } = _ref;
  8508. const supports = getSupportedGlobalStylesPanels(name);
  8509. const [solids] = useSetting('color.palette', name);
  8510. const [areCustomSolidsEnabled] = useSetting('color.custom', name);
  8511. const colorsPerOrigin = useColorsPerOrigin(name);
  8512. const [isLinkEnabled] = useSetting('color.link', name);
  8513. const hasLinkColor = supports.includes('linkColor') && isLinkEnabled && (solids.length > 0 || areCustomSolidsEnabled);
  8514. const pseudoStates = {
  8515. default: {
  8516. label: (0,external_wp_i18n_namespaceObject.__)('Default'),
  8517. value: useStyle('elements.link.color.text', name)[0],
  8518. handler: useStyle('elements.link.color.text', name)[1],
  8519. userValue: useStyle('elements.link.color.text', name, 'user')[0]
  8520. },
  8521. hover: {
  8522. label: (0,external_wp_i18n_namespaceObject.__)('Hover'),
  8523. value: useStyle('elements.link.:hover.color.text', name)[0],
  8524. handler: useStyle('elements.link.:hover.color.text', name)[1],
  8525. userValue: useStyle('elements.link.:hover.color.text', name, 'user')[0]
  8526. }
  8527. };
  8528. if (!hasLinkColor) {
  8529. return null;
  8530. }
  8531. const tabs = Object.entries(pseudoStates).map(_ref2 => {
  8532. let [selector, config] = _ref2;
  8533. return {
  8534. name: selector,
  8535. title: config.label,
  8536. className: `color-text-${selector}`
  8537. };
  8538. });
  8539. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8540. title: (0,external_wp_i18n_namespaceObject.__)('Links'),
  8541. description: (0,external_wp_i18n_namespaceObject.__)('Set the colors used for links across the site.')
  8542. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
  8543. tabs: tabs
  8544. }, tab => {
  8545. var _pseudoStates$tab$nam;
  8546. const pseudoSelectorConfig = (_pseudoStates$tab$nam = pseudoStates[tab.name]) !== null && _pseudoStates$tab$nam !== void 0 ? _pseudoStates$tab$nam : null;
  8547. if (!pseudoSelectorConfig) {
  8548. return null;
  8549. }
  8550. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
  8551. className: "edit-site-screen-link-color__control",
  8552. colors: colorsPerOrigin,
  8553. disableCustomColors: !areCustomSolidsEnabled,
  8554. __experimentalHasMultipleOrigins: true,
  8555. showTitle: false,
  8556. enableAlpha: true,
  8557. __experimentalIsRenderedInSidebar: true,
  8558. colorValue: pseudoSelectorConfig.value,
  8559. onColorChange: pseudoSelectorConfig.handler,
  8560. clearable: pseudoSelectorConfig.value === pseudoSelectorConfig.userValue
  8561. }));
  8562. }));
  8563. }
  8564. /* harmony default export */ var screen_link_color = (ScreenLinkColor);
  8565. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-heading-color.js
  8566. /**
  8567. * WordPress dependencies
  8568. */
  8569. /**
  8570. * Internal dependencies
  8571. */
  8572. function ScreenHeadingColor(_ref) {
  8573. let {
  8574. name
  8575. } = _ref;
  8576. const [selectedLevel, setCurrentTab] = (0,external_wp_element_namespaceObject.useState)('heading');
  8577. const supports = getSupportedGlobalStylesPanels(name);
  8578. const [solids] = useSetting('color.palette', name);
  8579. const [gradients] = useSetting('color.gradients', name);
  8580. const [areCustomSolidsEnabled] = useSetting('color.custom', name);
  8581. const [areCustomGradientsEnabled] = useSetting('color.customGradient', name);
  8582. const [isTextEnabled] = useSetting('color.text', name);
  8583. const [isBackgroundEnabled] = useSetting('color.background', name);
  8584. const colorsPerOrigin = useColorsPerOrigin(name);
  8585. const gradientsPerOrigin = useGradientsPerOrigin(name);
  8586. const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled);
  8587. const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
  8588. const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled);
  8589. const [color, setColor] = useStyle('elements.' + selectedLevel + '.color.text', name);
  8590. const [userColor] = useStyle('elements.' + selectedLevel + '.color.text', name, 'user');
  8591. const [backgroundColor, setBackgroundColor] = useStyle('elements.' + selectedLevel + '.color.background', name);
  8592. const [userBackgroundColor] = useStyle('elements.' + selectedLevel + '.color.background', name, 'user');
  8593. const [gradient, setGradient] = useStyle('elements.' + selectedLevel + '.color.gradient', name);
  8594. const [userGradient] = useStyle('elements.' + selectedLevel + '.color.gradient', name, 'user');
  8595. if (!hasTextColor && !hasBackgroundColor && !hasGradientColor) {
  8596. return null;
  8597. }
  8598. let backgroundSettings = {};
  8599. if (hasBackgroundColor) {
  8600. backgroundSettings = {
  8601. colorValue: backgroundColor,
  8602. onColorChange: setBackgroundColor
  8603. };
  8604. if (backgroundColor) {
  8605. backgroundSettings.clearable = backgroundColor === userBackgroundColor;
  8606. }
  8607. }
  8608. let gradientSettings = {};
  8609. if (hasGradientColor) {
  8610. gradientSettings = {
  8611. gradientValue: gradient,
  8612. onGradientChange: setGradient
  8613. };
  8614. if (gradient) {
  8615. gradientSettings.clearable = gradient === userGradient;
  8616. }
  8617. }
  8618. const controlProps = { ...backgroundSettings,
  8619. ...gradientSettings
  8620. };
  8621. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8622. title: (0,external_wp_i18n_namespaceObject.__)('Headings'),
  8623. description: (0,external_wp_i18n_namespaceObject.__)('Set the default color used for headings across the site.')
  8624. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  8625. className: "edit-site-global-styles-screen-heading-color"
  8626. }, (0,external_wp_element_namespaceObject.createElement)("h4", null, (0,external_wp_i18n_namespaceObject.__)('Select heading level')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControl, {
  8627. label: (0,external_wp_i18n_namespaceObject.__)('Select heading level'),
  8628. hideLabelFromVision: true,
  8629. value: selectedLevel,
  8630. onChange: setCurrentTab,
  8631. isBlock: true
  8632. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8633. value: "heading"
  8634. /* translators: 'All' refers to selecting all heading levels
  8635. and applying the same style to h1-h6. */
  8636. ,
  8637. label: (0,external_wp_i18n_namespaceObject.__)('All')
  8638. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8639. value: "h1",
  8640. label: (0,external_wp_i18n_namespaceObject.__)('H1')
  8641. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8642. value: "h2",
  8643. label: (0,external_wp_i18n_namespaceObject.__)('H2')
  8644. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8645. value: "h3",
  8646. label: (0,external_wp_i18n_namespaceObject.__)('H3')
  8647. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8648. value: "h4",
  8649. label: (0,external_wp_i18n_namespaceObject.__)('H4')
  8650. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8651. value: "h5",
  8652. label: (0,external_wp_i18n_namespaceObject.__)('H5')
  8653. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToggleGroupControlOption, {
  8654. value: "h6",
  8655. label: (0,external_wp_i18n_namespaceObject.__)('H6')
  8656. }))), hasTextColor && (0,external_wp_element_namespaceObject.createElement)("div", {
  8657. className: "edit-site-global-styles-screen-heading-color"
  8658. }, (0,external_wp_element_namespaceObject.createElement)("h4", null, selectedLevel === 'heading' ? (0,external_wp_i18n_namespaceObject.__)('Text color for all heading levels') : (0,external_wp_i18n_namespaceObject.sprintf)(
  8659. /* translators: %s: heading level (h1-h6) */
  8660. (0,external_wp_i18n_namespaceObject.__)('Text color for %s'), selectedLevel.toUpperCase())), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
  8661. className: "edit-site-screen-heading-text-color__control",
  8662. colors: colorsPerOrigin,
  8663. disableCustomColors: !areCustomSolidsEnabled,
  8664. __experimentalHasMultipleOrigins: true,
  8665. showTitle: false,
  8666. enableAlpha: true,
  8667. __experimentalIsRenderedInSidebar: true,
  8668. colorValue: color,
  8669. onColorChange: setColor,
  8670. clearable: color === userColor
  8671. })), hasBackgroundColor && (0,external_wp_element_namespaceObject.createElement)("div", {
  8672. className: "edit-site-global-styles-screen-heading-color"
  8673. }, (0,external_wp_element_namespaceObject.createElement)("h4", null, selectedLevel === 'heading' ? (0,external_wp_i18n_namespaceObject.__)('Background color for all heading levels') : (0,external_wp_i18n_namespaceObject.sprintf)(
  8674. /* translators: %s: heading level (h1-h6) */
  8675. (0,external_wp_i18n_namespaceObject.__)('Background color for %s'), selectedLevel.toUpperCase())), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, extends_extends({
  8676. className: "edit-site-screen-heading-background-color__control",
  8677. colors: colorsPerOrigin,
  8678. gradients: gradientsPerOrigin,
  8679. disableCustomColors: !areCustomSolidsEnabled,
  8680. disableCustomGradients: !areCustomGradientsEnabled,
  8681. __experimentalHasMultipleOrigins: true,
  8682. showTitle: false,
  8683. enableAlpha: true,
  8684. __experimentalIsRenderedInSidebar: true
  8685. }, controlProps))));
  8686. }
  8687. /* harmony default export */ var screen_heading_color = (ScreenHeadingColor);
  8688. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-button-color.js
  8689. /**
  8690. * WordPress dependencies
  8691. */
  8692. /**
  8693. * Internal dependencies
  8694. */
  8695. function ScreenButtonColor(_ref) {
  8696. let {
  8697. name
  8698. } = _ref;
  8699. const supports = getSupportedGlobalStylesPanels(name);
  8700. const [solids] = useSetting('color.palette', name);
  8701. const [areCustomSolidsEnabled] = useSetting('color.custom', name);
  8702. const colorsPerOrigin = useColorsPerOrigin(name);
  8703. const [isBackgroundEnabled] = useSetting('color.background', name);
  8704. const hasButtonColor = supports.includes('buttonColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
  8705. const [buttonTextColor, setButtonTextColor] = useStyle('elements.button.color.text', name);
  8706. const [userButtonTextColor] = useStyle('elements.button.color.text', name, 'user');
  8707. const [buttonBgColor, setButtonBgColor] = useStyle('elements.button.color.background', name);
  8708. const [userButtonBgColor] = useStyle('elements.button.color.background', name, 'user');
  8709. if (!hasButtonColor) {
  8710. return null;
  8711. }
  8712. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8713. title: (0,external_wp_i18n_namespaceObject.__)('Buttons'),
  8714. description: (0,external_wp_i18n_namespaceObject.__)('Set the default colors used for buttons across the site.')
  8715. }), (0,external_wp_element_namespaceObject.createElement)("h4", {
  8716. className: "edit-site-global-styles-section-title"
  8717. }, (0,external_wp_i18n_namespaceObject.__)('Text color')), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
  8718. className: "edit-site-screen-button-color__control",
  8719. colors: colorsPerOrigin,
  8720. disableCustomColors: !areCustomSolidsEnabled,
  8721. __experimentalHasMultipleOrigins: true,
  8722. showTitle: false,
  8723. enableAlpha: true,
  8724. __experimentalIsRenderedInSidebar: true,
  8725. colorValue: buttonTextColor,
  8726. onColorChange: setButtonTextColor,
  8727. clearable: buttonTextColor === userButtonTextColor
  8728. }), (0,external_wp_element_namespaceObject.createElement)("h4", {
  8729. className: "edit-site-global-styles-section-title"
  8730. }, (0,external_wp_i18n_namespaceObject.__)('Background color')), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalColorGradientControl, {
  8731. className: "edit-site-screen-button-color__control",
  8732. colors: colorsPerOrigin,
  8733. disableCustomColors: !areCustomSolidsEnabled,
  8734. __experimentalHasMultipleOrigins: true,
  8735. showTitle: false,
  8736. enableAlpha: true,
  8737. __experimentalIsRenderedInSidebar: true,
  8738. colorValue: buttonBgColor,
  8739. onColorChange: setButtonBgColor,
  8740. clearable: buttonBgColor === userButtonBgColor
  8741. }));
  8742. }
  8743. /* harmony default export */ var screen_button_color = (ScreenButtonColor);
  8744. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-layout.js
  8745. /**
  8746. * WordPress dependencies
  8747. */
  8748. /**
  8749. * Internal dependencies
  8750. */
  8751. function ScreenLayout(_ref) {
  8752. let {
  8753. name
  8754. } = _ref;
  8755. const hasBorderPanel = useHasBorderPanel(name);
  8756. const hasDimensionsPanel = useHasDimensionsPanel(name);
  8757. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8758. title: (0,external_wp_i18n_namespaceObject.__)('Layout')
  8759. }), hasDimensionsPanel && (0,external_wp_element_namespaceObject.createElement)(DimensionsPanel, {
  8760. name: name
  8761. }), hasBorderPanel && (0,external_wp_element_namespaceObject.createElement)(BorderPanel, {
  8762. name: name
  8763. }));
  8764. }
  8765. /* harmony default export */ var screen_layout = (ScreenLayout);
  8766. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/global-styles-provider.js
  8767. /**
  8768. * External dependencies
  8769. */
  8770. /**
  8771. * WordPress dependencies
  8772. */
  8773. /**
  8774. * Internal dependencies
  8775. */
  8776. const identity = x => x;
  8777. function mergeTreesCustomizer(_, srcValue) {
  8778. // We only pass as arrays the presets,
  8779. // in which case we want the new array of values
  8780. // to override the old array (no merging).
  8781. if (Array.isArray(srcValue)) {
  8782. return srcValue;
  8783. }
  8784. }
  8785. function mergeBaseAndUserConfigs(base, user) {
  8786. return (0,external_lodash_namespaceObject.mergeWith)({}, base, user, mergeTreesCustomizer);
  8787. }
  8788. const cleanEmptyObject = object => {
  8789. if (object === null || typeof object !== 'object' || Array.isArray(object)) {
  8790. return object;
  8791. }
  8792. const cleanedNestedObjects = (0,external_lodash_namespaceObject.pickBy)((0,external_lodash_namespaceObject.mapValues)(object, cleanEmptyObject), identity);
  8793. return (0,external_lodash_namespaceObject.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
  8794. };
  8795. function useGlobalStylesUserConfig() {
  8796. const {
  8797. globalStylesId,
  8798. settings,
  8799. styles
  8800. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8801. const _globalStylesId = select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentGlobalStylesId();
  8802. const record = _globalStylesId ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('root', 'globalStyles', _globalStylesId) : undefined;
  8803. return {
  8804. globalStylesId: _globalStylesId,
  8805. settings: record === null || record === void 0 ? void 0 : record.settings,
  8806. styles: record === null || record === void 0 ? void 0 : record.styles
  8807. };
  8808. }, []);
  8809. const {
  8810. getEditedEntityRecord
  8811. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
  8812. const {
  8813. editEntityRecord
  8814. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  8815. const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
  8816. return {
  8817. settings: settings !== null && settings !== void 0 ? settings : {},
  8818. styles: styles !== null && styles !== void 0 ? styles : {}
  8819. };
  8820. }, [settings, styles]);
  8821. const setConfig = (0,external_wp_element_namespaceObject.useCallback)(callback => {
  8822. var _record$styles, _record$settings;
  8823. const record = getEditedEntityRecord('root', 'globalStyles', globalStylesId);
  8824. const currentConfig = {
  8825. styles: (_record$styles = record === null || record === void 0 ? void 0 : record.styles) !== null && _record$styles !== void 0 ? _record$styles : {},
  8826. settings: (_record$settings = record === null || record === void 0 ? void 0 : record.settings) !== null && _record$settings !== void 0 ? _record$settings : {}
  8827. };
  8828. const updatedConfig = callback(currentConfig);
  8829. editEntityRecord('root', 'globalStyles', globalStylesId, {
  8830. styles: cleanEmptyObject(updatedConfig.styles) || {},
  8831. settings: cleanEmptyObject(updatedConfig.settings) || {}
  8832. });
  8833. }, [globalStylesId]);
  8834. return [!!settings || !!styles, config, setConfig];
  8835. }
  8836. function useGlobalStylesBaseConfig() {
  8837. const baseConfig = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8838. return select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeBaseGlobalStyles();
  8839. }, []);
  8840. return [!!baseConfig, baseConfig];
  8841. }
  8842. function useGlobalStylesContext() {
  8843. const [isUserConfigReady, userConfig, setUserConfig] = useGlobalStylesUserConfig();
  8844. const [isBaseConfigReady, baseConfig] = useGlobalStylesBaseConfig();
  8845. const mergedConfig = (0,external_wp_element_namespaceObject.useMemo)(() => {
  8846. if (!baseConfig || !userConfig) {
  8847. return {};
  8848. }
  8849. return mergeBaseAndUserConfigs(baseConfig, userConfig);
  8850. }, [userConfig, baseConfig]);
  8851. const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
  8852. return {
  8853. isReady: isUserConfigReady && isBaseConfigReady,
  8854. user: userConfig,
  8855. base: baseConfig,
  8856. merged: mergedConfig,
  8857. setUserConfig
  8858. };
  8859. }, [mergedConfig, userConfig, baseConfig, setUserConfig, isUserConfigReady, isBaseConfigReady]);
  8860. return context;
  8861. }
  8862. function GlobalStylesProvider(_ref) {
  8863. let {
  8864. children
  8865. } = _ref;
  8866. const context = useGlobalStylesContext();
  8867. if (!context.isReady) {
  8868. return null;
  8869. }
  8870. return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, {
  8871. value: context
  8872. }, children);
  8873. }
  8874. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/screen-style-variations.js
  8875. /**
  8876. * External dependencies
  8877. */
  8878. /**
  8879. * WordPress dependencies
  8880. */
  8881. /**
  8882. * Internal dependencies
  8883. */
  8884. function compareVariations(a, b) {
  8885. return (0,external_lodash_namespaceObject.isEqual)(a.styles, b.styles) && (0,external_lodash_namespaceObject.isEqual)(a.settings, b.settings);
  8886. }
  8887. function Variation(_ref) {
  8888. let {
  8889. variation
  8890. } = _ref;
  8891. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  8892. const {
  8893. base,
  8894. user,
  8895. setUserConfig
  8896. } = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
  8897. const context = (0,external_wp_element_namespaceObject.useMemo)(() => {
  8898. var _variation$settings, _variation$styles;
  8899. return {
  8900. user: {
  8901. settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
  8902. styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
  8903. },
  8904. base,
  8905. merged: mergeBaseAndUserConfigs(base, variation),
  8906. setUserConfig: () => {}
  8907. };
  8908. }, [variation, base]);
  8909. const selectVariation = () => {
  8910. setUserConfig(() => {
  8911. return {
  8912. settings: variation.settings,
  8913. styles: variation.styles
  8914. };
  8915. });
  8916. };
  8917. const selectOnEnter = event => {
  8918. if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) {
  8919. event.preventDefault();
  8920. selectVariation();
  8921. }
  8922. };
  8923. const isActive = (0,external_wp_element_namespaceObject.useMemo)(() => {
  8924. return compareVariations(user, variation);
  8925. }, [user, variation]);
  8926. return (0,external_wp_element_namespaceObject.createElement)(GlobalStylesContext.Provider, {
  8927. value: context
  8928. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  8929. className: classnames_default()('edit-site-global-styles-variations_item', {
  8930. 'is-active': isActive
  8931. }),
  8932. role: "button",
  8933. onClick: selectVariation,
  8934. onKeyDown: selectOnEnter,
  8935. tabIndex: "0",
  8936. "aria-label": variation === null || variation === void 0 ? void 0 : variation.title,
  8937. "aria-current": isActive,
  8938. onFocus: () => setIsFocused(true),
  8939. onBlur: () => setIsFocused(false)
  8940. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  8941. className: "edit-site-global-styles-variations_item-preview"
  8942. }, (0,external_wp_element_namespaceObject.createElement)(preview, {
  8943. label: variation === null || variation === void 0 ? void 0 : variation.title,
  8944. isFocused: isFocused
  8945. }))));
  8946. }
  8947. function ScreenStyleVariations() {
  8948. const {
  8949. variations
  8950. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  8951. return {
  8952. variations: select(external_wp_coreData_namespaceObject.store).__experimentalGetCurrentThemeGlobalStylesVariations()
  8953. };
  8954. }, []);
  8955. const withEmptyVariation = (0,external_wp_element_namespaceObject.useMemo)(() => {
  8956. return [{
  8957. title: (0,external_wp_i18n_namespaceObject.__)('Default'),
  8958. settings: {},
  8959. styles: {}
  8960. }, ...variations.map(variation => {
  8961. var _variation$settings2, _variation$styles2;
  8962. return { ...variation,
  8963. settings: (_variation$settings2 = variation.settings) !== null && _variation$settings2 !== void 0 ? _variation$settings2 : {},
  8964. styles: (_variation$styles2 = variation.styles) !== null && _variation$styles2 !== void 0 ? _variation$styles2 : {}
  8965. };
  8966. })];
  8967. }, [variations]);
  8968. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(header, {
  8969. back: "/",
  8970. title: (0,external_wp_i18n_namespaceObject.__)('Browse styles'),
  8971. description: (0,external_wp_i18n_namespaceObject.__)('Choose a different style combination for the theme styles')
  8972. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  8973. size: "small",
  8974. isBorderless: true
  8975. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalGrid, {
  8976. columns: 2
  8977. }, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0,external_wp_element_namespaceObject.createElement)(Variation, {
  8978. key: index,
  8979. variation: variation
  8980. }))))));
  8981. }
  8982. /* harmony default export */ var screen_style_variations = (ScreenStyleVariations);
  8983. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/ui.js
  8984. /**
  8985. * WordPress dependencies
  8986. */
  8987. /**
  8988. * Internal dependencies
  8989. */
  8990. function GlobalStylesNavigationScreen(_ref) {
  8991. let {
  8992. className,
  8993. ...props
  8994. } = _ref;
  8995. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, extends_extends({
  8996. className: ['edit-site-global-styles-sidebar__navigator-screen', className].filter(Boolean).join(' ')
  8997. }, props));
  8998. }
  8999. function ContextScreens(_ref2) {
  9000. let {
  9001. name
  9002. } = _ref2;
  9003. const parentMenu = name === undefined ? '' : '/blocks/' + name;
  9004. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9005. path: parentMenu + '/typography'
  9006. }, (0,external_wp_element_namespaceObject.createElement)(screen_typography, {
  9007. name: name
  9008. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9009. path: parentMenu + '/typography/text'
  9010. }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, {
  9011. name: name,
  9012. element: "text"
  9013. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9014. path: parentMenu + '/typography/link'
  9015. }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, {
  9016. name: name,
  9017. element: "link"
  9018. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9019. path: parentMenu + '/typography/heading'
  9020. }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, {
  9021. name: name,
  9022. element: "heading"
  9023. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9024. path: parentMenu + '/typography/button'
  9025. }, (0,external_wp_element_namespaceObject.createElement)(screen_typography_element, {
  9026. name: name,
  9027. element: "button"
  9028. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9029. path: parentMenu + '/colors'
  9030. }, (0,external_wp_element_namespaceObject.createElement)(screen_colors, {
  9031. name: name
  9032. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9033. path: parentMenu + '/colors/palette'
  9034. }, (0,external_wp_element_namespaceObject.createElement)(screen_color_palette, {
  9035. name: name
  9036. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9037. path: parentMenu + '/colors/background'
  9038. }, (0,external_wp_element_namespaceObject.createElement)(screen_background_color, {
  9039. name: name
  9040. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9041. path: parentMenu + '/colors/text'
  9042. }, (0,external_wp_element_namespaceObject.createElement)(screen_text_color, {
  9043. name: name
  9044. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9045. path: parentMenu + '/colors/link'
  9046. }, (0,external_wp_element_namespaceObject.createElement)(screen_link_color, {
  9047. name: name
  9048. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9049. path: parentMenu + '/colors/heading'
  9050. }, (0,external_wp_element_namespaceObject.createElement)(screen_heading_color, {
  9051. name: name
  9052. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9053. path: parentMenu + '/colors/button'
  9054. }, (0,external_wp_element_namespaceObject.createElement)(screen_button_color, {
  9055. name: name
  9056. })), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9057. path: parentMenu + '/layout'
  9058. }, (0,external_wp_element_namespaceObject.createElement)(screen_layout, {
  9059. name: name
  9060. })));
  9061. }
  9062. function GlobalStylesUI() {
  9063. const blocks = (0,external_wp_blocks_namespaceObject.getBlockTypes)();
  9064. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
  9065. className: "edit-site-global-styles-sidebar__navigator-provider",
  9066. initialPath: "/"
  9067. }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9068. path: "/"
  9069. }, (0,external_wp_element_namespaceObject.createElement)(screen_root, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9070. path: "/variations"
  9071. }, (0,external_wp_element_namespaceObject.createElement)(screen_style_variations, null)), (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9072. path: "/blocks"
  9073. }, (0,external_wp_element_namespaceObject.createElement)(screen_block_list, null)), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(GlobalStylesNavigationScreen, {
  9074. key: 'menu-block-' + block.name,
  9075. path: '/blocks/' + block.name
  9076. }, (0,external_wp_element_namespaceObject.createElement)(screen_block, {
  9077. name: block.name
  9078. }))), (0,external_wp_element_namespaceObject.createElement)(ContextScreens, null), blocks.map(block => (0,external_wp_element_namespaceObject.createElement)(ContextScreens, {
  9079. key: 'screens-block-' + block.name,
  9080. name: block.name
  9081. })));
  9082. }
  9083. /* harmony default export */ var ui = (GlobalStylesUI);
  9084. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/global-styles/index.js
  9085. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/global-styles-sidebar.js
  9086. /**
  9087. * WordPress dependencies
  9088. */
  9089. /**
  9090. * Internal dependencies
  9091. */
  9092. function GlobalStylesSidebar() {
  9093. const [canReset, onReset] = useGlobalStylesReset();
  9094. const {
  9095. toggle
  9096. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  9097. return (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, {
  9098. className: "edit-site-global-styles-sidebar",
  9099. identifier: "edit-site/global-styles",
  9100. title: (0,external_wp_i18n_namespaceObject.__)('Styles'),
  9101. icon: library_styles,
  9102. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close global styles sidebar'),
  9103. panelClassName: "edit-site-global-styles-sidebar__panel",
  9104. header: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Styles'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
  9105. icon: more_vertical,
  9106. label: (0,external_wp_i18n_namespaceObject.__)('More Global Styles Actions'),
  9107. controls: [{
  9108. title: (0,external_wp_i18n_namespaceObject.__)('Reset to defaults'),
  9109. onClick: onReset,
  9110. isDisabled: !canReset
  9111. }, {
  9112. title: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide'),
  9113. onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
  9114. }]
  9115. })))
  9116. }, (0,external_wp_element_namespaceObject.createElement)(ui, null));
  9117. }
  9118. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js
  9119. /**
  9120. * WordPress dependencies
  9121. */
  9122. const ALLOWED_BLOCKS = {
  9123. 'core/navigation': ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'],
  9124. 'core/social-links': ['core/social-link'],
  9125. 'core/navigation-submenu': ['core/navigation-link', 'core/navigation-submenu'],
  9126. 'core/navigation-link': ['core/navigation-link', 'core/navigation-submenu']
  9127. };
  9128. function navigation_menu_NavigationMenu(_ref) {
  9129. let {
  9130. innerBlocks,
  9131. id
  9132. } = _ref;
  9133. const {
  9134. updateBlockListSettings
  9135. } = useDispatch(blockEditorStore); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
  9136. //Think through a better way of doing this, possible with adding allowed blocks to block library metadata
  9137. useEffect(() => {
  9138. updateBlockListSettings('', {
  9139. allowedBlocks: ALLOWED_BLOCKS['core/navigation']
  9140. });
  9141. innerBlocks.forEach(block => {
  9142. if (ALLOWED_BLOCKS[block.name]) {
  9143. updateBlockListSettings(block.clientId, {
  9144. allowedBlocks: ALLOWED_BLOCKS[block.name]
  9145. });
  9146. }
  9147. });
  9148. }, [updateBlockListSettings, innerBlocks]);
  9149. return createElement(ListView, {
  9150. id: id
  9151. });
  9152. }
  9153. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js
  9154. /**
  9155. * WordPress dependencies
  9156. */
  9157. /**
  9158. * Internal dependencies
  9159. */
  9160. const NAVIGATION_MENUS_QUERY = [{
  9161. per_page: -1,
  9162. status: 'publish'
  9163. }];
  9164. function navigation_inspector_NavigationInspector() {
  9165. var _navigationMenus$;
  9166. const {
  9167. selectedNavigationBlockId,
  9168. clientIdToRef,
  9169. navigationMenus,
  9170. isResolvingNavigationMenus,
  9171. hasResolvedNavigationMenus,
  9172. firstNavigationBlockId
  9173. } = useSelect(select => {
  9174. const {
  9175. __experimentalGetActiveBlockIdByBlockNames,
  9176. __experimentalGetGlobalBlocksByName,
  9177. getBlock
  9178. } = select(blockEditorStore);
  9179. const {
  9180. getEntityRecords,
  9181. hasFinishedResolution,
  9182. isResolving
  9183. } = select(coreStore);
  9184. const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY[0]]; // Get the active Navigation block (if present).
  9185. const selectedNavId = __experimentalGetActiveBlockIdByBlockNames('core/navigation'); // Get all Navigation blocks currently within the editor canvas.
  9186. const navBlockIds = __experimentalGetGlobalBlocksByName('core/navigation');
  9187. const idToRef = {};
  9188. navBlockIds.forEach(id => {
  9189. var _getBlock, _getBlock$attributes;
  9190. idToRef[id] = (_getBlock = getBlock(id)) === null || _getBlock === void 0 ? void 0 : (_getBlock$attributes = _getBlock.attributes) === null || _getBlock$attributes === void 0 ? void 0 : _getBlock$attributes.ref;
  9191. });
  9192. return {
  9193. selectedNavigationBlockId: selectedNavId,
  9194. firstNavigationBlockId: navBlockIds === null || navBlockIds === void 0 ? void 0 : navBlockIds[0],
  9195. clientIdToRef: idToRef,
  9196. navigationMenus: getEntityRecords(...navigationMenusQuery),
  9197. isResolvingNavigationMenus: isResolving('getEntityRecords', navigationMenusQuery),
  9198. hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
  9199. };
  9200. }, []);
  9201. const navMenuListId = useInstanceId(NavigationMenu, 'edit-site-navigation-inspector-menu');
  9202. const firstNavRefInTemplate = clientIdToRef[firstNavigationBlockId];
  9203. const firstNavigationMenuRef = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id; // Default Navigation Menu is either:
  9204. // - the Navigation Menu referenced by the first Nav block within the template.
  9205. // - the first of the available Navigation Menus (`wp_navigation`) posts.
  9206. const defaultNavigationMenuId = firstNavRefInTemplate || firstNavigationMenuRef; // The Navigation Menu manually selected by the user within the Nav inspector.
  9207. const [currentMenuId, setCurrentMenuId] = useState(firstNavRefInTemplate); // If a Nav block is selected within the canvas then set the
  9208. // Navigation Menu referenced by it's `ref` attribute to be
  9209. // active within the Navigation sidebar.
  9210. useEffect(() => {
  9211. if (selectedNavigationBlockId) {
  9212. setCurrentMenuId(clientIdToRef[selectedNavigationBlockId]);
  9213. }
  9214. }, [selectedNavigationBlockId]);
  9215. let options = [];
  9216. if (navigationMenus) {
  9217. options = navigationMenus.map(_ref => {
  9218. let {
  9219. id,
  9220. title
  9221. } = _ref;
  9222. return {
  9223. value: id,
  9224. label: title.rendered
  9225. };
  9226. });
  9227. }
  9228. const [innerBlocks, onInput, onChange] = useEntityBlockEditor('postType', 'wp_navigation', {
  9229. id: currentMenuId || defaultNavigationMenuId
  9230. });
  9231. const {
  9232. isLoadingInnerBlocks,
  9233. hasLoadedInnerBlocks
  9234. } = useSelect(select => {
  9235. const {
  9236. isResolving,
  9237. hasFinishedResolution
  9238. } = select(coreStore);
  9239. return {
  9240. isLoadingInnerBlocks: isResolving('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]),
  9241. hasLoadedInnerBlocks: hasFinishedResolution('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId])
  9242. };
  9243. }, [currentMenuId, defaultNavigationMenuId]);
  9244. const isLoading = !(hasResolvedNavigationMenus && hasLoadedInnerBlocks);
  9245. const hasMoreThanOneNavigationMenu = (navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.length) > 1;
  9246. const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length); // Entity block editor will return entities that are not currently published.
  9247. // Guard by only allowing their usage if there are published Nav Menus.
  9248. const publishedInnerBlocks = hasNavigationMenus ? innerBlocks : [];
  9249. const hasInnerBlocks = !!(publishedInnerBlocks !== null && publishedInnerBlocks !== void 0 && publishedInnerBlocks.length);
  9250. useEffect(() => {
  9251. if (isResolvingNavigationMenus) {
  9252. speak('Loading Navigation sidebar menus.');
  9253. }
  9254. if (hasResolvedNavigationMenus) {
  9255. speak('Navigation sidebar menus have loaded.');
  9256. }
  9257. }, [isResolvingNavigationMenus, hasResolvedNavigationMenus]);
  9258. useEffect(() => {
  9259. if (isLoadingInnerBlocks) {
  9260. speak('Loading Navigation sidebar selected menu items.');
  9261. }
  9262. if (hasLoadedInnerBlocks) {
  9263. speak('Navigation sidebar selected menu items have loaded.');
  9264. }
  9265. }, [isLoadingInnerBlocks, hasLoadedInnerBlocks]);
  9266. return createElement("div", {
  9267. className: "edit-site-navigation-inspector"
  9268. }, hasResolvedNavigationMenus && !hasNavigationMenus && createElement("p", {
  9269. className: "edit-site-navigation-inspector__empty-msg"
  9270. }, __('There are no Navigation Menus.')), !hasResolvedNavigationMenus && createElement("div", {
  9271. className: "edit-site-navigation-inspector__placeholder"
  9272. }), hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && createElement(SelectControl, {
  9273. "aria-controls": // aria-controls should only apply when referenced element is in DOM
  9274. hasLoadedInnerBlocks ? navMenuListId : undefined,
  9275. value: currentMenuId || defaultNavigationMenuId,
  9276. options: options,
  9277. onChange: newMenuId => setCurrentMenuId(Number(newMenuId))
  9278. }), isLoading && createElement(Fragment, null, createElement("div", {
  9279. className: "edit-site-navigation-inspector__placeholder is-child"
  9280. }), createElement("div", {
  9281. className: "edit-site-navigation-inspector__placeholder is-child"
  9282. }), createElement("div", {
  9283. className: "edit-site-navigation-inspector__placeholder is-child"
  9284. })), hasInnerBlocks && !isLoading && createElement(BlockEditorProvider, {
  9285. value: publishedInnerBlocks,
  9286. onChange: onChange,
  9287. onInput: onInput
  9288. }, createElement(NavigationMenu, {
  9289. id: navMenuListId,
  9290. innerBlocks: publishedInnerBlocks
  9291. })), !hasInnerBlocks && !isLoading && createElement("p", {
  9292. className: "edit-site-navigation-inspector__empty-msg"
  9293. }, __('Navigation Menu is empty.')));
  9294. }
  9295. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/navigation-menu-sidebar/index.js
  9296. /**
  9297. * WordPress dependencies
  9298. */
  9299. /**
  9300. * Internal dependencies
  9301. */
  9302. function NavigationMenuSidebar() {
  9303. return createElement(DefaultSidebar, {
  9304. className: "edit-site-navigation-menu-sidebar",
  9305. identifier: "edit-site/navigation-menu",
  9306. title: __('Navigation'),
  9307. icon: navigation,
  9308. closeLabel: __('Close navigation menu sidebar'),
  9309. panelClassName: "edit-site-navigation-menu-sidebar__panel",
  9310. header: createElement(Flex, null, createElement(FlexBlock, null, createElement("strong", null, __('Navigation Menus')), createElement("span", {
  9311. className: "edit-site-navigation-sidebar__beta"
  9312. }, __('Beta'))))
  9313. }, createElement(NavigationInspector, null));
  9314. }
  9315. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/constants.js
  9316. const SIDEBAR_TEMPLATE = 'edit-site/template';
  9317. const SIDEBAR_BLOCK = 'edit-site/block-inspector';
  9318. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/settings-header/index.js
  9319. /**
  9320. * WordPress dependencies
  9321. */
  9322. /**
  9323. * Internal dependencies
  9324. */
  9325. const SettingsHeader = _ref => {
  9326. let {
  9327. sidebarName
  9328. } = _ref;
  9329. const {
  9330. enableComplementaryArea
  9331. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  9332. const openTemplateSettings = () => enableComplementaryArea(constants_STORE_NAME, SIDEBAR_TEMPLATE);
  9333. const openBlockSettings = () => enableComplementaryArea(constants_STORE_NAME, SIDEBAR_BLOCK);
  9334. const [templateAriaLabel, templateActiveClass] = sidebarName === SIDEBAR_TEMPLATE ? // translators: ARIA label for the Template sidebar tab, selected.
  9335. [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : // translators: ARIA label for the Template Settings Sidebar tab, not selected.
  9336. [(0,external_wp_i18n_namespaceObject.__)('Template'), ''];
  9337. const [blockAriaLabel, blockActiveClass] = sidebarName === SIDEBAR_BLOCK ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
  9338. [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
  9339. [(0,external_wp_i18n_namespaceObject.__)('Block'), ''];
  9340. /* Use a list so screen readers will announce how many tabs there are. */
  9341. return (0,external_wp_element_namespaceObject.createElement)("ul", null, (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9342. onClick: openTemplateSettings,
  9343. className: `edit-site-sidebar__panel-tab ${templateActiveClass}`,
  9344. "aria-label": templateAriaLabel // translators: Data label for the Template Settings Sidebar tab.
  9345. ,
  9346. "data-label": (0,external_wp_i18n_namespaceObject.__)('Template')
  9347. }, // translators: Text label for the Template Settings Sidebar tab.
  9348. (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9349. onClick: openBlockSettings,
  9350. className: `edit-site-sidebar__panel-tab ${blockActiveClass}`,
  9351. "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
  9352. ,
  9353. "data-label": (0,external_wp_i18n_namespaceObject.__)('Block')
  9354. }, // translators: Text label for the Block Settings Sidebar tab.
  9355. (0,external_wp_i18n_namespaceObject.__)('Block'))));
  9356. };
  9357. /* harmony default export */ var settings_header = (SettingsHeader);
  9358. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/template-actions.js
  9359. /**
  9360. * WordPress dependencies
  9361. */
  9362. /**
  9363. * Internal dependencies
  9364. */
  9365. function Actions(_ref) {
  9366. let {
  9367. template
  9368. } = _ref;
  9369. const {
  9370. revertTemplate
  9371. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9372. const isRevertable = isTemplateRevertable(template);
  9373. if (!isRevertable) {
  9374. return null;
  9375. }
  9376. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
  9377. icon: more_vertical,
  9378. label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
  9379. className: "edit-site-template-card__actions",
  9380. toggleProps: {
  9381. isSmall: true
  9382. }
  9383. }, _ref2 => {
  9384. let {
  9385. onClose
  9386. } = _ref2;
  9387. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  9388. info: (0,external_wp_i18n_namespaceObject.__)('Use the template as supplied by the theme.'),
  9389. onClick: () => {
  9390. revertTemplate(template);
  9391. onClose();
  9392. }
  9393. }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')));
  9394. });
  9395. }
  9396. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/template-areas.js
  9397. /**
  9398. * WordPress dependencies
  9399. */
  9400. /**
  9401. * Internal dependencies
  9402. */
  9403. function TemplateAreaItem(_ref) {
  9404. let {
  9405. area,
  9406. clientId
  9407. } = _ref;
  9408. const {
  9409. selectBlock,
  9410. toggleBlockHighlight
  9411. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  9412. const templatePartArea = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9413. const defaultAreas = select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas();
  9414. return defaultAreas.find(defaultArea => defaultArea.area === area);
  9415. }, [area]);
  9416. const highlightBlock = () => toggleBlockHighlight(clientId, true);
  9417. const cancelHighlightBlock = () => toggleBlockHighlight(clientId, false);
  9418. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9419. className: "edit-site-template-card__template-areas-item",
  9420. icon: templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.icon,
  9421. onMouseOver: highlightBlock,
  9422. onMouseLeave: cancelHighlightBlock,
  9423. onFocus: highlightBlock,
  9424. onBlur: cancelHighlightBlock,
  9425. onClick: () => {
  9426. selectBlock(clientId);
  9427. }
  9428. }, templatePartArea === null || templatePartArea === void 0 ? void 0 : templatePartArea.label);
  9429. }
  9430. function template_areas_TemplateAreas() {
  9431. const templateParts = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentTemplateTemplateParts(), []);
  9432. if (!templateParts.length) {
  9433. return null;
  9434. }
  9435. return (0,external_wp_element_namespaceObject.createElement)("section", {
  9436. className: "edit-site-template-card__template-areas"
  9437. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  9438. level: 3,
  9439. className: "edit-site-template-card__template-areas-title"
  9440. }, (0,external_wp_i18n_namespaceObject.__)('Areas')), (0,external_wp_element_namespaceObject.createElement)("ul", {
  9441. className: "edit-site-template-card__template-areas-list"
  9442. }, templateParts.map(_ref2 => {
  9443. let {
  9444. templatePart,
  9445. block
  9446. } = _ref2;
  9447. return (0,external_wp_element_namespaceObject.createElement)("li", {
  9448. key: templatePart.slug
  9449. }, (0,external_wp_element_namespaceObject.createElement)(TemplateAreaItem, {
  9450. area: templatePart.area,
  9451. clientId: block.clientId
  9452. }));
  9453. })));
  9454. }
  9455. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/template-card/index.js
  9456. /**
  9457. * WordPress dependencies
  9458. */
  9459. /**
  9460. * Internal dependencies
  9461. */
  9462. function TemplateCard() {
  9463. const {
  9464. info: {
  9465. title,
  9466. description,
  9467. icon
  9468. },
  9469. template
  9470. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9471. const {
  9472. getEditedPostType,
  9473. getEditedPostId
  9474. } = select(store_store);
  9475. const {
  9476. getEditedEntityRecord
  9477. } = select(external_wp_coreData_namespaceObject.store);
  9478. const {
  9479. __experimentalGetTemplateInfo: getTemplateInfo
  9480. } = select(external_wp_editor_namespaceObject.store);
  9481. const postType = getEditedPostType();
  9482. const postId = getEditedPostId();
  9483. const record = getEditedEntityRecord('postType', postType, postId);
  9484. const info = record ? getTemplateInfo(record) : {};
  9485. return {
  9486. info,
  9487. template: record
  9488. };
  9489. }, []);
  9490. if (!title && !description) {
  9491. return null;
  9492. }
  9493. return (0,external_wp_element_namespaceObject.createElement)("div", {
  9494. className: "edit-site-template-card"
  9495. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  9496. className: "edit-site-template-card__icon",
  9497. icon: icon
  9498. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  9499. className: "edit-site-template-card__content"
  9500. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  9501. className: "edit-site-template-card__header"
  9502. }, (0,external_wp_element_namespaceObject.createElement)("h2", {
  9503. className: "edit-site-template-card__title"
  9504. }, title), (0,external_wp_element_namespaceObject.createElement)(Actions, {
  9505. template: template
  9506. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  9507. className: "edit-site-template-card__description"
  9508. }, description), (0,external_wp_element_namespaceObject.createElement)(template_areas_TemplateAreas, null)));
  9509. }
  9510. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/index.js
  9511. /**
  9512. * WordPress dependencies
  9513. */
  9514. /**
  9515. * Internal dependencies
  9516. */
  9517. const {
  9518. Slot: InspectorSlot,
  9519. Fill: InspectorFill
  9520. } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteSidebarInspector');
  9521. const SidebarInspectorFill = InspectorFill;
  9522. function SidebarComplementaryAreaFills() {
  9523. const {
  9524. sidebar,
  9525. isEditorSidebarOpened,
  9526. hasBlockSelection,
  9527. supportsGlobalStyles
  9528. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9529. const _sidebar = select(store).getActiveComplementaryArea(constants_STORE_NAME);
  9530. const _isEditorSidebarOpened = [SIDEBAR_BLOCK, SIDEBAR_TEMPLATE].includes(_sidebar);
  9531. const settings = select(store_store).getSettings();
  9532. return {
  9533. sidebar: _sidebar,
  9534. isEditorSidebarOpened: _isEditorSidebarOpened,
  9535. hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
  9536. supportsGlobalStyles: !(settings !== null && settings !== void 0 && settings.supportsTemplatePartsMode)
  9537. };
  9538. }, []);
  9539. const {
  9540. enableComplementaryArea
  9541. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  9542. (0,external_wp_element_namespaceObject.useEffect)(() => {
  9543. if (!isEditorSidebarOpened) return;
  9544. if (hasBlockSelection) {
  9545. enableComplementaryArea(constants_STORE_NAME, SIDEBAR_BLOCK);
  9546. } else {
  9547. enableComplementaryArea(constants_STORE_NAME, SIDEBAR_TEMPLATE);
  9548. }
  9549. }, [hasBlockSelection, isEditorSidebarOpened]);
  9550. let sidebarName = sidebar;
  9551. if (!isEditorSidebarOpened) {
  9552. sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;
  9553. } // Conditionally include NavMenu sidebar in Plugin only.
  9554. // Optimise for dead code elimination.
  9555. // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
  9556. let MaybeNavigationMenuSidebar = external_wp_element_namespaceObject.Fragment;
  9557. if (false) {}
  9558. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(default_sidebar_DefaultSidebar, {
  9559. identifier: sidebarName,
  9560. title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  9561. icon: library_cog,
  9562. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings sidebar'),
  9563. header: (0,external_wp_element_namespaceObject.createElement)(settings_header, {
  9564. sidebarName: sidebarName
  9565. }),
  9566. headerClassName: "edit-site-sidebar__panel-tabs"
  9567. }, sidebarName === SIDEBAR_TEMPLATE && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(TemplateCard, null)), sidebarName === SIDEBAR_BLOCK && (0,external_wp_element_namespaceObject.createElement)(InspectorSlot, {
  9568. bubblesVirtually: true
  9569. })), supportsGlobalStyles && (0,external_wp_element_namespaceObject.createElement)(GlobalStylesSidebar, null), (0,external_wp_element_namespaceObject.createElement)(MaybeNavigationMenuSidebar, null));
  9570. }
  9571. ;// CONCATENATED MODULE: external ["wp","htmlEntities"]
  9572. var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"];
  9573. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/home.js
  9574. /**
  9575. * WordPress dependencies
  9576. */
  9577. const home = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  9578. xmlns: "http://www.w3.org/2000/svg",
  9579. viewBox: "0 0 24 24"
  9580. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  9581. d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z"
  9582. }));
  9583. /* harmony default export */ var library_home = (home);
  9584. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js
  9585. /**
  9586. * WordPress dependencies
  9587. */
  9588. const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  9589. xmlns: "http://www.w3.org/2000/svg",
  9590. viewBox: "0 0 24 24"
  9591. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  9592. d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
  9593. }));
  9594. /* harmony default export */ var symbol_filled = (symbolFilled);
  9595. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/main-dashboard-button/index.js
  9596. /**
  9597. * WordPress dependencies
  9598. */
  9599. const slotName = '__experimentalMainDashboardButton';
  9600. const {
  9601. Fill,
  9602. Slot: MainDashboardButtonSlot
  9603. } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
  9604. const MainDashboardButton = Fill;
  9605. const main_dashboard_button_Slot = _ref => {
  9606. let {
  9607. children
  9608. } = _ref;
  9609. const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName);
  9610. const hasFills = Boolean(slot.fills && slot.fills.length);
  9611. if (!hasFills) {
  9612. return children;
  9613. }
  9614. return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, {
  9615. bubblesVirtually: true
  9616. });
  9617. };
  9618. MainDashboardButton.Slot = main_dashboard_button_Slot;
  9619. /* harmony default export */ var main_dashboard_button = (MainDashboardButton);
  9620. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-panel/index.js
  9621. /**
  9622. * External dependencies
  9623. */
  9624. /**
  9625. * WordPress dependencies
  9626. */
  9627. /**
  9628. * Internal dependencies
  9629. */
  9630. const SITE_EDITOR_KEY = 'site-editor';
  9631. function NavLink(_ref) {
  9632. let {
  9633. params,
  9634. replace,
  9635. ...props
  9636. } = _ref;
  9637. const linkProps = useLink(params, replace);
  9638. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationItem, extends_extends({}, linkProps, props));
  9639. }
  9640. const NavigationPanel = _ref2 => {
  9641. let {
  9642. activeItem = SITE_EDITOR_KEY
  9643. } = _ref2;
  9644. const {
  9645. homeTemplate,
  9646. isNavigationOpen,
  9647. isTemplatePartsMode,
  9648. siteTitle
  9649. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9650. const {
  9651. getEntityRecord
  9652. } = select(external_wp_coreData_namespaceObject.store);
  9653. const {
  9654. getSettings,
  9655. isNavigationOpened
  9656. } = select(store_store);
  9657. const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
  9658. const {
  9659. supportsTemplatePartsMode,
  9660. __unstableHomeTemplate
  9661. } = getSettings();
  9662. return {
  9663. siteTitle: siteData.name,
  9664. homeTemplate: __unstableHomeTemplate,
  9665. isNavigationOpen: isNavigationOpened(),
  9666. isTemplatePartsMode: !!supportsTemplatePartsMode
  9667. };
  9668. }, []);
  9669. const {
  9670. setIsNavigationPanelOpened
  9671. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9672. const closeOnEscape = event => {
  9673. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  9674. event.preventDefault();
  9675. setIsNavigationPanelOpened(false);
  9676. }
  9677. };
  9678. return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
  9679. (0,external_wp_element_namespaceObject.createElement)("div", {
  9680. className: classnames_default()(`edit-site-navigation-panel`, {
  9681. 'is-open': isNavigationOpen
  9682. }),
  9683. onKeyDown: closeOnEscape
  9684. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  9685. className: "edit-site-navigation-panel__inner"
  9686. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  9687. className: "edit-site-navigation-panel__site-title-container"
  9688. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  9689. className: "edit-site-navigation-panel__site-title"
  9690. }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle))), (0,external_wp_element_namespaceObject.createElement)("div", {
  9691. className: "edit-site-navigation-panel__scroll-container"
  9692. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigation, {
  9693. activeItem: activeItem
  9694. }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationBackButton, {
  9695. backButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Dashboard'),
  9696. className: "edit-site-navigation-panel__back-to-dashboard",
  9697. href: "index.php"
  9698. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationMenu, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigationGroup, {
  9699. title: (0,external_wp_i18n_namespaceObject.__)('Editor')
  9700. }, !isTemplatePartsMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(NavLink, {
  9701. icon: library_home,
  9702. title: (0,external_wp_i18n_namespaceObject.__)('Site'),
  9703. item: SITE_EDITOR_KEY,
  9704. params: {
  9705. postId: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postId,
  9706. postType: homeTemplate === null || homeTemplate === void 0 ? void 0 : homeTemplate.postType
  9707. }
  9708. }), (0,external_wp_element_namespaceObject.createElement)(NavLink, {
  9709. icon: library_layout,
  9710. title: (0,external_wp_i18n_namespaceObject.__)('Templates'),
  9711. item: "wp_template",
  9712. params: {
  9713. postId: undefined,
  9714. postType: 'wp_template'
  9715. }
  9716. })), (0,external_wp_element_namespaceObject.createElement)(NavLink, {
  9717. icon: symbol_filled,
  9718. title: (0,external_wp_i18n_namespaceObject.__)('Template Parts'),
  9719. item: "wp_template_part",
  9720. params: {
  9721. postId: undefined,
  9722. postType: 'wp_template_part'
  9723. }
  9724. })))))))
  9725. );
  9726. };
  9727. /* harmony default export */ var navigation_panel = (NavigationPanel);
  9728. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
  9729. /**
  9730. * WordPress dependencies
  9731. */
  9732. const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  9733. xmlns: "http://www.w3.org/2000/svg",
  9734. viewBox: "-2 -2 24 24"
  9735. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  9736. 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"
  9737. }));
  9738. /* harmony default export */ var library_wordpress = (wordpress);
  9739. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/navigation-toggle/index.js
  9740. /**
  9741. * External dependencies
  9742. */
  9743. /**
  9744. * WordPress dependencies
  9745. */
  9746. /**
  9747. * Internal dependencies
  9748. */
  9749. function NavigationToggle(_ref) {
  9750. let {
  9751. icon
  9752. } = _ref;
  9753. const {
  9754. isNavigationOpen,
  9755. isRequestingSiteIcon,
  9756. siteIconUrl
  9757. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  9758. const {
  9759. getEntityRecord,
  9760. isResolving
  9761. } = select(external_wp_coreData_namespaceObject.store);
  9762. const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
  9763. return {
  9764. isNavigationOpen: select(store_store).isNavigationOpened(),
  9765. isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
  9766. siteIconUrl: siteData.site_icon_url
  9767. };
  9768. }, []);
  9769. const {
  9770. setIsNavigationPanelOpened
  9771. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9772. const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  9773. const navigationToggleRef = (0,external_wp_element_namespaceObject.useRef)();
  9774. (0,external_wp_element_namespaceObject.useEffect)(() => {
  9775. // TODO: Remove this effect when alternative solution is merged.
  9776. // See: https://github.com/WordPress/gutenberg/pull/37314
  9777. if (!isNavigationOpen) {
  9778. navigationToggleRef.current.focus();
  9779. }
  9780. }, [isNavigationOpen]);
  9781. const toggleNavigationPanel = () => setIsNavigationPanelOpened(!isNavigationOpen);
  9782. let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  9783. size: "36px",
  9784. icon: library_wordpress
  9785. });
  9786. const effect = {
  9787. expand: {
  9788. scale: 1.25,
  9789. transition: {
  9790. type: 'tween',
  9791. duration: '0.3'
  9792. }
  9793. }
  9794. };
  9795. if (siteIconUrl) {
  9796. buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
  9797. variants: !disableMotion && effect,
  9798. alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
  9799. className: "edit-site-navigation-toggle__site-icon",
  9800. src: siteIconUrl
  9801. });
  9802. } else if (isRequestingSiteIcon) {
  9803. buttonIcon = null;
  9804. } else if (icon) {
  9805. buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  9806. size: "36px",
  9807. icon: icon
  9808. });
  9809. }
  9810. const classes = classnames_default()({
  9811. 'edit-site-navigation-toggle__button': true,
  9812. 'has-icon': siteIconUrl
  9813. });
  9814. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  9815. className: 'edit-site-navigation-toggle' + (isNavigationOpen ? ' is-open' : ''),
  9816. whileHover: "expand"
  9817. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9818. className: classes,
  9819. label: (0,external_wp_i18n_namespaceObject.__)('Toggle navigation'),
  9820. ref: navigationToggleRef // isPressed will add unwanted styles.
  9821. ,
  9822. "aria-pressed": isNavigationOpen,
  9823. onClick: toggleNavigationPanel,
  9824. showTooltip: true
  9825. }, buttonIcon));
  9826. }
  9827. /* harmony default export */ var navigation_toggle = (NavigationToggle);
  9828. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigation-sidebar/index.js
  9829. /**
  9830. * WordPress dependencies
  9831. */
  9832. /**
  9833. * Internal dependencies
  9834. */
  9835. const {
  9836. Fill: NavigationPanelPreviewFill,
  9837. Slot: NavigationPanelPreviewSlot
  9838. } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationPanelPreview');
  9839. const {
  9840. Fill: NavigationSidebarFill,
  9841. Slot: NavigationSidebarSlot
  9842. } = (0,external_wp_components_namespaceObject.createSlotFill)('EditSiteNavigationSidebar');
  9843. function NavigationSidebar(_ref) {
  9844. let {
  9845. isDefaultOpen = false,
  9846. activeTemplateType
  9847. } = _ref;
  9848. const isDesktopViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  9849. const {
  9850. setIsNavigationPanelOpened
  9851. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  9852. (0,external_wp_element_namespaceObject.useEffect)(function autoOpenNavigationPanelOnViewportChange() {
  9853. setIsNavigationPanelOpened(isDefaultOpen && isDesktopViewport);
  9854. }, [isDefaultOpen, isDesktopViewport, setIsNavigationPanelOpened]);
  9855. return (0,external_wp_element_namespaceObject.createElement)(NavigationSidebarFill, null, (0,external_wp_element_namespaceObject.createElement)(navigation_toggle, null), (0,external_wp_element_namespaceObject.createElement)(navigation_panel, {
  9856. activeItem: activeTemplateType
  9857. }), (0,external_wp_element_namespaceObject.createElement)(NavigationPanelPreviewSlot, null));
  9858. }
  9859. NavigationSidebar.Slot = NavigationSidebarSlot;
  9860. /* harmony default export */ var navigation_sidebar = (NavigationSidebar);
  9861. ;// CONCATENATED MODULE: external ["wp","reusableBlocks"]
  9862. var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"];
  9863. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-regular.js
  9864. /**
  9865. * WordPress dependencies
  9866. */
  9867. function ConvertToRegularBlocks(_ref) {
  9868. let {
  9869. clientId
  9870. } = _ref;
  9871. const {
  9872. getBlocks
  9873. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
  9874. const {
  9875. replaceBlocks
  9876. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  9877. const canRemove = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).canRemoveBlock(clientId), [clientId]);
  9878. if (!canRemove) {
  9879. return null;
  9880. }
  9881. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
  9882. let {
  9883. onClose
  9884. } = _ref2;
  9885. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  9886. onClick: () => {
  9887. replaceBlocks(clientId, getBlocks(clientId));
  9888. onClose();
  9889. }
  9890. }, (0,external_wp_i18n_namespaceObject.__)('Detach blocks from template part'));
  9891. });
  9892. }
  9893. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/create-template-part-modal/index.js
  9894. /**
  9895. * WordPress dependencies
  9896. */
  9897. /**
  9898. * Internal dependencies
  9899. */
  9900. function CreateTemplatePartModal(_ref) {
  9901. let {
  9902. closeModal,
  9903. onCreate
  9904. } = _ref;
  9905. const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
  9906. const [area, setArea] = (0,external_wp_element_namespaceObject.useState)(TEMPLATE_PART_AREA_GENERAL);
  9907. const [isSubmitting, setIsSubmitting] = (0,external_wp_element_namespaceObject.useState)(false);
  9908. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CreateTemplatePartModal);
  9909. const templatePartAreas = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplatePartAreas(), []);
  9910. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  9911. title: (0,external_wp_i18n_namespaceObject.__)('Create a template part'),
  9912. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  9913. onRequestClose: closeModal,
  9914. overlayClassName: "edit-site-create-template-part-modal"
  9915. }, (0,external_wp_element_namespaceObject.createElement)("form", {
  9916. onSubmit: async event => {
  9917. event.preventDefault();
  9918. if (!title) {
  9919. return;
  9920. }
  9921. setIsSubmitting(true);
  9922. await onCreate({
  9923. title,
  9924. area
  9925. });
  9926. }
  9927. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  9928. label: (0,external_wp_i18n_namespaceObject.__)('Name'),
  9929. value: title,
  9930. onChange: setTitle,
  9931. required: true
  9932. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.BaseControl, {
  9933. label: (0,external_wp_i18n_namespaceObject.__)('Area'),
  9934. id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
  9935. className: "edit-site-create-template-part-modal__area-base-control"
  9936. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadioGroup, {
  9937. label: (0,external_wp_i18n_namespaceObject.__)('Area'),
  9938. className: "edit-site-create-template-part-modal__area-radio-group",
  9939. id: `edit-site-create-template-part-modal__area-selection-${instanceId}`,
  9940. onChange: setArea,
  9941. checked: area
  9942. }, templatePartAreas.map(_ref2 => {
  9943. let {
  9944. icon,
  9945. label,
  9946. area: value,
  9947. description
  9948. } = _ref2;
  9949. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalRadio, {
  9950. key: label,
  9951. value: value,
  9952. className: "edit-site-create-template-part-modal__area-radio"
  9953. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  9954. align: "start",
  9955. justify: "start"
  9956. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  9957. icon: icon
  9958. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, {
  9959. className: "edit-site-create-template-part-modal__option-label"
  9960. }, label, (0,external_wp_element_namespaceObject.createElement)("div", null, description)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  9961. className: "edit-site-create-template-part-modal__checkbox"
  9962. }, area === value && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  9963. icon: library_check
  9964. }))));
  9965. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  9966. className: "edit-site-create-template-part-modal__modal-actions",
  9967. justify: "flex-end"
  9968. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9969. variant: "secondary",
  9970. onClick: () => {
  9971. closeModal();
  9972. }
  9973. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  9974. variant: "primary",
  9975. type: "submit",
  9976. disabled: !title,
  9977. isBusy: isSubmitting
  9978. }, (0,external_wp_i18n_namespaceObject.__)('Create'))))));
  9979. }
  9980. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/convert-to-template-part.js
  9981. /**
  9982. * External dependencies
  9983. */
  9984. /**
  9985. * WordPress dependencies
  9986. */
  9987. /**
  9988. * Internal dependencies
  9989. */
  9990. function ConvertToTemplatePart(_ref) {
  9991. let {
  9992. clientIds,
  9993. blocks
  9994. } = _ref;
  9995. const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  9996. const {
  9997. replaceBlocks
  9998. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  9999. const {
  10000. saveEntityRecord
  10001. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  10002. const {
  10003. createSuccessNotice
  10004. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  10005. const {
  10006. canCreate
  10007. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10008. const {
  10009. supportsTemplatePartsMode
  10010. } = select(store_store).getSettings();
  10011. return {
  10012. canCreate: !supportsTemplatePartsMode
  10013. };
  10014. }, []);
  10015. if (!canCreate) {
  10016. return null;
  10017. }
  10018. const onConvert = async _ref2 => {
  10019. let {
  10020. title,
  10021. area
  10022. } = _ref2;
  10023. // Currently template parts only allow latin chars.
  10024. // Fallback slug will receive suffix by default.
  10025. const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
  10026. const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
  10027. slug: cleanSlug,
  10028. title,
  10029. content: (0,external_wp_blocks_namespaceObject.serialize)(blocks),
  10030. area
  10031. });
  10032. replaceBlocks(clientIds, (0,external_wp_blocks_namespaceObject.createBlock)('core/template-part', {
  10033. slug: templatePart.slug,
  10034. theme: templatePart.theme
  10035. }));
  10036. createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Template part created.'), {
  10037. type: 'snackbar'
  10038. }); // The modal and this component will be unmounted because of `replaceBlocks` above,
  10039. // so no need to call `closeModal` or `onClose`.
  10040. };
  10041. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  10042. icon: symbol_filled,
  10043. onClick: () => {
  10044. setIsModalOpen(true);
  10045. }
  10046. }, (0,external_wp_i18n_namespaceObject.__)('Create Template part'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, {
  10047. closeModal: () => {
  10048. setIsModalOpen(false);
  10049. },
  10050. onCreate: onConvert
  10051. }));
  10052. }
  10053. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/template-part-converter/index.js
  10054. /**
  10055. * WordPress dependencies
  10056. */
  10057. /**
  10058. * Internal dependencies
  10059. */
  10060. function TemplatePartConverter() {
  10061. var _blocks$;
  10062. const {
  10063. clientIds,
  10064. blocks
  10065. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10066. const {
  10067. getSelectedBlockClientIds,
  10068. getBlocksByClientId
  10069. } = select(external_wp_blockEditor_namespaceObject.store);
  10070. const selectedBlockClientIds = getSelectedBlockClientIds();
  10071. return {
  10072. clientIds: selectedBlockClientIds,
  10073. blocks: getBlocksByClientId(selectedBlockClientIds)
  10074. };
  10075. }, []); // Allow converting a single template part to standard blocks.
  10076. if (blocks.length === 1 && ((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.name) === 'core/template-part') {
  10077. return (0,external_wp_element_namespaceObject.createElement)(ConvertToRegularBlocks, {
  10078. clientId: clientIds[0]
  10079. });
  10080. }
  10081. return (0,external_wp_element_namespaceObject.createElement)(ConvertToTemplatePart, {
  10082. clientIds: clientIds,
  10083. blocks: blocks
  10084. });
  10085. }
  10086. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
  10087. /**
  10088. * WordPress dependencies
  10089. */
  10090. const pencil = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  10091. xmlns: "http://www.w3.org/2000/svg",
  10092. viewBox: "0 0 24 24"
  10093. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  10094. d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"
  10095. }));
  10096. /* harmony default export */ var library_pencil = (pencil);
  10097. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
  10098. /**
  10099. * Internal dependencies
  10100. */
  10101. /* harmony default export */ var edit = (library_pencil);
  10102. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/navigate-to-link/index.js
  10103. /**
  10104. * WordPress dependencies
  10105. */
  10106. function NavigateToLink(_ref) {
  10107. let {
  10108. type,
  10109. id,
  10110. activePage,
  10111. onActivePageChange
  10112. } = _ref;
  10113. const post = (0,external_wp_data_namespaceObject.useSelect)(select => type && id && type !== 'URL' && select(external_wp_coreData_namespaceObject.store).getEntityRecord('postType', type, id), [type, id]);
  10114. const onClick = (0,external_wp_element_namespaceObject.useMemo)(() => {
  10115. if (!(post !== null && post !== void 0 && post.link)) return null;
  10116. const path = (0,external_wp_url_namespaceObject.getPathAndQueryString)(post.link);
  10117. if (path === (activePage === null || activePage === void 0 ? void 0 : activePage.path)) return null;
  10118. return () => onActivePageChange({
  10119. type,
  10120. slug: post.slug,
  10121. path,
  10122. context: {
  10123. postType: post.type,
  10124. postId: post.id
  10125. }
  10126. });
  10127. }, [post, activePage === null || activePage === void 0 ? void 0 : activePage.path, onActivePageChange]);
  10128. return onClick && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10129. icon: edit,
  10130. label: (0,external_wp_i18n_namespaceObject.__)('Edit Page Template'),
  10131. onClick: onClick
  10132. });
  10133. }
  10134. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/block-inspector-button.js
  10135. /**
  10136. * WordPress dependencies
  10137. */
  10138. /**
  10139. * Internal dependencies
  10140. */
  10141. function BlockInspectorButton(_ref) {
  10142. let {
  10143. onClick = () => {}
  10144. } = _ref;
  10145. const {
  10146. shortcut,
  10147. isBlockInspectorOpen
  10148. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  10149. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-site/toggle-block-settings-sidebar'),
  10150. isBlockInspectorOpen: select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK
  10151. }), []);
  10152. const {
  10153. enableComplementaryArea,
  10154. disableComplementaryArea
  10155. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  10156. const label = isBlockInspectorOpen ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings');
  10157. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  10158. onClick: () => {
  10159. if (isBlockInspectorOpen) {
  10160. disableComplementaryArea(constants_STORE_NAME);
  10161. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed'));
  10162. } else {
  10163. enableComplementaryArea(constants_STORE_NAME, SIDEBAR_BLOCK);
  10164. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar'));
  10165. } // Close dropdown menu.
  10166. onClick();
  10167. },
  10168. shortcut: shortcut
  10169. }, label);
  10170. }
  10171. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
  10172. /**
  10173. * WordPress dependencies
  10174. */
  10175. const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  10176. xmlns: "http://www.w3.org/2000/svg",
  10177. viewBox: "0 0 24 24"
  10178. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  10179. d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
  10180. }));
  10181. /* harmony default export */ var arrow_left = (arrowLeft);
  10182. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/back-button.js
  10183. /**
  10184. * WordPress dependencies
  10185. */
  10186. /**
  10187. * Internal dependencies
  10188. */
  10189. function BackButton() {
  10190. var _location$state;
  10191. const location = useLocation();
  10192. const history = useHistory();
  10193. const isTemplatePart = location.params.postType === 'wp_template_part';
  10194. const previousTemplateId = (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.fromTemplateId;
  10195. if (!isTemplatePart || !previousTemplateId) {
  10196. return null;
  10197. }
  10198. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10199. className: "edit-site-visual-editor__back-button",
  10200. icon: arrow_left,
  10201. onClick: () => {
  10202. history.back();
  10203. }
  10204. }, (0,external_wp_i18n_namespaceObject.__)('Back'));
  10205. }
  10206. /* harmony default export */ var back_button = (BackButton);
  10207. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resize-handle.js
  10208. /**
  10209. * WordPress dependencies
  10210. */
  10211. const DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.
  10212. function ResizeHandle(_ref) {
  10213. let {
  10214. direction,
  10215. resizeWidthBy
  10216. } = _ref;
  10217. function handleKeyDown(event) {
  10218. const {
  10219. keyCode
  10220. } = event;
  10221. if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.LEFT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
  10222. resizeWidthBy(DELTA_DISTANCE);
  10223. } else if (direction === 'left' && keyCode === external_wp_keycodes_namespaceObject.RIGHT || direction === 'right' && keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  10224. resizeWidthBy(-DELTA_DISTANCE);
  10225. }
  10226. }
  10227. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("button", {
  10228. className: `resizable-editor__drag-handle is-${direction}`,
  10229. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'),
  10230. "aria-describedby": `resizable-editor__resize-help-${direction}`,
  10231. onKeyDown: handleKeyDown
  10232. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  10233. id: `resizable-editor__resize-help-${direction}`
  10234. }, (0,external_wp_i18n_namespaceObject.__)('Use left and right arrow keys to resize the canvas.')));
  10235. }
  10236. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/resizable-editor.js
  10237. /**
  10238. * WordPress dependencies
  10239. */
  10240. /**
  10241. * Internal dependencies
  10242. */
  10243. const DEFAULT_STYLES = {
  10244. width: '100%',
  10245. height: '100%'
  10246. }; // Removes the inline styles in the drag handles.
  10247. const HANDLE_STYLES_OVERRIDE = {
  10248. position: undefined,
  10249. userSelect: undefined,
  10250. cursor: undefined,
  10251. width: undefined,
  10252. height: undefined,
  10253. top: undefined,
  10254. right: undefined,
  10255. bottom: undefined,
  10256. left: undefined
  10257. };
  10258. function ResizableEditor(_ref) {
  10259. let {
  10260. enableResizing,
  10261. settings,
  10262. children,
  10263. ...props
  10264. } = _ref;
  10265. const {
  10266. deviceType,
  10267. isZoomOutMode
  10268. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  10269. deviceType: select(store_store).__experimentalGetPreviewDeviceType(),
  10270. isZoomOutMode: select(external_wp_blockEditor_namespaceObject.store).__unstableGetEditorMode() === 'zoom-out'
  10271. }), []);
  10272. const deviceStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType);
  10273. const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.width);
  10274. const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(DEFAULT_STYLES.height);
  10275. const iframeRef = (0,external_wp_element_namespaceObject.useRef)();
  10276. const mouseMoveTypingResetRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)();
  10277. const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, mouseMoveTypingResetRef]);
  10278. (0,external_wp_element_namespaceObject.useEffect)(function autoResizeIframeHeight() {
  10279. if (!iframeRef.current || !enableResizing) {
  10280. return;
  10281. }
  10282. const iframe = iframeRef.current;
  10283. function setFrameHeight() {
  10284. setHeight(iframe.contentDocument.body.scrollHeight);
  10285. }
  10286. let resizeObserver;
  10287. function registerObserver() {
  10288. var _resizeObserver;
  10289. (_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.disconnect();
  10290. resizeObserver = new iframe.contentWindow.ResizeObserver(setFrameHeight); // Observe the body, since the `html` element seems to always
  10291. // have a height of `100%`.
  10292. resizeObserver.observe(iframe.contentDocument.body);
  10293. setFrameHeight();
  10294. }
  10295. iframe.addEventListener('load', registerObserver);
  10296. return () => {
  10297. var _resizeObserver2;
  10298. (_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : _resizeObserver2.disconnect();
  10299. iframe.removeEventListener('load', registerObserver);
  10300. };
  10301. }, [enableResizing, iframeRef.current]);
  10302. const resizeWidthBy = (0,external_wp_element_namespaceObject.useCallback)(deltaPixels => {
  10303. if (iframeRef.current) {
  10304. setWidth(iframeRef.current.offsetWidth + deltaPixels);
  10305. }
  10306. }, []);
  10307. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResizableBox, {
  10308. size: {
  10309. width,
  10310. height
  10311. },
  10312. onResizeStop: (event, direction, element) => {
  10313. setWidth(element.style.width);
  10314. },
  10315. minWidth: 300,
  10316. maxWidth: "100%",
  10317. maxHeight: "100%",
  10318. enable: {
  10319. right: enableResizing,
  10320. left: enableResizing
  10321. },
  10322. showHandle: enableResizing // The editor is centered horizontally, resizing it only
  10323. // moves half the distance. Hence double the ratio to correctly
  10324. // align the cursor to the resizer handle.
  10325. ,
  10326. resizeRatio: 2,
  10327. handleComponent: {
  10328. left: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, {
  10329. direction: "left",
  10330. resizeWidthBy: resizeWidthBy
  10331. }),
  10332. right: (0,external_wp_element_namespaceObject.createElement)(ResizeHandle, {
  10333. direction: "right",
  10334. resizeWidthBy: resizeWidthBy
  10335. })
  10336. },
  10337. handleClasses: undefined,
  10338. handleStyles: {
  10339. left: HANDLE_STYLES_OVERRIDE,
  10340. right: HANDLE_STYLES_OVERRIDE
  10341. }
  10342. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, extends_extends({
  10343. isZoomedOut: isZoomOutMode,
  10344. style: enableResizing ? {
  10345. height
  10346. } : deviceStyles,
  10347. head: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  10348. styles: settings.styles
  10349. }), (0,external_wp_element_namespaceObject.createElement)("style", null, // Forming a "block formatting context" to prevent margin collapsing.
  10350. // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
  10351. `.is-root-container { display: flow-root; }`), enableResizing && (0,external_wp_element_namespaceObject.createElement)("style", null, // Force the <html> and <body>'s heights to fit the content.
  10352. `html, body { height: -moz-fit-content !important; height: fit-content !important; min-height: 0 !important; }`, // Some themes will have `min-height: 100vh` for the root container,
  10353. // which isn't a requirement in auto resize mode.
  10354. `.is-root-container { min-height: 0 !important; }`)),
  10355. assets: settings.__unstableResolvedAssets,
  10356. ref: ref,
  10357. name: "editor-canvas",
  10358. className: "edit-site-visual-editor__editor-canvas"
  10359. }, props), settings.svgFilters, children));
  10360. }
  10361. /* harmony default export */ var resizable_editor = (ResizableEditor);
  10362. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/block-editor/index.js
  10363. /**
  10364. * External dependencies
  10365. */
  10366. /**
  10367. * WordPress dependencies
  10368. */
  10369. /**
  10370. * Internal dependencies
  10371. */
  10372. const LAYOUT = {
  10373. type: 'default',
  10374. // At the root level of the site editor, no alignments should be allowed.
  10375. alignments: []
  10376. };
  10377. function BlockEditor(_ref) {
  10378. var _storedSettings$__exp, _storedSettings$__exp2;
  10379. let {
  10380. setIsInserterOpen
  10381. } = _ref;
  10382. const {
  10383. storedSettings,
  10384. templateType,
  10385. templateId,
  10386. page
  10387. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10388. const {
  10389. getSettings,
  10390. getEditedPostType,
  10391. getEditedPostId,
  10392. getPage
  10393. } = select(store_store);
  10394. return {
  10395. storedSettings: getSettings(setIsInserterOpen),
  10396. templateType: getEditedPostType(),
  10397. templateId: getEditedPostId(),
  10398. page: getPage()
  10399. };
  10400. }, [setIsInserterOpen]);
  10401. const settingsBlockPatterns = (_storedSettings$__exp = storedSettings.__experimentalAdditionalBlockPatterns) !== null && _storedSettings$__exp !== void 0 ? _storedSettings$__exp : // WP 6.0
  10402. storedSettings.__experimentalBlockPatterns; // WP 5.9
  10403. const settingsBlockPatternCategories = (_storedSettings$__exp2 = storedSettings.__experimentalAdditionalBlockPatternCategories) !== null && _storedSettings$__exp2 !== void 0 ? _storedSettings$__exp2 : // WP 6.0
  10404. storedSettings.__experimentalBlockPatternCategories; // WP 5.9
  10405. const {
  10406. restBlockPatterns,
  10407. restBlockPatternCategories
  10408. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  10409. restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(),
  10410. restBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories()
  10411. }), []);
  10412. const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(_ref2 => {
  10413. let {
  10414. postTypes
  10415. } = _ref2;
  10416. return !postTypes || Array.isArray(postTypes) && postTypes.includes(templateType);
  10417. }), [settingsBlockPatterns, restBlockPatterns, templateType]);
  10418. const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
  10419. const settings = (0,external_wp_element_namespaceObject.useMemo)(() => {
  10420. const {
  10421. __experimentalAdditionalBlockPatterns,
  10422. __experimentalAdditionalBlockPatternCategories,
  10423. ...restStoredSettings
  10424. } = storedSettings;
  10425. return { ...restStoredSettings,
  10426. __experimentalBlockPatterns: blockPatterns,
  10427. __experimentalBlockPatternCategories: blockPatternCategories
  10428. };
  10429. }, [storedSettings, blockPatterns, blockPatternCategories]);
  10430. const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType);
  10431. const {
  10432. setPage
  10433. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10434. const {
  10435. enableComplementaryArea
  10436. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  10437. const openNavigationSidebar = (0,external_wp_element_namespaceObject.useCallback)(() => {
  10438. enableComplementaryArea('core/edit-site', 'edit-site/navigation-menu');
  10439. }, [enableComplementaryArea]);
  10440. const contentRef = (0,external_wp_element_namespaceObject.useRef)();
  10441. const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([contentRef, (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)()]);
  10442. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<');
  10443. const {
  10444. clearSelectedBlock
  10445. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  10446. const isTemplatePart = templateType === 'wp_template_part';
  10447. const hasBlocks = blocks.length !== 0;
  10448. const NavMenuSidebarToggle = () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
  10449. className: "components-toolbar__control",
  10450. label: (0,external_wp_i18n_namespaceObject.__)('Open list view'),
  10451. onClick: openNavigationSidebar,
  10452. icon: list_view
  10453. })); // Conditionally include NavMenu sidebar in Plugin only.
  10454. // Optimise for dead code elimination.
  10455. // See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
  10456. let MaybeNavMenuSidebarToggle = external_wp_element_namespaceObject.Fragment;
  10457. if (false) {}
  10458. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, {
  10459. settings: settings,
  10460. value: blocks,
  10461. onInput: onInput,
  10462. onChange: onChange,
  10463. useSubRegistry: false
  10464. }, (0,external_wp_element_namespaceObject.createElement)(TemplatePartConverter, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLinkControl.ViewerFill, null, (0,external_wp_element_namespaceObject.useCallback)(fillProps => (0,external_wp_element_namespaceObject.createElement)(NavigateToLink, extends_extends({}, fillProps, {
  10465. activePage: page,
  10466. onActivePageChange: setPage
  10467. })), [page])), (0,external_wp_element_namespaceObject.createElement)(SidebarInspectorFill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, {
  10468. className: classnames_default()('edit-site-visual-editor', {
  10469. 'is-focus-mode': isTemplatePart
  10470. }),
  10471. __unstableContentRef: contentRef,
  10472. onClick: event => {
  10473. // Clear selected block when clicking on the gray background.
  10474. if (event.target === event.currentTarget) {
  10475. clearSelectedBlock();
  10476. }
  10477. }
  10478. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(back_button, null), (0,external_wp_element_namespaceObject.createElement)(resizable_editor // Reinitialize the editor and reset the states when the template changes.
  10479. , {
  10480. key: templateId,
  10481. enableResizing: isTemplatePart && // Disable resizing in mobile viewport.
  10482. !isMobileViewport,
  10483. settings: settings,
  10484. contentRef: mergedRefs
  10485. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
  10486. className: "edit-site-block-editor__block-list wp-site-blocks",
  10487. __experimentalLayout: LAYOUT,
  10488. renderAppender: isTemplatePart && hasBlocks ? false : undefined
  10489. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
  10490. let {
  10491. onClose
  10492. } = _ref3;
  10493. return (0,external_wp_element_namespaceObject.createElement)(BlockInspectorButton, {
  10494. onClick: onClose
  10495. });
  10496. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockToolbarLastItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockNameContext.Consumer, null, blockName => blockName === 'core/navigation' && (0,external_wp_element_namespaceObject.createElement)(MaybeNavMenuSidebarToggle, null)))), (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null));
  10497. }
  10498. // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
  10499. var lib = __webpack_require__(773);
  10500. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/code-editor-text-area.js
  10501. /**
  10502. * External dependencies
  10503. */
  10504. /**
  10505. * WordPress dependencies
  10506. */
  10507. function CodeEditorTextArea(_ref) {
  10508. let {
  10509. value,
  10510. onChange,
  10511. onInput
  10512. } = _ref;
  10513. const [stateValue, setStateValue] = (0,external_wp_element_namespaceObject.useState)(value);
  10514. const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false);
  10515. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CodeEditorTextArea);
  10516. const valueRef = (0,external_wp_element_namespaceObject.useRef)();
  10517. if (!isDirty && stateValue !== value) {
  10518. setStateValue(value);
  10519. }
  10520. /**
  10521. * Handles a textarea change event to notify the onChange prop callback and
  10522. * reflect the new value in the component's own state. This marks the start
  10523. * of the user's edits, if not already changed, preventing future props
  10524. * changes to value from replacing the rendered value. This is expected to
  10525. * be followed by a reset to dirty state via `stopEditing`.
  10526. *
  10527. * @see stopEditing
  10528. *
  10529. * @param {Event} event Change event.
  10530. */
  10531. const onChangeHandler = event => {
  10532. const newValue = event.target.value;
  10533. onInput(newValue);
  10534. setStateValue(newValue);
  10535. setIsDirty(true);
  10536. valueRef.current = newValue;
  10537. };
  10538. /**
  10539. * Function called when the user has completed their edits, responsible for
  10540. * ensuring that changes, if made, are surfaced to the onPersist prop
  10541. * callback and resetting dirty state.
  10542. */
  10543. const stopEditing = () => {
  10544. if (isDirty) {
  10545. onChange(stateValue);
  10546. setIsDirty(false);
  10547. }
  10548. }; // Ensure changes aren't lost when component unmounts.
  10549. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10550. return () => {
  10551. if (valueRef.current) {
  10552. onChange(valueRef.current);
  10553. }
  10554. };
  10555. }, []);
  10556. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  10557. as: "label",
  10558. htmlFor: `code-editor-text-area-${instanceId}`
  10559. }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, {
  10560. autoComplete: "off",
  10561. dir: "auto",
  10562. value: stateValue,
  10563. onChange: onChangeHandler,
  10564. onBlur: stopEditing,
  10565. className: "edit-site-code-editor-text-area",
  10566. id: `code-editor-text-area-${instanceId}`,
  10567. placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML')
  10568. }));
  10569. }
  10570. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/code-editor/index.js
  10571. /**
  10572. * WordPress dependencies
  10573. */
  10574. /**
  10575. * Internal dependencies
  10576. */
  10577. function CodeEditor() {
  10578. const {
  10579. templateType,
  10580. shortcut
  10581. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  10582. const {
  10583. getEditedPostType
  10584. } = select(store_store);
  10585. const {
  10586. getShortcutRepresentation
  10587. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  10588. return {
  10589. templateType: getEditedPostType(),
  10590. shortcut: getShortcutRepresentation('core/edit-site/toggle-mode')
  10591. };
  10592. }, []);
  10593. const [contentStructure, setContent] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', templateType, 'content');
  10594. const [blocks,, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', templateType); // Replicates the logic found in getEditedPostContent().
  10595. let content;
  10596. if (contentStructure instanceof Function) {
  10597. content = contentStructure({
  10598. blocks
  10599. });
  10600. } else if (blocks) {
  10601. // If we have parsed blocks already, they should be our source of truth.
  10602. // Parsing applies block deprecations and legacy block conversions that
  10603. // unparsed content will not have.
  10604. content = (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocks);
  10605. } else {
  10606. content = contentStructure;
  10607. }
  10608. const {
  10609. switchEditorMode
  10610. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10611. return (0,external_wp_element_namespaceObject.createElement)("div", {
  10612. className: "edit-site-code-editor"
  10613. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  10614. className: "edit-site-code-editor__toolbar"
  10615. }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10616. variant: "tertiary",
  10617. onClick: () => switchEditorMode('visual'),
  10618. shortcut: shortcut
  10619. }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", {
  10620. className: "edit-site-code-editor__body"
  10621. }, (0,external_wp_element_namespaceObject.createElement)(CodeEditorTextArea, {
  10622. value: content,
  10623. onChange: newContent => {
  10624. onChange((0,external_wp_blocks_namespaceObject.parse)(newContent), {
  10625. selection: undefined
  10626. });
  10627. },
  10628. onInput: setContent
  10629. })));
  10630. }
  10631. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/keyboard-shortcuts/index.js
  10632. /**
  10633. * WordPress dependencies
  10634. */
  10635. /**
  10636. * Internal dependencies
  10637. */
  10638. function KeyboardShortcuts(_ref) {
  10639. let {
  10640. openEntitiesSavedStates
  10641. } = _ref;
  10642. const {
  10643. __experimentalGetDirtyEntityRecords,
  10644. isSavingEntityRecord
  10645. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_coreData_namespaceObject.store);
  10646. const {
  10647. getEditorMode
  10648. } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
  10649. const isListViewOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isListViewOpened(), []);
  10650. const isBlockInspectorOpen = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(store_store.name) === SIDEBAR_BLOCK, []);
  10651. const {
  10652. redo,
  10653. undo
  10654. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  10655. const {
  10656. setIsListViewOpened,
  10657. switchEditorMode
  10658. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10659. const {
  10660. enableComplementaryArea,
  10661. disableComplementaryArea
  10662. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  10663. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/save', event => {
  10664. event.preventDefault();
  10665. const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
  10666. const isDirty = !!dirtyEntityRecords.length;
  10667. const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
  10668. if (!isSaving && isDirty) {
  10669. openEntitiesSavedStates();
  10670. }
  10671. });
  10672. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/undo', event => {
  10673. undo();
  10674. event.preventDefault();
  10675. });
  10676. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/redo', event => {
  10677. redo();
  10678. event.preventDefault();
  10679. });
  10680. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-list-view', () => {
  10681. setIsListViewOpened(!isListViewOpen);
  10682. });
  10683. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-block-settings-sidebar', event => {
  10684. // This shortcut has no known clashes, but use preventDefault to prevent any
  10685. // obscure shortcuts from triggering.
  10686. event.preventDefault();
  10687. if (isBlockInspectorOpen) {
  10688. disableComplementaryArea(constants_STORE_NAME);
  10689. } else {
  10690. enableComplementaryArea(constants_STORE_NAME, SIDEBAR_BLOCK);
  10691. }
  10692. });
  10693. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-site/toggle-mode', () => {
  10694. switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
  10695. });
  10696. return null;
  10697. }
  10698. function KeyboardShortcutsRegister() {
  10699. // Registering the shortcuts.
  10700. const {
  10701. registerShortcut
  10702. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  10703. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10704. registerShortcut({
  10705. name: 'core/edit-site/save',
  10706. category: 'global',
  10707. description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'),
  10708. keyCombination: {
  10709. modifier: 'primary',
  10710. character: 's'
  10711. }
  10712. });
  10713. registerShortcut({
  10714. name: 'core/edit-site/undo',
  10715. category: 'global',
  10716. description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'),
  10717. keyCombination: {
  10718. modifier: 'primary',
  10719. character: 'z'
  10720. }
  10721. });
  10722. registerShortcut({
  10723. name: 'core/edit-site/redo',
  10724. category: 'global',
  10725. description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'),
  10726. keyCombination: {
  10727. modifier: 'primaryShift',
  10728. character: 'z'
  10729. }
  10730. });
  10731. registerShortcut({
  10732. name: 'core/edit-site/toggle-list-view',
  10733. category: 'global',
  10734. description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
  10735. keyCombination: {
  10736. modifier: 'access',
  10737. character: 'o'
  10738. }
  10739. });
  10740. registerShortcut({
  10741. name: 'core/edit-site/toggle-block-settings-sidebar',
  10742. category: 'global',
  10743. description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the block settings sidebar.'),
  10744. keyCombination: {
  10745. modifier: 'primaryShift',
  10746. character: ','
  10747. }
  10748. });
  10749. registerShortcut({
  10750. name: 'core/edit-site/keyboard-shortcuts',
  10751. category: 'main',
  10752. description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
  10753. keyCombination: {
  10754. modifier: 'access',
  10755. character: 'h'
  10756. }
  10757. });
  10758. registerShortcut({
  10759. name: 'core/edit-site/next-region',
  10760. category: 'global',
  10761. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
  10762. keyCombination: {
  10763. modifier: 'ctrl',
  10764. character: '`'
  10765. },
  10766. aliases: [{
  10767. modifier: 'access',
  10768. character: 'n'
  10769. }]
  10770. });
  10771. registerShortcut({
  10772. name: 'core/edit-site/previous-region',
  10773. category: 'global',
  10774. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
  10775. keyCombination: {
  10776. modifier: 'ctrlShift',
  10777. character: '`'
  10778. },
  10779. aliases: [{
  10780. modifier: 'access',
  10781. character: 'p'
  10782. }]
  10783. });
  10784. registerShortcut({
  10785. name: 'core/edit-site/toggle-mode',
  10786. category: 'global',
  10787. description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
  10788. keyCombination: {
  10789. modifier: 'secondary',
  10790. character: 'm'
  10791. }
  10792. });
  10793. }, [registerShortcut]);
  10794. return null;
  10795. }
  10796. KeyboardShortcuts.Register = KeyboardShortcutsRegister;
  10797. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  10798. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/url-query-controller/index.js
  10799. /**
  10800. * WordPress dependencies
  10801. */
  10802. /**
  10803. * Internal dependencies
  10804. */
  10805. function URLQueryController() {
  10806. const {
  10807. setTemplate,
  10808. setTemplatePart,
  10809. setPage
  10810. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10811. const {
  10812. params: {
  10813. postId,
  10814. postType
  10815. }
  10816. } = useLocation(); // Set correct entity on page navigation.
  10817. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10818. if ('page' === postType || 'post' === postType) {
  10819. setPage({
  10820. context: {
  10821. postType,
  10822. postId
  10823. }
  10824. }); // Resolves correct template based on ID.
  10825. } else if ('wp_template' === postType) {
  10826. setTemplate(postId);
  10827. } else if ('wp_template_part' === postType) {
  10828. setTemplatePart(postId);
  10829. }
  10830. }, [postId, postType]);
  10831. return null;
  10832. }
  10833. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  10834. /**
  10835. * WordPress dependencies
  10836. */
  10837. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  10838. xmlns: "http://www.w3.org/2000/svg",
  10839. viewBox: "0 0 24 24"
  10840. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  10841. 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"
  10842. }));
  10843. /* harmony default export */ var library_close = (close_close);
  10844. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/inserter-sidebar.js
  10845. /**
  10846. * WordPress dependencies
  10847. */
  10848. /**
  10849. * Internal dependencies
  10850. */
  10851. function InserterSidebar() {
  10852. const {
  10853. setIsInserterOpened
  10854. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10855. const insertionPoint = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).__experimentalGetInsertionPoint(), []);
  10856. const isMobile = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  10857. const TagName = !isMobile ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
  10858. const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  10859. onClose: () => setIsInserterOpened(false),
  10860. focusOnMount: null
  10861. });
  10862. const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
  10863. (0,external_wp_element_namespaceObject.useEffect)(() => {
  10864. libraryRef.current.focusSearch();
  10865. }, []);
  10866. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  10867. ref: inserterDialogRef
  10868. }, inserterDialogProps, {
  10869. className: "edit-site-editor__inserter-panel"
  10870. }), (0,external_wp_element_namespaceObject.createElement)(TagName, {
  10871. className: "edit-site-editor__inserter-panel-header"
  10872. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10873. icon: library_close,
  10874. label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'),
  10875. onClick: () => setIsInserterOpened(false)
  10876. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  10877. className: "edit-site-editor__inserter-panel-content"
  10878. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
  10879. showInserterHelpPanel: true,
  10880. shouldFocusBlock: isMobile,
  10881. rootClientId: insertionPoint.rootClientId,
  10882. __experimentalInsertionIndex: insertionPoint.insertionIndex,
  10883. __experimentalFilterValue: insertionPoint.filterValue,
  10884. ref: libraryRef
  10885. })));
  10886. }
  10887. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/secondary-sidebar/list-view-sidebar.js
  10888. /**
  10889. * WordPress dependencies
  10890. */
  10891. /**
  10892. * Internal dependencies
  10893. */
  10894. function ListViewSidebar() {
  10895. const {
  10896. setIsListViewOpened
  10897. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  10898. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
  10899. const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  10900. const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  10901. function closeOnEscape(event) {
  10902. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  10903. setIsListViewOpened(false);
  10904. }
  10905. }
  10906. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
  10907. const labelId = `edit-site-editor__list-view-panel-label-${instanceId}`;
  10908. return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
  10909. (0,external_wp_element_namespaceObject.createElement)("div", {
  10910. "aria-labelledby": labelId,
  10911. className: "edit-site-editor__list-view-panel",
  10912. onKeyDown: closeOnEscape
  10913. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  10914. className: "edit-site-editor__list-view-panel-header",
  10915. ref: headerFocusReturnRef
  10916. }, (0,external_wp_element_namespaceObject.createElement)("strong", {
  10917. id: labelId
  10918. }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10919. icon: close_small,
  10920. label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'),
  10921. onClick: () => setIsListViewOpened(false)
  10922. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  10923. className: "edit-site-editor__list-view-panel-content",
  10924. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
  10925. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, null)))
  10926. );
  10927. }
  10928. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/warning.js
  10929. /**
  10930. * WordPress dependencies
  10931. */
  10932. function CopyButton(_ref) {
  10933. let {
  10934. text,
  10935. children
  10936. } = _ref;
  10937. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text);
  10938. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10939. variant: "secondary",
  10940. ref: ref
  10941. }, children);
  10942. }
  10943. function ErrorBoundaryWarning(_ref2) {
  10944. let {
  10945. message,
  10946. error,
  10947. reboot,
  10948. dashboardLink
  10949. } = _ref2;
  10950. const actions = [];
  10951. if (reboot) {
  10952. actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10953. key: "recovery",
  10954. onClick: reboot,
  10955. variant: "secondary"
  10956. }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')));
  10957. }
  10958. if (error) {
  10959. actions.push((0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  10960. key: "copy-error",
  10961. text: error.stack
  10962. }, (0,external_wp_i18n_namespaceObject.__)('Copy Error')));
  10963. }
  10964. if (dashboardLink) {
  10965. actions.push((0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  10966. key: "back-to-dashboard",
  10967. variant: "secondary",
  10968. href: dashboardLink
  10969. }, (0,external_wp_i18n_namespaceObject.__)('Back to dashboard')));
  10970. }
  10971. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  10972. className: "editor-error-boundary",
  10973. actions: actions
  10974. }, message);
  10975. }
  10976. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/error-boundary/index.js
  10977. /**
  10978. * WordPress dependencies
  10979. */
  10980. /**
  10981. * Internal dependencies
  10982. */
  10983. class ErrorBoundary extends external_wp_element_namespaceObject.Component {
  10984. constructor() {
  10985. super(...arguments);
  10986. this.reboot = this.reboot.bind(this);
  10987. this.state = {
  10988. error: null
  10989. };
  10990. }
  10991. componentDidCatch(error) {
  10992. (0,external_wp_hooks_namespaceObject.doAction)('editor.ErrorBoundary.errorLogged', error);
  10993. }
  10994. static getDerivedStateFromError(error) {
  10995. return {
  10996. error
  10997. };
  10998. }
  10999. reboot() {
  11000. this.props.onError();
  11001. }
  11002. render() {
  11003. const {
  11004. error
  11005. } = this.state;
  11006. if (!error) {
  11007. return this.props.children;
  11008. }
  11009. return (0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, {
  11010. message: (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.'),
  11011. error: error,
  11012. reboot: this.reboot
  11013. });
  11014. }
  11015. }
  11016. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/image.js
  11017. function WelcomeGuideImage(_ref) {
  11018. let {
  11019. nonAnimatedSrc,
  11020. animatedSrc
  11021. } = _ref;
  11022. return (0,external_wp_element_namespaceObject.createElement)("picture", {
  11023. className: "edit-site-welcome-guide__image"
  11024. }, (0,external_wp_element_namespaceObject.createElement)("source", {
  11025. srcSet: nonAnimatedSrc,
  11026. media: "(prefers-reduced-motion: reduce)"
  11027. }), (0,external_wp_element_namespaceObject.createElement)("img", {
  11028. src: animatedSrc,
  11029. width: "312",
  11030. height: "240",
  11031. alt: ""
  11032. }));
  11033. }
  11034. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/editor.js
  11035. /**
  11036. * WordPress dependencies
  11037. */
  11038. /**
  11039. * Internal dependencies
  11040. */
  11041. function WelcomeGuideEditor() {
  11042. const {
  11043. toggle
  11044. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  11045. const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuide'), []);
  11046. if (!isActive) {
  11047. return null;
  11048. }
  11049. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  11050. className: "edit-site-welcome-guide",
  11051. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the site editor'),
  11052. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'),
  11053. onFinish: () => toggle('core/edit-site', 'welcomeGuide'),
  11054. pages: [{
  11055. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  11056. nonAnimatedSrc: "https://s.w.org/images/block-editor/edit-your-site.svg?1",
  11057. animatedSrc: "https://s.w.org/images/block-editor/edit-your-site.gif?1"
  11058. }),
  11059. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  11060. className: "edit-site-welcome-guide__heading"
  11061. }, (0,external_wp_i18n_namespaceObject.__)('Edit your site')), (0,external_wp_element_namespaceObject.createElement)("p", {
  11062. className: "edit-site-welcome-guide__text"
  11063. }, (0,external_wp_i18n_namespaceObject.__)('Design everything on your site — from the header right down to the footer — using blocks.')), (0,external_wp_element_namespaceObject.createElement)("p", {
  11064. className: "edit-site-welcome-guide__text"
  11065. }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('Click <StylesIconImage /> to start designing your blocks, and choose your typography, layout, and colors.'), {
  11066. StylesIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
  11067. alt: (0,external_wp_i18n_namespaceObject.__)('styles'),
  11068. src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 4c-4.4 0-8 3.6-8 8v.1c0 4.1 3.2 7.5 7.2 7.9h.8c4.4 0 8-3.6 8-8s-3.6-8-8-8zm0 15V5c3.9 0 7 3.1 7 7s-3.1 7-7 7z' fill='%231E1E1E'/%3E%3C/svg%3E%0A"
  11069. })
  11070. })))
  11071. }]
  11072. });
  11073. }
  11074. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/styles.js
  11075. /**
  11076. * WordPress dependencies
  11077. */
  11078. /**
  11079. * Internal dependencies
  11080. */
  11081. function WelcomeGuideStyles() {
  11082. const {
  11083. toggle
  11084. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store);
  11085. const {
  11086. isActive,
  11087. isStylesOpen
  11088. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  11089. const sidebar = select(store).getActiveComplementaryArea(store_store.name);
  11090. return {
  11091. isActive: !!select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'welcomeGuideStyles'),
  11092. isStylesOpen: sidebar === 'edit-site/global-styles'
  11093. };
  11094. }, []);
  11095. if (!isActive || !isStylesOpen) {
  11096. return null;
  11097. }
  11098. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  11099. className: "edit-site-welcome-guide",
  11100. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to styles'),
  11101. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get Started'),
  11102. onFinish: () => toggle('core/edit-site', 'welcomeGuideStyles'),
  11103. pages: [{
  11104. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  11105. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
  11106. animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
  11107. }),
  11108. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  11109. className: "edit-site-welcome-guide__heading"
  11110. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to Styles')), (0,external_wp_element_namespaceObject.createElement)("p", {
  11111. className: "edit-site-welcome-guide__text"
  11112. }, (0,external_wp_i18n_namespaceObject.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.')))
  11113. }, {
  11114. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  11115. nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
  11116. animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
  11117. }),
  11118. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  11119. className: "edit-site-welcome-guide__heading"
  11120. }, (0,external_wp_i18n_namespaceObject.__)('Set the design')), (0,external_wp_element_namespaceObject.createElement)("p", {
  11121. className: "edit-site-welcome-guide__text"
  11122. }, (0,external_wp_i18n_namespaceObject.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! ')))
  11123. }, {
  11124. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  11125. nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
  11126. animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
  11127. }),
  11128. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  11129. className: "edit-site-welcome-guide__heading"
  11130. }, (0,external_wp_i18n_namespaceObject.__)('Personalize blocks')), (0,external_wp_element_namespaceObject.createElement)("p", {
  11131. className: "edit-site-welcome-guide__text"
  11132. }, (0,external_wp_i18n_namespaceObject.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.')))
  11133. }, {
  11134. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  11135. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
  11136. animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
  11137. }),
  11138. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  11139. className: "edit-site-welcome-guide__heading"
  11140. }, (0,external_wp_i18n_namespaceObject.__)('Learn more')), (0,external_wp_element_namespaceObject.createElement)("p", {
  11141. className: "edit-site-welcome-guide__text"
  11142. }, (0,external_wp_i18n_namespaceObject.__)('New to block themes and styling your site? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  11143. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/styles-overview/')
  11144. }, (0,external_wp_i18n_namespaceObject.__)('Here’s a detailed guide to learn how to make the most of it.'))))
  11145. }]
  11146. });
  11147. }
  11148. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/welcome-guide/index.js
  11149. /**
  11150. * Internal dependencies
  11151. */
  11152. function WelcomeGuide() {
  11153. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideEditor, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideStyles, null));
  11154. }
  11155. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/global-styles-renderer.js
  11156. /**
  11157. * External dependencies
  11158. */
  11159. /**
  11160. * WordPress dependencies
  11161. */
  11162. /**
  11163. * Internal dependencies
  11164. */
  11165. /**
  11166. * Internal dependencies
  11167. */
  11168. function useGlobalStylesRenderer() {
  11169. const [styles, settings, svgFilters] = useGlobalStylesOutput();
  11170. const {
  11171. getSettings
  11172. } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
  11173. const {
  11174. updateSettings
  11175. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  11176. (0,external_wp_element_namespaceObject.useEffect)(() => {
  11177. if (!styles || !settings) {
  11178. return;
  11179. }
  11180. const currentStoreSettings = getSettings();
  11181. const nonGlobalStyles = (0,external_lodash_namespaceObject.filter)(currentStoreSettings.styles, style => !style.isGlobalStyles);
  11182. updateSettings({ ...currentStoreSettings,
  11183. styles: [...nonGlobalStyles, ...styles],
  11184. svgFilters,
  11185. __experimentalFeatures: settings
  11186. });
  11187. }, [styles, settings]);
  11188. }
  11189. function GlobalStylesRenderer() {
  11190. useGlobalStylesRenderer();
  11191. return null;
  11192. }
  11193. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/routes/use-title.js
  11194. /**
  11195. * WordPress dependencies
  11196. */
  11197. /**
  11198. * Internal dependencies
  11199. */
  11200. function useTitle(title) {
  11201. const location = useLocation();
  11202. const siteTitle = (0,external_wp_data_namespaceObject.useSelect)(select => {
  11203. var _select$getEntityReco;
  11204. return (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title;
  11205. }, []);
  11206. const isInitialLocationRef = (0,external_wp_element_namespaceObject.useRef)(true);
  11207. (0,external_wp_element_namespaceObject.useEffect)(() => {
  11208. isInitialLocationRef.current = false;
  11209. }, [location]);
  11210. (0,external_wp_element_namespaceObject.useEffect)(() => {
  11211. // Don't update or announce the title for initial page load.
  11212. if (isInitialLocationRef.current) {
  11213. return;
  11214. }
  11215. if (title && siteTitle) {
  11216. // @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68
  11217. const formattedTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
  11218. /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
  11219. (0,external_wp_i18n_namespaceObject.__)('%1$s ‹ %2$s — WordPress'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle));
  11220. document.title = formattedTitle; // Announce title on route change for screen readers.
  11221. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)(
  11222. /* translators: The page title that is currently displaying. */
  11223. (0,external_wp_i18n_namespaceObject.__)('Now displaying: %s'), document.title), 'assertive');
  11224. }
  11225. }, [title, siteTitle, location]);
  11226. }
  11227. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/editor/index.js
  11228. /**
  11229. * WordPress dependencies
  11230. */
  11231. /**
  11232. * Internal dependencies
  11233. */
  11234. const interfaceLabels = {
  11235. /* translators: accessibility text for the editor top bar landmark region. */
  11236. header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
  11237. /* translators: accessibility text for the editor content landmark region. */
  11238. body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
  11239. /* translators: accessibility text for the editor settings landmark region. */
  11240. sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
  11241. /* translators: accessibility text for the editor publish landmark region. */
  11242. actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
  11243. /* translators: accessibility text for the editor footer landmark region. */
  11244. footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer'),
  11245. /* translators: accessibility text for the navigation sidebar landmark region. */
  11246. drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar')
  11247. };
  11248. function Editor(_ref) {
  11249. let {
  11250. onError
  11251. } = _ref;
  11252. const {
  11253. isInserterOpen,
  11254. isListViewOpen,
  11255. sidebarIsOpened,
  11256. settings,
  11257. entityId,
  11258. templateType,
  11259. page,
  11260. template,
  11261. templateResolved,
  11262. isNavigationOpen,
  11263. previousShortcut,
  11264. nextShortcut,
  11265. editorMode,
  11266. showIconLabels,
  11267. blockEditorMode
  11268. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  11269. const {
  11270. isInserterOpened,
  11271. isListViewOpened,
  11272. getSettings,
  11273. getEditedPostType,
  11274. getEditedPostId,
  11275. getPage,
  11276. isNavigationOpened,
  11277. getEditorMode
  11278. } = select(store_store);
  11279. const {
  11280. hasFinishedResolution,
  11281. getEntityRecord
  11282. } = select(external_wp_coreData_namespaceObject.store);
  11283. const {
  11284. __unstableGetEditorMode
  11285. } = select(external_wp_blockEditor_namespaceObject.store);
  11286. const postType = getEditedPostType();
  11287. const postId = getEditedPostId(); // The currently selected entity to display. Typically template or template part.
  11288. return {
  11289. isInserterOpen: isInserterOpened(),
  11290. isListViewOpen: isListViewOpened(),
  11291. sidebarIsOpened: !!select(store).getActiveComplementaryArea(store_store.name),
  11292. settings: getSettings(),
  11293. templateType: postType,
  11294. page: getPage(),
  11295. template: postId ? getEntityRecord('postType', postType, postId) : null,
  11296. templateResolved: postId ? hasFinishedResolution('getEntityRecord', ['postType', postType, postId]) : false,
  11297. entityId: postId,
  11298. isNavigationOpen: isNavigationOpened(),
  11299. previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
  11300. nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'),
  11301. editorMode: getEditorMode(),
  11302. showIconLabels: select(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'showIconLabels'),
  11303. blockEditorMode: __unstableGetEditorMode()
  11304. };
  11305. }, []);
  11306. const {
  11307. setPage,
  11308. setIsInserterOpened
  11309. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  11310. const {
  11311. enableComplementaryArea
  11312. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  11313. const [isEntitiesSavedStatesOpen, setIsEntitiesSavedStatesOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  11314. const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setIsEntitiesSavedStatesOpen(true), []);
  11315. const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => {
  11316. setIsEntitiesSavedStatesOpen(false);
  11317. }, []);
  11318. const blockContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(page === null || page === void 0 ? void 0 : page.context),
  11319. queryContext: [(page === null || page === void 0 ? void 0 : page.context.queryContext) || {
  11320. page: 1
  11321. }, newQueryContext => setPage({ ...page,
  11322. context: { ...(page === null || page === void 0 ? void 0 : page.context),
  11323. queryContext: { ...(page === null || page === void 0 ? void 0 : page.context.queryContext),
  11324. ...newQueryContext
  11325. }
  11326. }
  11327. })]
  11328. }), [page === null || page === void 0 ? void 0 : page.context]);
  11329. (0,external_wp_element_namespaceObject.useEffect)(() => {
  11330. if (isNavigationOpen) {
  11331. document.body.classList.add('is-navigation-sidebar-open');
  11332. } else {
  11333. document.body.classList.remove('is-navigation-sidebar-open');
  11334. }
  11335. }, [isNavigationOpen]);
  11336. (0,external_wp_element_namespaceObject.useEffect)(function openGlobalStylesOnLoad() {
  11337. const searchParams = new URLSearchParams(window.location.search);
  11338. if (searchParams.get('styles') === 'open') {
  11339. enableComplementaryArea('core/edit-site', 'edit-site/global-styles');
  11340. }
  11341. }, [enableComplementaryArea]); // Don't render the Editor until the settings are set and loaded.
  11342. const isReady = (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && templateType !== undefined && entityId !== undefined;
  11343. const secondarySidebarLabel = isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
  11344. const secondarySidebar = () => {
  11345. if (editorMode === 'visual' && isInserterOpen) {
  11346. return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
  11347. }
  11348. if (editorMode === 'visual' && isListViewOpen) {
  11349. return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
  11350. }
  11351. return null;
  11352. }; // Only announce the title once the editor is ready to prevent "Replace"
  11353. // action in <URlQueryController> from double-announcing.
  11354. useTitle(isReady && (0,external_wp_i18n_namespaceObject.__)('Editor (beta)'));
  11355. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(URLQueryController, null), isReady && (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
  11356. kind: "root",
  11357. type: "site"
  11358. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, {
  11359. kind: "postType",
  11360. type: templateType,
  11361. id: entityId
  11362. }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, {
  11363. value: blockContext
  11364. }, (0,external_wp_element_namespaceObject.createElement)(GlobalStylesRenderer, null), (0,external_wp_element_namespaceObject.createElement)(ErrorBoundary, {
  11365. onError: onError
  11366. }, (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts.Register, null), (0,external_wp_element_namespaceObject.createElement)(SidebarComplementaryAreaFills, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
  11367. labels: { ...interfaceLabels,
  11368. secondarySidebar: secondarySidebarLabel
  11369. },
  11370. className: showIconLabels && 'show-icon-labels',
  11371. secondarySidebar: secondarySidebar(),
  11372. sidebar: sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
  11373. scope: "core/edit-site"
  11374. }),
  11375. drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null),
  11376. header: (0,external_wp_element_namespaceObject.createElement)(Header, {
  11377. openEntitiesSavedStates: openEntitiesSavedStates,
  11378. showIconLabels: showIconLabels
  11379. }),
  11380. notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
  11381. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, {
  11382. scope: "core/block-inspector"
  11383. }), editorMode === 'visual' && template && (0,external_wp_element_namespaceObject.createElement)(BlockEditor, {
  11384. setIsInserterOpen: setIsInserterOpened
  11385. }), editorMode === 'text' && template && (0,external_wp_element_namespaceObject.createElement)(CodeEditor, null), templateResolved && !template && (settings === null || settings === void 0 ? void 0 : settings.siteUrl) && entityId && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
  11386. status: "warning",
  11387. isDismissible: false
  11388. }, (0,external_wp_i18n_namespaceObject.__)("You attempted to edit an item that doesn't exist. Perhaps it was deleted?")), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, {
  11389. openEntitiesSavedStates: openEntitiesSavedStates
  11390. })),
  11391. actions: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen ? (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
  11392. close: closeEntitiesSavedStates
  11393. }) : (0,external_wp_element_namespaceObject.createElement)("div", {
  11394. className: "edit-site-editor__toggle-save-panel"
  11395. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  11396. variant: "secondary",
  11397. className: "edit-site-editor__toggle-save-panel-button",
  11398. onClick: openEntitiesSavedStates,
  11399. "aria-expanded": false
  11400. }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')))),
  11401. footer: blockEditorMode !== 'zoom-out' ? (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
  11402. rootLabelText: (0,external_wp_i18n_namespaceObject.__)('Template')
  11403. }) : undefined,
  11404. shortcuts: {
  11405. previous: previousShortcut,
  11406. next: nextShortcut
  11407. }
  11408. }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null))))))));
  11409. }
  11410. /* harmony default export */ var editor = (Editor);
  11411. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/use-register-shortcuts.js
  11412. /**
  11413. * WordPress dependencies
  11414. */
  11415. function useRegisterShortcuts() {
  11416. const {
  11417. registerShortcut
  11418. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  11419. (0,external_wp_element_namespaceObject.useEffect)(() => {
  11420. registerShortcut({
  11421. name: 'core/edit-site/next-region',
  11422. category: 'global',
  11423. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
  11424. keyCombination: {
  11425. modifier: 'ctrl',
  11426. character: '`'
  11427. },
  11428. aliases: [{
  11429. modifier: 'access',
  11430. character: 'n'
  11431. }]
  11432. });
  11433. registerShortcut({
  11434. name: 'core/edit-site/previous-region',
  11435. category: 'global',
  11436. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
  11437. keyCombination: {
  11438. modifier: 'ctrlShift',
  11439. character: '`'
  11440. },
  11441. aliases: [{
  11442. modifier: 'access',
  11443. character: 'p'
  11444. }]
  11445. });
  11446. }, []);
  11447. }
  11448. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post.js
  11449. /**
  11450. * WordPress dependencies
  11451. */
  11452. const post = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11453. xmlns: "http://www.w3.org/2000/svg",
  11454. viewBox: "0 0 24 24"
  11455. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11456. d: "m7.3 9.7 1.4 1.4c.2-.2.3-.3.4-.5 0 0 0-.1.1-.1.3-.5.4-1.1.3-1.6L12 7 9 4 7.2 6.5c-.6-.1-1.1 0-1.6.3 0 0-.1 0-.1.1-.3.1-.4.2-.6.4l1.4 1.4L4 11v1h1l2.3-2.3zM4 20h9v-1.5H4V20zm0-5.5V16h16v-1.5H4z"
  11457. }));
  11458. /* harmony default export */ var library_post = (post);
  11459. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
  11460. /**
  11461. * WordPress dependencies
  11462. */
  11463. const page = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11464. xmlns: "http://www.w3.org/2000/svg",
  11465. viewBox: "0 0 24 24"
  11466. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11467. 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"
  11468. }));
  11469. /* harmony default export */ var library_page = (page);
  11470. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/archive.js
  11471. /**
  11472. * WordPress dependencies
  11473. */
  11474. const archive = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11475. viewBox: "0 0 24 24",
  11476. xmlns: "http://www.w3.org/2000/svg"
  11477. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11478. d: "M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z"
  11479. }));
  11480. /* harmony default export */ var library_archive = (archive);
  11481. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
  11482. /**
  11483. * WordPress dependencies
  11484. */
  11485. const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11486. xmlns: "http://www.w3.org/2000/svg",
  11487. viewBox: "0 0 24 24"
  11488. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11489. d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"
  11490. }));
  11491. /* harmony default export */ var library_search = (search);
  11492. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/not-found.js
  11493. /**
  11494. * WordPress dependencies
  11495. */
  11496. const notFound = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11497. xmlns: "http://www.w3.org/2000/svg",
  11498. viewBox: "0 0 24 24"
  11499. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11500. d: "M19 5H5c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm.5 12c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v10zm-11-7.6h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-.9 3.5H6.3l1.2-1.7v1.7zm5.6-3.2c-.4-.2-.8-.4-1.2-.4-.5 0-.9.1-1.2.4-.4.2-.6.6-.8 1-.2.4-.3.9-.3 1.5s.1 1.1.3 1.6c.2.4.5.8.8 1 .4.2.8.4 1.2.4.5 0 .9-.1 1.2-.4.4-.2.6-.6.8-1 .2-.4.3-1 .3-1.6 0-.6-.1-1.1-.3-1.5-.1-.5-.4-.8-.8-1zm0 3.6c-.1.3-.3.5-.5.7-.2.1-.4.2-.7.2-.3 0-.5-.1-.7-.2-.2-.1-.4-.4-.5-.7-.1-.3-.2-.7-.2-1.2 0-.7.1-1.2.4-1.5.3-.3.6-.5 1-.5s.7.2 1 .5c.3.3.4.8.4 1.5-.1.5-.1.9-.2 1.2zm5-3.9h-.7l-3.1 4.3h2.8V15h1v-1.3h.7v-.8h-.7V9.4zm-1 3.5H16l1.2-1.7v1.7z"
  11501. }));
  11502. /* harmony default export */ var not_found = (notFound);
  11503. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js
  11504. /**
  11505. * WordPress dependencies
  11506. */
  11507. const list = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11508. viewBox: "0 0 24 24",
  11509. xmlns: "http://www.w3.org/2000/svg"
  11510. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11511. d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z"
  11512. }));
  11513. /* harmony default export */ var library_list = (list);
  11514. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js
  11515. /**
  11516. * WordPress dependencies
  11517. */
  11518. const category = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11519. viewBox: "0 0 24 24",
  11520. xmlns: "http://www.w3.org/2000/svg"
  11521. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11522. d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",
  11523. fillRule: "evenodd",
  11524. clipRule: "evenodd"
  11525. }));
  11526. /* harmony default export */ var library_category = (category);
  11527. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-author.js
  11528. /**
  11529. * WordPress dependencies
  11530. */
  11531. const postAuthor = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11532. viewBox: "0 0 24 24",
  11533. xmlns: "http://www.w3.org/2000/svg"
  11534. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11535. d: "M10 4.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm2.25 7.5v-1A2.75 2.75 0 0011 8.25H7A2.75 2.75 0 004.25 11v1h1.5v-1c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v1h1.5zM4 20h9v-1.5H4V20zm16-4H4v-1.5h16V16z",
  11536. fillRule: "evenodd",
  11537. clipRule: "evenodd"
  11538. }));
  11539. /* harmony default export */ var post_author = (postAuthor);
  11540. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-meta.js
  11541. /**
  11542. * WordPress dependencies
  11543. */
  11544. const blockMeta = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11545. xmlns: "http://www.w3.org/2000/svg",
  11546. viewBox: "0 0 24 24"
  11547. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11548. fillRule: "evenodd",
  11549. d: "M8.95 11.25H4v1.5h4.95v4.5H13V18c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2v-3c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75h-2.55v-7.5H13V9c0 1.1.9 2 2 2h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3c-1.1 0-2 .9-2 2v.75H8.95v4.5ZM14.5 15v3c0 .3.2.5.5.5h3c.3 0 .5-.2.5-.5v-3c0-.3-.2-.5-.5-.5h-3c-.3 0-.5.2-.5.5Zm0-6V6c0-.3.2-.5.5-.5h3c.3 0 .5.2.5.5v3c0 .3-.2.5-.5.5h-3c-.3 0-.5-.2-.5-.5Z",
  11550. clipRule: "evenodd"
  11551. }));
  11552. /* harmony default export */ var block_meta = (blockMeta);
  11553. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-date.js
  11554. /**
  11555. * WordPress dependencies
  11556. */
  11557. const postDate = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11558. xmlns: "http://www.w3.org/2000/svg",
  11559. viewBox: "0 0 24 24"
  11560. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11561. d: "M11.696 13.972c.356-.546.599-.958.728-1.235a1.79 1.79 0 00.203-.783c0-.264-.077-.47-.23-.618-.148-.153-.354-.23-.618-.23-.295 0-.569.07-.82.212a3.413 3.413 0 00-.738.571l-.147-1.188c.289-.234.59-.41.903-.526.313-.117.66-.175 1.041-.175.375 0 .695.08.959.24.264.153.46.362.59.626.135.265.203.556.203.876 0 .362-.08.734-.24 1.115-.154.381-.427.87-.82 1.466l-.756 1.152H14v1.106h-4l1.696-2.609z"
  11562. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11563. d: "M19.5 7h-15v12a.5.5 0 00.5.5h14a.5.5 0 00.5-.5V7zM3 7V5a2 2 0 012-2h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V7z"
  11564. }));
  11565. /* harmony default export */ var post_date = (postDate);
  11566. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tag.js
  11567. /**
  11568. * WordPress dependencies
  11569. */
  11570. const tag = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11571. xmlns: "http://www.w3.org/2000/svg",
  11572. viewBox: "0 0 24 24"
  11573. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11574. d: "M20.1 11.2l-6.7-6.7c-.1-.1-.3-.2-.5-.2H5c-.4-.1-.8.3-.8.7v7.8c0 .2.1.4.2.5l6.7 6.7c.2.2.5.4.7.5s.6.2.9.2c.3 0 .6-.1.9-.2.3-.1.5-.3.8-.5l5.6-5.6c.4-.4.7-1 .7-1.6.1-.6-.2-1.2-.6-1.6zM19 13.4L13.4 19c-.1.1-.2.1-.3.2-.2.1-.4.1-.6 0-.1 0-.2-.1-.3-.2l-6.5-6.5V5.8h6.8l6.5 6.5c.2.2.2.4.2.6 0 .1 0 .3-.2.5zM9 8c-.6 0-1 .4-1 1s.4 1 1 1 1-.4 1-1-.4-1-1-1z"
  11575. }));
  11576. /* harmony default export */ var library_tag = (tag);
  11577. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/media.js
  11578. /**
  11579. * WordPress dependencies
  11580. */
  11581. const media = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  11582. xmlns: "http://www.w3.org/2000/svg",
  11583. viewBox: "0 0 24 24"
  11584. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  11585. d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h13.4c.4 0 .8.4.8.8v13.4zM10 15l5-3-5-3v6z"
  11586. }));
  11587. /* harmony default export */ var library_media = (media);
  11588. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/utils.js
  11589. /**
  11590. * External dependencies
  11591. */
  11592. /**
  11593. * WordPress dependencies
  11594. */
  11595. /**
  11596. * @typedef IHasNameAndId
  11597. * @property {string|number} id The entity's id.
  11598. * @property {string} name The entity's name.
  11599. */
  11600. /**
  11601. * Helper util to map records to add a `name` prop from a
  11602. * provided path, in order to handle all entities in the same
  11603. * fashion(implementing`IHasNameAndId` interface).
  11604. *
  11605. * @param {Object[]} entities The array of entities.
  11606. * @param {string} path The path to map a `name` property from the entity.
  11607. * @return {IHasNameAndId[]} An array of enitities that now implement the `IHasNameAndId` interface.
  11608. */
  11609. const mapToIHasNameAndId = (entities, path) => {
  11610. return (entities || []).map(entity => ({ ...entity,
  11611. name: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)((0,external_lodash_namespaceObject.get)(entity, path))
  11612. }));
  11613. };
  11614. /**
  11615. * @typedef {Object} EntitiesInfo
  11616. * @property {boolean} hasEntities If an entity has available records(posts, terms, etc..).
  11617. * @property {number[]} existingEntitiesIds An array of the existing entities ids.
  11618. */
  11619. const useExistingTemplates = () => {
  11620. return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
  11621. per_page: -1
  11622. }), []);
  11623. };
  11624. const useDefaultTemplateTypes = () => {
  11625. return (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).__experimentalGetDefaultTemplateTypes(), []);
  11626. };
  11627. const usePublicPostTypes = () => {
  11628. const postTypes = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostTypes({
  11629. per_page: -1
  11630. }), []);
  11631. return (0,external_wp_element_namespaceObject.useMemo)(() => {
  11632. const excludedPostTypes = ['attachment'];
  11633. return postTypes === null || postTypes === void 0 ? void 0 : postTypes.filter(_ref => {
  11634. let {
  11635. viewable,
  11636. slug
  11637. } = _ref;
  11638. return viewable && !excludedPostTypes.includes(slug);
  11639. });
  11640. }, [postTypes]);
  11641. };
  11642. const usePublicTaxonomies = () => {
  11643. const taxonomies = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTaxonomies({
  11644. per_page: -1
  11645. }), []);
  11646. return (0,external_wp_element_namespaceObject.useMemo)(() => {
  11647. return taxonomies === null || taxonomies === void 0 ? void 0 : taxonomies.filter(_ref2 => {
  11648. let {
  11649. visibility
  11650. } = _ref2;
  11651. return visibility === null || visibility === void 0 ? void 0 : visibility.publicly_queryable;
  11652. });
  11653. }, [taxonomies]);
  11654. };
  11655. function usePostTypeNeedsUniqueIdentifier(publicPostTypes) {
  11656. const postTypeLabels = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes === null || publicPostTypes === void 0 ? void 0 : publicPostTypes.reduce((accumulator, _ref3) => {
  11657. let {
  11658. labels
  11659. } = _ref3;
  11660. const singularName = labels.singular_name.toLowerCase();
  11661. accumulator[singularName] = (accumulator[singularName] || 0) + 1;
  11662. return accumulator;
  11663. }, {}));
  11664. return (0,external_wp_element_namespaceObject.useCallback)(_ref4 => {
  11665. let {
  11666. labels,
  11667. slug
  11668. } = _ref4;
  11669. const singularName = labels.singular_name.toLowerCase();
  11670. return postTypeLabels[singularName] > 1 && singularName !== slug;
  11671. }, [postTypeLabels]);
  11672. }
  11673. function usePostTypeArchiveMenuItems() {
  11674. const publicPostTypes = usePublicPostTypes();
  11675. const postTypesWithArchives = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes === null || publicPostTypes === void 0 ? void 0 : publicPostTypes.filter(postType => postType.has_archive), [publicPostTypes]);
  11676. const existingTemplates = useExistingTemplates();
  11677. const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(postTypesWithArchives);
  11678. return (0,external_wp_element_namespaceObject.useMemo)(() => (postTypesWithArchives === null || postTypesWithArchives === void 0 ? void 0 : postTypesWithArchives.filter(postType => !(existingTemplates || []).some(existingTemplate => existingTemplate.slug === 'archive-' + postType.slug)).map(postType => {
  11679. var _postType$icon;
  11680. let title;
  11681. if (needsUniqueIdentifier(postType)) {
  11682. title = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
  11683. (0,external_wp_i18n_namespaceObject.__)('Archive: %1$s (%2$s)'), postType.labels.singular_name, postType.slug);
  11684. } else {
  11685. title = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post".
  11686. (0,external_wp_i18n_namespaceObject.__)('Archive: %s'), postType.labels.singular_name);
  11687. }
  11688. return {
  11689. slug: 'archive-' + postType.slug,
  11690. description: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post".
  11691. (0,external_wp_i18n_namespaceObject.__)('Displays an archive with the latests posts of type: %s.'), postType.labels.singular_name),
  11692. title,
  11693. // `icon` is the `menu_icon` property of a post type. We
  11694. // only handle `dashicons` for now, even if the `menu_icon`
  11695. // also supports urls and svg as values.
  11696. icon: (_postType$icon = postType.icon) !== null && _postType$icon !== void 0 && _postType$icon.startsWith('dashicons-') ? postType.icon.slice(10) : library_archive,
  11697. templatePrefix: 'archive'
  11698. };
  11699. })) || [], [postTypesWithArchives, existingTemplates, needsUniqueIdentifier]);
  11700. }
  11701. const usePostTypeMenuItems = onClickMenuItem => {
  11702. const publicPostTypes = usePublicPostTypes();
  11703. const existingTemplates = useExistingTemplates();
  11704. const defaultTemplateTypes = useDefaultTemplateTypes();
  11705. const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier(publicPostTypes); // `page`is a special case in template hierarchy.
  11706. const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicPostTypes === null || publicPostTypes === void 0 ? void 0 : publicPostTypes.reduce((accumulator, _ref5) => {
  11707. let {
  11708. slug
  11709. } = _ref5;
  11710. let suffix = slug;
  11711. if (slug !== 'page') {
  11712. suffix = `single-${suffix}`;
  11713. }
  11714. accumulator[slug] = suffix;
  11715. return accumulator;
  11716. }, {}), [publicPostTypes]);
  11717. const postTypesInfo = useEntitiesInfo('postType', templatePrefixes);
  11718. const existingTemplateSlugs = (existingTemplates || []).map(_ref6 => {
  11719. let {
  11720. slug
  11721. } = _ref6;
  11722. return slug;
  11723. });
  11724. const menuItems = (publicPostTypes || []).reduce((accumulator, postType) => {
  11725. var _postTypesInfo$slug;
  11726. const {
  11727. slug,
  11728. labels,
  11729. icon
  11730. } = postType; // We need to check if the general template is part of the
  11731. // defaultTemplateTypes. If it is, just use that info and
  11732. // augment it with the specific template functionality.
  11733. const generalTemplateSlug = templatePrefixes[slug];
  11734. const defaultTemplateType = defaultTemplateTypes === null || defaultTemplateTypes === void 0 ? void 0 : defaultTemplateTypes.find(_ref7 => {
  11735. let {
  11736. slug: _slug
  11737. } = _ref7;
  11738. return _slug === generalTemplateSlug;
  11739. });
  11740. const hasGeneralTemplate = existingTemplateSlugs === null || existingTemplateSlugs === void 0 ? void 0 : existingTemplateSlugs.includes(generalTemplateSlug);
  11741. const _needsUniqueIdentifier = needsUniqueIdentifier(postType);
  11742. let menuItemTitle = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post".
  11743. (0,external_wp_i18n_namespaceObject.__)('Single item: %s'), labels.singular_name);
  11744. if (_needsUniqueIdentifier) {
  11745. menuItemTitle = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book".
  11746. (0,external_wp_i18n_namespaceObject.__)('Single item: %1$s (%2$s)'), labels.singular_name, slug);
  11747. }
  11748. const menuItem = defaultTemplateType ? { ...defaultTemplateType,
  11749. templatePrefix: templatePrefixes[slug]
  11750. } : {
  11751. slug: generalTemplateSlug,
  11752. title: menuItemTitle,
  11753. description: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post".
  11754. (0,external_wp_i18n_namespaceObject.__)('Displays a single item: %s.'), labels.singular_name),
  11755. // `icon` is the `menu_icon` property of a post type. We
  11756. // only handle `dashicons` for now, even if the `menu_icon`
  11757. // also supports urls and svg as values.
  11758. icon: icon !== null && icon !== void 0 && icon.startsWith('dashicons-') ? icon.slice(10) : library_post,
  11759. templatePrefix: templatePrefixes[slug]
  11760. };
  11761. const hasEntities = postTypesInfo === null || postTypesInfo === void 0 ? void 0 : (_postTypesInfo$slug = postTypesInfo[slug]) === null || _postTypesInfo$slug === void 0 ? void 0 : _postTypesInfo$slug.hasEntities; // We have a different template creation flow only if they have entities.
  11762. if (hasEntities) {
  11763. menuItem.onClick = template => {
  11764. onClickMenuItem({
  11765. type: 'postType',
  11766. slug,
  11767. config: {
  11768. recordNamePath: 'title.rendered',
  11769. queryArgs: _ref8 => {
  11770. let {
  11771. search
  11772. } = _ref8;
  11773. return {
  11774. _fields: 'id,title,slug,link',
  11775. orderBy: search ? 'relevance' : 'modified',
  11776. exclude: postTypesInfo[slug].existingEntitiesIds
  11777. };
  11778. },
  11779. getSpecificTemplate: suggestion => {
  11780. const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`;
  11781. return {
  11782. title: templateSlug,
  11783. slug: templateSlug,
  11784. templatePrefix: templatePrefixes[slug]
  11785. };
  11786. }
  11787. },
  11788. labels,
  11789. hasGeneralTemplate,
  11790. template
  11791. });
  11792. };
  11793. } // We don't need to add the menu item if there are no
  11794. // entities and the general template exists.
  11795. if (!hasGeneralTemplate || hasEntities) {
  11796. accumulator.push(menuItem);
  11797. }
  11798. return accumulator;
  11799. }, []); // Split menu items into two groups: one for the default post types
  11800. // and one for the rest.
  11801. const postTypesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, postType) => {
  11802. const {
  11803. slug
  11804. } = postType;
  11805. let key = 'postTypesMenuItems';
  11806. if (slug === 'page') {
  11807. key = 'defaultPostTypesMenuItems';
  11808. }
  11809. accumulator[key].push(postType);
  11810. return accumulator;
  11811. }, {
  11812. defaultPostTypesMenuItems: [],
  11813. postTypesMenuItems: []
  11814. }), [menuItems]);
  11815. return postTypesMenuItems;
  11816. };
  11817. const useTaxonomiesMenuItems = onClickMenuItem => {
  11818. const publicTaxonomies = usePublicTaxonomies();
  11819. const existingTemplates = useExistingTemplates();
  11820. const defaultTemplateTypes = useDefaultTemplateTypes(); // `category` and `post_tag` are special cases in template hierarchy.
  11821. const templatePrefixes = (0,external_wp_element_namespaceObject.useMemo)(() => publicTaxonomies === null || publicTaxonomies === void 0 ? void 0 : publicTaxonomies.reduce((accumulator, _ref9) => {
  11822. let {
  11823. slug
  11824. } = _ref9;
  11825. let suffix = slug;
  11826. if (!['category', 'post_tag'].includes(slug)) {
  11827. suffix = `taxonomy-${suffix}`;
  11828. }
  11829. if (slug === 'post_tag') {
  11830. suffix = `tag`;
  11831. }
  11832. accumulator[slug] = suffix;
  11833. return accumulator;
  11834. }, {}), [publicTaxonomies]); // We need to keep track of naming conflicts. If a conflict
  11835. // occurs, we need to add slug.
  11836. const taxonomyLabels = publicTaxonomies === null || publicTaxonomies === void 0 ? void 0 : publicTaxonomies.reduce((accumulator, _ref10) => {
  11837. let {
  11838. labels
  11839. } = _ref10;
  11840. const singularName = labels.singular_name.toLowerCase();
  11841. accumulator[singularName] = (accumulator[singularName] || 0) + 1;
  11842. return accumulator;
  11843. }, {});
  11844. const needsUniqueIdentifier = (labels, slug) => {
  11845. if (['category', 'post_tag'].includes(slug)) {
  11846. return false;
  11847. }
  11848. const singularName = labels.singular_name.toLowerCase();
  11849. return taxonomyLabels[singularName] > 1 && singularName !== slug;
  11850. };
  11851. const taxonomiesInfo = useEntitiesInfo('taxonomy', templatePrefixes);
  11852. const existingTemplateSlugs = (existingTemplates || []).map(_ref11 => {
  11853. let {
  11854. slug
  11855. } = _ref11;
  11856. return slug;
  11857. });
  11858. const menuItems = (publicTaxonomies || []).reduce((accumulator, taxonomy) => {
  11859. var _taxonomiesInfo$slug;
  11860. const {
  11861. slug,
  11862. labels
  11863. } = taxonomy; // We need to check if the general template is part of the
  11864. // defaultTemplateTypes. If it is, just use that info and
  11865. // augment it with the specific template functionality.
  11866. const generalTemplateSlug = templatePrefixes[slug];
  11867. const defaultTemplateType = defaultTemplateTypes === null || defaultTemplateTypes === void 0 ? void 0 : defaultTemplateTypes.find(_ref12 => {
  11868. let {
  11869. slug: _slug
  11870. } = _ref12;
  11871. return _slug === generalTemplateSlug;
  11872. });
  11873. const hasGeneralTemplate = existingTemplateSlugs === null || existingTemplateSlugs === void 0 ? void 0 : existingTemplateSlugs.includes(generalTemplateSlug);
  11874. const _needsUniqueIdentifier = needsUniqueIdentifier(labels, slug);
  11875. let menuItemTitle = labels.singular_name;
  11876. if (_needsUniqueIdentifier) {
  11877. menuItemTitle = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
  11878. (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s)'), labels.singular_name, slug);
  11879. }
  11880. const menuItem = defaultTemplateType ? { ...defaultTemplateType,
  11881. templatePrefix: templatePrefixes[slug]
  11882. } : {
  11883. slug: generalTemplateSlug,
  11884. title: menuItemTitle,
  11885. description: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the taxonomy e.g: "Product Categories".
  11886. (0,external_wp_i18n_namespaceObject.__)('Displays taxonomy: %s.'), labels.singular_name),
  11887. icon: block_meta,
  11888. templatePrefix: templatePrefixes[slug]
  11889. };
  11890. const hasEntities = taxonomiesInfo === null || taxonomiesInfo === void 0 ? void 0 : (_taxonomiesInfo$slug = taxonomiesInfo[slug]) === null || _taxonomiesInfo$slug === void 0 ? void 0 : _taxonomiesInfo$slug.hasEntities; // We have a different template creation flow only if they have entities.
  11891. if (hasEntities) {
  11892. menuItem.onClick = template => {
  11893. onClickMenuItem({
  11894. type: 'taxonomy',
  11895. slug,
  11896. config: {
  11897. queryArgs: _ref13 => {
  11898. let {
  11899. search
  11900. } = _ref13;
  11901. return {
  11902. _fields: 'id,name,slug,link',
  11903. orderBy: search ? 'name' : 'count',
  11904. exclude: taxonomiesInfo[slug].existingEntitiesIds
  11905. };
  11906. },
  11907. getSpecificTemplate: suggestion => {
  11908. const templateSlug = `${templatePrefixes[slug]}-${suggestion.slug}`;
  11909. return {
  11910. title: templateSlug,
  11911. slug: templateSlug,
  11912. templatePrefix: templatePrefixes[slug]
  11913. };
  11914. }
  11915. },
  11916. labels,
  11917. hasGeneralTemplate,
  11918. template
  11919. });
  11920. };
  11921. } // We don't need to add the menu item if there are no
  11922. // entities and the general template exists.
  11923. if (!hasGeneralTemplate || hasEntities) {
  11924. accumulator.push(menuItem);
  11925. }
  11926. return accumulator;
  11927. }, []); // Split menu items into two groups: one for the default taxonomies
  11928. // and one for the rest.
  11929. const taxonomiesMenuItems = (0,external_wp_element_namespaceObject.useMemo)(() => menuItems.reduce((accumulator, taxonomy) => {
  11930. const {
  11931. slug
  11932. } = taxonomy;
  11933. let key = 'taxonomiesMenuItems';
  11934. if (['category', 'tag'].includes(slug)) {
  11935. key = 'defaultTaxonomiesMenuItems';
  11936. }
  11937. accumulator[key].push(taxonomy);
  11938. return accumulator;
  11939. }, {
  11940. defaultTaxonomiesMenuItems: [],
  11941. taxonomiesMenuItems: []
  11942. }), [menuItems]);
  11943. return taxonomiesMenuItems;
  11944. };
  11945. const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = {
  11946. user: 'author'
  11947. };
  11948. const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = {
  11949. user: {
  11950. who: 'authors'
  11951. }
  11952. };
  11953. function useAuthorMenuItem(onClickMenuItem) {
  11954. var _authorInfo$user, _authorInfo$user2;
  11955. const existingTemplates = useExistingTemplates();
  11956. const defaultTemplateTypes = useDefaultTemplateTypes();
  11957. const authorInfo = useEntitiesInfo('root', USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX, USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS);
  11958. let authorMenuItem = defaultTemplateTypes === null || defaultTemplateTypes === void 0 ? void 0 : defaultTemplateTypes.find(_ref14 => {
  11959. let {
  11960. slug
  11961. } = _ref14;
  11962. return slug === 'author';
  11963. });
  11964. if (!authorMenuItem) {
  11965. authorMenuItem = {
  11966. description: (0,external_wp_i18n_namespaceObject.__)('Displays latest posts written by a single author.'),
  11967. slug: 'author',
  11968. title: 'Author'
  11969. };
  11970. }
  11971. const hasGeneralTemplate = !!(existingTemplates !== null && existingTemplates !== void 0 && existingTemplates.find(_ref15 => {
  11972. let {
  11973. slug
  11974. } = _ref15;
  11975. return slug === 'author';
  11976. }));
  11977. if ((_authorInfo$user = authorInfo.user) !== null && _authorInfo$user !== void 0 && _authorInfo$user.hasEntities) {
  11978. authorMenuItem = { ...authorMenuItem,
  11979. templatePrefix: 'author'
  11980. };
  11981. authorMenuItem.onClick = template => {
  11982. onClickMenuItem({
  11983. type: 'root',
  11984. slug: 'user',
  11985. config: {
  11986. queryArgs: _ref16 => {
  11987. let {
  11988. search
  11989. } = _ref16;
  11990. return {
  11991. _fields: 'id,name,slug,link',
  11992. orderBy: search ? 'name' : 'registered_date',
  11993. exclude: authorInfo.user.existingEntitiesIds,
  11994. who: 'authors'
  11995. };
  11996. },
  11997. getSpecificTemplate: suggestion => {
  11998. const templateSlug = `author-${suggestion.slug}`;
  11999. return {
  12000. title: templateSlug,
  12001. slug: templateSlug,
  12002. templatePrefix: 'author'
  12003. };
  12004. }
  12005. },
  12006. labels: {
  12007. singular_name: (0,external_wp_i18n_namespaceObject.__)('Author'),
  12008. search_items: (0,external_wp_i18n_namespaceObject.__)('Search Authors'),
  12009. not_found: (0,external_wp_i18n_namespaceObject.__)('No authors found.'),
  12010. all_items: (0,external_wp_i18n_namespaceObject.__)('All Authors')
  12011. },
  12012. hasGeneralTemplate,
  12013. template
  12014. });
  12015. };
  12016. }
  12017. if (!hasGeneralTemplate || (_authorInfo$user2 = authorInfo.user) !== null && _authorInfo$user2 !== void 0 && _authorInfo$user2.hasEntities) {
  12018. return authorMenuItem;
  12019. }
  12020. }
  12021. /**
  12022. * Helper hook that filters all the existing templates by the given
  12023. * object with the entity's slug as key and the template prefix as value.
  12024. *
  12025. * Example:
  12026. * `existingTemplates` is: [ { slug: 'tag-apple' }, { slug: 'page-about' }, { slug: 'tag' } ]
  12027. * `templatePrefixes` is: { post_tag: 'tag' }
  12028. * It will return: { post_tag: ['apple'] }
  12029. *
  12030. * Note: We append the `-` to the given template prefix in this function for our checks.
  12031. *
  12032. * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
  12033. * @return {Record<string,string[]>} An object with the entity's slug as key and an array with the existing template slugs as value.
  12034. */
  12035. const useExistingTemplateSlugs = templatePrefixes => {
  12036. const existingTemplates = useExistingTemplates();
  12037. const existingSlugs = (0,external_wp_element_namespaceObject.useMemo)(() => {
  12038. return Object.entries(templatePrefixes || {}).reduce((accumulator, _ref17) => {
  12039. let [slug, prefix] = _ref17;
  12040. const slugsWithTemplates = (existingTemplates || []).reduce((_accumulator, existingTemplate) => {
  12041. const _prefix = `${prefix}-`;
  12042. if (existingTemplate.slug.startsWith(_prefix)) {
  12043. _accumulator.push(existingTemplate.slug.substring(_prefix.length));
  12044. }
  12045. return _accumulator;
  12046. }, []);
  12047. if (slugsWithTemplates.length) {
  12048. accumulator[slug] = slugsWithTemplates;
  12049. }
  12050. return accumulator;
  12051. }, {});
  12052. }, [templatePrefixes, existingTemplates]);
  12053. return existingSlugs;
  12054. };
  12055. /**
  12056. * Helper hook that finds the existing records with an associated template,
  12057. * as they need to be excluded from the template suggestions.
  12058. *
  12059. * @param {string} entityName The entity's name.
  12060. * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
  12061. * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
  12062. * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the existing records as value.
  12063. */
  12064. const useTemplatesToExclude = function (entityName, templatePrefixes) {
  12065. let additionalQueryParameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  12066. const slugsToExcludePerEntity = useExistingTemplateSlugs(templatePrefixes);
  12067. const recordsToExcludePerEntity = (0,external_wp_data_namespaceObject.useSelect)(select => {
  12068. return Object.entries(slugsToExcludePerEntity || {}).reduce((accumulator, _ref18) => {
  12069. let [slug, slugsWithTemplates] = _ref18;
  12070. const entitiesWithTemplates = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, {
  12071. _fields: 'id',
  12072. context: 'view',
  12073. slug: slugsWithTemplates,
  12074. ...additionalQueryParameters[slug]
  12075. });
  12076. if (entitiesWithTemplates !== null && entitiesWithTemplates !== void 0 && entitiesWithTemplates.length) {
  12077. accumulator[slug] = entitiesWithTemplates;
  12078. }
  12079. return accumulator;
  12080. }, {});
  12081. }, [slugsToExcludePerEntity]);
  12082. return recordsToExcludePerEntity;
  12083. };
  12084. /**
  12085. * Helper hook that returns information about an entity having
  12086. * records that we can create a specific template for.
  12087. *
  12088. * For example we can search for `terms` in `taxonomy` entity or
  12089. * `posts` in `postType` entity.
  12090. *
  12091. * First we need to find the existing records with an associated template,
  12092. * to query afterwards for any remaining record, by excluding them.
  12093. *
  12094. * @param {string} entityName The entity's name.
  12095. * @param {Record<string,string>} templatePrefixes An object with the entity's slug as key and the template prefix as value.
  12096. * @param {Record<string,Object>} additionalQueryParameters An object with the entity's slug as key and additional query parameters as value.
  12097. * @return {Record<string,EntitiesInfo>} An object with the entity's slug as key and the EntitiesInfo as value.
  12098. */
  12099. const useEntitiesInfo = function (entityName, templatePrefixes) {
  12100. let additionalQueryParameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  12101. const recordsToExcludePerEntity = useTemplatesToExclude(entityName, templatePrefixes, additionalQueryParameters);
  12102. const entitiesInfo = (0,external_wp_data_namespaceObject.useSelect)(select => {
  12103. return Object.keys(templatePrefixes || {}).reduce((accumulator, slug) => {
  12104. var _recordsToExcludePerE, _select$getEntityReco;
  12105. const existingEntitiesIds = (recordsToExcludePerEntity === null || recordsToExcludePerEntity === void 0 ? void 0 : (_recordsToExcludePerE = recordsToExcludePerEntity[slug]) === null || _recordsToExcludePerE === void 0 ? void 0 : _recordsToExcludePerE.map(_ref19 => {
  12106. let {
  12107. id
  12108. } = _ref19;
  12109. return id;
  12110. })) || [];
  12111. accumulator[slug] = {
  12112. hasEntities: !!((_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords(entityName, slug, {
  12113. per_page: 1,
  12114. _fields: 'id',
  12115. context: 'view',
  12116. exclude: existingEntitiesIds,
  12117. ...additionalQueryParameters[slug]
  12118. })) !== null && _select$getEntityReco !== void 0 && _select$getEntityReco.length),
  12119. existingEntitiesIds
  12120. };
  12121. return accumulator;
  12122. }, {});
  12123. }, [templatePrefixes, recordsToExcludePerEntity]);
  12124. return entitiesInfo;
  12125. };
  12126. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-template-modal.js
  12127. /**
  12128. * WordPress dependencies
  12129. */
  12130. /**
  12131. * Internal dependencies
  12132. */
  12133. const EMPTY_ARRAY = [];
  12134. function SuggestionListItem(_ref) {
  12135. let {
  12136. suggestion,
  12137. search,
  12138. onSelect,
  12139. entityForSuggestions,
  12140. composite
  12141. } = _ref;
  12142. const baseCssClass = 'edit-site-custom-template-modal__suggestions_list__list-item';
  12143. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableCompositeItem, extends_extends({
  12144. role: "option",
  12145. as: external_wp_components_namespaceObject.Button
  12146. }, composite, {
  12147. className: baseCssClass,
  12148. onClick: () => onSelect(entityForSuggestions.config.getSpecificTemplate(suggestion))
  12149. }), (0,external_wp_element_namespaceObject.createElement)("span", {
  12150. className: `${baseCssClass}__title`
  12151. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextHighlight, {
  12152. text: suggestion.name,
  12153. highlight: search
  12154. })), suggestion.link && (0,external_wp_element_namespaceObject.createElement)("span", {
  12155. className: `${baseCssClass}__info`
  12156. }, suggestion.link));
  12157. }
  12158. function useDebouncedInput() {
  12159. const [input, setInput] = (0,external_wp_element_namespaceObject.useState)('');
  12160. const [debounced, setter] = (0,external_wp_element_namespaceObject.useState)('');
  12161. const setDebounced = (0,external_wp_compose_namespaceObject.useDebounce)(setter, 250);
  12162. (0,external_wp_element_namespaceObject.useEffect)(() => {
  12163. if (debounced !== input) {
  12164. setDebounced(input);
  12165. }
  12166. }, [debounced, input]);
  12167. return [input, setInput, debounced];
  12168. }
  12169. function useSearchSuggestions(entityForSuggestions, search) {
  12170. const {
  12171. config
  12172. } = entityForSuggestions;
  12173. const query = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  12174. order: 'asc',
  12175. context: 'view',
  12176. search,
  12177. per_page: search ? 20 : 10,
  12178. ...config.queryArgs(search)
  12179. }), [search, config]);
  12180. const {
  12181. records: searchResults,
  12182. hasResolved: searchHasResolved
  12183. } = (0,external_wp_coreData_namespaceObject.useEntityRecords)(entityForSuggestions.type, entityForSuggestions.slug, query);
  12184. const [suggestions, setSuggestions] = (0,external_wp_element_namespaceObject.useState)(EMPTY_ARRAY);
  12185. (0,external_wp_element_namespaceObject.useEffect)(() => {
  12186. if (!searchHasResolved) return;
  12187. let newSuggestions = EMPTY_ARRAY;
  12188. if (searchResults !== null && searchResults !== void 0 && searchResults.length) {
  12189. newSuggestions = searchResults;
  12190. if (config.recordNamePath) {
  12191. newSuggestions = mapToIHasNameAndId(newSuggestions, config.recordNamePath);
  12192. }
  12193. } // Update suggestions only when the query has resolved, so as to keep
  12194. // the previous results in the UI.
  12195. setSuggestions(newSuggestions);
  12196. }, [searchResults, searchHasResolved]);
  12197. return suggestions;
  12198. }
  12199. function SuggestionList(_ref2) {
  12200. let {
  12201. entityForSuggestions,
  12202. onSelect
  12203. } = _ref2;
  12204. const composite = (0,external_wp_components_namespaceObject.__unstableUseCompositeState)({
  12205. orientation: 'vertical'
  12206. });
  12207. const [search, setSearch, debouncedSearch] = useDebouncedInput();
  12208. const suggestions = useSearchSuggestions(entityForSuggestions, debouncedSearch);
  12209. const {
  12210. labels
  12211. } = entityForSuggestions;
  12212. const [showSearchControl, setShowSearchControl] = (0,external_wp_element_namespaceObject.useState)(false);
  12213. if (!showSearchControl && (suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 9) {
  12214. setShowSearchControl(true);
  12215. }
  12216. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showSearchControl && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
  12217. onChange: setSearch,
  12218. value: search,
  12219. label: labels.search_items,
  12220. placeholder: labels.search_items
  12221. }), !!(suggestions !== null && suggestions !== void 0 && suggestions.length) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableComposite, extends_extends({}, composite, {
  12222. role: "listbox",
  12223. className: "edit-site-custom-template-modal__suggestions_list",
  12224. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Suggestions list')
  12225. }), suggestions.map(suggestion => (0,external_wp_element_namespaceObject.createElement)(SuggestionListItem, {
  12226. key: suggestion.slug,
  12227. suggestion: suggestion,
  12228. search: debouncedSearch,
  12229. onSelect: onSelect,
  12230. entityForSuggestions: entityForSuggestions,
  12231. composite: composite
  12232. }))), debouncedSearch && !(suggestions !== null && suggestions !== void 0 && suggestions.length) && (0,external_wp_element_namespaceObject.createElement)("p", {
  12233. className: "edit-site-custom-template-modal__no-results"
  12234. }, labels.not_found));
  12235. }
  12236. function AddCustomTemplateModal(_ref3) {
  12237. let {
  12238. onClose,
  12239. onSelect,
  12240. entityForSuggestions
  12241. } = _ref3;
  12242. const [showSearchEntities, setShowSearchEntities] = (0,external_wp_element_namespaceObject.useState)(entityForSuggestions.hasGeneralTemplate);
  12243. const baseCssClass = 'edit-site-custom-template-modal';
  12244. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  12245. title: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Name of the post type e.g: "Post".
  12246. (0,external_wp_i18n_namespaceObject.__)('Add template: %s'), entityForSuggestions.labels.singular_name),
  12247. className: baseCssClass,
  12248. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  12249. onRequestClose: onClose
  12250. }, !showSearchEntities && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Select whether to create a single template for all items or a specific one.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  12251. className: `${baseCssClass}__contents`,
  12252. gap: "4",
  12253. align: "initial"
  12254. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  12255. isBlock: true,
  12256. as: external_wp_components_namespaceObject.Button,
  12257. onClick: () => {
  12258. const {
  12259. slug,
  12260. title,
  12261. description,
  12262. templatePrefix
  12263. } = entityForSuggestions.template;
  12264. onSelect({
  12265. slug,
  12266. title,
  12267. description,
  12268. templatePrefix
  12269. });
  12270. }
  12271. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  12272. as: "span",
  12273. weight: 600
  12274. }, entityForSuggestions.labels.all_items), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  12275. as: "span"
  12276. }, // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
  12277. (0,external_wp_i18n_namespaceObject.__)('For all items'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, {
  12278. isBlock: true,
  12279. as: external_wp_components_namespaceObject.Button,
  12280. onClick: () => {
  12281. setShowSearchEntities(true);
  12282. }
  12283. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  12284. as: "span",
  12285. weight: 600
  12286. }, entityForSuggestions.labels.singular_name), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  12287. as: "span"
  12288. }, // translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.
  12289. (0,external_wp_i18n_namespaceObject.__)('For a specific item'))))), showSearchEntities && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('This template will be used only for the specific item chosen.')), (0,external_wp_element_namespaceObject.createElement)(SuggestionList, {
  12290. entityForSuggestions: entityForSuggestions,
  12291. onSelect: onSelect
  12292. })));
  12293. }
  12294. /* harmony default export */ var add_custom_template_modal = (AddCustomTemplateModal);
  12295. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/add-custom-generic-template-modal.js
  12296. /**
  12297. * External dependencies
  12298. */
  12299. /**
  12300. * WordPress dependencies
  12301. */
  12302. function AddCustomGenericTemplateModal(_ref) {
  12303. let {
  12304. onClose,
  12305. createTemplate
  12306. } = _ref;
  12307. const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
  12308. const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
  12309. const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
  12310. async function onCreateTemplate(event) {
  12311. event.preventDefault();
  12312. if (isBusy) {
  12313. return;
  12314. }
  12315. setIsBusy(true);
  12316. createTemplate({
  12317. slug: 'wp-custom-template-' + (0,external_lodash_namespaceObject.kebabCase)(title || defaultTitle),
  12318. title: title || defaultTitle
  12319. }, false);
  12320. }
  12321. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  12322. title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
  12323. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  12324. onRequestClose: () => {
  12325. onClose();
  12326. },
  12327. overlayClassName: "edit-site-custom-generic-template__modal"
  12328. }, (0,external_wp_element_namespaceObject.createElement)("form", {
  12329. onSubmit: onCreateTemplate
  12330. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  12331. align: "flex-start",
  12332. gap: 8
  12333. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  12334. label: (0,external_wp_i18n_namespaceObject.__)('Name'),
  12335. value: title,
  12336. onChange: setTitle,
  12337. placeholder: defaultTitle,
  12338. disabled: isBusy,
  12339. help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar".')
  12340. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  12341. className: "edit-site-custom-generic-template__modal-actions",
  12342. justify: "flex-end",
  12343. expanded: false
  12344. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  12345. variant: "tertiary",
  12346. onClick: () => {
  12347. onClose();
  12348. }
  12349. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  12350. variant: "primary",
  12351. type: "submit",
  12352. isBusy: isBusy,
  12353. "aria-disabled": isBusy
  12354. }, (0,external_wp_i18n_namespaceObject.__)('Create'))))));
  12355. }
  12356. /* harmony default export */ var add_custom_generic_template_modal = (AddCustomGenericTemplateModal);
  12357. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template.js
  12358. /**
  12359. * WordPress dependencies
  12360. */
  12361. /**
  12362. * Internal dependencies
  12363. */
  12364. const DEFAULT_TEMPLATE_SLUGS = ['front-page', 'single', 'page', 'index', 'archive', 'author', 'category', 'date', 'tag', 'taxonomy', 'search', '404'];
  12365. const TEMPLATE_ICONS = {
  12366. 'front-page': library_home,
  12367. single: library_post,
  12368. page: library_page,
  12369. archive: library_archive,
  12370. search: library_search,
  12371. 404: not_found,
  12372. index: library_list,
  12373. category: library_category,
  12374. author: post_author,
  12375. taxonomy: block_meta,
  12376. date: post_date,
  12377. tag: library_tag,
  12378. attachment: library_media
  12379. };
  12380. function NewTemplate(_ref) {
  12381. let {
  12382. postType
  12383. } = _ref;
  12384. const [showCustomTemplateModal, setShowCustomTemplateModal] = (0,external_wp_element_namespaceObject.useState)(false);
  12385. const [showCustomGenericTemplateModal, setShowCustomGenericTemplateModal] = (0,external_wp_element_namespaceObject.useState)(false);
  12386. const [entityForSuggestions, setEntityForSuggestions] = (0,external_wp_element_namespaceObject.useState)({});
  12387. const history = useHistory();
  12388. const {
  12389. saveEntityRecord
  12390. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  12391. const {
  12392. createErrorNotice,
  12393. createSuccessNotice
  12394. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  12395. const {
  12396. setTemplate
  12397. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  12398. async function createTemplate(template) {
  12399. let isWPSuggestion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  12400. try {
  12401. const {
  12402. title,
  12403. description,
  12404. slug,
  12405. templatePrefix
  12406. } = template;
  12407. let templateContent = template.content; // Try to find fallback content from existing templates.
  12408. if (!templateContent) {
  12409. const fallbackTemplate = await external_wp_apiFetch_default()({
  12410. path: (0,external_wp_url_namespaceObject.addQueryArgs)('/wp/v2/templates/lookup', {
  12411. slug,
  12412. is_custom: !isWPSuggestion,
  12413. template_prefix: templatePrefix
  12414. })
  12415. });
  12416. templateContent = fallbackTemplate.content.raw;
  12417. }
  12418. const newTemplate = await saveEntityRecord('postType', 'wp_template', {
  12419. description,
  12420. // Slugs need to be strings, so this is for template `404`
  12421. slug: slug.toString(),
  12422. status: 'publish',
  12423. title,
  12424. content: templateContent,
  12425. // This adds a post meta field in template that is part of `is_custom` value calculation.
  12426. is_wp_suggestion: isWPSuggestion
  12427. }, {
  12428. throwOnError: true
  12429. }); // Set template before navigating away to avoid initial stale value.
  12430. setTemplate(newTemplate.id, newTemplate.slug); // Navigate to the created template editor.
  12431. history.push({
  12432. postId: newTemplate.id,
  12433. postType: newTemplate.type
  12434. });
  12435. createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Title of the created template e.g: "Category".
  12436. (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), title), {
  12437. type: 'snackbar'
  12438. });
  12439. } catch (error) {
  12440. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template.');
  12441. createErrorNotice(errorMessage, {
  12442. type: 'snackbar'
  12443. });
  12444. }
  12445. }
  12446. const missingTemplates = useMissingTemplates(setEntityForSuggestions, setShowCustomTemplateModal);
  12447. if (!missingTemplates.length) {
  12448. return null;
  12449. }
  12450. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
  12451. className: "edit-site-new-template-dropdown",
  12452. icon: null,
  12453. text: postType.labels.add_new,
  12454. label: postType.labels.add_new_item,
  12455. popoverProps: {
  12456. noArrow: false
  12457. },
  12458. toggleProps: {
  12459. variant: 'primary'
  12460. }
  12461. }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NavigableMenu, {
  12462. className: "edit-site-new-template-dropdown__popover"
  12463. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  12464. label: postType.labels.add_new_item
  12465. }, missingTemplates.map(template => {
  12466. const {
  12467. title,
  12468. description,
  12469. slug,
  12470. onClick,
  12471. icon
  12472. } = template;
  12473. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  12474. icon: icon || TEMPLATE_ICONS[slug] || library_post,
  12475. iconPosition: "left",
  12476. info: description,
  12477. key: slug,
  12478. onClick: () => onClick ? onClick(template) : createTemplate(template)
  12479. }, title);
  12480. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  12481. icon: library_layout,
  12482. iconPosition: "left",
  12483. info: (0,external_wp_i18n_namespaceObject.__)('Custom templates can be applied to any post or page.'),
  12484. key: "custom-template",
  12485. onClick: () => setShowCustomGenericTemplateModal(true)
  12486. }, (0,external_wp_i18n_namespaceObject.__)('Custom template'))))), showCustomTemplateModal && (0,external_wp_element_namespaceObject.createElement)(add_custom_template_modal, {
  12487. onClose: () => setShowCustomTemplateModal(false),
  12488. onSelect: createTemplate,
  12489. entityForSuggestions: entityForSuggestions
  12490. }), showCustomGenericTemplateModal && (0,external_wp_element_namespaceObject.createElement)(add_custom_generic_template_modal, {
  12491. onClose: () => setShowCustomGenericTemplateModal(false),
  12492. createTemplate: createTemplate
  12493. }));
  12494. }
  12495. function useMissingTemplates(setEntityForSuggestions, setShowCustomTemplateModal) {
  12496. const existingTemplates = useExistingTemplates();
  12497. const defaultTemplateTypes = useDefaultTemplateTypes();
  12498. const existingTemplateSlugs = (existingTemplates || []).map(_ref2 => {
  12499. let {
  12500. slug
  12501. } = _ref2;
  12502. return slug;
  12503. });
  12504. const missingDefaultTemplates = (defaultTemplateTypes || []).filter(template => DEFAULT_TEMPLATE_SLUGS.includes(template.slug) && !existingTemplateSlugs.includes(template.slug));
  12505. const onClickMenuItem = _entityForSuggestions => {
  12506. setShowCustomTemplateModal(true);
  12507. setEntityForSuggestions(_entityForSuggestions);
  12508. }; // We need to replace existing default template types with
  12509. // the create specific template functionality. The original
  12510. // info (title, description, etc.) is preserved in the
  12511. // used hooks.
  12512. const enhancedMissingDefaultTemplateTypes = [...missingDefaultTemplates];
  12513. const {
  12514. defaultTaxonomiesMenuItems,
  12515. taxonomiesMenuItems
  12516. } = useTaxonomiesMenuItems(onClickMenuItem);
  12517. const {
  12518. defaultPostTypesMenuItems,
  12519. postTypesMenuItems
  12520. } = usePostTypeMenuItems(onClickMenuItem);
  12521. const authorMenuItem = useAuthorMenuItem(onClickMenuItem);
  12522. [...defaultTaxonomiesMenuItems, ...defaultPostTypesMenuItems, authorMenuItem].forEach(menuItem => {
  12523. if (!menuItem) {
  12524. return;
  12525. }
  12526. const matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(template => template.slug === menuItem.slug); // Some default template types might have been filtered above from
  12527. // `missingDefaultTemplates` because they only check for the general
  12528. // template. So here we either replace or append the item, augmented
  12529. // with the check if it has available specific item to create a
  12530. // template for.
  12531. if (matchIndex > -1) {
  12532. enhancedMissingDefaultTemplateTypes[matchIndex] = menuItem;
  12533. } else {
  12534. enhancedMissingDefaultTemplateTypes.push(menuItem);
  12535. }
  12536. }); // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.
  12537. enhancedMissingDefaultTemplateTypes === null || enhancedMissingDefaultTemplateTypes === void 0 ? void 0 : enhancedMissingDefaultTemplateTypes.sort((template1, template2) => {
  12538. return DEFAULT_TEMPLATE_SLUGS.indexOf(template1.slug) - DEFAULT_TEMPLATE_SLUGS.indexOf(template2.slug);
  12539. });
  12540. const missingTemplates = [...enhancedMissingDefaultTemplateTypes, ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems];
  12541. return missingTemplates;
  12542. }
  12543. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/new-template-part.js
  12544. /**
  12545. * External dependencies
  12546. */
  12547. /**
  12548. * WordPress dependencies
  12549. */
  12550. /**
  12551. * Internal dependencies
  12552. */
  12553. function NewTemplatePart(_ref) {
  12554. let {
  12555. postType
  12556. } = _ref;
  12557. const history = useHistory();
  12558. const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  12559. const {
  12560. createErrorNotice
  12561. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  12562. const {
  12563. saveEntityRecord
  12564. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  12565. async function createTemplatePart(_ref2) {
  12566. let {
  12567. title,
  12568. area
  12569. } = _ref2;
  12570. if (!title) {
  12571. createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Title is not defined.'), {
  12572. type: 'snackbar'
  12573. });
  12574. return;
  12575. }
  12576. try {
  12577. // Currently template parts only allow latin chars.
  12578. // Fallback slug will receive suffix by default.
  12579. const cleanSlug = (0,external_lodash_namespaceObject.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
  12580. const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
  12581. slug: cleanSlug,
  12582. title,
  12583. content: '',
  12584. area
  12585. }, {
  12586. throwOnError: true
  12587. });
  12588. setIsModalOpen(false); // Navigate to the created template part editor.
  12589. history.push({
  12590. postId: templatePart.id,
  12591. postType: templatePart.type
  12592. }); // TODO: Add a success notice?
  12593. } catch (error) {
  12594. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while creating the template part.');
  12595. createErrorNotice(errorMessage, {
  12596. type: 'snackbar'
  12597. });
  12598. setIsModalOpen(false);
  12599. }
  12600. }
  12601. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  12602. variant: "primary",
  12603. onClick: () => {
  12604. setIsModalOpen(true);
  12605. }
  12606. }, postType.labels.add_new), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(CreateTemplatePartModal, {
  12607. closeModal: () => setIsModalOpen(false),
  12608. onCreate: createTemplatePart
  12609. }));
  12610. }
  12611. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/add-new-template/index.js
  12612. /**
  12613. * WordPress dependencies
  12614. */
  12615. /**
  12616. * Internal dependencies
  12617. */
  12618. function AddNewTemplate(_ref) {
  12619. let {
  12620. templateType = 'wp_template'
  12621. } = _ref;
  12622. const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
  12623. if (!postType) {
  12624. return null;
  12625. }
  12626. if (templateType === 'wp_template') {
  12627. return (0,external_wp_element_namespaceObject.createElement)(NewTemplate, {
  12628. postType: postType
  12629. });
  12630. } else if (templateType === 'wp_template_part') {
  12631. return (0,external_wp_element_namespaceObject.createElement)(NewTemplatePart, {
  12632. postType: postType
  12633. });
  12634. }
  12635. return null;
  12636. }
  12637. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/header.js
  12638. /**
  12639. * WordPress dependencies
  12640. */
  12641. /**
  12642. * Internal dependencies
  12643. */
  12644. function header_Header(_ref) {
  12645. var _postType$labels;
  12646. let {
  12647. templateType
  12648. } = _ref;
  12649. const {
  12650. canCreate,
  12651. postType
  12652. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  12653. const {
  12654. supportsTemplatePartsMode
  12655. } = select(store_store).getSettings();
  12656. return {
  12657. postType: select(external_wp_coreData_namespaceObject.store).getPostType(templateType),
  12658. canCreate: !supportsTemplatePartsMode
  12659. };
  12660. }, [templateType]);
  12661. if (!postType) {
  12662. return null;
  12663. }
  12664. return (0,external_wp_element_namespaceObject.createElement)("header", {
  12665. className: "edit-site-list-header"
  12666. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  12667. level: 1,
  12668. className: "edit-site-list-header__title"
  12669. }, (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name), canCreate && (0,external_wp_element_namespaceObject.createElement)("div", {
  12670. className: "edit-site-list-header__right"
  12671. }, (0,external_wp_element_namespaceObject.createElement)(AddNewTemplate, {
  12672. templateType: templateType
  12673. })));
  12674. }
  12675. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/is-template-removable.js
  12676. /**
  12677. * Check if a template is removable.
  12678. *
  12679. * @param {Object} template The template entity to check.
  12680. * @return {boolean} Whether the template is revertable.
  12681. */
  12682. function isTemplateRemovable(template) {
  12683. if (!template) {
  12684. return false;
  12685. }
  12686. return template.source === 'custom' && !template.has_theme_file;
  12687. }
  12688. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/rename-menu-item.js
  12689. /**
  12690. * WordPress dependencies
  12691. */
  12692. function RenameMenuItem(_ref) {
  12693. let {
  12694. template,
  12695. onClose
  12696. } = _ref;
  12697. const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(() => template.title.rendered);
  12698. const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  12699. const {
  12700. editEntityRecord,
  12701. saveEditedEntityRecord
  12702. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  12703. const {
  12704. createSuccessNotice,
  12705. createErrorNotice
  12706. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  12707. if (!template.is_custom) {
  12708. return null;
  12709. }
  12710. async function onTemplateRename(event) {
  12711. event.preventDefault();
  12712. try {
  12713. await editEntityRecord('postType', template.type, template.id, {
  12714. title
  12715. }); // Update state before saving rerenders the list.
  12716. setTitle('');
  12717. setIsModalOpen(false);
  12718. onClose(); // Persist edited entity.
  12719. await saveEditedEntityRecord('postType', template.type, template.id, {
  12720. throwOnError: true
  12721. });
  12722. createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity renamed.'), {
  12723. type: 'snackbar'
  12724. });
  12725. } catch (error) {
  12726. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while renaming the entity.');
  12727. createErrorNotice(errorMessage, {
  12728. type: 'snackbar'
  12729. });
  12730. }
  12731. }
  12732. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  12733. onClick: () => {
  12734. setIsModalOpen(true);
  12735. setTitle(template.title.rendered);
  12736. }
  12737. }, (0,external_wp_i18n_namespaceObject.__)('Rename')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  12738. title: (0,external_wp_i18n_namespaceObject.__)('Rename'),
  12739. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  12740. onRequestClose: () => {
  12741. setIsModalOpen(false);
  12742. },
  12743. overlayClassName: "edit-site-list__rename-modal"
  12744. }, (0,external_wp_element_namespaceObject.createElement)("form", {
  12745. onSubmit: onTemplateRename
  12746. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  12747. align: "flex-start",
  12748. gap: 8
  12749. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  12750. label: (0,external_wp_i18n_namespaceObject.__)('Name'),
  12751. value: title,
  12752. onChange: setTitle,
  12753. required: true
  12754. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  12755. className: "edit-site-list__rename-modal-actions",
  12756. justify: "flex-end",
  12757. expanded: false
  12758. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  12759. variant: "tertiary",
  12760. onClick: () => {
  12761. setIsModalOpen(false);
  12762. }
  12763. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  12764. variant: "primary",
  12765. type: "submit"
  12766. }, (0,external_wp_i18n_namespaceObject.__)('Save')))))));
  12767. }
  12768. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/actions/index.js
  12769. /**
  12770. * WordPress dependencies
  12771. */
  12772. /**
  12773. * Internal dependencies
  12774. */
  12775. function actions_Actions(_ref) {
  12776. let {
  12777. template
  12778. } = _ref;
  12779. const {
  12780. removeTemplate,
  12781. revertTemplate
  12782. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  12783. const {
  12784. saveEditedEntityRecord
  12785. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  12786. const {
  12787. createSuccessNotice,
  12788. createErrorNotice
  12789. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  12790. const isRemovable = isTemplateRemovable(template);
  12791. const isRevertable = isTemplateRevertable(template);
  12792. if (!isRemovable && !isRevertable) {
  12793. return null;
  12794. }
  12795. async function revertAndSaveTemplate() {
  12796. try {
  12797. await revertTemplate(template, {
  12798. allowUndo: false
  12799. });
  12800. await saveEditedEntityRecord('postType', template.type, template.id);
  12801. createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Entity reverted.'), {
  12802. type: 'snackbar'
  12803. });
  12804. } catch (error) {
  12805. const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0,external_wp_i18n_namespaceObject.__)('An error occurred while reverting the entity.');
  12806. createErrorNotice(errorMessage, {
  12807. type: 'snackbar'
  12808. });
  12809. }
  12810. }
  12811. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
  12812. icon: more_vertical,
  12813. label: (0,external_wp_i18n_namespaceObject.__)('Actions'),
  12814. className: "edit-site-list-table__actions"
  12815. }, _ref2 => {
  12816. let {
  12817. onClose
  12818. } = _ref2;
  12819. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, isRemovable && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(RenameMenuItem, {
  12820. template: template,
  12821. onClose: onClose
  12822. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  12823. isDestructive: true,
  12824. isTertiary: true,
  12825. onClick: () => {
  12826. removeTemplate(template);
  12827. onClose();
  12828. }
  12829. }, (0,external_wp_i18n_namespaceObject.__)('Delete'))), isRevertable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  12830. info: (0,external_wp_i18n_namespaceObject.__)('Use the template as supplied by the theme.'),
  12831. onClick: () => {
  12832. revertAndSaveTemplate();
  12833. onClose();
  12834. }
  12835. }, (0,external_wp_i18n_namespaceObject.__)('Clear customizations')));
  12836. });
  12837. }
  12838. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plugins.js
  12839. /**
  12840. * WordPress dependencies
  12841. */
  12842. const plugins = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  12843. xmlns: "http://www.w3.org/2000/svg",
  12844. viewBox: "0 0 24 24"
  12845. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  12846. d: "M10.5 4v4h3V4H15v4h1.5a1 1 0 011 1v4l-3 4v2a1 1 0 01-1 1h-3a1 1 0 01-1-1v-2l-3-4V9a1 1 0 011-1H9V4h1.5zm.5 12.5v2h2v-2l3-4v-3H8v3l3 4z"
  12847. }));
  12848. /* harmony default export */ var library_plugins = (plugins);
  12849. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/comment-author-avatar.js
  12850. /**
  12851. * WordPress dependencies
  12852. */
  12853. const commentAuthorAvatar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  12854. xmlns: "http://www.w3.org/2000/svg",
  12855. viewBox: "0 0 24 24"
  12856. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  12857. fillRule: "evenodd",
  12858. d: "M7.25 16.437a6.5 6.5 0 1 1 9.5 0V16A2.75 2.75 0 0 0 14 13.25h-4A2.75 2.75 0 0 0 7.25 16v.437Zm1.5 1.193a6.47 6.47 0 0 0 3.25.87 6.47 6.47 0 0 0 3.25-.87V16c0-.69-.56-1.25-1.25-1.25h-4c-.69 0-1.25.56-1.25 1.25v1.63ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm10-2a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z",
  12859. clipRule: "evenodd"
  12860. }));
  12861. /* harmony default export */ var comment_author_avatar = (commentAuthorAvatar);
  12862. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/globe.js
  12863. /**
  12864. * WordPress dependencies
  12865. */
  12866. const globe = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  12867. xmlns: "http://www.w3.org/2000/svg",
  12868. viewBox: "0 0 24 24"
  12869. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  12870. d: "M12 3.3c-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.8s-4-8.8-8.8-8.8zm6.5 5.5h-2.6C15.4 7.3 14.8 6 14 5c2 .6 3.6 2 4.5 3.8zm.7 3.2c0 .6-.1 1.2-.2 1.8h-2.9c.1-.6.1-1.2.1-1.8s-.1-1.2-.1-1.8H19c.2.6.2 1.2.2 1.8zM12 18.7c-1-.7-1.8-1.9-2.3-3.5h4.6c-.5 1.6-1.3 2.9-2.3 3.5zm-2.6-4.9c-.1-.6-.1-1.1-.1-1.8 0-.6.1-1.2.1-1.8h5.2c.1.6.1 1.1.1 1.8s-.1 1.2-.1 1.8H9.4zM4.8 12c0-.6.1-1.2.2-1.8h2.9c-.1.6-.1 1.2-.1 1.8 0 .6.1 1.2.1 1.8H5c-.2-.6-.2-1.2-.2-1.8zM12 5.3c1 .7 1.8 1.9 2.3 3.5H9.7c.5-1.6 1.3-2.9 2.3-3.5zM10 5c-.8 1-1.4 2.3-1.8 3.8H5.5C6.4 7 8 5.6 10 5zM5.5 15.3h2.6c.4 1.5 1 2.8 1.8 3.7-1.8-.6-3.5-2-4.4-3.7zM14 19c.8-1 1.4-2.2 1.8-3.7h2.6C17.6 17 16 18.4 14 19z"
  12871. }));
  12872. /* harmony default export */ var library_globe = (globe);
  12873. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/added-by.js
  12874. /**
  12875. * External dependencies
  12876. */
  12877. /**
  12878. * WordPress dependencies
  12879. */
  12880. const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part'];
  12881. function CustomizedTooltip(_ref) {
  12882. let {
  12883. isCustomized,
  12884. children
  12885. } = _ref;
  12886. if (!isCustomized) {
  12887. return children;
  12888. }
  12889. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Tooltip, {
  12890. text: (0,external_wp_i18n_namespaceObject.__)('This template has been customized')
  12891. }, children);
  12892. }
  12893. function BaseAddedBy(_ref2) {
  12894. let {
  12895. text,
  12896. icon,
  12897. imageUrl,
  12898. isCustomized
  12899. } = _ref2;
  12900. const [isImageLoaded, setIsImageLoaded] = (0,external_wp_element_namespaceObject.useState)(false);
  12901. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  12902. alignment: "left"
  12903. }, (0,external_wp_element_namespaceObject.createElement)(CustomizedTooltip, {
  12904. isCustomized: isCustomized
  12905. }, imageUrl ? (0,external_wp_element_namespaceObject.createElement)("div", {
  12906. className: classnames_default()('edit-site-list-added-by__avatar', {
  12907. 'is-loaded': isImageLoaded
  12908. })
  12909. }, (0,external_wp_element_namespaceObject.createElement)("img", {
  12910. onLoad: () => setIsImageLoaded(true),
  12911. alt: "",
  12912. src: imageUrl
  12913. })) : (0,external_wp_element_namespaceObject.createElement)("div", {
  12914. className: classnames_default()('edit-site-list-added-by__icon', {
  12915. 'is-customized': isCustomized
  12916. })
  12917. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  12918. icon: icon
  12919. }))), (0,external_wp_element_namespaceObject.createElement)("span", null, text));
  12920. }
  12921. function AddedByTheme(_ref3) {
  12922. var _theme$name;
  12923. let {
  12924. slug,
  12925. isCustomized
  12926. } = _ref3;
  12927. const theme = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getTheme(slug), [slug]);
  12928. return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
  12929. icon: library_layout,
  12930. text: (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug,
  12931. isCustomized: isCustomized
  12932. });
  12933. }
  12934. function AddedByPlugin(_ref4) {
  12935. let {
  12936. slug,
  12937. isCustomized
  12938. } = _ref4;
  12939. const plugin = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPlugin(slug), [slug]);
  12940. return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
  12941. icon: library_plugins,
  12942. text: (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug,
  12943. isCustomized: isCustomized
  12944. });
  12945. }
  12946. function AddedByAuthor(_ref5) {
  12947. var _user$avatar_urls;
  12948. let {
  12949. id
  12950. } = _ref5;
  12951. const user = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getUser(id), [id]);
  12952. return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
  12953. icon: comment_author_avatar,
  12954. imageUrl: user === null || user === void 0 ? void 0 : (_user$avatar_urls = user.avatar_urls) === null || _user$avatar_urls === void 0 ? void 0 : _user$avatar_urls[48],
  12955. text: user === null || user === void 0 ? void 0 : user.nickname
  12956. });
  12957. }
  12958. function AddedBySite() {
  12959. const {
  12960. name,
  12961. logoURL
  12962. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  12963. var _getMedia;
  12964. const {
  12965. getEntityRecord,
  12966. getMedia
  12967. } = select(external_wp_coreData_namespaceObject.store);
  12968. const siteData = getEntityRecord('root', '__unstableBase');
  12969. return {
  12970. name: siteData === null || siteData === void 0 ? void 0 : siteData.name,
  12971. logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined
  12972. };
  12973. }, []);
  12974. return (0,external_wp_element_namespaceObject.createElement)(BaseAddedBy, {
  12975. icon: library_globe,
  12976. imageUrl: logoURL,
  12977. text: name
  12978. });
  12979. }
  12980. function AddedBy(_ref6) {
  12981. let {
  12982. templateType,
  12983. template
  12984. } = _ref6;
  12985. if (!template) {
  12986. return;
  12987. }
  12988. if (TEMPLATE_POST_TYPE_NAMES.includes(templateType)) {
  12989. // Template originally provided by a theme, but customized by a user.
  12990. // Templates originally didn't have the 'origin' field so identify
  12991. // older customized templates by checking for no origin and a 'theme'
  12992. // or 'custom' source.
  12993. if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) {
  12994. return (0,external_wp_element_namespaceObject.createElement)(AddedByTheme, {
  12995. slug: template.theme,
  12996. isCustomized: template.source === 'custom'
  12997. });
  12998. } // Template originally provided by a plugin, but customized by a user.
  12999. if (template.has_theme_file && template.origin === 'plugin') {
  13000. return (0,external_wp_element_namespaceObject.createElement)(AddedByPlugin, {
  13001. slug: template.theme,
  13002. isCustomized: template.source === 'custom'
  13003. });
  13004. } // Template was created from scratch, but has no author. Author support
  13005. // was only added to templates in WordPress 5.9. Fallback to showing the
  13006. // site logo and title.
  13007. if (!template.has_theme_file && template.source === 'custom' && !template.author) {
  13008. return (0,external_wp_element_namespaceObject.createElement)(AddedBySite, null);
  13009. }
  13010. } // Simply show the author for templates created from scratch that have an
  13011. // author or for any other post type.
  13012. return (0,external_wp_element_namespaceObject.createElement)(AddedByAuthor, {
  13013. id: template.author
  13014. });
  13015. }
  13016. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/table.js
  13017. /**
  13018. * WordPress dependencies
  13019. */
  13020. /**
  13021. * Internal dependencies
  13022. */
  13023. function Table(_ref) {
  13024. let {
  13025. templateType
  13026. } = _ref;
  13027. const {
  13028. records: templates,
  13029. isResolving: isLoading
  13030. } = (0,external_wp_coreData_namespaceObject.useEntityRecords)('postType', templateType, {
  13031. per_page: -1
  13032. });
  13033. const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
  13034. if (!templates || isLoading) {
  13035. return null;
  13036. }
  13037. if (!templates.length) {
  13038. var _postType$labels, _postType$labels$name;
  13039. return (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_i18n_namespaceObject.sprintf)( // translators: The template type name, should be either "templates" or "template parts".
  13040. (0,external_wp_i18n_namespaceObject.__)('No %s found.'), postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : (_postType$labels$name = _postType$labels.name) === null || _postType$labels$name === void 0 ? void 0 : _postType$labels$name.toLowerCase()));
  13041. }
  13042. return (// These explicit aria roles are needed for Safari.
  13043. // See https://developer.mozilla.org/en-US/docs/Web/CSS/display#tables
  13044. (0,external_wp_element_namespaceObject.createElement)("table", {
  13045. className: "edit-site-list-table",
  13046. role: "table"
  13047. }, (0,external_wp_element_namespaceObject.createElement)("thead", null, (0,external_wp_element_namespaceObject.createElement)("tr", {
  13048. className: "edit-site-list-table-head",
  13049. role: "row"
  13050. }, (0,external_wp_element_namespaceObject.createElement)("th", {
  13051. className: "edit-site-list-table-column",
  13052. role: "columnheader"
  13053. }, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)("th", {
  13054. className: "edit-site-list-table-column",
  13055. role: "columnheader"
  13056. }, (0,external_wp_i18n_namespaceObject.__)('Added by')), (0,external_wp_element_namespaceObject.createElement)("th", {
  13057. className: "edit-site-list-table-column",
  13058. role: "columnheader"
  13059. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, null, (0,external_wp_i18n_namespaceObject.__)('Actions'))))), (0,external_wp_element_namespaceObject.createElement)("tbody", null, templates.map(template => {
  13060. var _template$title;
  13061. return (0,external_wp_element_namespaceObject.createElement)("tr", {
  13062. key: template.id,
  13063. className: "edit-site-list-table-row",
  13064. role: "row"
  13065. }, (0,external_wp_element_namespaceObject.createElement)("td", {
  13066. className: "edit-site-list-table-column",
  13067. role: "cell"
  13068. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  13069. level: 4
  13070. }, (0,external_wp_element_namespaceObject.createElement)(Link, {
  13071. params: {
  13072. postId: template.id,
  13073. postType: template.type
  13074. }
  13075. }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug))), template.description), (0,external_wp_element_namespaceObject.createElement)("td", {
  13076. className: "edit-site-list-table-column",
  13077. role: "cell"
  13078. }, (0,external_wp_element_namespaceObject.createElement)(AddedBy, {
  13079. templateType: templateType,
  13080. template: template
  13081. })), (0,external_wp_element_namespaceObject.createElement)("td", {
  13082. className: "edit-site-list-table-column",
  13083. role: "cell"
  13084. }, (0,external_wp_element_namespaceObject.createElement)(actions_Actions, {
  13085. template: template
  13086. })));
  13087. })))
  13088. );
  13089. }
  13090. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/list/index.js
  13091. /**
  13092. * External dependencies
  13093. */
  13094. /**
  13095. * WordPress dependencies
  13096. */
  13097. /**
  13098. * Internal dependencies
  13099. */
  13100. function List() {
  13101. var _postType$labels, _postType$labels2;
  13102. const {
  13103. params: {
  13104. postType: templateType
  13105. }
  13106. } = useLocation();
  13107. useRegisterShortcuts();
  13108. const {
  13109. previousShortcut,
  13110. nextShortcut,
  13111. isNavigationOpen
  13112. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  13113. return {
  13114. previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
  13115. nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-site/next-region'),
  13116. isNavigationOpen: select(store_store).isNavigationOpened()
  13117. };
  13118. }, []);
  13119. const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getPostType(templateType), [templateType]);
  13120. useTitle(postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.name); // `postType` could load in asynchronously. Only provide the detailed region labels if
  13121. // the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.
  13122. const itemsListLabel = postType === null || postType === void 0 ? void 0 : (_postType$labels2 = postType.labels) === null || _postType$labels2 === void 0 ? void 0 : _postType$labels2.items_list;
  13123. const detailedRegionLabels = postType ? {
  13124. header: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Header' as in the header area of that page.
  13125. (0,external_wp_i18n_namespaceObject.__)('%s - Header'), itemsListLabel),
  13126. body: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s - the name of the page, 'Content' as in the content area of that page.
  13127. (0,external_wp_i18n_namespaceObject.__)('%s - Content'), itemsListLabel)
  13128. } : undefined;
  13129. return (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
  13130. className: classnames_default()('edit-site-list', {
  13131. 'is-navigation-open': isNavigationOpen
  13132. }),
  13133. labels: {
  13134. drawer: (0,external_wp_i18n_namespaceObject.__)('Navigation Sidebar'),
  13135. ...detailedRegionLabels
  13136. },
  13137. header: (0,external_wp_element_namespaceObject.createElement)(header_Header, {
  13138. templateType: templateType
  13139. }),
  13140. drawer: (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar.Slot, null),
  13141. notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
  13142. content: (0,external_wp_element_namespaceObject.createElement)(Table, {
  13143. templateType: templateType
  13144. }),
  13145. shortcuts: {
  13146. previous: previousShortcut,
  13147. next: nextShortcut
  13148. }
  13149. });
  13150. }
  13151. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/utils/get-is-list-page.js
  13152. /**
  13153. * Returns if the params match the list page route.
  13154. *
  13155. * @param {Object} params The search params.
  13156. * @param {string} params.postId The post ID.
  13157. * @param {string} params.postType The post type.
  13158. * @return {boolean} Is list page or not.
  13159. */
  13160. function getIsListPage(_ref) {
  13161. let {
  13162. postId,
  13163. postType
  13164. } = _ref;
  13165. return !!(!postId && postType);
  13166. }
  13167. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/app/index.js
  13168. /**
  13169. * WordPress dependencies
  13170. */
  13171. /**
  13172. * Internal dependencies
  13173. */
  13174. function EditSiteApp(_ref) {
  13175. let {
  13176. reboot
  13177. } = _ref;
  13178. const {
  13179. createErrorNotice
  13180. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  13181. function onPluginAreaError(name) {
  13182. createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(
  13183. /* translators: %s: plugin name */
  13184. (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
  13185. }
  13186. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(Routes, null, _ref2 => {
  13187. let {
  13188. params
  13189. } = _ref2;
  13190. const isListPage = getIsListPage(params);
  13191. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isListPage ? (0,external_wp_element_namespaceObject.createElement)(List, null) : (0,external_wp_element_namespaceObject.createElement)(editor, {
  13192. onError: reboot
  13193. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
  13194. onError: onPluginAreaError
  13195. }), (0,external_wp_element_namespaceObject.createElement)(navigation_sidebar // Open the navigation sidebar by default when in the list page.
  13196. , {
  13197. isDefaultOpen: !!isListPage,
  13198. activeTemplateType: isListPage ? params.postType : undefined
  13199. }));
  13200. }));
  13201. }
  13202. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/sidebar/plugin-sidebar/index.js
  13203. /**
  13204. * WordPress dependencies
  13205. */
  13206. /**
  13207. * Internal dependencies
  13208. */
  13209. /**
  13210. * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
  13211. * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
  13212. * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
  13213. *
  13214. * ```js
  13215. * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
  13216. * ```
  13217. *
  13218. * @see PluginSidebarMoreMenuItem
  13219. *
  13220. * @param {Object} props Element props.
  13221. * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
  13222. * @param {string} [props.className] An optional class name added to the sidebar body.
  13223. * @param {string} props.title Title displayed at the top of the sidebar.
  13224. * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
  13225. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  13226. *
  13227. * @example
  13228. * ```js
  13229. * // Using ES5 syntax
  13230. * var __ = wp.i18n.__;
  13231. * var el = wp.element.createElement;
  13232. * var PanelBody = wp.components.PanelBody;
  13233. * var PluginSidebar = wp.editSite.PluginSidebar;
  13234. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  13235. *
  13236. * function MyPluginSidebar() {
  13237. * return el(
  13238. * PluginSidebar,
  13239. * {
  13240. * name: 'my-sidebar',
  13241. * title: 'My sidebar title',
  13242. * icon: moreIcon,
  13243. * },
  13244. * el(
  13245. * PanelBody,
  13246. * {},
  13247. * __( 'My sidebar content' )
  13248. * )
  13249. * );
  13250. * }
  13251. * ```
  13252. *
  13253. * @example
  13254. * ```jsx
  13255. * // Using ESNext syntax
  13256. * import { __ } from '@wordpress/i18n';
  13257. * import { PanelBody } from '@wordpress/components';
  13258. * import { PluginSidebar } from '@wordpress/edit-site';
  13259. * import { more } from '@wordpress/icons';
  13260. *
  13261. * const MyPluginSidebar = () => (
  13262. * <PluginSidebar
  13263. * name="my-sidebar"
  13264. * title="My sidebar title"
  13265. * icon={ more }
  13266. * >
  13267. * <PanelBody>
  13268. * { __( 'My sidebar content' ) }
  13269. * </PanelBody>
  13270. * </PluginSidebar>
  13271. * );
  13272. * ```
  13273. */
  13274. function PluginSidebarEditSite(_ref) {
  13275. let {
  13276. className,
  13277. ...props
  13278. } = _ref;
  13279. const showIconLabels = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getSettings().showIconLabels, []);
  13280. return (0,external_wp_element_namespaceObject.createElement)(complementary_area, extends_extends({
  13281. panelClassName: className,
  13282. className: "edit-site-sidebar",
  13283. scope: "core/edit-site",
  13284. showIconLabels: showIconLabels
  13285. }, props));
  13286. }
  13287. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-sidebar-more-menu-item/index.js
  13288. /**
  13289. * WordPress dependencies
  13290. */
  13291. /**
  13292. * Renders a menu item in `Plugins` group in `More Menu` drop down,
  13293. * and can be used to activate the corresponding `PluginSidebar` component.
  13294. * The text within the component appears as the menu item label.
  13295. *
  13296. * @param {Object} props Component props.
  13297. * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
  13298. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
  13299. *
  13300. * @example
  13301. * ```js
  13302. * // Using ES5 syntax
  13303. * var __ = wp.i18n.__;
  13304. * var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem;
  13305. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  13306. *
  13307. * function MySidebarMoreMenuItem() {
  13308. * return wp.element.createElement(
  13309. * PluginSidebarMoreMenuItem,
  13310. * {
  13311. * target: 'my-sidebar',
  13312. * icon: moreIcon,
  13313. * },
  13314. * __( 'My sidebar title' )
  13315. * )
  13316. * }
  13317. * ```
  13318. *
  13319. * @example
  13320. * ```jsx
  13321. * // Using ESNext syntax
  13322. * import { __ } from '@wordpress/i18n';
  13323. * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site';
  13324. * import { more } from '@wordpress/icons';
  13325. *
  13326. * const MySidebarMoreMenuItem = () => (
  13327. * <PluginSidebarMoreMenuItem
  13328. * target="my-sidebar"
  13329. * icon={ more }
  13330. * >
  13331. * { __( 'My sidebar title' ) }
  13332. * </PluginSidebarMoreMenuItem>
  13333. * );
  13334. * ```
  13335. *
  13336. * @return {WPComponent} The component to be rendered.
  13337. */
  13338. function PluginSidebarMoreMenuItem(props) {
  13339. return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility.
  13340. // @see https://github.com/WordPress/gutenberg/issues/14457
  13341. , extends_extends({
  13342. __unstableExplicitMenuItem: true,
  13343. scope: "core/edit-site"
  13344. }, props));
  13345. }
  13346. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/components/header/plugin-more-menu-item/index.js
  13347. /**
  13348. * WordPress dependencies
  13349. */
  13350. /**
  13351. * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
  13352. * The text within the component appears as the menu item label.
  13353. *
  13354. * @param {Object} props Component properties.
  13355. * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
  13356. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
  13357. * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
  13358. * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component.
  13359. *
  13360. * @example
  13361. * ```js
  13362. * // Using ES5 syntax
  13363. * var __ = wp.i18n.__;
  13364. * var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem;
  13365. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  13366. *
  13367. * function onButtonClick() {
  13368. * alert( 'Button clicked.' );
  13369. * }
  13370. *
  13371. * function MyButtonMoreMenuItem() {
  13372. * return wp.element.createElement(
  13373. * PluginMoreMenuItem,
  13374. * {
  13375. * icon: moreIcon,
  13376. * onClick: onButtonClick,
  13377. * },
  13378. * __( 'My button title' )
  13379. * );
  13380. * }
  13381. * ```
  13382. *
  13383. * @example
  13384. * ```jsx
  13385. * // Using ESNext syntax
  13386. * import { __ } from '@wordpress/i18n';
  13387. * import { PluginMoreMenuItem } from '@wordpress/edit-site';
  13388. * import { more } from '@wordpress/icons';
  13389. *
  13390. * function onButtonClick() {
  13391. * alert( 'Button clicked.' );
  13392. * }
  13393. *
  13394. * const MyButtonMoreMenuItem = () => (
  13395. * <PluginMoreMenuItem
  13396. * icon={ more }
  13397. * onClick={ onButtonClick }
  13398. * >
  13399. * { __( 'My button title' ) }
  13400. * </PluginMoreMenuItem>
  13401. * );
  13402. * ```
  13403. *
  13404. * @return {WPComponent} The component to be rendered.
  13405. */
  13406. /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  13407. var _ownProps$as;
  13408. return {
  13409. as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
  13410. icon: ownProps.icon || context.icon,
  13411. name: 'core/edit-site/plugin-more-menu'
  13412. };
  13413. }))(action_item));
  13414. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-site/build-module/index.js
  13415. /**
  13416. * WordPress dependencies
  13417. */
  13418. /**
  13419. * Internal dependencies
  13420. */
  13421. /**
  13422. * Reinitializes the editor after the user chooses to reboot the editor after
  13423. * an unhandled error occurs, replacing previously mounted editor element using
  13424. * an initial state from prior to the crash.
  13425. *
  13426. * @param {Element} target DOM node in which editor is rendered.
  13427. * @param {?Object} settings Editor settings object.
  13428. */
  13429. function reinitializeEditor(target, settings) {
  13430. // Display warning if editor wasn't able to resolve homepage template.
  13431. if (!settings.__unstableHomeTemplate) {
  13432. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(ErrorBoundaryWarning, {
  13433. message: (0,external_wp_i18n_namespaceObject.__)('The editor is unable to find a block template for the homepage.'),
  13434. dashboardLink: "index.php"
  13435. }), target);
  13436. return;
  13437. }
  13438. /*
  13439. * Prevent adding the Clasic block in the site editor.
  13440. * Only add the filter when the site editor is initialized, not imported.
  13441. * Also only add the filter(s) after registerCoreBlocks()
  13442. * so that common filters in the block library are not overwritten.
  13443. *
  13444. * This usage here is inspired by previous usage of the filter in the post editor:
  13445. * https://github.com/WordPress/gutenberg/pull/37157
  13446. */
  13447. (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeClassicBlockFromInserter', (canInsert, blockType) => {
  13448. if (blockType.name === 'core/freeform') {
  13449. return false;
  13450. }
  13451. return canInsert;
  13452. }); // This will be a no-op if the target doesn't have any React nodes.
  13453. (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
  13454. const reboot = reinitializeEditor.bind(null, target, settings); // We dispatch actions and update the store synchronously before rendering
  13455. // so that we won't trigger unnecessary re-renders with useEffect.
  13456. {
  13457. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-site', {
  13458. editorMode: 'visual',
  13459. fixedToolbar: false,
  13460. focusMode: false,
  13461. keepCaretInsideBlock: false,
  13462. welcomeGuide: true,
  13463. welcomeGuideStyles: true,
  13464. showListViewByDefault: false
  13465. }); // Check if the block list view should be open by default.
  13466. if ((0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core/edit-site', 'showListViewByDefault')) {
  13467. (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsListViewOpened(true);
  13468. }
  13469. (0,external_wp_data_namespaceObject.dispatch)(store).setDefaultComplementaryArea('core/edit-site', 'edit-site/template');
  13470. (0,external_wp_data_namespaceObject.dispatch)(store_store).updateSettings(settings); // Keep the defaultTemplateTypes in the core/editor settings too,
  13471. // so that they can be selected with core/editor selectors in any editor.
  13472. // This is needed because edit-site doesn't initialize with EditorProvider,
  13473. // which internally uses updateEditorSettings as well.
  13474. (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).updateEditorSettings({
  13475. defaultTemplateTypes: settings.defaultTemplateTypes,
  13476. defaultTemplatePartAreas: settings.defaultTemplatePartAreas
  13477. });
  13478. const isLandingOnListPage = getIsListPage((0,external_wp_url_namespaceObject.getQueryArgs)(window.location.href));
  13479. if (isLandingOnListPage) {
  13480. // Default the navigation panel to be opened when we're in a bigger
  13481. // screen and land in the list screen.
  13482. (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsNavigationPanelOpened((0,external_wp_data_namespaceObject.select)(external_wp_viewport_namespaceObject.store).isViewportMatch('medium'));
  13483. }
  13484. } // Prevent the default browser action for files dropped outside of dropzones.
  13485. window.addEventListener('dragover', e => e.preventDefault(), false);
  13486. window.addEventListener('drop', e => e.preventDefault(), false);
  13487. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(EditSiteApp, {
  13488. reboot: reboot
  13489. }), target);
  13490. }
  13491. /**
  13492. * Initializes the site editor screen.
  13493. *
  13494. * @param {string} id ID of the root element to render the screen in.
  13495. * @param {Object} settings Editor settings.
  13496. */
  13497. function initializeEditor(id, settings) {
  13498. settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
  13499. settings.__experimentalFetchRichUrlData = external_wp_coreData_namespaceObject.__experimentalFetchUrlData;
  13500. const target = document.getElementById(id);
  13501. (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
  13502. (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
  13503. if (false) {}
  13504. reinitializeEditor(target, settings);
  13505. }
  13506. }();
  13507. (window.wp = window.wp || {}).editSite = __webpack_exports__;
  13508. /******/ })()
  13509. ;