acf-input.js 271 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-compatibility.js":
  4. /*!****************************************************************************!*\
  5. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-compatibility.js ***!
  6. \****************************************************************************/
  7. /***/ (function() {
  8. (function ($, undefined) {
  9. /**
  10. * acf.newCompatibility
  11. *
  12. * Inserts a new __proto__ object compatibility layer
  13. *
  14. * @date 15/2/18
  15. * @since 5.6.9
  16. *
  17. * @param object instance The object to modify.
  18. * @param object compatibilty Optional. The compatibilty layer.
  19. * @return object compatibilty
  20. */
  21. acf.newCompatibility = function (instance, compatibilty) {
  22. // defaults
  23. compatibilty = compatibilty || {};
  24. // inherit __proto_-
  25. compatibilty.__proto__ = instance.__proto__;
  26. // inject
  27. instance.__proto__ = compatibilty;
  28. // reference
  29. instance.compatibility = compatibilty;
  30. // return
  31. return compatibilty;
  32. };
  33. /**
  34. * acf.getCompatibility
  35. *
  36. * Returns the compatibility layer for a given instance
  37. *
  38. * @date 13/3/18
  39. * @since 5.6.9
  40. *
  41. * @param object instance The object to look in.
  42. * @return object|null compatibility The compatibility object or null on failure.
  43. */
  44. acf.getCompatibility = function (instance) {
  45. return instance.compatibility || null;
  46. };
  47. /**
  48. * acf (compatibility)
  49. *
  50. * Compatibility layer for the acf object
  51. *
  52. * @date 15/2/18
  53. * @since 5.6.9
  54. *
  55. * @param void
  56. * @return void
  57. */
  58. var _acf = acf.newCompatibility(acf, {
  59. // storage
  60. l10n: {},
  61. o: {},
  62. fields: {},
  63. // changed function names
  64. update: acf.set,
  65. add_action: acf.addAction,
  66. remove_action: acf.removeAction,
  67. do_action: acf.doAction,
  68. add_filter: acf.addFilter,
  69. remove_filter: acf.removeFilter,
  70. apply_filters: acf.applyFilters,
  71. parse_args: acf.parseArgs,
  72. disable_el: acf.disable,
  73. disable_form: acf.disable,
  74. enable_el: acf.enable,
  75. enable_form: acf.enable,
  76. update_user_setting: acf.updateUserSetting,
  77. prepare_for_ajax: acf.prepareForAjax,
  78. is_ajax_success: acf.isAjaxSuccess,
  79. remove_el: acf.remove,
  80. remove_tr: acf.remove,
  81. str_replace: acf.strReplace,
  82. render_select: acf.renderSelect,
  83. get_uniqid: acf.uniqid,
  84. serialize_form: acf.serialize,
  85. esc_html: acf.strEscape,
  86. str_sanitize: acf.strSanitize
  87. });
  88. _acf._e = function (k1, k2) {
  89. // defaults
  90. k1 = k1 || '';
  91. k2 = k2 || '';
  92. // compability
  93. var compatKey = k2 ? k1 + '.' + k2 : k1;
  94. var compats = {
  95. 'image.select': 'Select Image',
  96. 'image.edit': 'Edit Image',
  97. 'image.update': 'Update Image'
  98. };
  99. if (compats[compatKey]) {
  100. return acf.__(compats[compatKey]);
  101. }
  102. // try k1
  103. var string = this.l10n[k1] || '';
  104. // try k2
  105. if (k2) {
  106. string = string[k2] || '';
  107. }
  108. // return
  109. return string;
  110. };
  111. _acf.get_selector = function (s) {
  112. // vars
  113. var selector = '.acf-field';
  114. // bail early if no search
  115. if (!s) {
  116. return selector;
  117. }
  118. // compatibility with object
  119. if ($.isPlainObject(s)) {
  120. if ($.isEmptyObject(s)) {
  121. return selector;
  122. } else {
  123. for (var k in s) {
  124. s = s[k];
  125. break;
  126. }
  127. }
  128. }
  129. // append
  130. selector += '-' + s;
  131. // replace underscores (split/join replaces all and is faster than regex!)
  132. selector = acf.strReplace('_', '-', selector);
  133. // remove potential double up
  134. selector = acf.strReplace('field-field-', 'field-', selector);
  135. // return
  136. return selector;
  137. };
  138. _acf.get_fields = function (s, $el, all) {
  139. // args
  140. var args = {
  141. is: s || '',
  142. parent: $el || false,
  143. suppressFilters: all || false
  144. };
  145. // change 'field_123' to '.acf-field-123'
  146. if (args.is) {
  147. args.is = this.get_selector(args.is);
  148. }
  149. // return
  150. return acf.findFields(args);
  151. };
  152. _acf.get_field = function (s, $el) {
  153. // get fields
  154. var $fields = this.get_fields.apply(this, arguments);
  155. // return
  156. if ($fields.length) {
  157. return $fields.first();
  158. } else {
  159. return false;
  160. }
  161. };
  162. _acf.get_closest_field = function ($el, s) {
  163. return $el.closest(this.get_selector(s));
  164. };
  165. _acf.get_field_wrap = function ($el) {
  166. return $el.closest(this.get_selector());
  167. };
  168. _acf.get_field_key = function ($field) {
  169. return $field.data('key');
  170. };
  171. _acf.get_field_type = function ($field) {
  172. return $field.data('type');
  173. };
  174. _acf.get_data = function ($el, defaults) {
  175. return acf.parseArgs($el.data(), defaults);
  176. };
  177. _acf.maybe_get = function (obj, key, value) {
  178. // default
  179. if (value === undefined) {
  180. value = null;
  181. }
  182. // get keys
  183. keys = String(key).split('.');
  184. // acf.isget
  185. for (var i = 0; i < keys.length; i++) {
  186. if (!obj.hasOwnProperty(keys[i])) {
  187. return value;
  188. }
  189. obj = obj[keys[i]];
  190. }
  191. return obj;
  192. };
  193. /**
  194. * hooks
  195. *
  196. * Modify add_action and add_filter functions to add compatibility with changed $field parameter
  197. * Using the acf.add_action() or acf.add_filter() functions will interpret new field parameters as jQuery $field
  198. *
  199. * @date 12/5/18
  200. * @since 5.6.9
  201. *
  202. * @param void
  203. * @return void
  204. */
  205. var compatibleArgument = function (arg) {
  206. return arg instanceof acf.Field ? arg.$el : arg;
  207. };
  208. var compatibleArguments = function (args) {
  209. return acf.arrayArgs(args).map(compatibleArgument);
  210. };
  211. var compatibleCallback = function (origCallback) {
  212. return function () {
  213. // convert to compatible arguments
  214. if (arguments.length) {
  215. var args = compatibleArguments(arguments);
  216. // add default argument for 'ready', 'append' and 'load' events
  217. } else {
  218. var args = [$(document)];
  219. }
  220. // return
  221. return origCallback.apply(this, args);
  222. };
  223. };
  224. _acf.add_action = function (action, callback, priority, context) {
  225. // handle multiple actions
  226. var actions = action.split(' ');
  227. var length = actions.length;
  228. if (length > 1) {
  229. for (var i = 0; i < length; i++) {
  230. action = actions[i];
  231. _acf.add_action.apply(this, arguments);
  232. }
  233. return this;
  234. }
  235. // single
  236. var callback = compatibleCallback(callback);
  237. return acf.addAction.apply(this, arguments);
  238. };
  239. _acf.add_filter = function (action, callback, priority, context) {
  240. var callback = compatibleCallback(callback);
  241. return acf.addFilter.apply(this, arguments);
  242. };
  243. /*
  244. * acf.model
  245. *
  246. * This model acts as a scafold for action.event driven modules
  247. *
  248. * @type object
  249. * @date 8/09/2014
  250. * @since 5.0.0
  251. *
  252. * @param (object)
  253. * @return (object)
  254. */
  255. _acf.model = {
  256. actions: {},
  257. filters: {},
  258. events: {},
  259. extend: function (args) {
  260. // extend
  261. var model = $.extend({}, this, args);
  262. // setup actions
  263. $.each(model.actions, function (name, callback) {
  264. model._add_action(name, callback);
  265. });
  266. // setup filters
  267. $.each(model.filters, function (name, callback) {
  268. model._add_filter(name, callback);
  269. });
  270. // setup events
  271. $.each(model.events, function (name, callback) {
  272. model._add_event(name, callback);
  273. });
  274. // return
  275. return model;
  276. },
  277. _add_action: function (name, callback) {
  278. // split
  279. var model = this,
  280. data = name.split(' ');
  281. // add missing priority
  282. var name = data[0] || '',
  283. priority = data[1] || 10;
  284. // add action
  285. acf.add_action(name, model[callback], priority, model);
  286. },
  287. _add_filter: function (name, callback) {
  288. // split
  289. var model = this,
  290. data = name.split(' ');
  291. // add missing priority
  292. var name = data[0] || '',
  293. priority = data[1] || 10;
  294. // add action
  295. acf.add_filter(name, model[callback], priority, model);
  296. },
  297. _add_event: function (name, callback) {
  298. // vars
  299. var model = this,
  300. i = name.indexOf(' '),
  301. event = i > 0 ? name.substr(0, i) : name,
  302. selector = i > 0 ? name.substr(i + 1) : '';
  303. // event
  304. var fn = function (e) {
  305. // append $el to event object
  306. e.$el = $(this);
  307. // append $field to event object (used in field group)
  308. if (acf.field_group) {
  309. e.$field = e.$el.closest('.acf-field-object');
  310. }
  311. // event
  312. if (typeof model.event === 'function') {
  313. e = model.event(e);
  314. }
  315. // callback
  316. model[callback].apply(model, arguments);
  317. };
  318. // add event
  319. if (selector) {
  320. $(document).on(event, selector, fn);
  321. } else {
  322. $(document).on(event, fn);
  323. }
  324. },
  325. get: function (name, value) {
  326. // defaults
  327. value = value || null;
  328. // get
  329. if (typeof this[name] !== 'undefined') {
  330. value = this[name];
  331. }
  332. // return
  333. return value;
  334. },
  335. set: function (name, value) {
  336. // set
  337. this[name] = value;
  338. // function for 3rd party
  339. if (typeof this['_set_' + name] === 'function') {
  340. this['_set_' + name].apply(this);
  341. }
  342. // return for chaining
  343. return this;
  344. }
  345. };
  346. /*
  347. * field
  348. *
  349. * This model sets up many of the field's interactions
  350. *
  351. * @type function
  352. * @date 21/02/2014
  353. * @since 3.5.1
  354. *
  355. * @param n/a
  356. * @return n/a
  357. */
  358. _acf.field = acf.model.extend({
  359. type: '',
  360. o: {},
  361. $field: null,
  362. _add_action: function (name, callback) {
  363. // vars
  364. var model = this;
  365. // update name
  366. name = name + '_field/type=' + model.type;
  367. // add action
  368. acf.add_action(name, function ($field) {
  369. // focus
  370. model.set('$field', $field);
  371. // callback
  372. model[callback].apply(model, arguments);
  373. });
  374. },
  375. _add_filter: function (name, callback) {
  376. // vars
  377. var model = this;
  378. // update name
  379. name = name + '_field/type=' + model.type;
  380. // add action
  381. acf.add_filter(name, function ($field) {
  382. // focus
  383. model.set('$field', $field);
  384. // callback
  385. model[callback].apply(model, arguments);
  386. });
  387. },
  388. _add_event: function (name, callback) {
  389. // vars
  390. var model = this,
  391. event = name.substr(0, name.indexOf(' ')),
  392. selector = name.substr(name.indexOf(' ') + 1),
  393. context = acf.get_selector(model.type);
  394. // add event
  395. $(document).on(event, context + ' ' + selector, function (e) {
  396. // vars
  397. var $el = $(this);
  398. var $field = acf.get_closest_field($el, model.type);
  399. // bail early if no field
  400. if (!$field.length) return;
  401. // focus
  402. if (!$field.is(model.$field)) {
  403. model.set('$field', $field);
  404. }
  405. // append to event
  406. e.$el = $el;
  407. e.$field = $field;
  408. // callback
  409. model[callback].apply(model, [e]);
  410. });
  411. },
  412. _set_$field: function () {
  413. // callback
  414. if (typeof this.focus === 'function') {
  415. this.focus();
  416. }
  417. },
  418. // depreciated
  419. doFocus: function ($field) {
  420. return this.set('$field', $field);
  421. }
  422. });
  423. /**
  424. * validation
  425. *
  426. * description
  427. *
  428. * @date 15/2/18
  429. * @since 5.6.9
  430. *
  431. * @param type $var Description. Default.
  432. * @return type Description.
  433. */
  434. var _validation = acf.newCompatibility(acf.validation, {
  435. remove_error: function ($field) {
  436. acf.getField($field).removeError();
  437. },
  438. add_warning: function ($field, message) {
  439. acf.getField($field).showNotice({
  440. text: message,
  441. type: 'warning',
  442. timeout: 1000
  443. });
  444. },
  445. fetch: acf.validateForm,
  446. enableSubmit: acf.enableSubmit,
  447. disableSubmit: acf.disableSubmit,
  448. showSpinner: acf.showSpinner,
  449. hideSpinner: acf.hideSpinner,
  450. unlockForm: acf.unlockForm,
  451. lockForm: acf.lockForm
  452. });
  453. /**
  454. * tooltip
  455. *
  456. * description
  457. *
  458. * @date 15/2/18
  459. * @since 5.6.9
  460. *
  461. * @param type $var Description. Default.
  462. * @return type Description.
  463. */
  464. _acf.tooltip = {
  465. tooltip: function (text, $el) {
  466. var tooltip = acf.newTooltip({
  467. text: text,
  468. target: $el
  469. });
  470. // return
  471. return tooltip.$el;
  472. },
  473. temp: function (text, $el) {
  474. var tooltip = acf.newTooltip({
  475. text: text,
  476. target: $el,
  477. timeout: 250
  478. });
  479. },
  480. confirm: function ($el, callback, text, button_y, button_n) {
  481. var tooltip = acf.newTooltip({
  482. confirm: true,
  483. text: text,
  484. target: $el,
  485. confirm: function () {
  486. callback(true);
  487. },
  488. cancel: function () {
  489. callback(false);
  490. }
  491. });
  492. },
  493. confirm_remove: function ($el, callback) {
  494. var tooltip = acf.newTooltip({
  495. confirmRemove: true,
  496. target: $el,
  497. confirm: function () {
  498. callback(true);
  499. },
  500. cancel: function () {
  501. callback(false);
  502. }
  503. });
  504. }
  505. };
  506. /**
  507. * tooltip
  508. *
  509. * description
  510. *
  511. * @date 15/2/18
  512. * @since 5.6.9
  513. *
  514. * @param type $var Description. Default.
  515. * @return type Description.
  516. */
  517. _acf.media = new acf.Model({
  518. activeFrame: false,
  519. actions: {
  520. new_media_popup: 'onNewMediaPopup'
  521. },
  522. frame: function () {
  523. return this.activeFrame;
  524. },
  525. onNewMediaPopup: function (popup) {
  526. this.activeFrame = popup.frame;
  527. },
  528. popup: function (props) {
  529. // update props
  530. if (props.mime_types) {
  531. props.allowedTypes = props.mime_types;
  532. }
  533. if (props.id) {
  534. props.attachment = props.id;
  535. }
  536. // new
  537. var popup = acf.newMediaPopup(props);
  538. // append
  539. /*
  540. if( props.selected ) {
  541. popup.selected = props.selected;
  542. }
  543. */
  544. // return
  545. return popup.frame;
  546. }
  547. });
  548. /**
  549. * Select2
  550. *
  551. * description
  552. *
  553. * @date 11/6/18
  554. * @since 5.6.9
  555. *
  556. * @param type $var Description. Default.
  557. * @return type Description.
  558. */
  559. _acf.select2 = {
  560. init: function ($select, args, $field) {
  561. // compatible args
  562. if (args.allow_null) {
  563. args.allowNull = args.allow_null;
  564. }
  565. if (args.ajax_action) {
  566. args.ajaxAction = args.ajax_action;
  567. }
  568. if ($field) {
  569. args.field = acf.getField($field);
  570. }
  571. // return
  572. return acf.newSelect2($select, args);
  573. },
  574. destroy: function ($select) {
  575. return acf.getInstance($select).destroy();
  576. }
  577. };
  578. /**
  579. * postbox
  580. *
  581. * description
  582. *
  583. * @date 11/6/18
  584. * @since 5.6.9
  585. *
  586. * @param type $var Description. Default.
  587. * @return type Description.
  588. */
  589. _acf.postbox = {
  590. render: function (args) {
  591. // compatible args
  592. if (args.edit_url) {
  593. args.editLink = args.edit_url;
  594. }
  595. if (args.edit_title) {
  596. args.editTitle = args.edit_title;
  597. }
  598. // return
  599. return acf.newPostbox(args);
  600. }
  601. };
  602. /**
  603. * acf.screen
  604. *
  605. * description
  606. *
  607. * @date 11/6/18
  608. * @since 5.6.9
  609. *
  610. * @param type $var Description. Default.
  611. * @return type Description.
  612. */
  613. acf.newCompatibility(acf.screen, {
  614. update: function () {
  615. return this.set.apply(this, arguments);
  616. },
  617. fetch: acf.screen.check
  618. });
  619. _acf.ajax = acf.screen;
  620. })(jQuery);
  621. /***/ }),
  622. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-condition-types.js":
  623. /*!******************************************************************************!*\
  624. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-condition-types.js ***!
  625. \******************************************************************************/
  626. /***/ (function() {
  627. (function ($, undefined) {
  628. var __ = acf.__;
  629. var parseString = function (val) {
  630. return val ? '' + val : '';
  631. };
  632. var isEqualTo = function (v1, v2) {
  633. return parseString(v1).toLowerCase() === parseString(v2).toLowerCase();
  634. };
  635. var isEqualToNumber = function (v1, v2) {
  636. return parseFloat(v1) === parseFloat(v2);
  637. };
  638. var isGreaterThan = function (v1, v2) {
  639. return parseFloat(v1) > parseFloat(v2);
  640. };
  641. var isLessThan = function (v1, v2) {
  642. return parseFloat(v1) < parseFloat(v2);
  643. };
  644. var inArray = function (v1, array) {
  645. // cast all values as string
  646. array = array.map(function (v2) {
  647. return parseString(v2);
  648. });
  649. return array.indexOf(v1) > -1;
  650. };
  651. var containsString = function (haystack, needle) {
  652. return parseString(haystack).indexOf(parseString(needle)) > -1;
  653. };
  654. var matchesPattern = function (v1, pattern) {
  655. var regexp = new RegExp(parseString(pattern), 'gi');
  656. return parseString(v1).match(regexp);
  657. };
  658. /**
  659. * hasValue
  660. *
  661. * description
  662. *
  663. * @date 1/2/18
  664. * @since 5.6.5
  665. *
  666. * @param void
  667. * @return void
  668. */
  669. var HasValue = acf.Condition.extend({
  670. type: 'hasValue',
  671. operator: '!=empty',
  672. label: __('Has any value'),
  673. fieldTypes: ['text', 'textarea', 'number', 'range', 'email', 'url', 'password', 'image', 'file', 'wysiwyg', 'oembed', 'select', 'checkbox', 'radio', 'button_group', 'link', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user', 'google_map', 'date_picker', 'date_time_picker', 'time_picker', 'color_picker'],
  674. match: function (rule, field) {
  675. let val = field.val();
  676. if (val instanceof Array) {
  677. val = val.length;
  678. }
  679. return val ? true : false;
  680. },
  681. choices: function (fieldObject) {
  682. return '<input type="text" disabled="" />';
  683. }
  684. });
  685. acf.registerConditionType(HasValue);
  686. /**
  687. * hasValue
  688. *
  689. * description
  690. *
  691. * @date 1/2/18
  692. * @since 5.6.5
  693. *
  694. * @param void
  695. * @return void
  696. */
  697. var HasNoValue = HasValue.extend({
  698. type: 'hasNoValue',
  699. operator: '==empty',
  700. label: __('Has no value'),
  701. match: function (rule, field) {
  702. return !HasValue.prototype.match.apply(this, arguments);
  703. }
  704. });
  705. acf.registerConditionType(HasNoValue);
  706. /**
  707. * EqualTo
  708. *
  709. * description
  710. *
  711. * @date 1/2/18
  712. * @since 5.6.5
  713. *
  714. * @param void
  715. * @return void
  716. */
  717. var EqualTo = acf.Condition.extend({
  718. type: 'equalTo',
  719. operator: '==',
  720. label: __('Value is equal to'),
  721. fieldTypes: ['text', 'textarea', 'number', 'range', 'email', 'url', 'password'],
  722. match: function (rule, field) {
  723. if (acf.isNumeric(rule.value)) {
  724. return isEqualToNumber(rule.value, field.val());
  725. } else {
  726. return isEqualTo(rule.value, field.val());
  727. }
  728. },
  729. choices: function (fieldObject) {
  730. return '<input type="text" />';
  731. }
  732. });
  733. acf.registerConditionType(EqualTo);
  734. /**
  735. * NotEqualTo
  736. *
  737. * description
  738. *
  739. * @date 1/2/18
  740. * @since 5.6.5
  741. *
  742. * @param void
  743. * @return void
  744. */
  745. var NotEqualTo = EqualTo.extend({
  746. type: 'notEqualTo',
  747. operator: '!=',
  748. label: __('Value is not equal to'),
  749. match: function (rule, field) {
  750. return !EqualTo.prototype.match.apply(this, arguments);
  751. }
  752. });
  753. acf.registerConditionType(NotEqualTo);
  754. /**
  755. * PatternMatch
  756. *
  757. * description
  758. *
  759. * @date 1/2/18
  760. * @since 5.6.5
  761. *
  762. * @param void
  763. * @return void
  764. */
  765. var PatternMatch = acf.Condition.extend({
  766. type: 'patternMatch',
  767. operator: '==pattern',
  768. label: __('Value matches pattern'),
  769. fieldTypes: ['text', 'textarea', 'email', 'url', 'password', 'wysiwyg'],
  770. match: function (rule, field) {
  771. return matchesPattern(field.val(), rule.value);
  772. },
  773. choices: function (fieldObject) {
  774. return '<input type="text" placeholder="[a-z0-9]" />';
  775. }
  776. });
  777. acf.registerConditionType(PatternMatch);
  778. /**
  779. * Contains
  780. *
  781. * description
  782. *
  783. * @date 1/2/18
  784. * @since 5.6.5
  785. *
  786. * @param void
  787. * @return void
  788. */
  789. var Contains = acf.Condition.extend({
  790. type: 'contains',
  791. operator: '==contains',
  792. label: __('Value contains'),
  793. fieldTypes: ['text', 'textarea', 'number', 'email', 'url', 'password', 'wysiwyg', 'oembed', 'select'],
  794. match: function (rule, field) {
  795. return containsString(field.val(), rule.value);
  796. },
  797. choices: function (fieldObject) {
  798. return '<input type="text" />';
  799. }
  800. });
  801. acf.registerConditionType(Contains);
  802. /**
  803. * TrueFalseEqualTo
  804. *
  805. * description
  806. *
  807. * @date 1/2/18
  808. * @since 5.6.5
  809. *
  810. * @param void
  811. * @return void
  812. */
  813. var TrueFalseEqualTo = EqualTo.extend({
  814. type: 'trueFalseEqualTo',
  815. choiceType: 'select',
  816. fieldTypes: ['true_false'],
  817. choices: function (field) {
  818. return [{
  819. id: 1,
  820. text: __('Checked')
  821. }];
  822. }
  823. });
  824. acf.registerConditionType(TrueFalseEqualTo);
  825. /**
  826. * TrueFalseNotEqualTo
  827. *
  828. * description
  829. *
  830. * @date 1/2/18
  831. * @since 5.6.5
  832. *
  833. * @param void
  834. * @return void
  835. */
  836. var TrueFalseNotEqualTo = NotEqualTo.extend({
  837. type: 'trueFalseNotEqualTo',
  838. choiceType: 'select',
  839. fieldTypes: ['true_false'],
  840. choices: function (field) {
  841. return [{
  842. id: 1,
  843. text: __('Checked')
  844. }];
  845. }
  846. });
  847. acf.registerConditionType(TrueFalseNotEqualTo);
  848. /**
  849. * SelectEqualTo
  850. *
  851. * description
  852. *
  853. * @date 1/2/18
  854. * @since 5.6.5
  855. *
  856. * @param void
  857. * @return void
  858. */
  859. var SelectEqualTo = acf.Condition.extend({
  860. type: 'selectEqualTo',
  861. operator: '==',
  862. label: __('Value is equal to'),
  863. fieldTypes: ['select', 'checkbox', 'radio', 'button_group'],
  864. match: function (rule, field) {
  865. var val = field.val();
  866. if (val instanceof Array) {
  867. return inArray(rule.value, val);
  868. } else {
  869. return isEqualTo(rule.value, val);
  870. }
  871. },
  872. choices: function (fieldObject) {
  873. // vars
  874. var choices = [];
  875. var lines = fieldObject.$setting('choices textarea').val().split('\n');
  876. // allow null
  877. if (fieldObject.$input('allow_null').prop('checked')) {
  878. choices.push({
  879. id: '',
  880. text: __('Null')
  881. });
  882. }
  883. // loop
  884. lines.map(function (line) {
  885. // split
  886. line = line.split(':');
  887. // default label to value
  888. line[1] = line[1] || line[0];
  889. // append
  890. choices.push({
  891. id: line[0].trim(),
  892. text: line[1].trim()
  893. });
  894. });
  895. // return
  896. return choices;
  897. }
  898. });
  899. acf.registerConditionType(SelectEqualTo);
  900. /**
  901. * SelectNotEqualTo
  902. *
  903. * description
  904. *
  905. * @date 1/2/18
  906. * @since 5.6.5
  907. *
  908. * @param void
  909. * @return void
  910. */
  911. var SelectNotEqualTo = SelectEqualTo.extend({
  912. type: 'selectNotEqualTo',
  913. operator: '!=',
  914. label: __('Value is not equal to'),
  915. match: function (rule, field) {
  916. return !SelectEqualTo.prototype.match.apply(this, arguments);
  917. }
  918. });
  919. acf.registerConditionType(SelectNotEqualTo);
  920. /**
  921. * GreaterThan
  922. *
  923. * description
  924. *
  925. * @date 1/2/18
  926. * @since 5.6.5
  927. *
  928. * @param void
  929. * @return void
  930. */
  931. var GreaterThan = acf.Condition.extend({
  932. type: 'greaterThan',
  933. operator: '>',
  934. label: __('Value is greater than'),
  935. fieldTypes: ['number', 'range'],
  936. match: function (rule, field) {
  937. var val = field.val();
  938. if (val instanceof Array) {
  939. val = val.length;
  940. }
  941. return isGreaterThan(val, rule.value);
  942. },
  943. choices: function (fieldObject) {
  944. return '<input type="number" />';
  945. }
  946. });
  947. acf.registerConditionType(GreaterThan);
  948. /**
  949. * LessThan
  950. *
  951. * description
  952. *
  953. * @date 1/2/18
  954. * @since 5.6.5
  955. *
  956. * @param void
  957. * @return void
  958. */
  959. var LessThan = GreaterThan.extend({
  960. type: 'lessThan',
  961. operator: '<',
  962. label: __('Value is less than'),
  963. match: function (rule, field) {
  964. var val = field.val();
  965. if (val instanceof Array) {
  966. val = val.length;
  967. }
  968. if (val === undefined || val === null || val === false) {
  969. return true;
  970. }
  971. return isLessThan(val, rule.value);
  972. },
  973. choices: function (fieldObject) {
  974. return '<input type="number" />';
  975. }
  976. });
  977. acf.registerConditionType(LessThan);
  978. /**
  979. * SelectedGreaterThan
  980. *
  981. * description
  982. *
  983. * @date 1/2/18
  984. * @since 5.6.5
  985. *
  986. * @param void
  987. * @return void
  988. */
  989. var SelectionGreaterThan = GreaterThan.extend({
  990. type: 'selectionGreaterThan',
  991. label: __('Selection is greater than'),
  992. fieldTypes: ['checkbox', 'select', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user']
  993. });
  994. acf.registerConditionType(SelectionGreaterThan);
  995. /**
  996. * SelectedGreaterThan
  997. *
  998. * description
  999. *
  1000. * @date 1/2/18
  1001. * @since 5.6.5
  1002. *
  1003. * @param void
  1004. * @return void
  1005. */
  1006. var SelectionLessThan = LessThan.extend({
  1007. type: 'selectionLessThan',
  1008. label: __('Selection is less than'),
  1009. fieldTypes: ['checkbox', 'select', 'post_object', 'page_link', 'relationship', 'taxonomy', 'user']
  1010. });
  1011. acf.registerConditionType(SelectionLessThan);
  1012. })(jQuery);
  1013. /***/ }),
  1014. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-condition.js":
  1015. /*!************************************************************************!*\
  1016. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-condition.js ***!
  1017. \************************************************************************/
  1018. /***/ (function() {
  1019. (function ($, undefined) {
  1020. // vars
  1021. var storage = [];
  1022. /**
  1023. * acf.Condition
  1024. *
  1025. * description
  1026. *
  1027. * @date 23/3/18
  1028. * @since 5.6.9
  1029. *
  1030. * @param type $var Description. Default.
  1031. * @return type Description.
  1032. */
  1033. acf.Condition = acf.Model.extend({
  1034. type: '',
  1035. // used for model name
  1036. operator: '==',
  1037. // rule operator
  1038. label: '',
  1039. // label shown when editing fields
  1040. choiceType: 'input',
  1041. // input, select
  1042. fieldTypes: [],
  1043. // auto connect this conditions with these field types
  1044. data: {
  1045. conditions: false,
  1046. // the parent instance
  1047. field: false,
  1048. // the field which we query against
  1049. rule: {} // the rule [field, operator, value]
  1050. },
  1051. events: {
  1052. change: 'change',
  1053. keyup: 'change',
  1054. enableField: 'change',
  1055. disableField: 'change'
  1056. },
  1057. setup: function (props) {
  1058. $.extend(this.data, props);
  1059. },
  1060. getEventTarget: function ($el, event) {
  1061. return $el || this.get('field').$el;
  1062. },
  1063. change: function (e, $el) {
  1064. this.get('conditions').change(e);
  1065. },
  1066. match: function (rule, field) {
  1067. return false;
  1068. },
  1069. calculate: function () {
  1070. return this.match(this.get('rule'), this.get('field'));
  1071. },
  1072. choices: function (field) {
  1073. return '<input type="text" />';
  1074. }
  1075. });
  1076. /**
  1077. * acf.newCondition
  1078. *
  1079. * description
  1080. *
  1081. * @date 1/2/18
  1082. * @since 5.6.5
  1083. *
  1084. * @param type $var Description. Default.
  1085. * @return type Description.
  1086. */
  1087. acf.newCondition = function (rule, conditions) {
  1088. // currently setting up conditions for fieldX, this field is the 'target'
  1089. var target = conditions.get('field');
  1090. // use the 'target' to find the 'trigger' field.
  1091. // - this field is used to setup the conditional logic events
  1092. var field = target.getField(rule.field);
  1093. // bail early if no target or no field (possible if field doesn't exist due to HTML error)
  1094. if (!target || !field) {
  1095. return false;
  1096. }
  1097. // vars
  1098. var args = {
  1099. rule: rule,
  1100. target: target,
  1101. conditions: conditions,
  1102. field: field
  1103. };
  1104. // vars
  1105. var fieldType = field.get('type');
  1106. var operator = rule.operator;
  1107. // get avaibale conditions
  1108. var conditionTypes = acf.getConditionTypes({
  1109. fieldType: fieldType,
  1110. operator: operator
  1111. });
  1112. // instantiate
  1113. var model = conditionTypes[0] || acf.Condition;
  1114. // instantiate
  1115. var condition = new model(args);
  1116. // return
  1117. return condition;
  1118. };
  1119. /**
  1120. * mid
  1121. *
  1122. * Calculates the model ID for a field type
  1123. *
  1124. * @date 15/12/17
  1125. * @since 5.6.5
  1126. *
  1127. * @param string type
  1128. * @return string
  1129. */
  1130. var modelId = function (type) {
  1131. return acf.strPascalCase(type || '') + 'Condition';
  1132. };
  1133. /**
  1134. * acf.registerConditionType
  1135. *
  1136. * description
  1137. *
  1138. * @date 1/2/18
  1139. * @since 5.6.5
  1140. *
  1141. * @param type $var Description. Default.
  1142. * @return type Description.
  1143. */
  1144. acf.registerConditionType = function (model) {
  1145. // vars
  1146. var proto = model.prototype;
  1147. var type = proto.type;
  1148. var mid = modelId(type);
  1149. // store model
  1150. acf.models[mid] = model;
  1151. // store reference
  1152. storage.push(type);
  1153. };
  1154. /**
  1155. * acf.getConditionType
  1156. *
  1157. * description
  1158. *
  1159. * @date 1/2/18
  1160. * @since 5.6.5
  1161. *
  1162. * @param type $var Description. Default.
  1163. * @return type Description.
  1164. */
  1165. acf.getConditionType = function (type) {
  1166. var mid = modelId(type);
  1167. return acf.models[mid] || false;
  1168. };
  1169. /**
  1170. * acf.registerConditionForFieldType
  1171. *
  1172. * description
  1173. *
  1174. * @date 1/2/18
  1175. * @since 5.6.5
  1176. *
  1177. * @param type $var Description. Default.
  1178. * @return type Description.
  1179. */
  1180. acf.registerConditionForFieldType = function (conditionType, fieldType) {
  1181. // get model
  1182. var model = acf.getConditionType(conditionType);
  1183. // append
  1184. if (model) {
  1185. model.prototype.fieldTypes.push(fieldType);
  1186. }
  1187. };
  1188. /**
  1189. * acf.getConditionTypes
  1190. *
  1191. * description
  1192. *
  1193. * @date 1/2/18
  1194. * @since 5.6.5
  1195. *
  1196. * @param type $var Description. Default.
  1197. * @return type Description.
  1198. */
  1199. acf.getConditionTypes = function (args) {
  1200. // defaults
  1201. args = acf.parseArgs(args, {
  1202. fieldType: '',
  1203. operator: ''
  1204. });
  1205. // clonse available types
  1206. var types = [];
  1207. // loop
  1208. storage.map(function (type) {
  1209. // vars
  1210. var model = acf.getConditionType(type);
  1211. var ProtoFieldTypes = model.prototype.fieldTypes;
  1212. var ProtoOperator = model.prototype.operator;
  1213. // check fieldType
  1214. if (args.fieldType && ProtoFieldTypes.indexOf(args.fieldType) === -1) {
  1215. return;
  1216. }
  1217. // check operator
  1218. if (args.operator && ProtoOperator !== args.operator) {
  1219. return;
  1220. }
  1221. // append
  1222. types.push(model);
  1223. });
  1224. // return
  1225. return types;
  1226. };
  1227. })(jQuery);
  1228. /***/ }),
  1229. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-conditions.js":
  1230. /*!*************************************************************************!*\
  1231. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-conditions.js ***!
  1232. \*************************************************************************/
  1233. /***/ (function() {
  1234. (function ($, undefined) {
  1235. // vars
  1236. var CONTEXT = 'conditional_logic';
  1237. /**
  1238. * conditionsManager
  1239. *
  1240. * description
  1241. *
  1242. * @date 1/2/18
  1243. * @since 5.6.5
  1244. *
  1245. * @param type $var Description. Default.
  1246. * @return type Description.
  1247. */
  1248. var conditionsManager = new acf.Model({
  1249. id: 'conditionsManager',
  1250. priority: 20,
  1251. // run actions later
  1252. actions: {
  1253. new_field: 'onNewField'
  1254. },
  1255. onNewField: function (field) {
  1256. if (field.has('conditions')) {
  1257. field.getConditions().render();
  1258. }
  1259. }
  1260. });
  1261. /**
  1262. * acf.Field.prototype.getField
  1263. *
  1264. * Finds a field that is related to another field
  1265. *
  1266. * @date 1/2/18
  1267. * @since 5.6.5
  1268. *
  1269. * @param type $var Description. Default.
  1270. * @return type Description.
  1271. */
  1272. var getSiblingField = function (field, key) {
  1273. // find sibling (very fast)
  1274. var fields = acf.getFields({
  1275. key: key,
  1276. sibling: field.$el,
  1277. suppressFilters: true
  1278. });
  1279. // find sibling-children (fast)
  1280. // needed for group fields, accordions, etc
  1281. if (!fields.length) {
  1282. fields = acf.getFields({
  1283. key: key,
  1284. parent: field.$el.parent(),
  1285. suppressFilters: true
  1286. });
  1287. }
  1288. // Check for fields on other settings tabs (probably less fast).
  1289. if (!fields.length && $('.acf-field-settings').length) {
  1290. fields = acf.getFields({
  1291. key: key,
  1292. parent: field.$el.parents('.acf-field-settings:first'),
  1293. suppressFilters: true
  1294. });
  1295. }
  1296. // return
  1297. if (fields.length) {
  1298. return fields[0];
  1299. }
  1300. return false;
  1301. };
  1302. acf.Field.prototype.getField = function (key) {
  1303. // get sibling field
  1304. var field = getSiblingField(this, key);
  1305. // return early
  1306. if (field) {
  1307. return field;
  1308. }
  1309. // move up through each parent and try again
  1310. var parents = this.parents();
  1311. for (var i = 0; i < parents.length; i++) {
  1312. // get sibling field
  1313. field = getSiblingField(parents[i], key);
  1314. // return early
  1315. if (field) {
  1316. return field;
  1317. }
  1318. }
  1319. // return
  1320. return false;
  1321. };
  1322. /**
  1323. * acf.Field.prototype.getConditions
  1324. *
  1325. * Returns the field's conditions instance
  1326. *
  1327. * @date 1/2/18
  1328. * @since 5.6.5
  1329. *
  1330. * @param type $var Description. Default.
  1331. * @return type Description.
  1332. */
  1333. acf.Field.prototype.getConditions = function () {
  1334. // instantiate
  1335. if (!this.conditions) {
  1336. this.conditions = new Conditions(this);
  1337. }
  1338. // return
  1339. return this.conditions;
  1340. };
  1341. /**
  1342. * Conditions
  1343. *
  1344. * description
  1345. *
  1346. * @date 1/2/18
  1347. * @since 5.6.5
  1348. *
  1349. * @param type $var Description. Default.
  1350. * @return type Description.
  1351. */
  1352. var timeout = false;
  1353. var Conditions = acf.Model.extend({
  1354. id: 'Conditions',
  1355. data: {
  1356. field: false,
  1357. // The field with "data-conditions" (target).
  1358. timeStamp: false,
  1359. // Reference used during "change" event.
  1360. groups: [] // The groups of condition instances.
  1361. },
  1362. setup: function (field) {
  1363. // data
  1364. this.data.field = field;
  1365. // vars
  1366. var conditions = field.get('conditions');
  1367. // detect groups
  1368. if (conditions instanceof Array) {
  1369. // detect groups
  1370. if (conditions[0] instanceof Array) {
  1371. // loop
  1372. conditions.map(function (rules, i) {
  1373. this.addRules(rules, i);
  1374. }, this);
  1375. // detect rules
  1376. } else {
  1377. this.addRules(conditions);
  1378. }
  1379. // detect rule
  1380. } else {
  1381. this.addRule(conditions);
  1382. }
  1383. },
  1384. change: function (e) {
  1385. // this function may be triggered multiple times per event due to multiple condition classes
  1386. // compare timestamp to allow only 1 trigger per event
  1387. if (this.get('timeStamp') === e.timeStamp) {
  1388. return false;
  1389. } else {
  1390. this.set('timeStamp', e.timeStamp, true);
  1391. }
  1392. // render condition and store result
  1393. var changed = this.render();
  1394. },
  1395. render: function () {
  1396. return this.calculate() ? this.show() : this.hide();
  1397. },
  1398. show: function () {
  1399. return this.get('field').showEnable(this.cid, CONTEXT);
  1400. },
  1401. hide: function () {
  1402. return this.get('field').hideDisable(this.cid, CONTEXT);
  1403. },
  1404. calculate: function () {
  1405. // vars
  1406. var pass = false;
  1407. // loop
  1408. this.getGroups().map(function (group) {
  1409. // igrnore this group if another group passed
  1410. if (pass) return;
  1411. // find passed
  1412. var passed = group.filter(function (condition) {
  1413. return condition.calculate();
  1414. });
  1415. // if all conditions passed, update the global var
  1416. if (passed.length == group.length) {
  1417. pass = true;
  1418. }
  1419. });
  1420. return pass;
  1421. },
  1422. hasGroups: function () {
  1423. return this.data.groups != null;
  1424. },
  1425. getGroups: function () {
  1426. return this.data.groups;
  1427. },
  1428. addGroup: function () {
  1429. var group = [];
  1430. this.data.groups.push(group);
  1431. return group;
  1432. },
  1433. hasGroup: function (i) {
  1434. return this.data.groups[i] != null;
  1435. },
  1436. getGroup: function (i) {
  1437. return this.data.groups[i];
  1438. },
  1439. removeGroup: function (i) {
  1440. this.data.groups[i].delete;
  1441. return this;
  1442. },
  1443. addRules: function (rules, group) {
  1444. rules.map(function (rule) {
  1445. this.addRule(rule, group);
  1446. }, this);
  1447. },
  1448. addRule: function (rule, group) {
  1449. // defaults
  1450. group = group || 0;
  1451. // vars
  1452. var groupArray;
  1453. // get group
  1454. if (this.hasGroup(group)) {
  1455. groupArray = this.getGroup(group);
  1456. } else {
  1457. groupArray = this.addGroup();
  1458. }
  1459. // instantiate
  1460. var condition = acf.newCondition(rule, this);
  1461. // bail early if condition failed (field did not exist)
  1462. if (!condition) {
  1463. return false;
  1464. }
  1465. // add rule
  1466. groupArray.push(condition);
  1467. },
  1468. hasRule: function () {},
  1469. getRule: function (rule, group) {
  1470. // defaults
  1471. rule = rule || 0;
  1472. group = group || 0;
  1473. return this.data.groups[group][rule];
  1474. },
  1475. removeRule: function () {}
  1476. });
  1477. })(jQuery);
  1478. /***/ }),
  1479. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-accordion.js":
  1480. /*!******************************************************************************!*\
  1481. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-accordion.js ***!
  1482. \******************************************************************************/
  1483. /***/ (function() {
  1484. (function ($, undefined) {
  1485. var i = 0;
  1486. var Field = acf.Field.extend({
  1487. type: 'accordion',
  1488. wait: '',
  1489. $control: function () {
  1490. return this.$('.acf-fields:first');
  1491. },
  1492. initialize: function () {
  1493. // Bail early if this is a duplicate of an existing initialized accordion.
  1494. if (this.$el.hasClass('acf-accordion')) {
  1495. return;
  1496. }
  1497. // bail early if is cell
  1498. if (this.$el.is('td')) return;
  1499. // enpoint
  1500. if (this.get('endpoint')) {
  1501. return this.remove();
  1502. }
  1503. // vars
  1504. var $field = this.$el;
  1505. var $label = this.$labelWrap();
  1506. var $input = this.$inputWrap();
  1507. var $wrap = this.$control();
  1508. var $instructions = $input.children('.description');
  1509. // force description into label
  1510. if ($instructions.length) {
  1511. $label.append($instructions);
  1512. }
  1513. // table
  1514. if (this.$el.is('tr')) {
  1515. // vars
  1516. var $table = this.$el.closest('table');
  1517. var $newLabel = $('<div class="acf-accordion-title"/>');
  1518. var $newInput = $('<div class="acf-accordion-content"/>');
  1519. var $newTable = $('<table class="' + $table.attr('class') + '"/>');
  1520. var $newWrap = $('<tbody/>');
  1521. // dom
  1522. $newLabel.append($label.html());
  1523. $newTable.append($newWrap);
  1524. $newInput.append($newTable);
  1525. $input.append($newLabel);
  1526. $input.append($newInput);
  1527. // modify
  1528. $label.remove();
  1529. $wrap.remove();
  1530. $input.attr('colspan', 2);
  1531. // update vars
  1532. $label = $newLabel;
  1533. $input = $newInput;
  1534. $wrap = $newWrap;
  1535. }
  1536. // add classes
  1537. $field.addClass('acf-accordion');
  1538. $label.addClass('acf-accordion-title');
  1539. $input.addClass('acf-accordion-content');
  1540. // index
  1541. i++;
  1542. // multi-expand
  1543. if (this.get('multi_expand')) {
  1544. $field.attr('multi-expand', 1);
  1545. }
  1546. // open
  1547. var order = acf.getPreference('this.accordions') || [];
  1548. if (order[i - 1] !== undefined) {
  1549. this.set('open', order[i - 1]);
  1550. }
  1551. if (this.get('open')) {
  1552. $field.addClass('-open');
  1553. $input.css('display', 'block'); // needed for accordion to close smoothly
  1554. }
  1555. // add icon
  1556. $label.prepend(accordionManager.iconHtml({
  1557. open: this.get('open')
  1558. }));
  1559. // classes
  1560. // - remove 'inside' which is a #poststuff WP class
  1561. var $parent = $field.parent();
  1562. $wrap.addClass($parent.hasClass('-left') ? '-left' : '');
  1563. $wrap.addClass($parent.hasClass('-clear') ? '-clear' : '');
  1564. // append
  1565. $wrap.append($field.nextUntil('.acf-field-accordion', '.acf-field'));
  1566. // clean up
  1567. $wrap.removeAttr('data-open data-multi_expand data-endpoint');
  1568. }
  1569. });
  1570. acf.registerFieldType(Field);
  1571. /**
  1572. * accordionManager
  1573. *
  1574. * Events manager for the acf accordion
  1575. *
  1576. * @date 14/2/18
  1577. * @since 5.6.9
  1578. *
  1579. * @param void
  1580. * @return void
  1581. */
  1582. var accordionManager = new acf.Model({
  1583. actions: {
  1584. unload: 'onUnload'
  1585. },
  1586. events: {
  1587. 'click .acf-accordion-title': 'onClick',
  1588. 'invalidField .acf-accordion': 'onInvalidField'
  1589. },
  1590. isOpen: function ($el) {
  1591. return $el.hasClass('-open');
  1592. },
  1593. toggle: function ($el) {
  1594. if (this.isOpen($el)) {
  1595. this.close($el);
  1596. } else {
  1597. this.open($el);
  1598. }
  1599. },
  1600. iconHtml: function (props) {
  1601. // Use SVG inside Gutenberg editor.
  1602. if (acf.isGutenberg()) {
  1603. if (props.open) {
  1604. return '<svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="acf-accordion-icon components-panel__arrow" aria-hidden="true" focusable="false"><path d="M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"></path></svg>';
  1605. } else {
  1606. return '<svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class=" acf-accordion-icon components-panel__arrow" aria-hidden="true" focusable="false"><path d="M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"></path></svg>';
  1607. }
  1608. } else {
  1609. if (props.open) {
  1610. return '<i class="acf-accordion-icon dashicons dashicons-arrow-down"></i>';
  1611. } else {
  1612. return '<i class="acf-accordion-icon dashicons dashicons-arrow-right"></i>';
  1613. }
  1614. }
  1615. },
  1616. open: function ($el) {
  1617. var duration = acf.isGutenberg() ? 0 : 300;
  1618. // open
  1619. $el.find('.acf-accordion-content:first').slideDown(duration).css('display', 'block');
  1620. $el.find('.acf-accordion-icon:first').replaceWith(this.iconHtml({
  1621. open: true
  1622. }));
  1623. $el.addClass('-open');
  1624. // action
  1625. acf.doAction('show', $el);
  1626. // close siblings
  1627. if (!$el.attr('multi-expand')) {
  1628. $el.siblings('.acf-accordion.-open').each(function () {
  1629. accordionManager.close($(this));
  1630. });
  1631. }
  1632. },
  1633. close: function ($el) {
  1634. var duration = acf.isGutenberg() ? 0 : 300;
  1635. // close
  1636. $el.find('.acf-accordion-content:first').slideUp(duration);
  1637. $el.find('.acf-accordion-icon:first').replaceWith(this.iconHtml({
  1638. open: false
  1639. }));
  1640. $el.removeClass('-open');
  1641. // action
  1642. acf.doAction('hide', $el);
  1643. },
  1644. onClick: function (e, $el) {
  1645. // prevent Defailt
  1646. e.preventDefault();
  1647. // open close
  1648. this.toggle($el.parent());
  1649. },
  1650. onInvalidField: function (e, $el) {
  1651. // bail early if already focused
  1652. if (this.busy) {
  1653. return;
  1654. }
  1655. // disable functionality for 1sec (allow next validation to work)
  1656. this.busy = true;
  1657. this.setTimeout(function () {
  1658. this.busy = false;
  1659. }, 1000);
  1660. // open accordion
  1661. this.open($el);
  1662. },
  1663. onUnload: function (e) {
  1664. // vars
  1665. var order = [];
  1666. // loop
  1667. $('.acf-accordion').each(function () {
  1668. var open = $(this).hasClass('-open') ? 1 : 0;
  1669. order.push(open);
  1670. });
  1671. // set
  1672. if (order.length) {
  1673. acf.setPreference('this.accordions', order);
  1674. }
  1675. }
  1676. });
  1677. })(jQuery);
  1678. /***/ }),
  1679. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-button-group.js":
  1680. /*!*********************************************************************************!*\
  1681. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-button-group.js ***!
  1682. \*********************************************************************************/
  1683. /***/ (function() {
  1684. (function ($, undefined) {
  1685. var Field = acf.Field.extend({
  1686. type: 'button_group',
  1687. events: {
  1688. 'click input[type="radio"]': 'onClick'
  1689. },
  1690. $control: function () {
  1691. return this.$('.acf-button-group');
  1692. },
  1693. $input: function () {
  1694. return this.$('input:checked');
  1695. },
  1696. setValue: function (val) {
  1697. this.$('input[value="' + val + '"]').prop('checked', true).trigger('change');
  1698. },
  1699. onClick: function (e, $el) {
  1700. // vars
  1701. var $label = $el.parent('label');
  1702. var selected = $label.hasClass('selected');
  1703. // remove previous selected
  1704. this.$('.selected').removeClass('selected');
  1705. // add active class
  1706. $label.addClass('selected');
  1707. // allow null
  1708. if (this.get('allow_null') && selected) {
  1709. $label.removeClass('selected');
  1710. $el.prop('checked', false).trigger('change');
  1711. }
  1712. }
  1713. });
  1714. acf.registerFieldType(Field);
  1715. })(jQuery);
  1716. /***/ }),
  1717. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-checkbox.js":
  1718. /*!*****************************************************************************!*\
  1719. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-checkbox.js ***!
  1720. \*****************************************************************************/
  1721. /***/ (function() {
  1722. (function ($, undefined) {
  1723. var Field = acf.Field.extend({
  1724. type: 'checkbox',
  1725. events: {
  1726. 'change input': 'onChange',
  1727. 'click .acf-add-checkbox': 'onClickAdd',
  1728. 'click .acf-checkbox-toggle': 'onClickToggle',
  1729. 'click .acf-checkbox-custom': 'onClickCustom'
  1730. },
  1731. $control: function () {
  1732. return this.$('.acf-checkbox-list');
  1733. },
  1734. $toggle: function () {
  1735. return this.$('.acf-checkbox-toggle');
  1736. },
  1737. $input: function () {
  1738. return this.$('input[type="hidden"]');
  1739. },
  1740. $inputs: function () {
  1741. return this.$('input[type="checkbox"]').not('.acf-checkbox-toggle');
  1742. },
  1743. getValue: function () {
  1744. var val = [];
  1745. this.$(':checked').each(function () {
  1746. val.push($(this).val());
  1747. });
  1748. return val.length ? val : false;
  1749. },
  1750. onChange: function (e, $el) {
  1751. // Vars.
  1752. var checked = $el.prop('checked');
  1753. var $label = $el.parent('label');
  1754. var $toggle = this.$toggle();
  1755. // Add or remove "selected" class.
  1756. if (checked) {
  1757. $label.addClass('selected');
  1758. } else {
  1759. $label.removeClass('selected');
  1760. }
  1761. // Update toggle state if all inputs are checked.
  1762. if ($toggle.length) {
  1763. var $inputs = this.$inputs();
  1764. // all checked
  1765. if ($inputs.not(':checked').length == 0) {
  1766. $toggle.prop('checked', true);
  1767. } else {
  1768. $toggle.prop('checked', false);
  1769. }
  1770. }
  1771. },
  1772. onClickAdd: function (e, $el) {
  1773. var html = '<li><input class="acf-checkbox-custom" type="checkbox" checked="checked" /><input type="text" name="' + this.getInputName() + '[]" /></li>';
  1774. $el.parent('li').before(html);
  1775. },
  1776. onClickToggle: function (e, $el) {
  1777. // Vars.
  1778. var checked = $el.prop('checked');
  1779. var $inputs = this.$('input[type="checkbox"]');
  1780. var $labels = this.$('label');
  1781. // Update "checked" state.
  1782. $inputs.prop('checked', checked);
  1783. // Add or remove "selected" class.
  1784. if (checked) {
  1785. $labels.addClass('selected');
  1786. } else {
  1787. $labels.removeClass('selected');
  1788. }
  1789. },
  1790. onClickCustom: function (e, $el) {
  1791. var checked = $el.prop('checked');
  1792. var $text = $el.next('input[type="text"]');
  1793. // checked
  1794. if (checked) {
  1795. $text.prop('disabled', false);
  1796. // not checked
  1797. } else {
  1798. $text.prop('disabled', true);
  1799. // remove
  1800. if ($text.val() == '') {
  1801. $el.parent('li').remove();
  1802. }
  1803. }
  1804. }
  1805. });
  1806. acf.registerFieldType(Field);
  1807. })(jQuery);
  1808. /***/ }),
  1809. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-color-picker.js":
  1810. /*!*********************************************************************************!*\
  1811. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-color-picker.js ***!
  1812. \*********************************************************************************/
  1813. /***/ (function() {
  1814. (function ($, undefined) {
  1815. var Field = acf.Field.extend({
  1816. type: 'color_picker',
  1817. wait: 'load',
  1818. events: {
  1819. duplicateField: 'onDuplicate'
  1820. },
  1821. $control: function () {
  1822. return this.$('.acf-color-picker');
  1823. },
  1824. $input: function () {
  1825. return this.$('input[type="hidden"]');
  1826. },
  1827. $inputText: function () {
  1828. return this.$('input[type="text"]');
  1829. },
  1830. setValue: function (val) {
  1831. // update input (with change)
  1832. acf.val(this.$input(), val);
  1833. // update iris
  1834. this.$inputText().iris('color', val);
  1835. },
  1836. initialize: function () {
  1837. // vars
  1838. var $input = this.$input();
  1839. var $inputText = this.$inputText();
  1840. // event
  1841. var onChange = function (e) {
  1842. // timeout is required to ensure the $input val is correct
  1843. setTimeout(function () {
  1844. acf.val($input, $inputText.val());
  1845. }, 1);
  1846. };
  1847. // args
  1848. var args = {
  1849. defaultColor: false,
  1850. palettes: true,
  1851. hide: true,
  1852. change: onChange,
  1853. clear: onChange
  1854. };
  1855. // filter
  1856. var args = acf.applyFilters('color_picker_args', args, this);
  1857. // initialize
  1858. $inputText.wpColorPicker(args);
  1859. },
  1860. onDuplicate: function (e, $el, $duplicate) {
  1861. // The wpColorPicker library does not provide a destroy method.
  1862. // Manually reset DOM by replacing elements back to their original state.
  1863. $colorPicker = $duplicate.find('.wp-picker-container');
  1864. $inputText = $duplicate.find('input[type="text"]');
  1865. $colorPicker.replaceWith($inputText);
  1866. }
  1867. });
  1868. acf.registerFieldType(Field);
  1869. })(jQuery);
  1870. /***/ }),
  1871. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-date-picker.js":
  1872. /*!********************************************************************************!*\
  1873. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-date-picker.js ***!
  1874. \********************************************************************************/
  1875. /***/ (function() {
  1876. (function ($, undefined) {
  1877. var Field = acf.Field.extend({
  1878. type: 'date_picker',
  1879. events: {
  1880. 'blur input[type="text"]': 'onBlur',
  1881. duplicateField: 'onDuplicate'
  1882. },
  1883. $control: function () {
  1884. return this.$('.acf-date-picker');
  1885. },
  1886. $input: function () {
  1887. return this.$('input[type="hidden"]');
  1888. },
  1889. $inputText: function () {
  1890. return this.$('input[type="text"]');
  1891. },
  1892. initialize: function () {
  1893. // save_format: compatibility with ACF < 5.0.0
  1894. if (this.has('save_format')) {
  1895. return this.initializeCompatibility();
  1896. }
  1897. // vars
  1898. var $input = this.$input();
  1899. var $inputText = this.$inputText();
  1900. // args
  1901. var args = {
  1902. dateFormat: this.get('date_format'),
  1903. altField: $input,
  1904. altFormat: 'yymmdd',
  1905. changeYear: true,
  1906. yearRange: '-100:+100',
  1907. changeMonth: true,
  1908. showButtonPanel: true,
  1909. firstDay: this.get('first_day')
  1910. };
  1911. // filter
  1912. args = acf.applyFilters('date_picker_args', args, this);
  1913. // add date picker
  1914. acf.newDatePicker($inputText, args);
  1915. // action
  1916. acf.doAction('date_picker_init', $inputText, args, this);
  1917. },
  1918. initializeCompatibility: function () {
  1919. // vars
  1920. var $input = this.$input();
  1921. var $inputText = this.$inputText();
  1922. // get and set value from alt field
  1923. $inputText.val($input.val());
  1924. // args
  1925. var args = {
  1926. dateFormat: this.get('date_format'),
  1927. altField: $input,
  1928. altFormat: this.get('save_format'),
  1929. changeYear: true,
  1930. yearRange: '-100:+100',
  1931. changeMonth: true,
  1932. showButtonPanel: true,
  1933. firstDay: this.get('first_day')
  1934. };
  1935. // filter for 3rd party customization
  1936. args = acf.applyFilters('date_picker_args', args, this);
  1937. // backup
  1938. var dateFormat = args.dateFormat;
  1939. // change args.dateFormat
  1940. args.dateFormat = this.get('save_format');
  1941. // add date picker
  1942. acf.newDatePicker($inputText, args);
  1943. // now change the format back to how it should be.
  1944. $inputText.datepicker('option', 'dateFormat', dateFormat);
  1945. // action for 3rd party customization
  1946. acf.doAction('date_picker_init', $inputText, args, this);
  1947. },
  1948. onBlur: function () {
  1949. if (!this.$inputText().val()) {
  1950. acf.val(this.$input(), '');
  1951. }
  1952. },
  1953. onDuplicate: function (e, $el, $duplicate) {
  1954. $duplicate.find('input[type="text"]').removeClass('hasDatepicker').removeAttr('id');
  1955. }
  1956. });
  1957. acf.registerFieldType(Field);
  1958. // manager
  1959. var datePickerManager = new acf.Model({
  1960. priority: 5,
  1961. wait: 'ready',
  1962. initialize: function () {
  1963. // vars
  1964. var locale = acf.get('locale');
  1965. var rtl = acf.get('rtl');
  1966. var l10n = acf.get('datePickerL10n');
  1967. // bail early if no l10n
  1968. if (!l10n) {
  1969. return false;
  1970. }
  1971. // bail early if no datepicker library
  1972. if (typeof $.datepicker === 'undefined') {
  1973. return false;
  1974. }
  1975. // rtl
  1976. l10n.isRTL = rtl;
  1977. // append
  1978. $.datepicker.regional[locale] = l10n;
  1979. $.datepicker.setDefaults(l10n);
  1980. }
  1981. });
  1982. // add
  1983. acf.newDatePicker = function ($input, args) {
  1984. // bail early if no datepicker library
  1985. if (typeof $.datepicker === 'undefined') {
  1986. return false;
  1987. }
  1988. // defaults
  1989. args = args || {};
  1990. // initialize
  1991. $input.datepicker(args);
  1992. // wrap the datepicker (only if it hasn't already been wrapped)
  1993. if ($('body > #ui-datepicker-div').exists()) {
  1994. $('body > #ui-datepicker-div').wrap('<div class="acf-ui-datepicker" />');
  1995. }
  1996. };
  1997. })(jQuery);
  1998. /***/ }),
  1999. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-date-time-picker.js":
  2000. /*!*************************************************************************************!*\
  2001. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-date-time-picker.js ***!
  2002. \*************************************************************************************/
  2003. /***/ (function() {
  2004. (function ($, undefined) {
  2005. var Field = acf.models.DatePickerField.extend({
  2006. type: 'date_time_picker',
  2007. $control: function () {
  2008. return this.$('.acf-date-time-picker');
  2009. },
  2010. initialize: function () {
  2011. // vars
  2012. var $input = this.$input();
  2013. var $inputText = this.$inputText();
  2014. // args
  2015. var args = {
  2016. dateFormat: this.get('date_format'),
  2017. timeFormat: this.get('time_format'),
  2018. altField: $input,
  2019. altFieldTimeOnly: false,
  2020. altFormat: 'yy-mm-dd',
  2021. altTimeFormat: 'HH:mm:ss',
  2022. changeYear: true,
  2023. yearRange: '-100:+100',
  2024. changeMonth: true,
  2025. showButtonPanel: true,
  2026. firstDay: this.get('first_day'),
  2027. controlType: 'select',
  2028. oneLine: true
  2029. };
  2030. // filter
  2031. args = acf.applyFilters('date_time_picker_args', args, this);
  2032. // add date time picker
  2033. acf.newDateTimePicker($inputText, args);
  2034. // action
  2035. acf.doAction('date_time_picker_init', $inputText, args, this);
  2036. }
  2037. });
  2038. acf.registerFieldType(Field);
  2039. // manager
  2040. var dateTimePickerManager = new acf.Model({
  2041. priority: 5,
  2042. wait: 'ready',
  2043. initialize: function () {
  2044. // vars
  2045. var locale = acf.get('locale');
  2046. var rtl = acf.get('rtl');
  2047. var l10n = acf.get('dateTimePickerL10n');
  2048. // bail early if no l10n
  2049. if (!l10n) {
  2050. return false;
  2051. }
  2052. // bail early if no datepicker library
  2053. if (typeof $.timepicker === 'undefined') {
  2054. return false;
  2055. }
  2056. // rtl
  2057. l10n.isRTL = rtl;
  2058. // append
  2059. $.timepicker.regional[locale] = l10n;
  2060. $.timepicker.setDefaults(l10n);
  2061. }
  2062. });
  2063. // add
  2064. acf.newDateTimePicker = function ($input, args) {
  2065. // bail early if no datepicker library
  2066. if (typeof $.timepicker === 'undefined') {
  2067. return false;
  2068. }
  2069. // defaults
  2070. args = args || {};
  2071. // initialize
  2072. $input.datetimepicker(args);
  2073. // wrap the datepicker (only if it hasn't already been wrapped)
  2074. if ($('body > #ui-datepicker-div').exists()) {
  2075. $('body > #ui-datepicker-div').wrap('<div class="acf-ui-datepicker" />');
  2076. }
  2077. };
  2078. })(jQuery);
  2079. /***/ }),
  2080. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-file.js":
  2081. /*!*************************************************************************!*\
  2082. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-file.js ***!
  2083. \*************************************************************************/
  2084. /***/ (function() {
  2085. (function ($, undefined) {
  2086. var Field = acf.models.ImageField.extend({
  2087. type: 'file',
  2088. $control: function () {
  2089. return this.$('.acf-file-uploader');
  2090. },
  2091. $input: function () {
  2092. return this.$('input[type="hidden"]:first');
  2093. },
  2094. validateAttachment: function (attachment) {
  2095. // defaults
  2096. attachment = attachment || {};
  2097. // WP attachment
  2098. if (attachment.id !== undefined) {
  2099. attachment = attachment.attributes;
  2100. }
  2101. // args
  2102. attachment = acf.parseArgs(attachment, {
  2103. url: '',
  2104. alt: '',
  2105. title: '',
  2106. filename: '',
  2107. filesizeHumanReadable: '',
  2108. icon: '/wp-includes/images/media/default.png'
  2109. });
  2110. // return
  2111. return attachment;
  2112. },
  2113. render: function (attachment) {
  2114. // vars
  2115. attachment = this.validateAttachment(attachment);
  2116. // update image
  2117. this.$('img').attr({
  2118. src: attachment.icon,
  2119. alt: attachment.alt,
  2120. title: attachment.title
  2121. });
  2122. // update elements
  2123. this.$('[data-name="title"]').text(attachment.title);
  2124. this.$('[data-name="filename"]').text(attachment.filename).attr('href', attachment.url);
  2125. this.$('[data-name="filesize"]').text(attachment.filesizeHumanReadable);
  2126. // vars
  2127. var val = attachment.id || '';
  2128. // update val
  2129. acf.val(this.$input(), val);
  2130. // update class
  2131. if (val) {
  2132. this.$control().addClass('has-value');
  2133. } else {
  2134. this.$control().removeClass('has-value');
  2135. }
  2136. },
  2137. selectAttachment: function () {
  2138. // vars
  2139. var parent = this.parent();
  2140. var multiple = parent && parent.get('type') === 'repeater';
  2141. // new frame
  2142. var frame = acf.newMediaPopup({
  2143. mode: 'select',
  2144. title: acf.__('Select File'),
  2145. field: this.get('key'),
  2146. multiple: multiple,
  2147. library: this.get('library'),
  2148. allowedTypes: this.get('mime_types'),
  2149. select: $.proxy(function (attachment, i) {
  2150. if (i > 0) {
  2151. this.append(attachment, parent);
  2152. } else {
  2153. this.render(attachment);
  2154. }
  2155. }, this)
  2156. });
  2157. },
  2158. editAttachment: function () {
  2159. // vars
  2160. var val = this.val();
  2161. // bail early if no val
  2162. if (!val) {
  2163. return false;
  2164. }
  2165. // popup
  2166. var frame = acf.newMediaPopup({
  2167. mode: 'edit',
  2168. title: acf.__('Edit File'),
  2169. button: acf.__('Update File'),
  2170. attachment: val,
  2171. field: this.get('key'),
  2172. select: $.proxy(function (attachment, i) {
  2173. this.render(attachment);
  2174. }, this)
  2175. });
  2176. }
  2177. });
  2178. acf.registerFieldType(Field);
  2179. })(jQuery);
  2180. /***/ }),
  2181. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-google-map.js":
  2182. /*!*******************************************************************************!*\
  2183. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-google-map.js ***!
  2184. \*******************************************************************************/
  2185. /***/ (function() {
  2186. (function ($, undefined) {
  2187. var Field = acf.Field.extend({
  2188. type: 'google_map',
  2189. map: false,
  2190. wait: 'load',
  2191. events: {
  2192. 'click a[data-name="clear"]': 'onClickClear',
  2193. 'click a[data-name="locate"]': 'onClickLocate',
  2194. 'click a[data-name="search"]': 'onClickSearch',
  2195. 'keydown .search': 'onKeydownSearch',
  2196. 'keyup .search': 'onKeyupSearch',
  2197. 'focus .search': 'onFocusSearch',
  2198. 'blur .search': 'onBlurSearch',
  2199. showField: 'onShow'
  2200. },
  2201. $control: function () {
  2202. return this.$('.acf-google-map');
  2203. },
  2204. $search: function () {
  2205. return this.$('.search');
  2206. },
  2207. $canvas: function () {
  2208. return this.$('.canvas');
  2209. },
  2210. setState: function (state) {
  2211. // Remove previous state classes.
  2212. this.$control().removeClass('-value -loading -searching');
  2213. // Determine auto state based of current value.
  2214. if (state === 'default') {
  2215. state = this.val() ? 'value' : '';
  2216. }
  2217. // Update state class.
  2218. if (state) {
  2219. this.$control().addClass('-' + state);
  2220. }
  2221. },
  2222. getValue: function () {
  2223. var val = this.$input().val();
  2224. if (val) {
  2225. return JSON.parse(val);
  2226. } else {
  2227. return false;
  2228. }
  2229. },
  2230. setValue: function (val, silent) {
  2231. // Convert input value.
  2232. var valAttr = '';
  2233. if (val) {
  2234. valAttr = JSON.stringify(val);
  2235. }
  2236. // Update input (with change).
  2237. acf.val(this.$input(), valAttr);
  2238. // Bail early if silent update.
  2239. if (silent) {
  2240. return;
  2241. }
  2242. // Render.
  2243. this.renderVal(val);
  2244. /**
  2245. * Fires immediately after the value has changed.
  2246. *
  2247. * @date 12/02/2014
  2248. * @since 5.0.0
  2249. *
  2250. * @param object|string val The new value.
  2251. * @param object map The Google Map isntance.
  2252. * @param object field The field instance.
  2253. */
  2254. acf.doAction('google_map_change', val, this.map, this);
  2255. },
  2256. renderVal: function (val) {
  2257. // Value.
  2258. if (val) {
  2259. this.setState('value');
  2260. this.$search().val(val.address);
  2261. this.setPosition(val.lat, val.lng);
  2262. // No value.
  2263. } else {
  2264. this.setState('');
  2265. this.$search().val('');
  2266. this.map.marker.setVisible(false);
  2267. }
  2268. },
  2269. newLatLng: function (lat, lng) {
  2270. return new google.maps.LatLng(parseFloat(lat), parseFloat(lng));
  2271. },
  2272. setPosition: function (lat, lng) {
  2273. // Update marker position.
  2274. this.map.marker.setPosition({
  2275. lat: parseFloat(lat),
  2276. lng: parseFloat(lng)
  2277. });
  2278. // Show marker.
  2279. this.map.marker.setVisible(true);
  2280. // Center map.
  2281. this.center();
  2282. },
  2283. center: function () {
  2284. // Find marker position.
  2285. var position = this.map.marker.getPosition();
  2286. if (position) {
  2287. var lat = position.lat();
  2288. var lng = position.lng();
  2289. // Or find default settings.
  2290. } else {
  2291. var lat = this.get('lat');
  2292. var lng = this.get('lng');
  2293. }
  2294. // Center map.
  2295. this.map.setCenter({
  2296. lat: parseFloat(lat),
  2297. lng: parseFloat(lng)
  2298. });
  2299. },
  2300. initialize: function () {
  2301. // Ensure Google API is loaded and then initialize map.
  2302. withAPI(this.initializeMap.bind(this));
  2303. },
  2304. initializeMap: function () {
  2305. // Get value ignoring conditional logic status.
  2306. var val = this.getValue();
  2307. // Construct default args.
  2308. var args = acf.parseArgs(val, {
  2309. zoom: this.get('zoom'),
  2310. lat: this.get('lat'),
  2311. lng: this.get('lng')
  2312. });
  2313. // Create Map.
  2314. var mapArgs = {
  2315. scrollwheel: false,
  2316. zoom: parseInt(args.zoom),
  2317. center: {
  2318. lat: parseFloat(args.lat),
  2319. lng: parseFloat(args.lng)
  2320. },
  2321. mapTypeId: google.maps.MapTypeId.ROADMAP,
  2322. marker: {
  2323. draggable: true,
  2324. raiseOnDrag: true
  2325. },
  2326. autocomplete: {}
  2327. };
  2328. mapArgs = acf.applyFilters('google_map_args', mapArgs, this);
  2329. var map = new google.maps.Map(this.$canvas()[0], mapArgs);
  2330. // Create Marker.
  2331. var markerArgs = acf.parseArgs(mapArgs.marker, {
  2332. draggable: true,
  2333. raiseOnDrag: true,
  2334. map: map
  2335. });
  2336. markerArgs = acf.applyFilters('google_map_marker_args', markerArgs, this);
  2337. var marker = new google.maps.Marker(markerArgs);
  2338. // Maybe Create Autocomplete.
  2339. var autocomplete = false;
  2340. if (acf.isset(google, 'maps', 'places', 'Autocomplete')) {
  2341. var autocompleteArgs = mapArgs.autocomplete || {};
  2342. autocompleteArgs = acf.applyFilters('google_map_autocomplete_args', autocompleteArgs, this);
  2343. autocomplete = new google.maps.places.Autocomplete(this.$search()[0], autocompleteArgs);
  2344. autocomplete.bindTo('bounds', map);
  2345. }
  2346. // Add map events.
  2347. this.addMapEvents(this, map, marker, autocomplete);
  2348. // Append references.
  2349. map.acf = this;
  2350. map.marker = marker;
  2351. map.autocomplete = autocomplete;
  2352. this.map = map;
  2353. // Set position.
  2354. if (val) {
  2355. this.setPosition(val.lat, val.lng);
  2356. }
  2357. /**
  2358. * Fires immediately after the Google Map has been initialized.
  2359. *
  2360. * @date 12/02/2014
  2361. * @since 5.0.0
  2362. *
  2363. * @param object map The Google Map isntance.
  2364. * @param object marker The Google Map marker isntance.
  2365. * @param object field The field instance.
  2366. */
  2367. acf.doAction('google_map_init', map, marker, this);
  2368. },
  2369. addMapEvents: function (field, map, marker, autocomplete) {
  2370. // Click map.
  2371. google.maps.event.addListener(map, 'click', function (e) {
  2372. var lat = e.latLng.lat();
  2373. var lng = e.latLng.lng();
  2374. field.searchPosition(lat, lng);
  2375. });
  2376. // Drag marker.
  2377. google.maps.event.addListener(marker, 'dragend', function () {
  2378. var lat = this.getPosition().lat();
  2379. var lng = this.getPosition().lng();
  2380. field.searchPosition(lat, lng);
  2381. });
  2382. // Autocomplete search.
  2383. if (autocomplete) {
  2384. google.maps.event.addListener(autocomplete, 'place_changed', function () {
  2385. var place = this.getPlace();
  2386. field.searchPlace(place);
  2387. });
  2388. }
  2389. // Detect zoom change.
  2390. google.maps.event.addListener(map, 'zoom_changed', function () {
  2391. var val = field.val();
  2392. if (val) {
  2393. val.zoom = map.getZoom();
  2394. field.setValue(val, true);
  2395. }
  2396. });
  2397. },
  2398. searchPosition: function (lat, lng) {
  2399. //console.log('searchPosition', lat, lng );
  2400. // Start Loading.
  2401. this.setState('loading');
  2402. // Query Geocoder.
  2403. var latLng = {
  2404. lat: lat,
  2405. lng: lng
  2406. };
  2407. geocoder.geocode({
  2408. location: latLng
  2409. }, function (results, status) {
  2410. //console.log('searchPosition', arguments );
  2411. // End Loading.
  2412. this.setState('');
  2413. // Status failure.
  2414. if (status !== 'OK') {
  2415. this.showNotice({
  2416. text: acf.__('Location not found: %s').replace('%s', status),
  2417. type: 'warning'
  2418. });
  2419. // Success.
  2420. } else {
  2421. var val = this.parseResult(results[0]);
  2422. // Override lat/lng to match user defined marker location.
  2423. // Avoids issue where marker "snaps" to nearest result.
  2424. val.lat = lat;
  2425. val.lng = lng;
  2426. this.val(val);
  2427. }
  2428. }.bind(this));
  2429. },
  2430. searchPlace: function (place) {
  2431. //console.log('searchPlace', place );
  2432. // Bail early if no place.
  2433. if (!place) {
  2434. return;
  2435. }
  2436. // Selecting from the autocomplete dropdown will return a rich PlaceResult object.
  2437. // Be sure to over-write the "formatted_address" value with the one displayed to the user for best UX.
  2438. if (place.geometry) {
  2439. place.formatted_address = this.$search().val();
  2440. var val = this.parseResult(place);
  2441. this.val(val);
  2442. // Searching a custom address will return an empty PlaceResult object.
  2443. } else if (place.name) {
  2444. this.searchAddress(place.name);
  2445. }
  2446. },
  2447. searchAddress: function (address) {
  2448. //console.log('searchAddress', address );
  2449. // Bail early if no address.
  2450. if (!address) {
  2451. return;
  2452. }
  2453. // Allow "lat,lng" search.
  2454. var latLng = address.split(',');
  2455. if (latLng.length == 2) {
  2456. var lat = parseFloat(latLng[0]);
  2457. var lng = parseFloat(latLng[1]);
  2458. if (lat && lng) {
  2459. return this.searchPosition(lat, lng);
  2460. }
  2461. }
  2462. // Start Loading.
  2463. this.setState('loading');
  2464. // Query Geocoder.
  2465. geocoder.geocode({
  2466. address: address
  2467. }, function (results, status) {
  2468. //console.log('searchPosition', arguments );
  2469. // End Loading.
  2470. this.setState('');
  2471. // Status failure.
  2472. if (status !== 'OK') {
  2473. this.showNotice({
  2474. text: acf.__('Location not found: %s').replace('%s', status),
  2475. type: 'warning'
  2476. });
  2477. // Success.
  2478. } else {
  2479. var val = this.parseResult(results[0]);
  2480. // Override address data with parameter allowing custom address to be defined in search.
  2481. val.address = address;
  2482. // Update value.
  2483. this.val(val);
  2484. }
  2485. }.bind(this));
  2486. },
  2487. searchLocation: function () {
  2488. //console.log('searchLocation' );
  2489. // Check HTML5 geolocation.
  2490. if (!navigator.geolocation) {
  2491. return alert(acf.__('Sorry, this browser does not support geolocation'));
  2492. }
  2493. // Start Loading.
  2494. this.setState('loading');
  2495. // Query Geolocation.
  2496. navigator.geolocation.getCurrentPosition(
  2497. // Success.
  2498. function (results) {
  2499. // End Loading.
  2500. this.setState('');
  2501. // Search position.
  2502. var lat = results.coords.latitude;
  2503. var lng = results.coords.longitude;
  2504. this.searchPosition(lat, lng);
  2505. }.bind(this),
  2506. // Failure.
  2507. function (error) {
  2508. this.setState('');
  2509. }.bind(this));
  2510. },
  2511. /**
  2512. * parseResult
  2513. *
  2514. * Returns location data for the given GeocoderResult object.
  2515. *
  2516. * @date 15/10/19
  2517. * @since 5.8.6
  2518. *
  2519. * @param object obj A GeocoderResult object.
  2520. * @return object
  2521. */
  2522. parseResult: function (obj) {
  2523. // Construct basic data.
  2524. var result = {
  2525. address: obj.formatted_address,
  2526. lat: obj.geometry.location.lat(),
  2527. lng: obj.geometry.location.lng()
  2528. };
  2529. // Add zoom level.
  2530. result.zoom = this.map.getZoom();
  2531. // Add place ID.
  2532. if (obj.place_id) {
  2533. result.place_id = obj.place_id;
  2534. }
  2535. // Add place name.
  2536. if (obj.name) {
  2537. result.name = obj.name;
  2538. }
  2539. // Create search map for address component data.
  2540. var map = {
  2541. street_number: ['street_number'],
  2542. street_name: ['street_address', 'route'],
  2543. city: ['locality', 'postal_town'],
  2544. state: ['administrative_area_level_1', 'administrative_area_level_2', 'administrative_area_level_3', 'administrative_area_level_4', 'administrative_area_level_5'],
  2545. post_code: ['postal_code'],
  2546. country: ['country']
  2547. };
  2548. // Loop over map.
  2549. for (var k in map) {
  2550. var keywords = map[k];
  2551. // Loop over address components.
  2552. for (var i = 0; i < obj.address_components.length; i++) {
  2553. var component = obj.address_components[i];
  2554. var component_type = component.types[0];
  2555. // Look for matching component type.
  2556. if (keywords.indexOf(component_type) !== -1) {
  2557. // Append to result.
  2558. result[k] = component.long_name;
  2559. // Append short version.
  2560. if (component.long_name !== component.short_name) {
  2561. result[k + '_short'] = component.short_name;
  2562. }
  2563. }
  2564. }
  2565. }
  2566. /**
  2567. * Filters the parsed result.
  2568. *
  2569. * @date 18/10/19
  2570. * @since 5.8.6
  2571. *
  2572. * @param object result The parsed result value.
  2573. * @param object obj The GeocoderResult object.
  2574. */
  2575. return acf.applyFilters('google_map_result', result, obj, this.map, this);
  2576. },
  2577. onClickClear: function () {
  2578. this.val(false);
  2579. },
  2580. onClickLocate: function () {
  2581. this.searchLocation();
  2582. },
  2583. onClickSearch: function () {
  2584. this.searchAddress(this.$search().val());
  2585. },
  2586. onFocusSearch: function (e, $el) {
  2587. this.setState('searching');
  2588. },
  2589. onBlurSearch: function (e, $el) {
  2590. // Get saved address value.
  2591. var val = this.val();
  2592. var address = val ? val.address : '';
  2593. // Remove 'is-searching' if value has not changed.
  2594. if ($el.val() === address) {
  2595. this.setState('default');
  2596. }
  2597. },
  2598. onKeyupSearch: function (e, $el) {
  2599. // Clear empty value.
  2600. if (!$el.val()) {
  2601. this.val(false);
  2602. }
  2603. },
  2604. // Prevent form from submitting.
  2605. onKeydownSearch: function (e, $el) {
  2606. if (e.which == 13) {
  2607. e.preventDefault();
  2608. $el.blur();
  2609. }
  2610. },
  2611. // Center map once made visible.
  2612. onShow: function () {
  2613. if (this.map) {
  2614. this.setTimeout(this.center);
  2615. }
  2616. }
  2617. });
  2618. acf.registerFieldType(Field);
  2619. // Vars.
  2620. var loading = false;
  2621. var geocoder = false;
  2622. /**
  2623. * withAPI
  2624. *
  2625. * Loads the Google Maps API library and troggers callback.
  2626. *
  2627. * @date 28/3/19
  2628. * @since 5.7.14
  2629. *
  2630. * @param function callback The callback to excecute.
  2631. * @return void
  2632. */
  2633. function withAPI(callback) {
  2634. // Check if geocoder exists.
  2635. if (geocoder) {
  2636. return callback();
  2637. }
  2638. // Check if geocoder API exists.
  2639. if (acf.isset(window, 'google', 'maps', 'Geocoder')) {
  2640. geocoder = new google.maps.Geocoder();
  2641. return callback();
  2642. }
  2643. // Geocoder will need to be loaded. Hook callback to action.
  2644. acf.addAction('google_map_api_loaded', callback);
  2645. // Bail early if already loading API.
  2646. if (loading) {
  2647. return;
  2648. }
  2649. // load api
  2650. var url = acf.get('google_map_api');
  2651. if (url) {
  2652. // Set loading status.
  2653. loading = true;
  2654. // Load API
  2655. $.ajax({
  2656. url: url,
  2657. dataType: 'script',
  2658. cache: true,
  2659. success: function () {
  2660. geocoder = new google.maps.Geocoder();
  2661. acf.doAction('google_map_api_loaded');
  2662. }
  2663. });
  2664. }
  2665. }
  2666. })(jQuery);
  2667. /***/ }),
  2668. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-image.js":
  2669. /*!**************************************************************************!*\
  2670. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-image.js ***!
  2671. \**************************************************************************/
  2672. /***/ (function() {
  2673. (function ($, undefined) {
  2674. var Field = acf.Field.extend({
  2675. type: 'image',
  2676. $control: function () {
  2677. return this.$('.acf-image-uploader');
  2678. },
  2679. $input: function () {
  2680. return this.$('input[type="hidden"]:first');
  2681. },
  2682. events: {
  2683. 'click a[data-name="add"]': 'onClickAdd',
  2684. 'click a[data-name="edit"]': 'onClickEdit',
  2685. 'click a[data-name="remove"]': 'onClickRemove',
  2686. 'change input[type="file"]': 'onChange'
  2687. },
  2688. initialize: function () {
  2689. // add attribute to form
  2690. if (this.get('uploader') === 'basic') {
  2691. this.$el.closest('form').attr('enctype', 'multipart/form-data');
  2692. }
  2693. },
  2694. validateAttachment: function (attachment) {
  2695. // Use WP attachment attributes when available.
  2696. if (attachment && attachment.attributes) {
  2697. attachment = attachment.attributes;
  2698. }
  2699. // Apply defaults.
  2700. attachment = acf.parseArgs(attachment, {
  2701. id: 0,
  2702. url: '',
  2703. alt: '',
  2704. title: '',
  2705. caption: '',
  2706. description: '',
  2707. width: 0,
  2708. height: 0
  2709. });
  2710. // Override with "preview size".
  2711. var size = acf.isget(attachment, 'sizes', this.get('preview_size'));
  2712. if (size) {
  2713. attachment.url = size.url;
  2714. attachment.width = size.width;
  2715. attachment.height = size.height;
  2716. }
  2717. // Return.
  2718. return attachment;
  2719. },
  2720. render: function (attachment) {
  2721. attachment = this.validateAttachment(attachment);
  2722. // Update DOM.
  2723. this.$('img').attr({
  2724. src: attachment.url,
  2725. alt: attachment.alt
  2726. });
  2727. if (attachment.id) {
  2728. this.val(attachment.id);
  2729. this.$control().addClass('has-value');
  2730. } else {
  2731. this.val('');
  2732. this.$control().removeClass('has-value');
  2733. }
  2734. },
  2735. // create a new repeater row and render value
  2736. append: function (attachment, parent) {
  2737. // create function to find next available field within parent
  2738. var getNext = function (field, parent) {
  2739. // find existing file fields within parent
  2740. var fields = acf.getFields({
  2741. key: field.get('key'),
  2742. parent: parent.$el
  2743. });
  2744. // find the first field with no value
  2745. for (var i = 0; i < fields.length; i++) {
  2746. if (!fields[i].val()) {
  2747. return fields[i];
  2748. }
  2749. }
  2750. // return
  2751. return false;
  2752. };
  2753. // find existing file fields within parent
  2754. var field = getNext(this, parent);
  2755. // add new row if no available field
  2756. if (!field) {
  2757. parent.$('.acf-button:last').trigger('click');
  2758. field = getNext(this, parent);
  2759. }
  2760. // render
  2761. if (field) {
  2762. field.render(attachment);
  2763. }
  2764. },
  2765. selectAttachment: function () {
  2766. // vars
  2767. var parent = this.parent();
  2768. var multiple = parent && parent.get('type') === 'repeater';
  2769. // new frame
  2770. var frame = acf.newMediaPopup({
  2771. mode: 'select',
  2772. type: 'image',
  2773. title: acf.__('Select Image'),
  2774. field: this.get('key'),
  2775. multiple: multiple,
  2776. library: this.get('library'),
  2777. allowedTypes: this.get('mime_types'),
  2778. select: $.proxy(function (attachment, i) {
  2779. if (i > 0) {
  2780. this.append(attachment, parent);
  2781. } else {
  2782. this.render(attachment);
  2783. }
  2784. }, this)
  2785. });
  2786. },
  2787. editAttachment: function () {
  2788. // vars
  2789. var val = this.val();
  2790. // bail early if no val
  2791. if (!val) return;
  2792. // popup
  2793. var frame = acf.newMediaPopup({
  2794. mode: 'edit',
  2795. title: acf.__('Edit Image'),
  2796. button: acf.__('Update Image'),
  2797. attachment: val,
  2798. field: this.get('key'),
  2799. select: $.proxy(function (attachment, i) {
  2800. this.render(attachment);
  2801. }, this)
  2802. });
  2803. },
  2804. removeAttachment: function () {
  2805. this.render(false);
  2806. },
  2807. onClickAdd: function (e, $el) {
  2808. this.selectAttachment();
  2809. },
  2810. onClickEdit: function (e, $el) {
  2811. this.editAttachment();
  2812. },
  2813. onClickRemove: function (e, $el) {
  2814. this.removeAttachment();
  2815. },
  2816. onChange: function (e, $el) {
  2817. var $hiddenInput = this.$input();
  2818. if (!$el.val()) {
  2819. $hiddenInput.val('');
  2820. }
  2821. acf.getFileInputData($el, function (data) {
  2822. $hiddenInput.val($.param(data));
  2823. });
  2824. }
  2825. });
  2826. acf.registerFieldType(Field);
  2827. })(jQuery);
  2828. /***/ }),
  2829. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-link.js":
  2830. /*!*************************************************************************!*\
  2831. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-link.js ***!
  2832. \*************************************************************************/
  2833. /***/ (function() {
  2834. (function ($, undefined) {
  2835. var Field = acf.Field.extend({
  2836. type: 'link',
  2837. events: {
  2838. 'click a[data-name="add"]': 'onClickEdit',
  2839. 'click a[data-name="edit"]': 'onClickEdit',
  2840. 'click a[data-name="remove"]': 'onClickRemove',
  2841. 'change .link-node': 'onChange'
  2842. },
  2843. $control: function () {
  2844. return this.$('.acf-link');
  2845. },
  2846. $node: function () {
  2847. return this.$('.link-node');
  2848. },
  2849. getValue: function () {
  2850. // vars
  2851. var $node = this.$node();
  2852. // return false if empty
  2853. if (!$node.attr('href')) {
  2854. return false;
  2855. }
  2856. // return
  2857. return {
  2858. title: $node.html(),
  2859. url: $node.attr('href'),
  2860. target: $node.attr('target')
  2861. };
  2862. },
  2863. setValue: function (val) {
  2864. // default
  2865. val = acf.parseArgs(val, {
  2866. title: '',
  2867. url: '',
  2868. target: ''
  2869. });
  2870. // vars
  2871. var $div = this.$control();
  2872. var $node = this.$node();
  2873. // remove class
  2874. $div.removeClass('-value -external');
  2875. // add class
  2876. if (val.url) $div.addClass('-value');
  2877. if (val.target === '_blank') $div.addClass('-external');
  2878. // update text
  2879. this.$('.link-title').html(val.title);
  2880. this.$('.link-url').attr('href', val.url).html(val.url);
  2881. // update node
  2882. $node.html(val.title);
  2883. $node.attr('href', val.url);
  2884. $node.attr('target', val.target);
  2885. // update inputs
  2886. this.$('.input-title').val(val.title);
  2887. this.$('.input-target').val(val.target);
  2888. this.$('.input-url').val(val.url).trigger('change');
  2889. },
  2890. onClickEdit: function (e, $el) {
  2891. acf.wpLink.open(this.$node());
  2892. },
  2893. onClickRemove: function (e, $el) {
  2894. this.setValue(false);
  2895. },
  2896. onChange: function (e, $el) {
  2897. // get the changed value
  2898. var val = this.getValue();
  2899. // update inputs
  2900. this.setValue(val);
  2901. }
  2902. });
  2903. acf.registerFieldType(Field);
  2904. // manager
  2905. acf.wpLink = new acf.Model({
  2906. getNodeValue: function () {
  2907. var $node = this.get('node');
  2908. return {
  2909. title: acf.decode($node.html()),
  2910. url: $node.attr('href'),
  2911. target: $node.attr('target')
  2912. };
  2913. },
  2914. setNodeValue: function (val) {
  2915. var $node = this.get('node');
  2916. $node.text(val.title);
  2917. $node.attr('href', val.url);
  2918. $node.attr('target', val.target);
  2919. $node.trigger('change');
  2920. },
  2921. getInputValue: function () {
  2922. return {
  2923. title: $('#wp-link-text').val(),
  2924. url: $('#wp-link-url').val(),
  2925. target: $('#wp-link-target').prop('checked') ? '_blank' : ''
  2926. };
  2927. },
  2928. setInputValue: function (val) {
  2929. $('#wp-link-text').val(val.title);
  2930. $('#wp-link-url').val(val.url);
  2931. $('#wp-link-target').prop('checked', val.target === '_blank');
  2932. },
  2933. open: function ($node) {
  2934. // add events
  2935. this.on('wplink-open', 'onOpen');
  2936. this.on('wplink-close', 'onClose');
  2937. // set node
  2938. this.set('node', $node);
  2939. // create textarea
  2940. var $textarea = $('<textarea id="acf-link-textarea" style="display:none;"></textarea>');
  2941. $('body').append($textarea);
  2942. // vars
  2943. var val = this.getNodeValue();
  2944. // open popup
  2945. wpLink.open('acf-link-textarea', val.url, val.title, null);
  2946. },
  2947. onOpen: function () {
  2948. // always show title (WP will hide title if empty)
  2949. $('#wp-link-wrap').addClass('has-text-field');
  2950. // set inputs
  2951. var val = this.getNodeValue();
  2952. this.setInputValue(val);
  2953. // Update button text.
  2954. if (val.url && wpLinkL10n) {
  2955. $('#wp-link-submit').val(wpLinkL10n.update);
  2956. }
  2957. },
  2958. close: function () {
  2959. wpLink.close();
  2960. },
  2961. onClose: function () {
  2962. // Bail early if no node.
  2963. // Needed due to WP triggering this event twice.
  2964. if (!this.has('node')) {
  2965. return false;
  2966. }
  2967. // Determine context.
  2968. var $submit = $('#wp-link-submit');
  2969. var isSubmit = $submit.is(':hover') || $submit.is(':focus');
  2970. // Set value
  2971. if (isSubmit) {
  2972. var val = this.getInputValue();
  2973. this.setNodeValue(val);
  2974. }
  2975. // Cleanup.
  2976. this.off('wplink-open');
  2977. this.off('wplink-close');
  2978. $('#acf-link-textarea').remove();
  2979. this.set('node', null);
  2980. }
  2981. });
  2982. })(jQuery);
  2983. /***/ }),
  2984. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-oembed.js":
  2985. /*!***************************************************************************!*\
  2986. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-oembed.js ***!
  2987. \***************************************************************************/
  2988. /***/ (function() {
  2989. (function ($, undefined) {
  2990. var Field = acf.Field.extend({
  2991. type: 'oembed',
  2992. events: {
  2993. 'click [data-name="clear-button"]': 'onClickClear',
  2994. 'keypress .input-search': 'onKeypressSearch',
  2995. 'keyup .input-search': 'onKeyupSearch',
  2996. 'change .input-search': 'onChangeSearch'
  2997. },
  2998. $control: function () {
  2999. return this.$('.acf-oembed');
  3000. },
  3001. $input: function () {
  3002. return this.$('.input-value');
  3003. },
  3004. $search: function () {
  3005. return this.$('.input-search');
  3006. },
  3007. getValue: function () {
  3008. return this.$input().val();
  3009. },
  3010. getSearchVal: function () {
  3011. return this.$search().val();
  3012. },
  3013. setValue: function (val) {
  3014. // class
  3015. if (val) {
  3016. this.$control().addClass('has-value');
  3017. } else {
  3018. this.$control().removeClass('has-value');
  3019. }
  3020. acf.val(this.$input(), val);
  3021. },
  3022. showLoading: function (show) {
  3023. acf.showLoading(this.$('.canvas'));
  3024. },
  3025. hideLoading: function () {
  3026. acf.hideLoading(this.$('.canvas'));
  3027. },
  3028. maybeSearch: function () {
  3029. // vars
  3030. var prevUrl = this.val();
  3031. var url = this.getSearchVal();
  3032. // no value
  3033. if (!url) {
  3034. return this.clear();
  3035. }
  3036. // fix missing 'http://' - causes the oembed code to error and fail
  3037. if (url.substr(0, 4) != 'http') {
  3038. url = 'http://' + url;
  3039. }
  3040. // bail early if no change
  3041. if (url === prevUrl) return;
  3042. // clear existing timeout
  3043. var timeout = this.get('timeout');
  3044. if (timeout) {
  3045. clearTimeout(timeout);
  3046. }
  3047. // set new timeout
  3048. var callback = $.proxy(this.search, this, url);
  3049. this.set('timeout', setTimeout(callback, 300));
  3050. },
  3051. search: function (url) {
  3052. // ajax
  3053. var ajaxData = {
  3054. action: 'acf/fields/oembed/search',
  3055. s: url,
  3056. field_key: this.get('key')
  3057. };
  3058. // clear existing timeout
  3059. var xhr = this.get('xhr');
  3060. if (xhr) {
  3061. xhr.abort();
  3062. }
  3063. // loading
  3064. this.showLoading();
  3065. // query
  3066. var xhr = $.ajax({
  3067. url: acf.get('ajaxurl'),
  3068. data: acf.prepareForAjax(ajaxData),
  3069. type: 'post',
  3070. dataType: 'json',
  3071. context: this,
  3072. success: function (json) {
  3073. // error
  3074. if (!json || !json.html) {
  3075. json = {
  3076. url: false,
  3077. html: ''
  3078. };
  3079. }
  3080. // update vars
  3081. this.val(json.url);
  3082. this.$('.canvas-media').html(json.html);
  3083. },
  3084. complete: function () {
  3085. this.hideLoading();
  3086. }
  3087. });
  3088. this.set('xhr', xhr);
  3089. },
  3090. clear: function () {
  3091. this.val('');
  3092. this.$search().val('');
  3093. this.$('.canvas-media').html('');
  3094. },
  3095. onClickClear: function (e, $el) {
  3096. this.clear();
  3097. },
  3098. onKeypressSearch: function (e, $el) {
  3099. if (e.which == 13) {
  3100. e.preventDefault();
  3101. this.maybeSearch();
  3102. }
  3103. },
  3104. onKeyupSearch: function (e, $el) {
  3105. if ($el.val()) {
  3106. this.maybeSearch();
  3107. }
  3108. },
  3109. onChangeSearch: function (e, $el) {
  3110. this.maybeSearch();
  3111. }
  3112. });
  3113. acf.registerFieldType(Field);
  3114. })(jQuery);
  3115. /***/ }),
  3116. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-page-link.js":
  3117. /*!******************************************************************************!*\
  3118. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-page-link.js ***!
  3119. \******************************************************************************/
  3120. /***/ (function() {
  3121. (function ($, undefined) {
  3122. var Field = acf.models.SelectField.extend({
  3123. type: 'page_link'
  3124. });
  3125. acf.registerFieldType(Field);
  3126. })(jQuery);
  3127. /***/ }),
  3128. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-post-object.js":
  3129. /*!********************************************************************************!*\
  3130. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-post-object.js ***!
  3131. \********************************************************************************/
  3132. /***/ (function() {
  3133. (function ($, undefined) {
  3134. var Field = acf.models.SelectField.extend({
  3135. type: 'post_object'
  3136. });
  3137. acf.registerFieldType(Field);
  3138. })(jQuery);
  3139. /***/ }),
  3140. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-radio.js":
  3141. /*!**************************************************************************!*\
  3142. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-radio.js ***!
  3143. \**************************************************************************/
  3144. /***/ (function() {
  3145. (function ($, undefined) {
  3146. var Field = acf.Field.extend({
  3147. type: 'radio',
  3148. events: {
  3149. 'click input[type="radio"]': 'onClick'
  3150. },
  3151. $control: function () {
  3152. return this.$('.acf-radio-list');
  3153. },
  3154. $input: function () {
  3155. return this.$('input:checked');
  3156. },
  3157. $inputText: function () {
  3158. return this.$('input[type="text"]');
  3159. },
  3160. getValue: function () {
  3161. var val = this.$input().val();
  3162. if (val === 'other' && this.get('other_choice')) {
  3163. val = this.$inputText().val();
  3164. }
  3165. return val;
  3166. },
  3167. onClick: function (e, $el) {
  3168. // vars
  3169. var $label = $el.parent('label');
  3170. var selected = $label.hasClass('selected');
  3171. var val = $el.val();
  3172. // remove previous selected
  3173. this.$('.selected').removeClass('selected');
  3174. // add active class
  3175. $label.addClass('selected');
  3176. // allow null
  3177. if (this.get('allow_null') && selected) {
  3178. $label.removeClass('selected');
  3179. $el.prop('checked', false).trigger('change');
  3180. val = false;
  3181. }
  3182. // other
  3183. if (this.get('other_choice')) {
  3184. // enable
  3185. if (val === 'other') {
  3186. this.$inputText().prop('disabled', false);
  3187. // disable
  3188. } else {
  3189. this.$inputText().prop('disabled', true);
  3190. }
  3191. }
  3192. }
  3193. });
  3194. acf.registerFieldType(Field);
  3195. })(jQuery);
  3196. /***/ }),
  3197. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-range.js":
  3198. /*!**************************************************************************!*\
  3199. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-range.js ***!
  3200. \**************************************************************************/
  3201. /***/ (function() {
  3202. (function ($, undefined) {
  3203. var Field = acf.Field.extend({
  3204. type: 'range',
  3205. events: {
  3206. 'input input[type="range"]': 'onChange',
  3207. 'change input': 'onChange'
  3208. },
  3209. $input: function () {
  3210. return this.$('input[type="range"]');
  3211. },
  3212. $inputAlt: function () {
  3213. return this.$('input[type="number"]');
  3214. },
  3215. setValue: function (val) {
  3216. this.busy = true;
  3217. // Update range input (with change).
  3218. acf.val(this.$input(), val);
  3219. // Update alt input (without change).
  3220. // Read in input value to inherit min/max validation.
  3221. acf.val(this.$inputAlt(), this.$input().val(), true);
  3222. this.busy = false;
  3223. },
  3224. onChange: function (e, $el) {
  3225. if (!this.busy) {
  3226. this.setValue($el.val());
  3227. }
  3228. }
  3229. });
  3230. acf.registerFieldType(Field);
  3231. })(jQuery);
  3232. /***/ }),
  3233. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-relationship.js":
  3234. /*!*********************************************************************************!*\
  3235. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-relationship.js ***!
  3236. \*********************************************************************************/
  3237. /***/ (function() {
  3238. (function ($, undefined) {
  3239. var Field = acf.Field.extend({
  3240. type: 'relationship',
  3241. events: {
  3242. 'keypress [data-filter]': 'onKeypressFilter',
  3243. 'change [data-filter]': 'onChangeFilter',
  3244. 'keyup [data-filter]': 'onChangeFilter',
  3245. 'click .choices-list .acf-rel-item': 'onClickAdd',
  3246. 'keypress .choices-list .acf-rel-item': 'onKeypressFilter',
  3247. 'keypress .values-list .acf-rel-item': 'onKeypressFilter',
  3248. 'click [data-name="remove_item"]': 'onClickRemove'
  3249. },
  3250. $control: function () {
  3251. return this.$('.acf-relationship');
  3252. },
  3253. $list: function (list) {
  3254. return this.$('.' + list + '-list');
  3255. },
  3256. $listItems: function (list) {
  3257. return this.$list(list).find('.acf-rel-item');
  3258. },
  3259. $listItem: function (list, id) {
  3260. return this.$list(list).find('.acf-rel-item[data-id="' + id + '"]');
  3261. },
  3262. getValue: function () {
  3263. var val = [];
  3264. this.$listItems('values').each(function () {
  3265. val.push($(this).data('id'));
  3266. });
  3267. return val.length ? val : false;
  3268. },
  3269. newChoice: function (props) {
  3270. return ['<li>', '<span tabindex="0" data-id="' + props.id + '" class="acf-rel-item">' + props.text + '</span>', '</li>'].join('');
  3271. },
  3272. newValue: function (props) {
  3273. return ['<li>', '<input type="hidden" name="' + this.getInputName() + '[]" value="' + props.id + '" />', '<span tabindex="0" data-id="' + props.id + '" class="acf-rel-item acf-rel-item-remove">' + props.text, '<a href="#" class="acf-icon -minus small dark" data-name="remove_item"></a>', '</span>', '</li>'].join('');
  3274. },
  3275. initialize: function () {
  3276. // Delay initialization until "interacted with" or "in view".
  3277. var delayed = this.proxy(acf.once(function () {
  3278. // Add sortable.
  3279. this.$list('values').sortable({
  3280. items: 'li',
  3281. forceHelperSize: true,
  3282. forcePlaceholderSize: true,
  3283. scroll: true,
  3284. update: this.proxy(function () {
  3285. this.$input().trigger('change');
  3286. })
  3287. });
  3288. // Avoid browser remembering old scroll position and add event.
  3289. this.$list('choices').scrollTop(0).on('scroll', this.proxy(this.onScrollChoices));
  3290. // Fetch choices.
  3291. this.fetch();
  3292. }));
  3293. // Bind "interacted with".
  3294. this.$el.one('mouseover', delayed);
  3295. this.$el.one('focus', 'input', delayed);
  3296. // Bind "in view".
  3297. acf.onceInView(this.$el, delayed);
  3298. },
  3299. onScrollChoices: function (e) {
  3300. // bail early if no more results
  3301. if (this.get('loading') || !this.get('more')) {
  3302. return;
  3303. }
  3304. // Scrolled to bottom
  3305. var $list = this.$list('choices');
  3306. var scrollTop = Math.ceil($list.scrollTop());
  3307. var scrollHeight = Math.ceil($list[0].scrollHeight);
  3308. var innerHeight = Math.ceil($list.innerHeight());
  3309. var paged = this.get('paged') || 1;
  3310. if (scrollTop + innerHeight >= scrollHeight) {
  3311. // update paged
  3312. this.set('paged', paged + 1);
  3313. // fetch
  3314. this.fetch();
  3315. }
  3316. },
  3317. onKeypressFilter: function (e, $el) {
  3318. // Receive enter key when selecting relationship items.
  3319. if ($el.hasClass('acf-rel-item-add') && e.which == 13) {
  3320. this.onClickAdd(e, $el);
  3321. }
  3322. // Receive enter key when removing relationship items.
  3323. if ($el.hasClass('acf-rel-item-remove') && e.which == 13) {
  3324. this.onClickRemove(e, $el);
  3325. }
  3326. // don't submit form
  3327. if (e.which == 13) {
  3328. e.preventDefault();
  3329. }
  3330. },
  3331. onChangeFilter: function (e, $el) {
  3332. // vars
  3333. var val = $el.val();
  3334. var filter = $el.data('filter');
  3335. // Bail early if filter has not changed
  3336. if (this.get(filter) === val) {
  3337. return;
  3338. }
  3339. // update attr
  3340. this.set(filter, val);
  3341. // reset paged
  3342. this.set('paged', 1);
  3343. // fetch
  3344. if ($el.is('select')) {
  3345. this.fetch();
  3346. // search must go through timeout
  3347. } else {
  3348. this.maybeFetch();
  3349. }
  3350. },
  3351. onClickAdd: function (e, $el) {
  3352. // vars
  3353. var val = this.val();
  3354. var max = parseInt(this.get('max'));
  3355. // can be added?
  3356. if ($el.hasClass('disabled')) {
  3357. return false;
  3358. }
  3359. // validate
  3360. if (max > 0 && val && val.length >= max) {
  3361. // add notice
  3362. this.showNotice({
  3363. text: acf.__('Maximum values reached ( {max} values )').replace('{max}', max),
  3364. type: 'warning'
  3365. });
  3366. return false;
  3367. }
  3368. // disable
  3369. $el.addClass('disabled');
  3370. // add
  3371. var html = this.newValue({
  3372. id: $el.data('id'),
  3373. text: $el.html()
  3374. });
  3375. this.$list('values').append(html);
  3376. // trigger change
  3377. this.$input().trigger('change');
  3378. },
  3379. onClickRemove: function (e, $el) {
  3380. // Prevent default here because generic handler wont be triggered.
  3381. e.preventDefault();
  3382. let $span;
  3383. // Behavior if triggered from tabbed event.
  3384. if ($el.hasClass('acf-rel-item-remove')) {
  3385. $span = $el;
  3386. } else {
  3387. // Behavior if triggered through click event.
  3388. $span = $el.parent();
  3389. }
  3390. // vars
  3391. const $li = $span.parent();
  3392. const id = $span.data('id');
  3393. // remove value
  3394. $li.remove();
  3395. // show choice
  3396. this.$listItem('choices', id).removeClass('disabled');
  3397. // trigger change
  3398. this.$input().trigger('change');
  3399. },
  3400. maybeFetch: function () {
  3401. // vars
  3402. var timeout = this.get('timeout');
  3403. // abort timeout
  3404. if (timeout) {
  3405. clearTimeout(timeout);
  3406. }
  3407. // fetch
  3408. timeout = this.setTimeout(this.fetch, 300);
  3409. this.set('timeout', timeout);
  3410. },
  3411. getAjaxData: function () {
  3412. // load data based on element attributes
  3413. var ajaxData = this.$control().data();
  3414. for (var name in ajaxData) {
  3415. ajaxData[name] = this.get(name);
  3416. }
  3417. // extra
  3418. ajaxData.action = 'acf/fields/relationship/query';
  3419. ajaxData.field_key = this.get('key');
  3420. // Filter.
  3421. ajaxData = acf.applyFilters('relationship_ajax_data', ajaxData, this);
  3422. // return
  3423. return ajaxData;
  3424. },
  3425. fetch: function () {
  3426. // abort XHR if this field is already loading AJAX data
  3427. var xhr = this.get('xhr');
  3428. if (xhr) {
  3429. xhr.abort();
  3430. }
  3431. // add to this.o
  3432. var ajaxData = this.getAjaxData();
  3433. // clear html if is new query
  3434. var $choiceslist = this.$list('choices');
  3435. if (ajaxData.paged == 1) {
  3436. $choiceslist.html('');
  3437. }
  3438. // loading
  3439. var $loading = $('<li><i class="acf-loading"></i> ' + acf.__('Loading') + '</li>');
  3440. $choiceslist.append($loading);
  3441. this.set('loading', true);
  3442. // callback
  3443. var onComplete = function () {
  3444. this.set('loading', false);
  3445. $loading.remove();
  3446. };
  3447. var onSuccess = function (json) {
  3448. // no results
  3449. if (!json || !json.results || !json.results.length) {
  3450. // prevent pagination
  3451. this.set('more', false);
  3452. // add message
  3453. if (this.get('paged') == 1) {
  3454. this.$list('choices').append('<li>' + acf.__('No matches found') + '</li>');
  3455. }
  3456. // return
  3457. return;
  3458. }
  3459. // set more (allows pagination scroll)
  3460. this.set('more', json.more);
  3461. // get new results
  3462. var html = this.walkChoices(json.results);
  3463. var $html = $(html);
  3464. // apply .disabled to left li's
  3465. var val = this.val();
  3466. if (val && val.length) {
  3467. val.map(function (id) {
  3468. $html.find('.acf-rel-item[data-id="' + id + '"]').addClass('disabled');
  3469. });
  3470. }
  3471. // append
  3472. $choiceslist.append($html);
  3473. // merge together groups
  3474. var $prevLabel = false;
  3475. var $prevList = false;
  3476. $choiceslist.find('.acf-rel-label').each(function () {
  3477. var $label = $(this);
  3478. var $list = $label.siblings('ul');
  3479. if ($prevLabel && $prevLabel.text() == $label.text()) {
  3480. $prevList.append($list.children());
  3481. $(this).parent().remove();
  3482. return;
  3483. }
  3484. // update vars
  3485. $prevLabel = $label;
  3486. $prevList = $list;
  3487. });
  3488. };
  3489. // get results
  3490. var xhr = $.ajax({
  3491. url: acf.get('ajaxurl'),
  3492. dataType: 'json',
  3493. type: 'post',
  3494. data: acf.prepareForAjax(ajaxData),
  3495. context: this,
  3496. success: onSuccess,
  3497. complete: onComplete
  3498. });
  3499. // set
  3500. this.set('xhr', xhr);
  3501. },
  3502. walkChoices: function (data) {
  3503. // walker
  3504. var walk = function (data) {
  3505. // vars
  3506. var html = '';
  3507. // is array
  3508. if ($.isArray(data)) {
  3509. data.map(function (item) {
  3510. html += walk(item);
  3511. });
  3512. // is item
  3513. } else if ($.isPlainObject(data)) {
  3514. // group
  3515. if (data.children !== undefined) {
  3516. html += '<li><span class="acf-rel-label">' + acf.escHtml(data.text) + '</span><ul class="acf-bl">';
  3517. html += walk(data.children);
  3518. html += '</ul></li>';
  3519. // single
  3520. } else {
  3521. html += '<li><span tabindex="0" class="acf-rel-item acf-rel-item-add" data-id="' + acf.escAttr(data.id) + '">' + acf.escHtml(data.text) + '</span></li>';
  3522. }
  3523. }
  3524. // return
  3525. return html;
  3526. };
  3527. return walk(data);
  3528. }
  3529. });
  3530. acf.registerFieldType(Field);
  3531. })(jQuery);
  3532. /***/ }),
  3533. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-select.js":
  3534. /*!***************************************************************************!*\
  3535. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-select.js ***!
  3536. \***************************************************************************/
  3537. /***/ (function() {
  3538. (function ($, undefined) {
  3539. var Field = acf.Field.extend({
  3540. type: 'select',
  3541. select2: false,
  3542. wait: 'load',
  3543. events: {
  3544. removeField: 'onRemove',
  3545. duplicateField: 'onDuplicate'
  3546. },
  3547. $input: function () {
  3548. return this.$('select');
  3549. },
  3550. initialize: function () {
  3551. // vars
  3552. var $select = this.$input();
  3553. // inherit data
  3554. this.inherit($select);
  3555. // select2
  3556. if (this.get('ui')) {
  3557. // populate ajax_data (allowing custom attribute to already exist)
  3558. var ajaxAction = this.get('ajax_action');
  3559. if (!ajaxAction) {
  3560. ajaxAction = 'acf/fields/' + this.get('type') + '/query';
  3561. }
  3562. // select2
  3563. this.select2 = acf.newSelect2($select, {
  3564. field: this,
  3565. ajax: this.get('ajax'),
  3566. multiple: this.get('multiple'),
  3567. placeholder: this.get('placeholder'),
  3568. allowNull: this.get('allow_null'),
  3569. ajaxAction: ajaxAction
  3570. });
  3571. }
  3572. },
  3573. onRemove: function () {
  3574. if (this.select2) {
  3575. this.select2.destroy();
  3576. }
  3577. },
  3578. onDuplicate: function (e, $el, $duplicate) {
  3579. if (this.select2) {
  3580. $duplicate.find('.select2-container').remove();
  3581. $duplicate.find('select').removeClass('select2-hidden-accessible');
  3582. }
  3583. }
  3584. });
  3585. acf.registerFieldType(Field);
  3586. })(jQuery);
  3587. /***/ }),
  3588. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-tab.js":
  3589. /*!************************************************************************!*\
  3590. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-tab.js ***!
  3591. \************************************************************************/
  3592. /***/ (function() {
  3593. (function ($, undefined) {
  3594. // vars
  3595. var CONTEXT = 'tab';
  3596. var Field = acf.Field.extend({
  3597. type: 'tab',
  3598. wait: '',
  3599. tabs: false,
  3600. tab: false,
  3601. events: {
  3602. duplicateField: 'onDuplicate'
  3603. },
  3604. findFields: function () {
  3605. let filter = '.acf-field';
  3606. if (this.get('key') === 'acf_field_settings_tabs') {
  3607. filter = '.acf-field-settings-main';
  3608. }
  3609. if (this.get('key') === 'acf_field_group_settings_tabs') {
  3610. filter = '.field-group-settings-tab';
  3611. }
  3612. return this.$el.nextUntil('.acf-field-tab', filter);
  3613. },
  3614. getFields: function () {
  3615. return acf.getFields(this.findFields());
  3616. },
  3617. findTabs: function () {
  3618. return this.$el.prevAll('.acf-tab-wrap:first');
  3619. },
  3620. findTab: function () {
  3621. return this.$('.acf-tab-button');
  3622. },
  3623. initialize: function () {
  3624. // bail early if is td
  3625. if (this.$el.is('td')) {
  3626. this.events = {};
  3627. return false;
  3628. }
  3629. // vars
  3630. var $tabs = this.findTabs();
  3631. var $tab = this.findTab();
  3632. var settings = acf.parseArgs($tab.data(), {
  3633. endpoint: false,
  3634. placement: '',
  3635. before: this.$el
  3636. });
  3637. // create wrap
  3638. if (!$tabs.length || settings.endpoint) {
  3639. this.tabs = new Tabs(settings);
  3640. } else {
  3641. this.tabs = $tabs.data('acf');
  3642. }
  3643. // add tab
  3644. this.tab = this.tabs.addTab($tab, this);
  3645. },
  3646. isActive: function () {
  3647. return this.tab.isActive();
  3648. },
  3649. showFields: function () {
  3650. // show fields
  3651. this.getFields().map(function (field) {
  3652. field.show(this.cid, CONTEXT);
  3653. field.hiddenByTab = false;
  3654. }, this);
  3655. },
  3656. hideFields: function () {
  3657. // hide fields
  3658. this.getFields().map(function (field) {
  3659. field.hide(this.cid, CONTEXT);
  3660. field.hiddenByTab = this.tab;
  3661. }, this);
  3662. },
  3663. show: function (lockKey) {
  3664. // show field and store result
  3665. var visible = acf.Field.prototype.show.apply(this, arguments);
  3666. // check if now visible
  3667. if (visible) {
  3668. // show tab
  3669. this.tab.show();
  3670. // check active tabs
  3671. this.tabs.refresh();
  3672. }
  3673. // return
  3674. return visible;
  3675. },
  3676. hide: function (lockKey) {
  3677. // hide field and store result
  3678. var hidden = acf.Field.prototype.hide.apply(this, arguments);
  3679. // check if now hidden
  3680. if (hidden) {
  3681. // hide tab
  3682. this.tab.hide();
  3683. // reset tabs if this was active
  3684. if (this.isActive()) {
  3685. this.tabs.reset();
  3686. }
  3687. }
  3688. // return
  3689. return hidden;
  3690. },
  3691. enable: function (lockKey) {
  3692. // enable fields
  3693. this.getFields().map(function (field) {
  3694. field.enable(CONTEXT);
  3695. });
  3696. },
  3697. disable: function (lockKey) {
  3698. // disable fields
  3699. this.getFields().map(function (field) {
  3700. field.disable(CONTEXT);
  3701. });
  3702. },
  3703. onDuplicate: function (e, $el, $duplicate) {
  3704. if (this.isActive()) {
  3705. $duplicate.prevAll('.acf-tab-wrap:first').remove();
  3706. }
  3707. }
  3708. });
  3709. acf.registerFieldType(Field);
  3710. /**
  3711. * tabs
  3712. *
  3713. * description
  3714. *
  3715. * @date 8/2/18
  3716. * @since 5.6.5
  3717. *
  3718. * @param type $var Description. Default.
  3719. * @return type Description.
  3720. */
  3721. var i = 0;
  3722. var Tabs = acf.Model.extend({
  3723. tabs: [],
  3724. active: false,
  3725. actions: {
  3726. refresh: 'onRefresh',
  3727. close_field_object: 'onCloseFieldObject'
  3728. },
  3729. data: {
  3730. before: false,
  3731. placement: 'top',
  3732. index: 0,
  3733. initialized: false
  3734. },
  3735. setup: function (settings) {
  3736. // data
  3737. $.extend(this.data, settings);
  3738. // define this prop to avoid scope issues
  3739. this.tabs = [];
  3740. this.active = false;
  3741. // vars
  3742. var placement = this.get('placement');
  3743. var $before = this.get('before');
  3744. var $parent = $before.parent();
  3745. // add sidebar for left placement
  3746. if (placement == 'left' && $parent.hasClass('acf-fields')) {
  3747. $parent.addClass('-sidebar');
  3748. }
  3749. // create wrap
  3750. if ($before.is('tr')) {
  3751. this.$el = $('<tr class="acf-tab-wrap"><td colspan="2"><ul class="acf-hl acf-tab-group"></ul></td></tr>');
  3752. } else {
  3753. let ulClass = 'acf-hl acf-tab-group';
  3754. if (this.get('key') === 'acf_field_settings_tabs') {
  3755. ulClass = 'acf-field-settings-tab-bar';
  3756. }
  3757. this.$el = $('<div class="acf-tab-wrap -' + placement + '"><ul class="' + ulClass + '"></ul></div>');
  3758. }
  3759. // append
  3760. $before.before(this.$el);
  3761. // set index
  3762. this.set('index', i, true);
  3763. i++;
  3764. },
  3765. initializeTabs: function () {
  3766. // Bail if tabs are disabled.
  3767. if ('acf_field_settings_tabs' === this.get('key') && $('#acf-field-group-fields').hasClass('hide-tabs')) {
  3768. return;
  3769. }
  3770. // find first visible tab
  3771. var tab = this.getVisible().shift();
  3772. // remember previous tab state
  3773. var order = acf.getPreference('this.tabs') || [];
  3774. var groupIndex = this.get('index');
  3775. var tabIndex = order[groupIndex];
  3776. if (this.tabs[tabIndex] && this.tabs[tabIndex].isVisible()) {
  3777. tab = this.tabs[tabIndex];
  3778. }
  3779. // select
  3780. if (tab) {
  3781. this.selectTab(tab);
  3782. } else {
  3783. this.closeTabs();
  3784. }
  3785. // set local variable used by tabsManager
  3786. this.set('initialized', true);
  3787. },
  3788. getVisible: function () {
  3789. return this.tabs.filter(function (tab) {
  3790. return tab.isVisible();
  3791. });
  3792. },
  3793. getActive: function () {
  3794. return this.active;
  3795. },
  3796. setActive: function (tab) {
  3797. return this.active = tab;
  3798. },
  3799. hasActive: function () {
  3800. return this.active !== false;
  3801. },
  3802. isActive: function (tab) {
  3803. var active = this.getActive();
  3804. return active && active.cid === tab.cid;
  3805. },
  3806. closeActive: function () {
  3807. if (this.hasActive()) {
  3808. this.closeTab(this.getActive());
  3809. }
  3810. },
  3811. openTab: function (tab) {
  3812. // close existing tab
  3813. this.closeActive();
  3814. // open
  3815. tab.open();
  3816. // set active
  3817. this.setActive(tab);
  3818. },
  3819. closeTab: function (tab) {
  3820. // close
  3821. tab.close();
  3822. // set active
  3823. this.setActive(false);
  3824. },
  3825. closeTabs: function () {
  3826. this.tabs.map(this.closeTab, this);
  3827. },
  3828. selectTab: function (tab) {
  3829. // close other tabs
  3830. this.tabs.map(function (t) {
  3831. if (tab.cid !== t.cid) {
  3832. this.closeTab(t);
  3833. }
  3834. }, this);
  3835. // open
  3836. this.openTab(tab);
  3837. },
  3838. addTab: function ($a, field) {
  3839. // create <li>
  3840. var $li = $('<li>' + $a.outerHTML() + '</li>');
  3841. // add settings type class.
  3842. var classes = $a.attr('class').replace('acf-tab-button', '');
  3843. $li.addClass(classes);
  3844. // append
  3845. this.$('ul').append($li);
  3846. // initialize
  3847. var tab = new Tab({
  3848. $el: $li,
  3849. field: field,
  3850. group: this
  3851. });
  3852. // store
  3853. this.tabs.push(tab);
  3854. // return
  3855. return tab;
  3856. },
  3857. reset: function () {
  3858. // close existing tab
  3859. this.closeActive();
  3860. // find and active a tab
  3861. return this.refresh();
  3862. },
  3863. refresh: function () {
  3864. // bail early if active already exists
  3865. if (this.hasActive()) {
  3866. return false;
  3867. }
  3868. // find next active tab
  3869. var tab = this.getVisible().shift();
  3870. // open tab
  3871. if (tab) {
  3872. this.openTab(tab);
  3873. }
  3874. // return
  3875. return tab;
  3876. },
  3877. onRefresh: function () {
  3878. // only for left placements
  3879. if (this.get('placement') !== 'left') {
  3880. return;
  3881. }
  3882. // vars
  3883. var $parent = this.$el.parent();
  3884. var $list = this.$el.children('ul');
  3885. var attribute = $parent.is('td') ? 'height' : 'min-height';
  3886. // find height (minus 1 for border-bottom)
  3887. var height = $list.position().top + $list.outerHeight(true) - 1;
  3888. // add css
  3889. $parent.css(attribute, height);
  3890. },
  3891. onCloseFieldObject: function (fieldObject) {
  3892. const tab = this.getVisible().find(item => {
  3893. const id = item.$el.closest('div[data-id]').data('id');
  3894. if (fieldObject.data.id === id) {
  3895. return item;
  3896. }
  3897. });
  3898. if (tab) {
  3899. // Wait for field group drawer to close
  3900. setTimeout(() => {
  3901. this.openTab(tab);
  3902. }, 300);
  3903. }
  3904. }
  3905. });
  3906. var Tab = acf.Model.extend({
  3907. group: false,
  3908. field: false,
  3909. events: {
  3910. 'click a': 'onClick'
  3911. },
  3912. index: function () {
  3913. return this.$el.index();
  3914. },
  3915. isVisible: function () {
  3916. return acf.isVisible(this.$el);
  3917. },
  3918. isActive: function () {
  3919. return this.$el.hasClass('active');
  3920. },
  3921. open: function () {
  3922. // add class
  3923. this.$el.addClass('active');
  3924. // show field
  3925. this.field.showFields();
  3926. },
  3927. close: function () {
  3928. // remove class
  3929. this.$el.removeClass('active');
  3930. // hide field
  3931. this.field.hideFields();
  3932. },
  3933. onClick: function (e, $el) {
  3934. // prevent default
  3935. e.preventDefault();
  3936. // toggle
  3937. this.toggle();
  3938. },
  3939. toggle: function () {
  3940. // bail early if already active
  3941. if (this.isActive()) {
  3942. return;
  3943. }
  3944. // toggle this tab
  3945. this.group.openTab(this);
  3946. }
  3947. });
  3948. var tabsManager = new acf.Model({
  3949. priority: 50,
  3950. actions: {
  3951. prepare: 'render',
  3952. append: 'render',
  3953. unload: 'onUnload',
  3954. show: 'render',
  3955. invalid_field: 'onInvalidField'
  3956. },
  3957. findTabs: function () {
  3958. return $('.acf-tab-wrap');
  3959. },
  3960. getTabs: function () {
  3961. return acf.getInstances(this.findTabs());
  3962. },
  3963. render: function ($el) {
  3964. this.getTabs().map(function (tabs) {
  3965. if (!tabs.get('initialized')) {
  3966. tabs.initializeTabs();
  3967. }
  3968. });
  3969. },
  3970. onInvalidField: function (field) {
  3971. // bail early if busy
  3972. if (this.busy) {
  3973. return;
  3974. }
  3975. // ignore if not hidden by tab
  3976. if (!field.hiddenByTab) {
  3977. return;
  3978. }
  3979. // toggle tab
  3980. field.hiddenByTab.toggle();
  3981. // ignore other invalid fields
  3982. this.busy = true;
  3983. this.setTimeout(function () {
  3984. this.busy = false;
  3985. }, 100);
  3986. },
  3987. onUnload: function () {
  3988. // vars
  3989. var order = [];
  3990. // loop
  3991. this.getTabs().map(function (group) {
  3992. // Do not save selected tab on field settings when unloading
  3993. if (group.$el.children('.acf-field-settings-tab-bar').length) {
  3994. return true;
  3995. }
  3996. var active = group.hasActive() ? group.getActive().index() : 0;
  3997. order.push(active);
  3998. });
  3999. // bail if no tabs
  4000. if (!order.length) {
  4001. return;
  4002. }
  4003. // update
  4004. acf.setPreference('this.tabs', order);
  4005. }
  4006. });
  4007. })(jQuery);
  4008. /***/ }),
  4009. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-taxonomy.js":
  4010. /*!*****************************************************************************!*\
  4011. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-taxonomy.js ***!
  4012. \*****************************************************************************/
  4013. /***/ (function() {
  4014. (function ($, undefined) {
  4015. var Field = acf.Field.extend({
  4016. type: 'taxonomy',
  4017. data: {
  4018. ftype: 'select'
  4019. },
  4020. select2: false,
  4021. wait: 'load',
  4022. events: {
  4023. 'click a[data-name="add"]': 'onClickAdd',
  4024. 'click input[type="radio"]': 'onClickRadio',
  4025. removeField: 'onRemove'
  4026. },
  4027. $control: function () {
  4028. return this.$('.acf-taxonomy-field');
  4029. },
  4030. $input: function () {
  4031. return this.getRelatedPrototype().$input.apply(this, arguments);
  4032. },
  4033. getRelatedType: function () {
  4034. // vars
  4035. var fieldType = this.get('ftype');
  4036. // normalize
  4037. if (fieldType == 'multi_select') {
  4038. fieldType = 'select';
  4039. }
  4040. // return
  4041. return fieldType;
  4042. },
  4043. getRelatedPrototype: function () {
  4044. return acf.getFieldType(this.getRelatedType()).prototype;
  4045. },
  4046. getValue: function () {
  4047. return this.getRelatedPrototype().getValue.apply(this, arguments);
  4048. },
  4049. setValue: function () {
  4050. return this.getRelatedPrototype().setValue.apply(this, arguments);
  4051. },
  4052. initialize: function () {
  4053. this.getRelatedPrototype().initialize.apply(this, arguments);
  4054. },
  4055. onRemove: function () {
  4056. var proto = this.getRelatedPrototype();
  4057. if (proto.onRemove) {
  4058. proto.onRemove.apply(this, arguments);
  4059. }
  4060. },
  4061. onClickAdd: function (e, $el) {
  4062. // vars
  4063. var field = this;
  4064. var popup = false;
  4065. var $form = false;
  4066. var $name = false;
  4067. var $parent = false;
  4068. var $button = false;
  4069. var $message = false;
  4070. var notice = false;
  4071. // step 1.
  4072. var step1 = function () {
  4073. // popup
  4074. popup = acf.newPopup({
  4075. title: $el.attr('title'),
  4076. loading: true,
  4077. width: '300px'
  4078. });
  4079. // ajax
  4080. var ajaxData = {
  4081. action: 'acf/fields/taxonomy/add_term',
  4082. field_key: field.get('key')
  4083. };
  4084. // get HTML
  4085. $.ajax({
  4086. url: acf.get('ajaxurl'),
  4087. data: acf.prepareForAjax(ajaxData),
  4088. type: 'post',
  4089. dataType: 'html',
  4090. success: step2
  4091. });
  4092. };
  4093. // step 2.
  4094. var step2 = function (html) {
  4095. // update popup
  4096. popup.loading(false);
  4097. popup.content(html);
  4098. // vars
  4099. $form = popup.$('form');
  4100. $name = popup.$('input[name="term_name"]');
  4101. $parent = popup.$('select[name="term_parent"]');
  4102. $button = popup.$('.acf-submit-button');
  4103. // focus
  4104. $name.trigger('focus');
  4105. // submit form
  4106. popup.on('submit', 'form', step3);
  4107. };
  4108. // step 3.
  4109. var step3 = function (e, $el) {
  4110. // prevent
  4111. e.preventDefault();
  4112. e.stopImmediatePropagation();
  4113. // basic validation
  4114. if ($name.val() === '') {
  4115. $name.trigger('focus');
  4116. return false;
  4117. }
  4118. // disable
  4119. acf.startButtonLoading($button);
  4120. // ajax
  4121. var ajaxData = {
  4122. action: 'acf/fields/taxonomy/add_term',
  4123. field_key: field.get('key'),
  4124. term_name: $name.val(),
  4125. term_parent: $parent.length ? $parent.val() : 0
  4126. };
  4127. $.ajax({
  4128. url: acf.get('ajaxurl'),
  4129. data: acf.prepareForAjax(ajaxData),
  4130. type: 'post',
  4131. dataType: 'json',
  4132. success: step4
  4133. });
  4134. };
  4135. // step 4.
  4136. var step4 = function (json) {
  4137. // enable
  4138. acf.stopButtonLoading($button);
  4139. // remove prev notice
  4140. if (notice) {
  4141. notice.remove();
  4142. }
  4143. // success
  4144. if (acf.isAjaxSuccess(json)) {
  4145. // clear name
  4146. $name.val('');
  4147. // update term lists
  4148. step5(json.data);
  4149. // notice
  4150. notice = acf.newNotice({
  4151. type: 'success',
  4152. text: acf.getAjaxMessage(json),
  4153. target: $form,
  4154. timeout: 2000,
  4155. dismiss: false
  4156. });
  4157. } else {
  4158. // notice
  4159. notice = acf.newNotice({
  4160. type: 'error',
  4161. text: acf.getAjaxError(json),
  4162. target: $form,
  4163. timeout: 2000,
  4164. dismiss: false
  4165. });
  4166. }
  4167. // focus
  4168. $name.trigger('focus');
  4169. };
  4170. // step 5.
  4171. var step5 = function (term) {
  4172. // update parent dropdown
  4173. var $option = $('<option value="' + term.term_id + '">' + term.term_label + '</option>');
  4174. if (term.term_parent) {
  4175. $parent.children('option[value="' + term.term_parent + '"]').after($option);
  4176. } else {
  4177. $parent.append($option);
  4178. }
  4179. // add this new term to all taxonomy field
  4180. var fields = acf.getFields({
  4181. type: 'taxonomy'
  4182. });
  4183. fields.map(function (otherField) {
  4184. if (otherField.get('taxonomy') == field.get('taxonomy')) {
  4185. otherField.appendTerm(term);
  4186. }
  4187. });
  4188. // select
  4189. field.selectTerm(term.term_id);
  4190. };
  4191. // run
  4192. step1();
  4193. },
  4194. appendTerm: function (term) {
  4195. if (this.getRelatedType() == 'select') {
  4196. this.appendTermSelect(term);
  4197. } else {
  4198. this.appendTermCheckbox(term);
  4199. }
  4200. },
  4201. appendTermSelect: function (term) {
  4202. this.select2.addOption({
  4203. id: term.term_id,
  4204. text: term.term_label
  4205. });
  4206. },
  4207. appendTermCheckbox: function (term) {
  4208. // vars
  4209. var name = this.$('[name]:first').attr('name');
  4210. var $ul = this.$('ul:first');
  4211. // allow multiple selection
  4212. if (this.getRelatedType() == 'checkbox') {
  4213. name += '[]';
  4214. }
  4215. // create new li
  4216. var $li = $(['<li data-id="' + term.term_id + '">', '<label>', '<input type="' + this.get('ftype') + '" value="' + term.term_id + '" name="' + name + '" /> ', '<span>' + term.term_name + '</span>', '</label>', '</li>'].join(''));
  4217. // find parent
  4218. if (term.term_parent) {
  4219. // vars
  4220. var $parent = $ul.find('li[data-id="' + term.term_parent + '"]');
  4221. // update vars
  4222. $ul = $parent.children('ul');
  4223. // create ul
  4224. if (!$ul.exists()) {
  4225. $ul = $('<ul class="children acf-bl"></ul>');
  4226. $parent.append($ul);
  4227. }
  4228. }
  4229. // append
  4230. $ul.append($li);
  4231. },
  4232. selectTerm: function (id) {
  4233. if (this.getRelatedType() == 'select') {
  4234. this.select2.selectOption(id);
  4235. } else {
  4236. var $input = this.$('input[value="' + id + '"]');
  4237. $input.prop('checked', true).trigger('change');
  4238. }
  4239. },
  4240. onClickRadio: function (e, $el) {
  4241. // vars
  4242. var $label = $el.parent('label');
  4243. var selected = $label.hasClass('selected');
  4244. // remove previous selected
  4245. this.$('.selected').removeClass('selected');
  4246. // add active class
  4247. $label.addClass('selected');
  4248. // allow null
  4249. if (this.get('allow_null') && selected) {
  4250. $label.removeClass('selected');
  4251. $el.prop('checked', false).trigger('change');
  4252. }
  4253. }
  4254. });
  4255. acf.registerFieldType(Field);
  4256. })(jQuery);
  4257. /***/ }),
  4258. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-time-picker.js":
  4259. /*!********************************************************************************!*\
  4260. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-time-picker.js ***!
  4261. \********************************************************************************/
  4262. /***/ (function() {
  4263. (function ($, undefined) {
  4264. var Field = acf.models.DatePickerField.extend({
  4265. type: 'time_picker',
  4266. $control: function () {
  4267. return this.$('.acf-time-picker');
  4268. },
  4269. initialize: function () {
  4270. // vars
  4271. var $input = this.$input();
  4272. var $inputText = this.$inputText();
  4273. // args
  4274. var args = {
  4275. timeFormat: this.get('time_format'),
  4276. altField: $input,
  4277. altFieldTimeOnly: false,
  4278. altTimeFormat: 'HH:mm:ss',
  4279. showButtonPanel: true,
  4280. controlType: 'select',
  4281. oneLine: true,
  4282. closeText: acf.get('dateTimePickerL10n').selectText,
  4283. timeOnly: true
  4284. };
  4285. // add custom 'Close = Select' functionality
  4286. args.onClose = function (value, dp_instance, t_instance) {
  4287. // vars
  4288. var $close = dp_instance.dpDiv.find('.ui-datepicker-close');
  4289. // if clicking close button
  4290. if (!value && $close.is(':hover')) {
  4291. t_instance._updateDateTime();
  4292. }
  4293. };
  4294. // filter
  4295. args = acf.applyFilters('time_picker_args', args, this);
  4296. // add date time picker
  4297. acf.newTimePicker($inputText, args);
  4298. // action
  4299. acf.doAction('time_picker_init', $inputText, args, this);
  4300. }
  4301. });
  4302. acf.registerFieldType(Field);
  4303. // add
  4304. acf.newTimePicker = function ($input, args) {
  4305. // bail early if no datepicker library
  4306. if (typeof $.timepicker === 'undefined') {
  4307. return false;
  4308. }
  4309. // defaults
  4310. args = args || {};
  4311. // initialize
  4312. $input.timepicker(args);
  4313. // wrap the datepicker (only if it hasn't already been wrapped)
  4314. if ($('body > #ui-datepicker-div').exists()) {
  4315. $('body > #ui-datepicker-div').wrap('<div class="acf-ui-datepicker" />');
  4316. }
  4317. };
  4318. })(jQuery);
  4319. /***/ }),
  4320. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-true-false.js":
  4321. /*!*******************************************************************************!*\
  4322. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-true-false.js ***!
  4323. \*******************************************************************************/
  4324. /***/ (function() {
  4325. (function ($, undefined) {
  4326. var Field = acf.Field.extend({
  4327. type: 'true_false',
  4328. events: {
  4329. 'change .acf-switch-input': 'onChange',
  4330. 'focus .acf-switch-input': 'onFocus',
  4331. 'blur .acf-switch-input': 'onBlur',
  4332. 'keypress .acf-switch-input': 'onKeypress'
  4333. },
  4334. $input: function () {
  4335. return this.$('input[type="checkbox"]');
  4336. },
  4337. $switch: function () {
  4338. return this.$('.acf-switch');
  4339. },
  4340. getValue: function () {
  4341. return this.$input().prop('checked') ? 1 : 0;
  4342. },
  4343. initialize: function () {
  4344. this.render();
  4345. },
  4346. render: function () {
  4347. // vars
  4348. var $switch = this.$switch();
  4349. // bail early if no $switch
  4350. if (!$switch.length) return;
  4351. // vars
  4352. var $on = $switch.children('.acf-switch-on');
  4353. var $off = $switch.children('.acf-switch-off');
  4354. var width = Math.max($on.width(), $off.width());
  4355. // bail early if no width
  4356. if (!width) return;
  4357. // set widths
  4358. $on.css('min-width', width);
  4359. $off.css('min-width', width);
  4360. },
  4361. switchOn: function () {
  4362. this.$input().prop('checked', true);
  4363. this.$switch().addClass('-on');
  4364. },
  4365. switchOff: function () {
  4366. this.$input().prop('checked', false);
  4367. this.$switch().removeClass('-on');
  4368. },
  4369. onChange: function (e, $el) {
  4370. if ($el.prop('checked')) {
  4371. this.switchOn();
  4372. } else {
  4373. this.switchOff();
  4374. }
  4375. },
  4376. onFocus: function (e, $el) {
  4377. this.$switch().addClass('-focus');
  4378. },
  4379. onBlur: function (e, $el) {
  4380. this.$switch().removeClass('-focus');
  4381. },
  4382. onKeypress: function (e, $el) {
  4383. // left
  4384. if (e.keyCode === 37) {
  4385. return this.switchOff();
  4386. }
  4387. // right
  4388. if (e.keyCode === 39) {
  4389. return this.switchOn();
  4390. }
  4391. }
  4392. });
  4393. acf.registerFieldType(Field);
  4394. })(jQuery);
  4395. /***/ }),
  4396. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-url.js":
  4397. /*!************************************************************************!*\
  4398. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-url.js ***!
  4399. \************************************************************************/
  4400. /***/ (function() {
  4401. (function ($, undefined) {
  4402. var Field = acf.Field.extend({
  4403. type: 'url',
  4404. events: {
  4405. 'keyup input[type="url"]': 'onkeyup'
  4406. },
  4407. $control: function () {
  4408. return this.$('.acf-input-wrap');
  4409. },
  4410. $input: function () {
  4411. return this.$('input[type="url"]');
  4412. },
  4413. initialize: function () {
  4414. this.render();
  4415. },
  4416. isValid: function () {
  4417. // vars
  4418. var val = this.val();
  4419. // bail early if no val
  4420. if (!val) {
  4421. return false;
  4422. }
  4423. // url
  4424. if (val.indexOf('://') !== -1) {
  4425. return true;
  4426. }
  4427. // protocol relative url
  4428. if (val.indexOf('//') === 0) {
  4429. return true;
  4430. }
  4431. // return
  4432. return false;
  4433. },
  4434. render: function () {
  4435. // add class
  4436. if (this.isValid()) {
  4437. this.$control().addClass('-valid');
  4438. } else {
  4439. this.$control().removeClass('-valid');
  4440. }
  4441. },
  4442. onkeyup: function (e, $el) {
  4443. this.render();
  4444. }
  4445. });
  4446. acf.registerFieldType(Field);
  4447. })(jQuery);
  4448. /***/ }),
  4449. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-user.js":
  4450. /*!*************************************************************************!*\
  4451. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-user.js ***!
  4452. \*************************************************************************/
  4453. /***/ (function() {
  4454. (function ($, undefined) {
  4455. var Field = acf.models.SelectField.extend({
  4456. type: 'user'
  4457. });
  4458. acf.registerFieldType(Field);
  4459. acf.addFilter('select2_ajax_data', function (data, args, $input, field, select2) {
  4460. if (!field) {
  4461. return data;
  4462. }
  4463. const query_nonce = field.get('queryNonce');
  4464. if (query_nonce && query_nonce.length) {
  4465. data.user_query_nonce = query_nonce;
  4466. }
  4467. return data;
  4468. });
  4469. })(jQuery);
  4470. /***/ }),
  4471. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-wysiwyg.js":
  4472. /*!****************************************************************************!*\
  4473. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field-wysiwyg.js ***!
  4474. \****************************************************************************/
  4475. /***/ (function() {
  4476. (function ($, undefined) {
  4477. var Field = acf.Field.extend({
  4478. type: 'wysiwyg',
  4479. wait: 'load',
  4480. events: {
  4481. 'mousedown .acf-editor-wrap.delay': 'onMousedown',
  4482. unmountField: 'disableEditor',
  4483. remountField: 'enableEditor',
  4484. removeField: 'disableEditor'
  4485. },
  4486. $control: function () {
  4487. return this.$('.acf-editor-wrap');
  4488. },
  4489. $input: function () {
  4490. return this.$('textarea');
  4491. },
  4492. getMode: function () {
  4493. return this.$control().hasClass('tmce-active') ? 'visual' : 'text';
  4494. },
  4495. initialize: function () {
  4496. // initializeEditor if no delay
  4497. if (!this.$control().hasClass('delay')) {
  4498. this.initializeEditor();
  4499. }
  4500. },
  4501. initializeEditor: function () {
  4502. // vars
  4503. var $wrap = this.$control();
  4504. var $textarea = this.$input();
  4505. var args = {
  4506. tinymce: true,
  4507. quicktags: true,
  4508. toolbar: this.get('toolbar'),
  4509. mode: this.getMode(),
  4510. field: this
  4511. };
  4512. // generate new id
  4513. var oldId = $textarea.attr('id');
  4514. var newId = acf.uniqueId('acf-editor-');
  4515. // Backup textarea data.
  4516. var inputData = $textarea.data();
  4517. var inputVal = $textarea.val();
  4518. // rename
  4519. acf.rename({
  4520. target: $wrap,
  4521. search: oldId,
  4522. replace: newId,
  4523. destructive: true
  4524. });
  4525. // update id
  4526. this.set('id', newId, true);
  4527. // apply data to new textarea (acf.rename creates a new textarea element due to destructive mode)
  4528. // fixes bug where conditional logic "disabled" is lost during "screen_check"
  4529. this.$input().data(inputData).val(inputVal);
  4530. // initialize
  4531. acf.tinymce.initialize(newId, args);
  4532. },
  4533. onMousedown: function (e) {
  4534. // prevent default
  4535. e.preventDefault();
  4536. // remove delay class
  4537. var $wrap = this.$control();
  4538. $wrap.removeClass('delay');
  4539. $wrap.find('.acf-editor-toolbar').remove();
  4540. // initialize
  4541. this.initializeEditor();
  4542. },
  4543. enableEditor: function () {
  4544. if (this.getMode() == 'visual') {
  4545. acf.tinymce.enable(this.get('id'));
  4546. }
  4547. },
  4548. disableEditor: function () {
  4549. acf.tinymce.destroy(this.get('id'));
  4550. }
  4551. });
  4552. acf.registerFieldType(Field);
  4553. })(jQuery);
  4554. /***/ }),
  4555. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field.js":
  4556. /*!********************************************************************!*\
  4557. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-field.js ***!
  4558. \********************************************************************/
  4559. /***/ (function() {
  4560. (function ($, undefined) {
  4561. // vars
  4562. var storage = [];
  4563. /**
  4564. * acf.Field
  4565. *
  4566. * description
  4567. *
  4568. * @date 23/3/18
  4569. * @since 5.6.9
  4570. *
  4571. * @param type $var Description. Default.
  4572. * @return type Description.
  4573. */
  4574. acf.Field = acf.Model.extend({
  4575. // field type
  4576. type: '',
  4577. // class used to avoid nested event triggers
  4578. eventScope: '.acf-field',
  4579. // initialize events on 'ready'
  4580. wait: 'ready',
  4581. /**
  4582. * setup
  4583. *
  4584. * Called during the constructor function to setup this field ready for initialization
  4585. *
  4586. * @date 8/5/18
  4587. * @since 5.6.9
  4588. *
  4589. * @param jQuery $field The field element.
  4590. * @return void
  4591. */
  4592. setup: function ($field) {
  4593. // set $el
  4594. this.$el = $field;
  4595. // inherit $field data
  4596. this.inherit($field);
  4597. // inherit controll data
  4598. this.inherit(this.$control());
  4599. },
  4600. /**
  4601. * val
  4602. *
  4603. * Sets or returns the field's value
  4604. *
  4605. * @date 8/5/18
  4606. * @since 5.6.9
  4607. *
  4608. * @param mixed val Optional. The value to set
  4609. * @return mixed
  4610. */
  4611. val: function (val) {
  4612. // Set.
  4613. if (val !== undefined) {
  4614. return this.setValue(val);
  4615. // Get.
  4616. } else {
  4617. return this.prop('disabled') ? null : this.getValue();
  4618. }
  4619. },
  4620. /**
  4621. * getValue
  4622. *
  4623. * returns the field's value
  4624. *
  4625. * @date 8/5/18
  4626. * @since 5.6.9
  4627. *
  4628. * @param void
  4629. * @return mixed
  4630. */
  4631. getValue: function () {
  4632. return this.$input().val();
  4633. },
  4634. /**
  4635. * setValue
  4636. *
  4637. * sets the field's value and returns true if changed
  4638. *
  4639. * @date 8/5/18
  4640. * @since 5.6.9
  4641. *
  4642. * @param mixed val
  4643. * @return boolean. True if changed.
  4644. */
  4645. setValue: function (val) {
  4646. return acf.val(this.$input(), val);
  4647. },
  4648. /**
  4649. * __
  4650. *
  4651. * i18n helper to be removed
  4652. *
  4653. * @date 8/5/18
  4654. * @since 5.6.9
  4655. *
  4656. * @param type $var Description. Default.
  4657. * @return type Description.
  4658. */
  4659. __: function (string) {
  4660. return acf._e(this.type, string);
  4661. },
  4662. /**
  4663. * $control
  4664. *
  4665. * returns the control jQuery element used for inheriting data. Uses this.control setting.
  4666. *
  4667. * @date 8/5/18
  4668. * @since 5.6.9
  4669. *
  4670. * @param void
  4671. * @return jQuery
  4672. */
  4673. $control: function () {
  4674. return false;
  4675. },
  4676. /**
  4677. * $input
  4678. *
  4679. * returns the input jQuery element used for saving values. Uses this.input setting.
  4680. *
  4681. * @date 8/5/18
  4682. * @since 5.6.9
  4683. *
  4684. * @param void
  4685. * @return jQuery
  4686. */
  4687. $input: function () {
  4688. return this.$('[name]:first');
  4689. },
  4690. /**
  4691. * $inputWrap
  4692. *
  4693. * description
  4694. *
  4695. * @date 12/5/18
  4696. * @since 5.6.9
  4697. *
  4698. * @param type $var Description. Default.
  4699. * @return type Description.
  4700. */
  4701. $inputWrap: function () {
  4702. return this.$('.acf-input:first');
  4703. },
  4704. /**
  4705. * $inputWrap
  4706. *
  4707. * description
  4708. *
  4709. * @date 12/5/18
  4710. * @since 5.6.9
  4711. *
  4712. * @param type $var Description. Default.
  4713. * @return type Description.
  4714. */
  4715. $labelWrap: function () {
  4716. return this.$('.acf-label:first');
  4717. },
  4718. /**
  4719. * getInputName
  4720. *
  4721. * Returns the field's input name
  4722. *
  4723. * @date 8/5/18
  4724. * @since 5.6.9
  4725. *
  4726. * @param void
  4727. * @return string
  4728. */
  4729. getInputName: function () {
  4730. return this.$input().attr('name') || '';
  4731. },
  4732. /**
  4733. * parent
  4734. *
  4735. * returns the field's parent field or false on failure.
  4736. *
  4737. * @date 8/5/18
  4738. * @since 5.6.9
  4739. *
  4740. * @param void
  4741. * @return object|false
  4742. */
  4743. parent: function () {
  4744. // vars
  4745. var parents = this.parents();
  4746. // return
  4747. return parents.length ? parents[0] : false;
  4748. },
  4749. /**
  4750. * parents
  4751. *
  4752. * description
  4753. *
  4754. * @date 9/7/18
  4755. * @since 5.6.9
  4756. *
  4757. * @param type $var Description. Default.
  4758. * @return type Description.
  4759. */
  4760. parents: function () {
  4761. // vars
  4762. var $parents = this.$el.parents('.acf-field');
  4763. // convert
  4764. var parents = acf.getFields($parents);
  4765. // return
  4766. return parents;
  4767. },
  4768. show: function (lockKey, context) {
  4769. // show field and store result
  4770. var changed = acf.show(this.$el, lockKey);
  4771. // do action if visibility has changed
  4772. if (changed) {
  4773. this.prop('hidden', false);
  4774. acf.doAction('show_field', this, context);
  4775. }
  4776. // return
  4777. return changed;
  4778. },
  4779. hide: function (lockKey, context) {
  4780. // hide field and store result
  4781. var changed = acf.hide(this.$el, lockKey);
  4782. // do action if visibility has changed
  4783. if (changed) {
  4784. this.prop('hidden', true);
  4785. acf.doAction('hide_field', this, context);
  4786. }
  4787. // return
  4788. return changed;
  4789. },
  4790. enable: function (lockKey, context) {
  4791. // enable field and store result
  4792. var changed = acf.enable(this.$el, lockKey);
  4793. // do action if disabled has changed
  4794. if (changed) {
  4795. this.prop('disabled', false);
  4796. acf.doAction('enable_field', this, context);
  4797. }
  4798. // return
  4799. return changed;
  4800. },
  4801. disable: function (lockKey, context) {
  4802. // disabled field and store result
  4803. var changed = acf.disable(this.$el, lockKey);
  4804. // do action if disabled has changed
  4805. if (changed) {
  4806. this.prop('disabled', true);
  4807. acf.doAction('disable_field', this, context);
  4808. }
  4809. // return
  4810. return changed;
  4811. },
  4812. showEnable: function (lockKey, context) {
  4813. // enable
  4814. this.enable.apply(this, arguments);
  4815. // show and return true if changed
  4816. return this.show.apply(this, arguments);
  4817. },
  4818. hideDisable: function (lockKey, context) {
  4819. // disable
  4820. this.disable.apply(this, arguments);
  4821. // hide and return true if changed
  4822. return this.hide.apply(this, arguments);
  4823. },
  4824. showNotice: function (props) {
  4825. // ensure object
  4826. if (typeof props !== 'object') {
  4827. props = {
  4828. text: props
  4829. };
  4830. }
  4831. // remove old notice
  4832. if (this.notice) {
  4833. this.notice.remove();
  4834. }
  4835. // create new notice
  4836. props.target = this.$inputWrap();
  4837. this.notice = acf.newNotice(props);
  4838. },
  4839. removeNotice: function (timeout) {
  4840. if (this.notice) {
  4841. this.notice.away(timeout || 0);
  4842. this.notice = false;
  4843. }
  4844. },
  4845. showError: function (message) {
  4846. // add class
  4847. this.$el.addClass('acf-error');
  4848. // add message
  4849. if (message !== undefined) {
  4850. this.showNotice({
  4851. text: message,
  4852. type: 'error',
  4853. dismiss: false
  4854. });
  4855. }
  4856. // action
  4857. acf.doAction('invalid_field', this);
  4858. // add event
  4859. this.$el.one('focus change', 'input, select, textarea', $.proxy(this.removeError, this));
  4860. },
  4861. removeError: function () {
  4862. // remove class
  4863. this.$el.removeClass('acf-error');
  4864. // remove notice
  4865. this.removeNotice(250);
  4866. // action
  4867. acf.doAction('valid_field', this);
  4868. },
  4869. trigger: function (name, args, bubbles) {
  4870. // allow some events to bubble
  4871. if (name == 'invalidField') {
  4872. bubbles = true;
  4873. }
  4874. // return
  4875. return acf.Model.prototype.trigger.apply(this, [name, args, bubbles]);
  4876. }
  4877. });
  4878. /**
  4879. * newField
  4880. *
  4881. * description
  4882. *
  4883. * @date 14/12/17
  4884. * @since 5.6.5
  4885. *
  4886. * @param type $var Description. Default.
  4887. * @return type Description.
  4888. */
  4889. acf.newField = function ($field) {
  4890. // vars
  4891. var type = $field.data('type');
  4892. var mid = modelId(type);
  4893. var model = acf.models[mid] || acf.Field;
  4894. // instantiate
  4895. var field = new model($field);
  4896. // actions
  4897. acf.doAction('new_field', field);
  4898. // return
  4899. return field;
  4900. };
  4901. /**
  4902. * mid
  4903. *
  4904. * Calculates the model ID for a field type
  4905. *
  4906. * @date 15/12/17
  4907. * @since 5.6.5
  4908. *
  4909. * @param string type
  4910. * @return string
  4911. */
  4912. var modelId = function (type) {
  4913. return acf.strPascalCase(type || '') + 'Field';
  4914. };
  4915. /**
  4916. * registerFieldType
  4917. *
  4918. * description
  4919. *
  4920. * @date 14/12/17
  4921. * @since 5.6.5
  4922. *
  4923. * @param type $var Description. Default.
  4924. * @return type Description.
  4925. */
  4926. acf.registerFieldType = function (model) {
  4927. // vars
  4928. var proto = model.prototype;
  4929. var type = proto.type;
  4930. var mid = modelId(type);
  4931. // store model
  4932. acf.models[mid] = model;
  4933. // store reference
  4934. storage.push(type);
  4935. };
  4936. /**
  4937. * acf.getFieldType
  4938. *
  4939. * description
  4940. *
  4941. * @date 1/2/18
  4942. * @since 5.6.5
  4943. *
  4944. * @param type $var Description. Default.
  4945. * @return type Description.
  4946. */
  4947. acf.getFieldType = function (type) {
  4948. var mid = modelId(type);
  4949. return acf.models[mid] || false;
  4950. };
  4951. /**
  4952. * acf.getFieldTypes
  4953. *
  4954. * description
  4955. *
  4956. * @date 1/2/18
  4957. * @since 5.6.5
  4958. *
  4959. * @param type $var Description. Default.
  4960. * @return type Description.
  4961. */
  4962. acf.getFieldTypes = function (args) {
  4963. // defaults
  4964. args = acf.parseArgs(args, {
  4965. category: ''
  4966. // hasValue: true
  4967. });
  4968. // clonse available types
  4969. var types = [];
  4970. // loop
  4971. storage.map(function (type) {
  4972. // vars
  4973. var model = acf.getFieldType(type);
  4974. var proto = model.prototype;
  4975. // check operator
  4976. if (args.category && proto.category !== args.category) {
  4977. return;
  4978. }
  4979. // append
  4980. types.push(model);
  4981. });
  4982. // return
  4983. return types;
  4984. };
  4985. })(jQuery);
  4986. /***/ }),
  4987. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-fields.js":
  4988. /*!*********************************************************************!*\
  4989. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-fields.js ***!
  4990. \*********************************************************************/
  4991. /***/ (function() {
  4992. (function ($, undefined) {
  4993. /**
  4994. * findFields
  4995. *
  4996. * Returns a jQuery selection object of acf fields.
  4997. *
  4998. * @date 14/12/17
  4999. * @since 5.6.5
  5000. *
  5001. * @param object $args {
  5002. * Optional. Arguments to find fields.
  5003. *
  5004. * @type string key The field's key (data-attribute).
  5005. * @type string name The field's name (data-attribute).
  5006. * @type string type The field's type (data-attribute).
  5007. * @type string is jQuery selector to compare against.
  5008. * @type jQuery parent jQuery element to search within.
  5009. * @type jQuery sibling jQuery element to search alongside.
  5010. * @type limit int The number of fields to find.
  5011. * @type suppressFilters bool Whether to allow filters to add/remove results. Default behaviour will ignore clone fields.
  5012. * }
  5013. * @return jQuery
  5014. */
  5015. acf.findFields = function (args) {
  5016. // vars
  5017. var selector = '.acf-field';
  5018. var $fields = false;
  5019. // args
  5020. args = acf.parseArgs(args, {
  5021. key: '',
  5022. name: '',
  5023. type: '',
  5024. is: '',
  5025. parent: false,
  5026. sibling: false,
  5027. limit: false,
  5028. visible: false,
  5029. suppressFilters: false,
  5030. excludeSubFields: false
  5031. });
  5032. // filter args
  5033. if (!args.suppressFilters) {
  5034. args = acf.applyFilters('find_fields_args', args);
  5035. }
  5036. // key
  5037. if (args.key) {
  5038. selector += '[data-key="' + args.key + '"]';
  5039. }
  5040. // type
  5041. if (args.type) {
  5042. selector += '[data-type="' + args.type + '"]';
  5043. }
  5044. // name
  5045. if (args.name) {
  5046. selector += '[data-name="' + args.name + '"]';
  5047. }
  5048. // is
  5049. if (args.is) {
  5050. selector += args.is;
  5051. }
  5052. // visibility
  5053. if (args.visible) {
  5054. selector += ':visible';
  5055. }
  5056. if (!args.suppressFilters) {
  5057. selector = acf.applyFilters('find_fields_selector', selector, args);
  5058. }
  5059. // query
  5060. if (args.parent) {
  5061. $fields = args.parent.find(selector);
  5062. // exclude sub fields if required (only if a parent is provided)
  5063. if (args.excludeSubFields) {
  5064. $fields = $fields.not(args.parent.find('.acf-is-subfields .acf-field'));
  5065. }
  5066. } else if (args.sibling) {
  5067. $fields = args.sibling.siblings(selector);
  5068. } else {
  5069. $fields = $(selector);
  5070. }
  5071. // filter
  5072. if (!args.suppressFilters) {
  5073. $fields = $fields.not('.acf-clone .acf-field');
  5074. $fields = acf.applyFilters('find_fields', $fields);
  5075. }
  5076. // limit
  5077. if (args.limit) {
  5078. $fields = $fields.slice(0, args.limit);
  5079. }
  5080. // return
  5081. return $fields;
  5082. };
  5083. /**
  5084. * findField
  5085. *
  5086. * Finds a specific field with jQuery
  5087. *
  5088. * @date 14/12/17
  5089. * @since 5.6.5
  5090. *
  5091. * @param string key The field's key.
  5092. * @param jQuery $parent jQuery element to search within.
  5093. * @return jQuery
  5094. */
  5095. acf.findField = function (key, $parent) {
  5096. return acf.findFields({
  5097. key: key,
  5098. limit: 1,
  5099. parent: $parent,
  5100. suppressFilters: true
  5101. });
  5102. };
  5103. /**
  5104. * getField
  5105. *
  5106. * Returns a field instance
  5107. *
  5108. * @date 14/12/17
  5109. * @since 5.6.5
  5110. *
  5111. * @param jQuery|string $field jQuery element or field key.
  5112. * @return object
  5113. */
  5114. acf.getField = function ($field) {
  5115. // allow jQuery
  5116. if ($field instanceof jQuery) {
  5117. // find fields
  5118. } else {
  5119. $field = acf.findField($field);
  5120. }
  5121. // instantiate
  5122. var field = $field.data('acf');
  5123. if (!field) {
  5124. field = acf.newField($field);
  5125. }
  5126. // return
  5127. return field;
  5128. };
  5129. /**
  5130. * getFields
  5131. *
  5132. * Returns multiple field instances
  5133. *
  5134. * @date 14/12/17
  5135. * @since 5.6.5
  5136. *
  5137. * @param jQuery|object $fields jQuery elements or query args.
  5138. * @return array
  5139. */
  5140. acf.getFields = function ($fields) {
  5141. // allow jQuery
  5142. if ($fields instanceof jQuery) {
  5143. // find fields
  5144. } else {
  5145. $fields = acf.findFields($fields);
  5146. }
  5147. // loop
  5148. var fields = [];
  5149. $fields.each(function () {
  5150. var field = acf.getField($(this));
  5151. fields.push(field);
  5152. });
  5153. // return
  5154. return fields;
  5155. };
  5156. /**
  5157. * findClosestField
  5158. *
  5159. * Returns the closest jQuery field element
  5160. *
  5161. * @date 9/4/18
  5162. * @since 5.6.9
  5163. *
  5164. * @param jQuery $el
  5165. * @return jQuery
  5166. */
  5167. acf.findClosestField = function ($el) {
  5168. return $el.closest('.acf-field');
  5169. };
  5170. /**
  5171. * getClosestField
  5172. *
  5173. * Returns the closest field instance
  5174. *
  5175. * @date 22/1/18
  5176. * @since 5.6.5
  5177. *
  5178. * @param jQuery $el
  5179. * @return object
  5180. */
  5181. acf.getClosestField = function ($el) {
  5182. var $field = acf.findClosestField($el);
  5183. return this.getField($field);
  5184. };
  5185. /**
  5186. * addGlobalFieldAction
  5187. *
  5188. * Sets up callback logic for global field actions
  5189. *
  5190. * @date 15/6/18
  5191. * @since 5.6.9
  5192. *
  5193. * @param string action
  5194. * @return void
  5195. */
  5196. var addGlobalFieldAction = function (action) {
  5197. // vars
  5198. var globalAction = action;
  5199. var pluralAction = action + '_fields'; // ready_fields
  5200. var singleAction = action + '_field'; // ready_field
  5201. // global action
  5202. var globalCallback = function ($el /*, arg1, arg2, etc*/) {
  5203. //console.log( action, arguments );
  5204. // get args [$el, ...]
  5205. var args = acf.arrayArgs(arguments);
  5206. var extraArgs = args.slice(1);
  5207. // find fields
  5208. var fields = acf.getFields({
  5209. parent: $el
  5210. });
  5211. // check
  5212. if (fields.length) {
  5213. // pluralAction
  5214. var pluralArgs = [pluralAction, fields].concat(extraArgs);
  5215. acf.doAction.apply(null, pluralArgs);
  5216. }
  5217. };
  5218. // plural action
  5219. var pluralCallback = function (fields /*, arg1, arg2, etc*/) {
  5220. //console.log( pluralAction, arguments );
  5221. // get args [fields, ...]
  5222. var args = acf.arrayArgs(arguments);
  5223. var extraArgs = args.slice(1);
  5224. // loop
  5225. fields.map(function (field, i) {
  5226. //setTimeout(function(){
  5227. // singleAction
  5228. var singleArgs = [singleAction, field].concat(extraArgs);
  5229. acf.doAction.apply(null, singleArgs);
  5230. //}, i * 100);
  5231. });
  5232. };
  5233. // add actions
  5234. acf.addAction(globalAction, globalCallback);
  5235. acf.addAction(pluralAction, pluralCallback);
  5236. // also add single action
  5237. addSingleFieldAction(action);
  5238. };
  5239. /**
  5240. * addSingleFieldAction
  5241. *
  5242. * Sets up callback logic for single field actions
  5243. *
  5244. * @date 15/6/18
  5245. * @since 5.6.9
  5246. *
  5247. * @param string action
  5248. * @return void
  5249. */
  5250. var addSingleFieldAction = function (action) {
  5251. // vars
  5252. var singleAction = action + '_field'; // ready_field
  5253. var singleEvent = action + 'Field'; // readyField
  5254. // single action
  5255. var singleCallback = function (field /*, arg1, arg2, etc*/) {
  5256. //console.log( singleAction, arguments );
  5257. // get args [field, ...]
  5258. var args = acf.arrayArgs(arguments);
  5259. var extraArgs = args.slice(1);
  5260. // action variations (ready_field/type=image)
  5261. var variations = ['type', 'name', 'key'];
  5262. variations.map(function (variation) {
  5263. // vars
  5264. var prefix = '/' + variation + '=' + field.get(variation);
  5265. // singleAction
  5266. args = [singleAction + prefix, field].concat(extraArgs);
  5267. acf.doAction.apply(null, args);
  5268. });
  5269. // event
  5270. if (singleFieldEvents.indexOf(action) > -1) {
  5271. field.trigger(singleEvent, extraArgs);
  5272. }
  5273. };
  5274. // add actions
  5275. acf.addAction(singleAction, singleCallback);
  5276. };
  5277. // vars
  5278. var globalFieldActions = ['prepare', 'ready', 'load', 'append', 'remove', 'unmount', 'remount', 'sortstart', 'sortstop', 'show', 'hide', 'unload'];
  5279. var singleFieldActions = ['valid', 'invalid', 'enable', 'disable', 'new', 'duplicate'];
  5280. var singleFieldEvents = ['remove', 'unmount', 'remount', 'sortstart', 'sortstop', 'show', 'hide', 'unload', 'valid', 'invalid', 'enable', 'disable', 'duplicate'];
  5281. // add
  5282. globalFieldActions.map(addGlobalFieldAction);
  5283. singleFieldActions.map(addSingleFieldAction);
  5284. /**
  5285. * fieldsEventManager
  5286. *
  5287. * Manages field actions and events
  5288. *
  5289. * @date 15/12/17
  5290. * @since 5.6.5
  5291. *
  5292. * @param void
  5293. * @param void
  5294. */
  5295. var fieldsEventManager = new acf.Model({
  5296. id: 'fieldsEventManager',
  5297. events: {
  5298. 'click .acf-field a[href="#"]': 'onClick',
  5299. 'change .acf-field': 'onChange'
  5300. },
  5301. onClick: function (e) {
  5302. // prevent default of any link with an href of #
  5303. e.preventDefault();
  5304. },
  5305. onChange: function () {
  5306. // preview hack allows post to save with no title or content
  5307. $('#_acf_changed').val(1);
  5308. }
  5309. });
  5310. var duplicateFieldsManager = new acf.Model({
  5311. id: 'duplicateFieldsManager',
  5312. actions: {
  5313. duplicate: 'onDuplicate',
  5314. duplicate_fields: 'onDuplicateFields'
  5315. },
  5316. onDuplicate: function ($el, $el2) {
  5317. var fields = acf.getFields({
  5318. parent: $el
  5319. });
  5320. if (fields.length) {
  5321. var $fields = acf.findFields({
  5322. parent: $el2
  5323. });
  5324. acf.doAction('duplicate_fields', fields, $fields);
  5325. }
  5326. },
  5327. onDuplicateFields: function (fields, duplicates) {
  5328. fields.map(function (field, i) {
  5329. acf.doAction('duplicate_field', field, $(duplicates[i]));
  5330. });
  5331. }
  5332. });
  5333. })(jQuery);
  5334. /***/ }),
  5335. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-helpers.js":
  5336. /*!**********************************************************************!*\
  5337. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-helpers.js ***!
  5338. \**********************************************************************/
  5339. /***/ (function() {
  5340. (function ($, undefined) {
  5341. /**
  5342. * refreshHelper
  5343. *
  5344. * description
  5345. *
  5346. * @date 1/7/18
  5347. * @since 5.6.9
  5348. *
  5349. * @param type $var Description. Default.
  5350. * @return type Description.
  5351. */
  5352. var refreshHelper = new acf.Model({
  5353. priority: 90,
  5354. actions: {
  5355. new_field: 'refresh',
  5356. show_field: 'refresh',
  5357. hide_field: 'refresh',
  5358. remove_field: 'refresh',
  5359. unmount_field: 'refresh',
  5360. remount_field: 'refresh'
  5361. },
  5362. refresh: function () {
  5363. acf.refresh();
  5364. }
  5365. });
  5366. /**
  5367. * mountHelper
  5368. *
  5369. * Adds compatiblity for the 'unmount' and 'remount' actions added in 5.8.0
  5370. *
  5371. * @date 7/3/19
  5372. * @since 5.7.14
  5373. *
  5374. * @param void
  5375. * @return void
  5376. */
  5377. var mountHelper = new acf.Model({
  5378. priority: 1,
  5379. actions: {
  5380. sortstart: 'onSortstart',
  5381. sortstop: 'onSortstop'
  5382. },
  5383. onSortstart: function ($item) {
  5384. acf.doAction('unmount', $item);
  5385. },
  5386. onSortstop: function ($item) {
  5387. acf.doAction('remount', $item);
  5388. }
  5389. });
  5390. /**
  5391. * sortableHelper
  5392. *
  5393. * Adds compatibility for sorting a <tr> element
  5394. *
  5395. * @date 6/3/18
  5396. * @since 5.6.9
  5397. *
  5398. * @param void
  5399. * @return void
  5400. */
  5401. var sortableHelper = new acf.Model({
  5402. actions: {
  5403. sortstart: 'onSortstart'
  5404. },
  5405. onSortstart: function ($item, $placeholder) {
  5406. // if $item is a tr, apply some css to the elements
  5407. if ($item.is('tr')) {
  5408. // replace $placeholder children with a single td
  5409. // fixes "width calculation issues" due to conditional logic hiding some children
  5410. $placeholder.html('<td style="padding:0;" colspan="' + $placeholder.children().length + '"></td>');
  5411. // add helper class to remove absolute positioning
  5412. $item.addClass('acf-sortable-tr-helper');
  5413. // set fixed widths for children
  5414. $item.children().each(function () {
  5415. $(this).width($(this).width());
  5416. });
  5417. // mimic height
  5418. $placeholder.height($item.height() + 'px');
  5419. // remove class
  5420. $item.removeClass('acf-sortable-tr-helper');
  5421. }
  5422. }
  5423. });
  5424. /**
  5425. * duplicateHelper
  5426. *
  5427. * Fixes browser bugs when duplicating an element
  5428. *
  5429. * @date 6/3/18
  5430. * @since 5.6.9
  5431. *
  5432. * @param void
  5433. * @return void
  5434. */
  5435. var duplicateHelper = new acf.Model({
  5436. actions: {
  5437. after_duplicate: 'onAfterDuplicate'
  5438. },
  5439. onAfterDuplicate: function ($el, $el2) {
  5440. // get original values
  5441. var vals = [];
  5442. $el.find('select').each(function (i) {
  5443. vals.push($(this).val());
  5444. });
  5445. // set duplicate values
  5446. $el2.find('select').each(function (i) {
  5447. $(this).val(vals[i]);
  5448. });
  5449. }
  5450. });
  5451. /**
  5452. * tableHelper
  5453. *
  5454. * description
  5455. *
  5456. * @date 6/3/18
  5457. * @since 5.6.9
  5458. *
  5459. * @param type $var Description. Default.
  5460. * @return type Description.
  5461. */
  5462. var tableHelper = new acf.Model({
  5463. id: 'tableHelper',
  5464. priority: 20,
  5465. actions: {
  5466. refresh: 'renderTables'
  5467. },
  5468. renderTables: function ($el) {
  5469. // loop
  5470. var self = this;
  5471. $('.acf-table:visible').each(function () {
  5472. self.renderTable($(this));
  5473. });
  5474. },
  5475. renderTable: function ($table) {
  5476. // vars
  5477. var $ths = $table.find('> thead > tr:visible > th[data-key]');
  5478. var $tds = $table.find('> tbody > tr:visible > td[data-key]');
  5479. // bail early if no thead
  5480. if (!$ths.length || !$tds.length) {
  5481. return false;
  5482. }
  5483. // visiblity
  5484. $ths.each(function (i) {
  5485. // vars
  5486. var $th = $(this);
  5487. var key = $th.data('key');
  5488. var $cells = $tds.filter('[data-key="' + key + '"]');
  5489. var $hidden = $cells.filter('.acf-hidden');
  5490. // always remove empty and allow cells to be hidden
  5491. $cells.removeClass('acf-empty');
  5492. // hide $th if all cells are hidden
  5493. if ($cells.length === $hidden.length) {
  5494. acf.hide($th);
  5495. // force all hidden cells to appear empty
  5496. } else {
  5497. acf.show($th);
  5498. $hidden.addClass('acf-empty');
  5499. }
  5500. });
  5501. // clear width
  5502. $ths.css('width', 'auto');
  5503. // get visible
  5504. $ths = $ths.not('.acf-hidden');
  5505. // vars
  5506. var availableWidth = 100;
  5507. var colspan = $ths.length;
  5508. // set custom widths first
  5509. var $fixedWidths = $ths.filter('[data-width]');
  5510. $fixedWidths.each(function () {
  5511. var width = $(this).data('width');
  5512. $(this).css('width', width + '%');
  5513. availableWidth -= width;
  5514. });
  5515. // set auto widths
  5516. var $auoWidths = $ths.not('[data-width]');
  5517. if ($auoWidths.length) {
  5518. var width = availableWidth / $auoWidths.length;
  5519. $auoWidths.css('width', width + '%');
  5520. availableWidth = 0;
  5521. }
  5522. // avoid stretching issue
  5523. if (availableWidth > 0) {
  5524. $ths.last().css('width', 'auto');
  5525. }
  5526. // update colspan on collapsed
  5527. $tds.filter('.-collapsed-target').each(function () {
  5528. // vars
  5529. var $td = $(this);
  5530. // check if collapsed
  5531. if ($td.parent().hasClass('-collapsed')) {
  5532. $td.attr('colspan', $ths.length);
  5533. } else {
  5534. $td.removeAttr('colspan');
  5535. }
  5536. });
  5537. }
  5538. });
  5539. /**
  5540. * fieldsHelper
  5541. *
  5542. * description
  5543. *
  5544. * @date 6/3/18
  5545. * @since 5.6.9
  5546. *
  5547. * @param type $var Description. Default.
  5548. * @return type Description.
  5549. */
  5550. var fieldsHelper = new acf.Model({
  5551. id: 'fieldsHelper',
  5552. priority: 30,
  5553. actions: {
  5554. refresh: 'renderGroups'
  5555. },
  5556. renderGroups: function () {
  5557. // loop
  5558. var self = this;
  5559. $('.acf-fields:visible').each(function () {
  5560. self.renderGroup($(this));
  5561. });
  5562. },
  5563. renderGroup: function ($el) {
  5564. // vars
  5565. var top = 0;
  5566. var height = 0;
  5567. var $row = $();
  5568. // get fields
  5569. var $fields = $el.children('.acf-field[data-width]:visible');
  5570. // bail early if no fields
  5571. if (!$fields.length) {
  5572. return false;
  5573. }
  5574. // bail early if is .-left
  5575. if ($el.hasClass('-left')) {
  5576. $fields.removeAttr('data-width');
  5577. $fields.css('width', 'auto');
  5578. return false;
  5579. }
  5580. // reset fields
  5581. $fields.removeClass('-r0 -c0').css({
  5582. 'min-height': 0
  5583. });
  5584. // loop
  5585. $fields.each(function (i) {
  5586. // vars
  5587. var $field = $(this);
  5588. var position = $field.position();
  5589. var thisTop = Math.ceil(position.top);
  5590. var thisLeft = Math.ceil(position.left);
  5591. // detect change in row
  5592. if ($row.length && thisTop > top) {
  5593. // set previous heights
  5594. $row.css({
  5595. 'min-height': height + 'px'
  5596. });
  5597. // update position due to change in row above
  5598. position = $field.position();
  5599. thisTop = Math.ceil(position.top);
  5600. thisLeft = Math.ceil(position.left);
  5601. // reset vars
  5602. top = 0;
  5603. height = 0;
  5604. $row = $();
  5605. }
  5606. // rtl
  5607. if (acf.get('rtl')) {
  5608. thisLeft = Math.ceil($field.parent().width() - (position.left + $field.outerWidth()));
  5609. }
  5610. // add classes
  5611. if (thisTop == 0) {
  5612. $field.addClass('-r0');
  5613. } else if (thisLeft == 0) {
  5614. $field.addClass('-c0');
  5615. }
  5616. // get height after class change
  5617. // - add 1 for subpixel rendering
  5618. var thisHeight = Math.ceil($field.outerHeight()) + 1;
  5619. // set height
  5620. height = Math.max(height, thisHeight);
  5621. // set y
  5622. top = Math.max(top, thisTop);
  5623. // append
  5624. $row = $row.add($field);
  5625. });
  5626. // clean up
  5627. if ($row.length) {
  5628. $row.css({
  5629. 'min-height': height + 'px'
  5630. });
  5631. }
  5632. }
  5633. });
  5634. /**
  5635. * Adds a body class when holding down the "shift" key.
  5636. *
  5637. * @date 06/05/2020
  5638. * @since 5.9.0
  5639. */
  5640. var bodyClassShiftHelper = new acf.Model({
  5641. id: 'bodyClassShiftHelper',
  5642. events: {
  5643. keydown: 'onKeyDown',
  5644. keyup: 'onKeyUp'
  5645. },
  5646. isShiftKey: function (e) {
  5647. return e.keyCode === 16;
  5648. },
  5649. onKeyDown: function (e) {
  5650. if (this.isShiftKey(e)) {
  5651. $('body').addClass('acf-keydown-shift');
  5652. }
  5653. },
  5654. onKeyUp: function (e) {
  5655. if (this.isShiftKey(e)) {
  5656. $('body').removeClass('acf-keydown-shift');
  5657. }
  5658. }
  5659. });
  5660. })(jQuery);
  5661. /***/ }),
  5662. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-media.js":
  5663. /*!********************************************************************!*\
  5664. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-media.js ***!
  5665. \********************************************************************/
  5666. /***/ (function() {
  5667. (function ($, undefined) {
  5668. /**
  5669. * acf.newMediaPopup
  5670. *
  5671. * description
  5672. *
  5673. * @date 10/1/18
  5674. * @since 5.6.5
  5675. *
  5676. * @param type $var Description. Default.
  5677. * @return type Description.
  5678. */
  5679. acf.newMediaPopup = function (args) {
  5680. // args
  5681. var popup = null;
  5682. var args = acf.parseArgs(args, {
  5683. mode: 'select',
  5684. // 'select', 'edit'
  5685. title: '',
  5686. // 'Upload Image'
  5687. button: '',
  5688. // 'Select Image'
  5689. type: '',
  5690. // 'image', ''
  5691. field: false,
  5692. // field instance
  5693. allowedTypes: '',
  5694. // '.jpg, .png, etc'
  5695. library: 'all',
  5696. // 'all', 'uploadedTo'
  5697. multiple: false,
  5698. // false, true, 'add'
  5699. attachment: 0,
  5700. // the attachment to edit
  5701. autoOpen: true,
  5702. // open the popup automatically
  5703. open: function () {},
  5704. // callback after close
  5705. select: function () {},
  5706. // callback after select
  5707. close: function () {} // callback after close
  5708. });
  5709. // initialize
  5710. if (args.mode == 'edit') {
  5711. popup = new acf.models.EditMediaPopup(args);
  5712. } else {
  5713. popup = new acf.models.SelectMediaPopup(args);
  5714. }
  5715. // open popup (allow frame customization before opening)
  5716. if (args.autoOpen) {
  5717. setTimeout(function () {
  5718. popup.open();
  5719. }, 1);
  5720. }
  5721. // action
  5722. acf.doAction('new_media_popup', popup);
  5723. // return
  5724. return popup;
  5725. };
  5726. /**
  5727. * getPostID
  5728. *
  5729. * description
  5730. *
  5731. * @date 10/1/18
  5732. * @since 5.6.5
  5733. *
  5734. * @param type $var Description. Default.
  5735. * @return type Description.
  5736. */
  5737. var getPostID = function () {
  5738. var postID = acf.get('post_id');
  5739. return acf.isNumeric(postID) ? postID : 0;
  5740. };
  5741. /**
  5742. * acf.getMimeTypes
  5743. *
  5744. * description
  5745. *
  5746. * @date 11/1/18
  5747. * @since 5.6.5
  5748. *
  5749. * @param type $var Description. Default.
  5750. * @return type Description.
  5751. */
  5752. acf.getMimeTypes = function () {
  5753. return this.get('mimeTypes');
  5754. };
  5755. acf.getMimeType = function (name) {
  5756. // vars
  5757. var allTypes = acf.getMimeTypes();
  5758. // search
  5759. if (allTypes[name] !== undefined) {
  5760. return allTypes[name];
  5761. }
  5762. // some types contain a mixed key such as "jpg|jpeg|jpe"
  5763. for (var key in allTypes) {
  5764. if (key.indexOf(name) !== -1) {
  5765. return allTypes[key];
  5766. }
  5767. }
  5768. // return
  5769. return false;
  5770. };
  5771. /**
  5772. * MediaPopup
  5773. *
  5774. * description
  5775. *
  5776. * @date 10/1/18
  5777. * @since 5.6.5
  5778. *
  5779. * @param type $var Description. Default.
  5780. * @return type Description.
  5781. */
  5782. var MediaPopup = acf.Model.extend({
  5783. id: 'MediaPopup',
  5784. data: {},
  5785. defaults: {},
  5786. frame: false,
  5787. setup: function (props) {
  5788. $.extend(this.data, props);
  5789. },
  5790. initialize: function () {
  5791. // vars
  5792. var options = this.getFrameOptions();
  5793. // add states
  5794. this.addFrameStates(options);
  5795. // create frame
  5796. var frame = wp.media(options);
  5797. // add args reference
  5798. frame.acf = this;
  5799. // add events
  5800. this.addFrameEvents(frame, options);
  5801. // strore frame
  5802. this.frame = frame;
  5803. },
  5804. open: function () {
  5805. this.frame.open();
  5806. },
  5807. close: function () {
  5808. this.frame.close();
  5809. },
  5810. remove: function () {
  5811. this.frame.detach();
  5812. this.frame.remove();
  5813. },
  5814. getFrameOptions: function () {
  5815. // vars
  5816. var options = {
  5817. title: this.get('title'),
  5818. multiple: this.get('multiple'),
  5819. library: {},
  5820. states: []
  5821. };
  5822. // type
  5823. if (this.get('type')) {
  5824. options.library.type = this.get('type');
  5825. }
  5826. // type
  5827. if (this.get('library') === 'uploadedTo') {
  5828. options.library.uploadedTo = getPostID();
  5829. }
  5830. // attachment
  5831. if (this.get('attachment')) {
  5832. options.library.post__in = [this.get('attachment')];
  5833. }
  5834. // button
  5835. if (this.get('button')) {
  5836. options.button = {
  5837. text: this.get('button')
  5838. };
  5839. }
  5840. // return
  5841. return options;
  5842. },
  5843. addFrameStates: function (options) {
  5844. // create query
  5845. var Query = wp.media.query(options.library);
  5846. // add _acfuploader
  5847. // this is super wack!
  5848. // if you add _acfuploader to the options.library args, new uploads will not be added to the library view.
  5849. // this has been traced back to the wp.media.model.Query initialize function (which can't be overriden)
  5850. // Adding any custom args will cause the Attahcments to not observe the uploader queue
  5851. // To bypass this security issue, we add in the args AFTER the Query has been initialized
  5852. // options.library._acfuploader = settings.field;
  5853. if (this.get('field') && acf.isset(Query, 'mirroring', 'args')) {
  5854. Query.mirroring.args._acfuploader = this.get('field');
  5855. }
  5856. // add states
  5857. options.states.push(
  5858. // main state
  5859. new wp.media.controller.Library({
  5860. library: Query,
  5861. multiple: this.get('multiple'),
  5862. title: this.get('title'),
  5863. priority: 20,
  5864. filterable: 'all',
  5865. editable: true,
  5866. allowLocalEdits: true
  5867. }));
  5868. // edit image functionality (added in WP 3.9)
  5869. if (acf.isset(wp, 'media', 'controller', 'EditImage')) {
  5870. options.states.push(new wp.media.controller.EditImage());
  5871. }
  5872. },
  5873. addFrameEvents: function (frame, options) {
  5874. // log all events
  5875. //frame.on('all', function( e ) {
  5876. // console.log( 'frame all: %o', e );
  5877. //});
  5878. // add class
  5879. frame.on('open', function () {
  5880. this.$el.closest('.media-modal').addClass('acf-media-modal -' + this.acf.get('mode'));
  5881. }, frame);
  5882. // edit image view
  5883. // source: media-views.js:2410 editImageContent()
  5884. frame.on('content:render:edit-image', function () {
  5885. var image = this.state().get('image');
  5886. var view = new wp.media.view.EditImage({
  5887. model: image,
  5888. controller: this
  5889. }).render();
  5890. this.content.set(view);
  5891. // after creating the wrapper view, load the actual editor via an ajax call
  5892. view.loadEditor();
  5893. }, frame);
  5894. // update toolbar button
  5895. //frame.on( 'toolbar:create:select', function( toolbar ) {
  5896. // toolbar.view = new wp.media.view.Toolbar.Select({
  5897. // text: frame.options._button,
  5898. // controller: this
  5899. // });
  5900. //}, frame );
  5901. // on select
  5902. frame.on('select', function () {
  5903. // vars
  5904. var selection = frame.state().get('selection');
  5905. // if selecting images
  5906. if (selection) {
  5907. // loop
  5908. selection.each(function (attachment, i) {
  5909. frame.acf.get('select').apply(frame.acf, [attachment, i]);
  5910. });
  5911. }
  5912. });
  5913. // on close
  5914. frame.on('close', function () {
  5915. // callback and remove
  5916. setTimeout(function () {
  5917. frame.acf.get('close').apply(frame.acf);
  5918. frame.acf.remove();
  5919. }, 1);
  5920. });
  5921. }
  5922. });
  5923. /**
  5924. * acf.models.SelectMediaPopup
  5925. *
  5926. * description
  5927. *
  5928. * @date 10/1/18
  5929. * @since 5.6.5
  5930. *
  5931. * @param type $var Description. Default.
  5932. * @return type Description.
  5933. */
  5934. acf.models.SelectMediaPopup = MediaPopup.extend({
  5935. id: 'SelectMediaPopup',
  5936. setup: function (props) {
  5937. // default button
  5938. if (!props.button) {
  5939. props.button = acf._x('Select', 'verb');
  5940. }
  5941. // parent
  5942. MediaPopup.prototype.setup.apply(this, arguments);
  5943. },
  5944. addFrameEvents: function (frame, options) {
  5945. // plupload
  5946. // adds _acfuploader param to validate uploads
  5947. if (acf.isset(_wpPluploadSettings, 'defaults', 'multipart_params')) {
  5948. // add _acfuploader so that Uploader will inherit
  5949. _wpPluploadSettings.defaults.multipart_params._acfuploader = this.get('field');
  5950. // remove acf_field so future Uploaders won't inherit
  5951. frame.on('open', function () {
  5952. delete _wpPluploadSettings.defaults.multipart_params._acfuploader;
  5953. });
  5954. }
  5955. // browse
  5956. frame.on('content:activate:browse', function () {
  5957. // vars
  5958. var toolbar = false;
  5959. // populate above vars making sure to allow for failure
  5960. // perhaps toolbar does not exist because the frame open is Upload Files
  5961. try {
  5962. toolbar = frame.content.get().toolbar;
  5963. } catch (e) {
  5964. console.log(e);
  5965. return;
  5966. }
  5967. // callback
  5968. frame.acf.customizeFilters.apply(frame.acf, [toolbar]);
  5969. });
  5970. // parent
  5971. MediaPopup.prototype.addFrameEvents.apply(this, arguments);
  5972. },
  5973. customizeFilters: function (toolbar) {
  5974. // vars
  5975. var filters = toolbar.get('filters');
  5976. // image
  5977. if (this.get('type') == 'image') {
  5978. // update all
  5979. filters.filters.all.text = acf.__('All images');
  5980. // remove some filters
  5981. delete filters.filters.audio;
  5982. delete filters.filters.video;
  5983. delete filters.filters.image;
  5984. // update all filters to show images
  5985. $.each(filters.filters, function (i, filter) {
  5986. filter.props.type = filter.props.type || 'image';
  5987. });
  5988. }
  5989. // specific types
  5990. if (this.get('allowedTypes')) {
  5991. // convert ".jpg, .png" into ["jpg", "png"]
  5992. var allowedTypes = this.get('allowedTypes').split(' ').join('').split('.').join('').split(',');
  5993. // loop
  5994. allowedTypes.map(function (name) {
  5995. // get type
  5996. var mimeType = acf.getMimeType(name);
  5997. // bail early if no type
  5998. if (!mimeType) return;
  5999. // create new filter
  6000. var newFilter = {
  6001. text: mimeType,
  6002. props: {
  6003. status: null,
  6004. type: mimeType,
  6005. uploadedTo: null,
  6006. orderby: 'date',
  6007. order: 'DESC'
  6008. },
  6009. priority: 20
  6010. };
  6011. // append
  6012. filters.filters[mimeType] = newFilter;
  6013. });
  6014. }
  6015. // uploaded to post
  6016. if (this.get('library') === 'uploadedTo') {
  6017. // vars
  6018. var uploadedTo = this.frame.options.library.uploadedTo;
  6019. // remove some filters
  6020. delete filters.filters.unattached;
  6021. delete filters.filters.uploaded;
  6022. // add uploadedTo to filters
  6023. $.each(filters.filters, function (i, filter) {
  6024. filter.text += ' (' + acf.__('Uploaded to this post') + ')';
  6025. filter.props.uploadedTo = uploadedTo;
  6026. });
  6027. }
  6028. // add _acfuploader to filters
  6029. var field = this.get('field');
  6030. $.each(filters.filters, function (k, filter) {
  6031. filter.props._acfuploader = field;
  6032. });
  6033. // add _acfuplaoder to search
  6034. var search = toolbar.get('search');
  6035. search.model.attributes._acfuploader = field;
  6036. // render (custom function added to prototype)
  6037. if (filters.renderFilters) {
  6038. filters.renderFilters();
  6039. }
  6040. }
  6041. });
  6042. /**
  6043. * acf.models.EditMediaPopup
  6044. *
  6045. * description
  6046. *
  6047. * @date 10/1/18
  6048. * @since 5.6.5
  6049. *
  6050. * @param type $var Description. Default.
  6051. * @return type Description.
  6052. */
  6053. acf.models.EditMediaPopup = MediaPopup.extend({
  6054. id: 'SelectMediaPopup',
  6055. setup: function (props) {
  6056. // default button
  6057. if (!props.button) {
  6058. props.button = acf._x('Update', 'verb');
  6059. }
  6060. // parent
  6061. MediaPopup.prototype.setup.apply(this, arguments);
  6062. },
  6063. addFrameEvents: function (frame, options) {
  6064. // add class
  6065. frame.on('open', function () {
  6066. // add class
  6067. this.$el.closest('.media-modal').addClass('acf-expanded');
  6068. // set to browse
  6069. if (this.content.mode() != 'browse') {
  6070. this.content.mode('browse');
  6071. }
  6072. // set selection
  6073. var state = this.state();
  6074. var selection = state.get('selection');
  6075. var attachment = wp.media.attachment(frame.acf.get('attachment'));
  6076. selection.add(attachment);
  6077. }, frame);
  6078. // parent
  6079. MediaPopup.prototype.addFrameEvents.apply(this, arguments);
  6080. }
  6081. });
  6082. /**
  6083. * customizePrototypes
  6084. *
  6085. * description
  6086. *
  6087. * @date 11/1/18
  6088. * @since 5.6.5
  6089. *
  6090. * @param type $var Description. Default.
  6091. * @return type Description.
  6092. */
  6093. var customizePrototypes = new acf.Model({
  6094. id: 'customizePrototypes',
  6095. wait: 'ready',
  6096. initialize: function () {
  6097. // bail early if no media views
  6098. if (!acf.isset(window, 'wp', 'media', 'view')) {
  6099. return;
  6100. }
  6101. // fix bug where CPT without "editor" does not set post.id setting which then prevents uploadedTo from working
  6102. var postID = getPostID();
  6103. if (postID && acf.isset(wp, 'media', 'view', 'settings', 'post')) {
  6104. wp.media.view.settings.post.id = postID;
  6105. }
  6106. // customize
  6107. this.customizeAttachmentsButton();
  6108. this.customizeAttachmentsRouter();
  6109. this.customizeAttachmentFilters();
  6110. this.customizeAttachmentCompat();
  6111. this.customizeAttachmentLibrary();
  6112. },
  6113. customizeAttachmentsButton: function () {
  6114. // validate
  6115. if (!acf.isset(wp, 'media', 'view', 'Button')) {
  6116. return;
  6117. }
  6118. // Extend
  6119. var Button = wp.media.view.Button;
  6120. wp.media.view.Button = Button.extend({
  6121. // Fix bug where "Select" button appears blank after editing an image.
  6122. // Do this by simplifying Button initialize function and avoid deleting this.options.
  6123. initialize: function () {
  6124. var options = _.defaults(this.options, this.defaults);
  6125. this.model = new Backbone.Model(options);
  6126. this.listenTo(this.model, 'change', this.render);
  6127. }
  6128. });
  6129. },
  6130. customizeAttachmentsRouter: function () {
  6131. // validate
  6132. if (!acf.isset(wp, 'media', 'view', 'Router')) {
  6133. return;
  6134. }
  6135. // vars
  6136. var Parent = wp.media.view.Router;
  6137. // extend
  6138. wp.media.view.Router = Parent.extend({
  6139. addExpand: function () {
  6140. // vars
  6141. var $a = $(['<a href="#" class="acf-expand-details">', '<span class="is-closed"><i class="acf-icon -left -small"></i>' + acf.__('Expand Details') + '</span>', '<span class="is-open"><i class="acf-icon -right -small"></i>' + acf.__('Collapse Details') + '</span>', '</a>'].join(''));
  6142. // add events
  6143. $a.on('click', function (e) {
  6144. e.preventDefault();
  6145. var $div = $(this).closest('.media-modal');
  6146. if ($div.hasClass('acf-expanded')) {
  6147. $div.removeClass('acf-expanded');
  6148. } else {
  6149. $div.addClass('acf-expanded');
  6150. }
  6151. });
  6152. // append
  6153. this.$el.append($a);
  6154. },
  6155. initialize: function () {
  6156. // initialize
  6157. Parent.prototype.initialize.apply(this, arguments);
  6158. // add buttons
  6159. this.addExpand();
  6160. // return
  6161. return this;
  6162. }
  6163. });
  6164. },
  6165. customizeAttachmentFilters: function () {
  6166. // validate
  6167. if (!acf.isset(wp, 'media', 'view', 'AttachmentFilters', 'All')) {
  6168. return;
  6169. }
  6170. // vars
  6171. var Parent = wp.media.view.AttachmentFilters.All;
  6172. // renderFilters
  6173. // copied from media-views.js:6939
  6174. Parent.prototype.renderFilters = function () {
  6175. // Build `<option>` elements.
  6176. this.$el.html(_.chain(this.filters).map(function (filter, value) {
  6177. return {
  6178. el: $('<option></option>').val(value).html(filter.text)[0],
  6179. priority: filter.priority || 50
  6180. };
  6181. }, this).sortBy('priority').pluck('el').value());
  6182. };
  6183. },
  6184. customizeAttachmentCompat: function () {
  6185. // validate
  6186. if (!acf.isset(wp, 'media', 'view', 'AttachmentCompat')) {
  6187. return;
  6188. }
  6189. // vars
  6190. var AttachmentCompat = wp.media.view.AttachmentCompat;
  6191. var timeout = false;
  6192. // extend
  6193. wp.media.view.AttachmentCompat = AttachmentCompat.extend({
  6194. render: function () {
  6195. // WP bug
  6196. // When multiple media frames exist on the same page (WP content, WYSIWYG, image, file ),
  6197. // WP creates multiple instances of this AttachmentCompat view.
  6198. // Each instance will attempt to render when a new modal is created.
  6199. // Use a property to avoid this and only render once per instance.
  6200. if (this.rendered) {
  6201. return this;
  6202. }
  6203. // render HTML
  6204. AttachmentCompat.prototype.render.apply(this, arguments);
  6205. // when uploading, render is called twice.
  6206. // ignore first render by checking for #acf-form-data element
  6207. if (!this.$('#acf-form-data').length) {
  6208. return this;
  6209. }
  6210. // clear timeout
  6211. clearTimeout(timeout);
  6212. // setTimeout
  6213. timeout = setTimeout($.proxy(function () {
  6214. this.rendered = true;
  6215. acf.doAction('append', this.$el);
  6216. }, this), 50);
  6217. // return
  6218. return this;
  6219. },
  6220. save: function (event) {
  6221. var data = {};
  6222. if (event) {
  6223. event.preventDefault();
  6224. }
  6225. //_.each( this.$el.serializeArray(), function( pair ) {
  6226. // data[ pair.name ] = pair.value;
  6227. //});
  6228. // Serialize data more thoroughly to allow chckbox inputs to save.
  6229. data = acf.serializeForAjax(this.$el);
  6230. this.controller.trigger('attachment:compat:waiting', ['waiting']);
  6231. this.model.saveCompat(data).always(_.bind(this.postSave, this));
  6232. }
  6233. });
  6234. },
  6235. customizeAttachmentLibrary: function () {
  6236. // validate
  6237. if (!acf.isset(wp, 'media', 'view', 'Attachment', 'Library')) {
  6238. return;
  6239. }
  6240. // vars
  6241. var AttachmentLibrary = wp.media.view.Attachment.Library;
  6242. // extend
  6243. wp.media.view.Attachment.Library = AttachmentLibrary.extend({
  6244. render: function () {
  6245. // vars
  6246. var popup = acf.isget(this, 'controller', 'acf');
  6247. var attributes = acf.isget(this, 'model', 'attributes');
  6248. // check vars exist to avoid errors
  6249. if (popup && attributes) {
  6250. // show errors
  6251. if (attributes.acf_errors) {
  6252. this.$el.addClass('acf-disabled');
  6253. }
  6254. // disable selected
  6255. var selected = popup.get('selected');
  6256. if (selected && selected.indexOf(attributes.id) > -1) {
  6257. this.$el.addClass('acf-selected');
  6258. }
  6259. }
  6260. // render
  6261. return AttachmentLibrary.prototype.render.apply(this, arguments);
  6262. },
  6263. /*
  6264. * toggleSelection
  6265. *
  6266. * This function is called before an attachment is selected
  6267. * A good place to check for errors and prevent the 'select' function from being fired
  6268. *
  6269. * @type function
  6270. * @date 29/09/2016
  6271. * @since 5.4.0
  6272. *
  6273. * @param options (object)
  6274. * @return n/a
  6275. */
  6276. toggleSelection: function (options) {
  6277. // vars
  6278. // source: wp-includes/js/media-views.js:2880
  6279. var collection = this.collection,
  6280. selection = this.options.selection,
  6281. model = this.model,
  6282. single = selection.single();
  6283. // vars
  6284. var frame = this.controller;
  6285. var errors = acf.isget(this, 'model', 'attributes', 'acf_errors');
  6286. var $sidebar = frame.$el.find('.media-frame-content .media-sidebar');
  6287. // remove previous error
  6288. $sidebar.children('.acf-selection-error').remove();
  6289. // show attachment details
  6290. $sidebar.children().removeClass('acf-hidden');
  6291. // add message
  6292. if (frame && errors) {
  6293. // vars
  6294. var filename = acf.isget(this, 'model', 'attributes', 'filename');
  6295. // hide attachment details
  6296. // Gallery field continues to show previously selected attachment...
  6297. $sidebar.children().addClass('acf-hidden');
  6298. // append message
  6299. $sidebar.prepend(['<div class="acf-selection-error">', '<span class="selection-error-label">' + acf.__('Restricted') + '</span>', '<span class="selection-error-filename">' + filename + '</span>', '<span class="selection-error-message">' + errors + '</span>', '</div>'].join(''));
  6300. // reset selection (unselects all attachments)
  6301. selection.reset();
  6302. // set single (attachment displayed in sidebar)
  6303. selection.single(model);
  6304. // return and prevent 'select' form being fired
  6305. return;
  6306. }
  6307. // return
  6308. return AttachmentLibrary.prototype.toggleSelection.apply(this, arguments);
  6309. }
  6310. });
  6311. }
  6312. });
  6313. })(jQuery);
  6314. /***/ }),
  6315. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-postbox.js":
  6316. /*!**********************************************************************!*\
  6317. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-postbox.js ***!
  6318. \**********************************************************************/
  6319. /***/ (function() {
  6320. (function ($, undefined) {
  6321. /**
  6322. * postboxManager
  6323. *
  6324. * Manages postboxes on the screen.
  6325. *
  6326. * @date 25/5/19
  6327. * @since 5.8.1
  6328. *
  6329. * @param void
  6330. * @return void
  6331. */
  6332. var postboxManager = new acf.Model({
  6333. wait: 'prepare',
  6334. priority: 1,
  6335. initialize: function () {
  6336. (acf.get('postboxes') || []).map(acf.newPostbox);
  6337. }
  6338. });
  6339. /**
  6340. * acf.getPostbox
  6341. *
  6342. * Returns a postbox instance.
  6343. *
  6344. * @date 23/9/18
  6345. * @since 5.7.7
  6346. *
  6347. * @param mixed $el Either a jQuery element or the postbox id.
  6348. * @return object
  6349. */
  6350. acf.getPostbox = function ($el) {
  6351. // allow string parameter
  6352. if (typeof arguments[0] == 'string') {
  6353. $el = $('#' + arguments[0]);
  6354. }
  6355. // return instance
  6356. return acf.getInstance($el);
  6357. };
  6358. /**
  6359. * acf.getPostboxes
  6360. *
  6361. * Returns an array of postbox instances.
  6362. *
  6363. * @date 23/9/18
  6364. * @since 5.7.7
  6365. *
  6366. * @param void
  6367. * @return array
  6368. */
  6369. acf.getPostboxes = function () {
  6370. return acf.getInstances($('.acf-postbox'));
  6371. };
  6372. /**
  6373. * acf.newPostbox
  6374. *
  6375. * Returns a new postbox instance for the given props.
  6376. *
  6377. * @date 20/9/18
  6378. * @since 5.7.6
  6379. *
  6380. * @param object props The postbox properties.
  6381. * @return object
  6382. */
  6383. acf.newPostbox = function (props) {
  6384. return new acf.models.Postbox(props);
  6385. };
  6386. /**
  6387. * acf.models.Postbox
  6388. *
  6389. * The postbox model.
  6390. *
  6391. * @date 20/9/18
  6392. * @since 5.7.6
  6393. *
  6394. * @param void
  6395. * @return void
  6396. */
  6397. acf.models.Postbox = acf.Model.extend({
  6398. data: {
  6399. id: '',
  6400. key: '',
  6401. style: 'default',
  6402. label: 'top',
  6403. edit: ''
  6404. },
  6405. setup: function (props) {
  6406. // compatibilty
  6407. if (props.editLink) {
  6408. props.edit = props.editLink;
  6409. }
  6410. // extend data
  6411. $.extend(this.data, props);
  6412. // set $el
  6413. this.$el = this.$postbox();
  6414. },
  6415. $postbox: function () {
  6416. return $('#' + this.get('id'));
  6417. },
  6418. $hide: function () {
  6419. return $('#' + this.get('id') + '-hide');
  6420. },
  6421. $hideLabel: function () {
  6422. return this.$hide().parent();
  6423. },
  6424. $hndle: function () {
  6425. return this.$('> .hndle');
  6426. },
  6427. $handleActions: function () {
  6428. return this.$('> .postbox-header .handle-actions');
  6429. },
  6430. $inside: function () {
  6431. return this.$('> .inside');
  6432. },
  6433. isVisible: function () {
  6434. return this.$el.hasClass('acf-hidden');
  6435. },
  6436. isHiddenByScreenOptions: function () {
  6437. return this.$el.hasClass('hide-if-js') || this.$el.css('display') == 'none';
  6438. },
  6439. initialize: function () {
  6440. // Add default class.
  6441. this.$el.addClass('acf-postbox');
  6442. // Add field group style class (ignore in block editor).
  6443. if (acf.get('editor') !== 'block') {
  6444. var style = this.get('style');
  6445. if (style !== 'default') {
  6446. this.$el.addClass(style);
  6447. }
  6448. }
  6449. // Add .inside class.
  6450. this.$inside().addClass('acf-fields').addClass('-' + this.get('label'));
  6451. // Append edit link.
  6452. var edit = this.get('edit');
  6453. if (edit) {
  6454. var html = '<a href="' + edit + '" class="dashicons dashicons-admin-generic acf-hndle-cog acf-js-tooltip" title="' + acf.__('Edit field group') + '"></a>';
  6455. var $handleActions = this.$handleActions();
  6456. if ($handleActions.length) {
  6457. $handleActions.prepend(html);
  6458. } else {
  6459. this.$hndle().append(html);
  6460. }
  6461. }
  6462. // Show postbox.
  6463. this.show();
  6464. },
  6465. show: function () {
  6466. // If disabled by screen options, set checked to false and return.
  6467. if (this.$el.hasClass('hide-if-js')) {
  6468. this.$hide().prop('checked', false);
  6469. return;
  6470. }
  6471. // Show label.
  6472. this.$hideLabel().show();
  6473. // toggle on checkbox
  6474. this.$hide().prop('checked', true);
  6475. // Show postbox
  6476. this.$el.show().removeClass('acf-hidden');
  6477. // Do action.
  6478. acf.doAction('show_postbox', this);
  6479. },
  6480. enable: function () {
  6481. acf.enable(this.$el, 'postbox');
  6482. },
  6483. showEnable: function () {
  6484. this.enable();
  6485. this.show();
  6486. },
  6487. hide: function () {
  6488. // Hide label.
  6489. this.$hideLabel().hide();
  6490. // Hide postbox
  6491. this.$el.hide().addClass('acf-hidden');
  6492. // Do action.
  6493. acf.doAction('hide_postbox', this);
  6494. },
  6495. disable: function () {
  6496. acf.disable(this.$el, 'postbox');
  6497. },
  6498. hideDisable: function () {
  6499. this.disable();
  6500. this.hide();
  6501. },
  6502. html: function (html) {
  6503. // Update HTML.
  6504. this.$inside().html(html);
  6505. // Do action.
  6506. acf.doAction('append', this.$el);
  6507. }
  6508. });
  6509. })(jQuery);
  6510. /***/ }),
  6511. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-screen.js":
  6512. /*!*********************************************************************!*\
  6513. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-screen.js ***!
  6514. \*********************************************************************/
  6515. /***/ (function() {
  6516. (function ($, undefined) {
  6517. acf.screen = new acf.Model({
  6518. active: true,
  6519. xhr: false,
  6520. timeout: false,
  6521. wait: 'load',
  6522. events: {
  6523. 'change #page_template': 'onChange',
  6524. 'change #parent_id': 'onChange',
  6525. 'change #post-formats-select': 'onChange',
  6526. 'change .categorychecklist': 'onChange',
  6527. 'change .tagsdiv': 'onChange',
  6528. 'change .acf-taxonomy-field[data-save="1"]': 'onChange',
  6529. 'change #product-type': 'onChange'
  6530. },
  6531. isPost: function () {
  6532. return acf.get('screen') === 'post';
  6533. },
  6534. isUser: function () {
  6535. return acf.get('screen') === 'user';
  6536. },
  6537. isTaxonomy: function () {
  6538. return acf.get('screen') === 'taxonomy';
  6539. },
  6540. isAttachment: function () {
  6541. return acf.get('screen') === 'attachment';
  6542. },
  6543. isNavMenu: function () {
  6544. return acf.get('screen') === 'nav_menu';
  6545. },
  6546. isWidget: function () {
  6547. return acf.get('screen') === 'widget';
  6548. },
  6549. isComment: function () {
  6550. return acf.get('screen') === 'comment';
  6551. },
  6552. getPageTemplate: function () {
  6553. var $el = $('#page_template');
  6554. return $el.length ? $el.val() : null;
  6555. },
  6556. getPageParent: function (e, $el) {
  6557. var $el = $('#parent_id');
  6558. return $el.length ? $el.val() : null;
  6559. },
  6560. getPageType: function (e, $el) {
  6561. return this.getPageParent() ? 'child' : 'parent';
  6562. },
  6563. getPostType: function () {
  6564. return $('#post_type').val();
  6565. },
  6566. getPostFormat: function (e, $el) {
  6567. var $el = $('#post-formats-select input:checked');
  6568. if ($el.length) {
  6569. var val = $el.val();
  6570. return val == '0' ? 'standard' : val;
  6571. }
  6572. return null;
  6573. },
  6574. getPostCoreTerms: function () {
  6575. // vars
  6576. var terms = {};
  6577. // serialize WP taxonomy postboxes
  6578. var data = acf.serialize($('.categorydiv, .tagsdiv'));
  6579. // use tax_input (tag, custom-taxonomy) when possible.
  6580. // this data is already formatted in taxonomy => [terms].
  6581. if (data.tax_input) {
  6582. terms = data.tax_input;
  6583. }
  6584. // append "category" which uses a different name
  6585. if (data.post_category) {
  6586. terms.category = data.post_category;
  6587. }
  6588. // convert any string values (tags) into array format
  6589. for (var tax in terms) {
  6590. if (!acf.isArray(terms[tax])) {
  6591. terms[tax] = terms[tax].split(/,[\s]?/);
  6592. }
  6593. }
  6594. // return
  6595. return terms;
  6596. },
  6597. getPostTerms: function () {
  6598. // Get core terms.
  6599. var terms = this.getPostCoreTerms();
  6600. // loop over taxonomy fields and add their values
  6601. acf.getFields({
  6602. type: 'taxonomy'
  6603. }).map(function (field) {
  6604. // ignore fields that don't save
  6605. if (!field.get('save')) {
  6606. return;
  6607. }
  6608. // vars
  6609. var val = field.val();
  6610. var tax = field.get('taxonomy');
  6611. // check val
  6612. if (val) {
  6613. // ensure terms exists
  6614. terms[tax] = terms[tax] || [];
  6615. // ensure val is an array
  6616. val = acf.isArray(val) ? val : [val];
  6617. // append
  6618. terms[tax] = terms[tax].concat(val);
  6619. }
  6620. });
  6621. // add WC product type
  6622. if ((productType = this.getProductType()) !== null) {
  6623. terms.product_type = [productType];
  6624. }
  6625. // remove duplicate values
  6626. for (var tax in terms) {
  6627. terms[tax] = acf.uniqueArray(terms[tax]);
  6628. }
  6629. // return
  6630. return terms;
  6631. },
  6632. getProductType: function () {
  6633. var $el = $('#product-type');
  6634. return $el.length ? $el.val() : null;
  6635. },
  6636. check: function () {
  6637. // bail early if not for post
  6638. if (acf.get('screen') !== 'post') {
  6639. return;
  6640. }
  6641. // abort XHR if is already loading AJAX data
  6642. if (this.xhr) {
  6643. this.xhr.abort();
  6644. }
  6645. // vars
  6646. var ajaxData = acf.parseArgs(this.data, {
  6647. action: 'acf/ajax/check_screen',
  6648. screen: acf.get('screen'),
  6649. exists: []
  6650. });
  6651. // post id
  6652. if (this.isPost()) {
  6653. ajaxData.post_id = acf.get('post_id');
  6654. }
  6655. // post type
  6656. if ((postType = this.getPostType()) !== null) {
  6657. ajaxData.post_type = postType;
  6658. }
  6659. // page template
  6660. if ((pageTemplate = this.getPageTemplate()) !== null) {
  6661. ajaxData.page_template = pageTemplate;
  6662. }
  6663. // page parent
  6664. if ((pageParent = this.getPageParent()) !== null) {
  6665. ajaxData.page_parent = pageParent;
  6666. }
  6667. // page type
  6668. if ((pageType = this.getPageType()) !== null) {
  6669. ajaxData.page_type = pageType;
  6670. }
  6671. // post format
  6672. if ((postFormat = this.getPostFormat()) !== null) {
  6673. ajaxData.post_format = postFormat;
  6674. }
  6675. // post terms
  6676. if ((postTerms = this.getPostTerms()) !== null) {
  6677. ajaxData.post_terms = postTerms;
  6678. }
  6679. // add array of existing postboxes to increase performance and reduce JSON HTML
  6680. acf.getPostboxes().map(function (postbox) {
  6681. ajaxData.exists.push(postbox.get('key'));
  6682. });
  6683. // filter
  6684. ajaxData = acf.applyFilters('check_screen_args', ajaxData);
  6685. // success
  6686. var onSuccess = function (json) {
  6687. // Render post screen.
  6688. if (acf.get('screen') == 'post') {
  6689. this.renderPostScreen(json);
  6690. // Render user screen.
  6691. } else if (acf.get('screen') == 'user') {
  6692. this.renderUserScreen(json);
  6693. }
  6694. // action
  6695. acf.doAction('check_screen_complete', json, ajaxData);
  6696. };
  6697. // ajax
  6698. this.xhr = $.ajax({
  6699. url: acf.get('ajaxurl'),
  6700. data: acf.prepareForAjax(ajaxData),
  6701. type: 'post',
  6702. dataType: 'json',
  6703. context: this,
  6704. success: onSuccess
  6705. });
  6706. },
  6707. onChange: function (e, $el) {
  6708. this.setTimeout(this.check, 1);
  6709. },
  6710. renderPostScreen: function (data) {
  6711. // Helper function to copy events
  6712. var copyEvents = function ($from, $to) {
  6713. var events = $._data($from[0]).events;
  6714. for (var type in events) {
  6715. for (var i = 0; i < events[type].length; i++) {
  6716. $to.on(type, events[type][i].handler);
  6717. }
  6718. }
  6719. };
  6720. // Helper function to sort metabox.
  6721. var sortMetabox = function (id, ids) {
  6722. // Find position of id within ids.
  6723. var index = ids.indexOf(id);
  6724. // Bail early if index not found.
  6725. if (index == -1) {
  6726. return false;
  6727. }
  6728. // Loop over metaboxes behind (in reverse order).
  6729. for (var i = index - 1; i >= 0; i--) {
  6730. if ($('#' + ids[i]).length) {
  6731. return $('#' + ids[i]).after($('#' + id));
  6732. }
  6733. }
  6734. // Loop over metaboxes infront.
  6735. for (var i = index + 1; i < ids.length; i++) {
  6736. if ($('#' + ids[i]).length) {
  6737. return $('#' + ids[i]).before($('#' + id));
  6738. }
  6739. }
  6740. // Return false if not sorted.
  6741. return false;
  6742. };
  6743. // Keep track of visible and hidden postboxes.
  6744. data.visible = [];
  6745. data.hidden = [];
  6746. // Show these postboxes.
  6747. data.results = data.results.map(function (result, i) {
  6748. // vars
  6749. var postbox = acf.getPostbox(result.id);
  6750. // Prevent "acf_after_title" position in Block Editor.
  6751. if (acf.isGutenberg() && result.position == 'acf_after_title') {
  6752. result.position = 'normal';
  6753. }
  6754. // Create postbox if doesn't exist.
  6755. if (!postbox) {
  6756. var wpMinorVersion = parseFloat(acf.get('wp_version'));
  6757. if (wpMinorVersion >= 5.5) {
  6758. var postboxHeader = ['<div class="postbox-header">', '<h2 class="hndle ui-sortable-handle">', '<span>' + acf.escHtml(result.title) + '</span>', '</h2>', '<div class="handle-actions hide-if-no-js">', '<button type="button" class="handlediv" aria-expanded="true">', '<span class="screen-reader-text">Toggle panel: ' + acf.escHtml(result.title) + '</span>', '<span class="toggle-indicator" aria-hidden="true"></span>', '</button>', '</div>', '</div>'].join('');
  6759. } else {
  6760. var postboxHeader = ['<button type="button" class="handlediv" aria-expanded="true">', '<span class="screen-reader-text">Toggle panel: ' + acf.escHtml(result.title) + '</span>', '<span class="toggle-indicator" aria-hidden="true"></span>', '</button>', '<h2 class="hndle ui-sortable-handle">', '<span>' + acf.escHtml(result.title) + '</span>', '</h2>'].join('');
  6761. }
  6762. // Ensure result.classes is set.
  6763. if (!result.classes) result.classes = '';
  6764. // Create it.
  6765. var $postbox = $(['<div id="' + result.id + '" class="postbox ' + result.classes + '">', postboxHeader, '<div class="inside">', result.html, '</div>', '</div>'].join(''));
  6766. // Create new hide toggle.
  6767. if ($('#adv-settings').length) {
  6768. var $prefs = $('#adv-settings .metabox-prefs');
  6769. var $label = $(['<label for="' + result.id + '-hide">', '<input class="hide-postbox-tog" name="' + result.id + '-hide" type="checkbox" id="' + result.id + '-hide" value="' + result.id + '" checked="checked">', ' ' + result.title, '</label>'].join(''));
  6770. // Copy default WP events onto checkbox.
  6771. copyEvents($prefs.find('input').first(), $label.find('input'));
  6772. // Append hide label
  6773. $prefs.append($label);
  6774. }
  6775. // Copy default WP events onto metabox.
  6776. if ($('.postbox').length) {
  6777. copyEvents($('.postbox .handlediv').first(), $postbox.children('.handlediv'));
  6778. copyEvents($('.postbox .hndle').first(), $postbox.children('.hndle'));
  6779. }
  6780. // Append metabox to the bottom of "side-sortables".
  6781. if (result.position === 'side') {
  6782. $('#' + result.position + '-sortables').append($postbox);
  6783. // Prepend metabox to the top of "normal-sortbables".
  6784. } else {
  6785. $('#' + result.position + '-sortables').prepend($postbox);
  6786. }
  6787. // Position metabox amongst existing ACF metaboxes within the same location.
  6788. var order = [];
  6789. data.results.map(function (_result) {
  6790. if (result.position === _result.position && $('#' + result.position + '-sortables #' + _result.id).length) {
  6791. order.push(_result.id);
  6792. }
  6793. });
  6794. sortMetabox(result.id, order);
  6795. // Check 'sorted' for user preference.
  6796. if (data.sorted) {
  6797. // Loop over each position (acf_after_title, side, normal).
  6798. for (var position in data.sorted) {
  6799. let order = data.sorted[position];
  6800. if (typeof order !== 'string') {
  6801. continue;
  6802. }
  6803. // Explode string into array of ids.
  6804. order = order.split(',');
  6805. // Position metabox relative to order.
  6806. if (sortMetabox(result.id, order)) {
  6807. break;
  6808. }
  6809. }
  6810. }
  6811. // Initalize it (modifies HTML).
  6812. postbox = acf.newPostbox(result);
  6813. // Trigger action.
  6814. acf.doAction('append', $postbox);
  6815. acf.doAction('append_postbox', postbox);
  6816. }
  6817. // show postbox
  6818. postbox.showEnable();
  6819. // append
  6820. data.visible.push(result.id);
  6821. // Return result (may have changed).
  6822. return result;
  6823. });
  6824. // Hide these postboxes.
  6825. acf.getPostboxes().map(function (postbox) {
  6826. if (data.visible.indexOf(postbox.get('id')) === -1) {
  6827. // Hide postbox.
  6828. postbox.hideDisable();
  6829. // Append to data.
  6830. data.hidden.push(postbox.get('id'));
  6831. }
  6832. });
  6833. // Update style.
  6834. $('#acf-style').html(data.style);
  6835. // Do action.
  6836. acf.doAction('refresh_post_screen', data);
  6837. },
  6838. renderUserScreen: function (json) {}
  6839. });
  6840. /**
  6841. * gutenScreen
  6842. *
  6843. * Adds compatibility with the Gutenberg edit screen.
  6844. *
  6845. * @date 11/12/18
  6846. * @since 5.8.0
  6847. *
  6848. * @param void
  6849. * @return void
  6850. */
  6851. var gutenScreen = new acf.Model({
  6852. // Keep a reference to the most recent post attributes.
  6853. postEdits: {},
  6854. // Wait until assets have been loaded.
  6855. wait: 'prepare',
  6856. initialize: function () {
  6857. // Bail early if not Gutenberg.
  6858. if (!acf.isGutenberg()) {
  6859. return;
  6860. }
  6861. // Listen for changes (use debounced version as this can fires often).
  6862. wp.data.subscribe(acf.debounce(this.onChange).bind(this));
  6863. // Customize "acf.screen.get" functions.
  6864. acf.screen.getPageTemplate = this.getPageTemplate;
  6865. acf.screen.getPageParent = this.getPageParent;
  6866. acf.screen.getPostType = this.getPostType;
  6867. acf.screen.getPostFormat = this.getPostFormat;
  6868. acf.screen.getPostCoreTerms = this.getPostCoreTerms;
  6869. // Disable unload
  6870. acf.unload.disable();
  6871. // Refresh metaboxes since WP 5.3.
  6872. var wpMinorVersion = parseFloat(acf.get('wp_version'));
  6873. if (wpMinorVersion >= 5.3) {
  6874. this.addAction('refresh_post_screen', this.onRefreshPostScreen);
  6875. }
  6876. // Trigger "refresh" after WP has moved metaboxes into place.
  6877. wp.domReady(acf.refresh);
  6878. },
  6879. onChange: function () {
  6880. // Determine attributes that can trigger a refresh.
  6881. var attributes = ['template', 'parent', 'format'];
  6882. // Append taxonomy attribute names to this list.
  6883. (wp.data.select('core').getTaxonomies() || []).map(function (taxonomy) {
  6884. attributes.push(taxonomy.rest_base);
  6885. });
  6886. // Get relevant current post edits.
  6887. var _postEdits = wp.data.select('core/editor').getPostEdits();
  6888. var postEdits = {};
  6889. attributes.map(function (k) {
  6890. if (_postEdits[k] !== undefined) {
  6891. postEdits[k] = _postEdits[k];
  6892. }
  6893. });
  6894. // Detect change.
  6895. if (JSON.stringify(postEdits) !== JSON.stringify(this.postEdits)) {
  6896. this.postEdits = postEdits;
  6897. // Check screen.
  6898. acf.screen.check();
  6899. }
  6900. },
  6901. getPageTemplate: function () {
  6902. return wp.data.select('core/editor').getEditedPostAttribute('template');
  6903. },
  6904. getPageParent: function (e, $el) {
  6905. return wp.data.select('core/editor').getEditedPostAttribute('parent');
  6906. },
  6907. getPostType: function () {
  6908. return wp.data.select('core/editor').getEditedPostAttribute('type');
  6909. },
  6910. getPostFormat: function (e, $el) {
  6911. return wp.data.select('core/editor').getEditedPostAttribute('format');
  6912. },
  6913. getPostCoreTerms: function () {
  6914. // vars
  6915. var terms = {};
  6916. // Loop over taxonomies.
  6917. var taxonomies = wp.data.select('core').getTaxonomies() || [];
  6918. taxonomies.map(function (taxonomy) {
  6919. // Append selected taxonomies to terms object.
  6920. var postTerms = wp.data.select('core/editor').getEditedPostAttribute(taxonomy.rest_base);
  6921. if (postTerms) {
  6922. terms[taxonomy.slug] = postTerms;
  6923. }
  6924. });
  6925. // return
  6926. return terms;
  6927. },
  6928. /**
  6929. * onRefreshPostScreen
  6930. *
  6931. * Fires after the Post edit screen metaboxs are refreshed to update the Block Editor API state.
  6932. *
  6933. * @date 11/11/19
  6934. * @since 5.8.7
  6935. *
  6936. * @param object data The "check_screen" JSON response data.
  6937. * @return void
  6938. */
  6939. onRefreshPostScreen: function (data) {
  6940. // Extract vars.
  6941. var select = wp.data.select('core/edit-post');
  6942. var dispatch = wp.data.dispatch('core/edit-post');
  6943. // Load current metabox locations and data.
  6944. var locations = {};
  6945. select.getActiveMetaBoxLocations().map(function (location) {
  6946. locations[location] = select.getMetaBoxesPerLocation(location);
  6947. });
  6948. // Generate flat array of existing ids.
  6949. var ids = [];
  6950. for (var k in locations) {
  6951. locations[k].map(function (m) {
  6952. ids.push(m.id);
  6953. });
  6954. }
  6955. // Append new ACF metaboxes (ignore those which already exist).
  6956. data.results.filter(function (r) {
  6957. return ids.indexOf(r.id) === -1;
  6958. }).map(function (result, i) {
  6959. // Ensure location exists.
  6960. var location = result.position;
  6961. locations[location] = locations[location] || [];
  6962. // Append.
  6963. locations[location].push({
  6964. id: result.id,
  6965. title: result.title
  6966. });
  6967. });
  6968. // Remove hidden ACF metaboxes.
  6969. for (var k in locations) {
  6970. locations[k] = locations[k].filter(function (m) {
  6971. return data.hidden.indexOf(m.id) === -1;
  6972. });
  6973. }
  6974. // Update state.
  6975. dispatch.setAvailableMetaBoxesPerLocation(locations);
  6976. }
  6977. });
  6978. })(jQuery);
  6979. /***/ }),
  6980. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-select2.js":
  6981. /*!**********************************************************************!*\
  6982. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-select2.js ***!
  6983. \**********************************************************************/
  6984. /***/ (function() {
  6985. (function ($, undefined) {
  6986. /**
  6987. * acf.newSelect2
  6988. *
  6989. * description
  6990. *
  6991. * @date 13/1/18
  6992. * @since 5.6.5
  6993. *
  6994. * @param type $var Description. Default.
  6995. * @return type Description.
  6996. */
  6997. acf.newSelect2 = function ($select, props) {
  6998. // defaults
  6999. props = acf.parseArgs(props, {
  7000. allowNull: false,
  7001. placeholder: '',
  7002. multiple: false,
  7003. field: false,
  7004. ajax: false,
  7005. ajaxAction: '',
  7006. ajaxData: function (data) {
  7007. return data;
  7008. },
  7009. ajaxResults: function (json) {
  7010. return json;
  7011. }
  7012. });
  7013. // initialize
  7014. if (getVersion() == 4) {
  7015. var select2 = new Select2_4($select, props);
  7016. } else {
  7017. var select2 = new Select2_3($select, props);
  7018. }
  7019. // actions
  7020. acf.doAction('new_select2', select2);
  7021. // return
  7022. return select2;
  7023. };
  7024. /**
  7025. * getVersion
  7026. *
  7027. * description
  7028. *
  7029. * @date 13/1/18
  7030. * @since 5.6.5
  7031. *
  7032. * @param type $var Description. Default.
  7033. * @return type Description.
  7034. */
  7035. function getVersion() {
  7036. // v4
  7037. if (acf.isset(window, 'jQuery', 'fn', 'select2', 'amd')) {
  7038. return 4;
  7039. }
  7040. // v3
  7041. if (acf.isset(window, 'Select2')) {
  7042. return 3;
  7043. }
  7044. // return
  7045. return false;
  7046. }
  7047. /**
  7048. * Select2
  7049. *
  7050. * description
  7051. *
  7052. * @date 13/1/18
  7053. * @since 5.6.5
  7054. *
  7055. * @param type $var Description. Default.
  7056. * @return type Description.
  7057. */
  7058. var Select2 = acf.Model.extend({
  7059. setup: function ($select, props) {
  7060. $.extend(this.data, props);
  7061. this.$el = $select;
  7062. },
  7063. initialize: function () {},
  7064. selectOption: function (value) {
  7065. var $option = this.getOption(value);
  7066. if (!$option.prop('selected')) {
  7067. $option.prop('selected', true).trigger('change');
  7068. }
  7069. },
  7070. unselectOption: function (value) {
  7071. var $option = this.getOption(value);
  7072. if ($option.prop('selected')) {
  7073. $option.prop('selected', false).trigger('change');
  7074. }
  7075. },
  7076. getOption: function (value) {
  7077. return this.$('option[value="' + value + '"]');
  7078. },
  7079. addOption: function (option) {
  7080. // defaults
  7081. option = acf.parseArgs(option, {
  7082. id: '',
  7083. text: '',
  7084. selected: false
  7085. });
  7086. // vars
  7087. var $option = this.getOption(option.id);
  7088. // append
  7089. if (!$option.length) {
  7090. $option = $('<option></option>');
  7091. $option.html(option.text);
  7092. $option.attr('value', option.id);
  7093. $option.prop('selected', option.selected);
  7094. this.$el.append($option);
  7095. }
  7096. // chain
  7097. return $option;
  7098. },
  7099. getValue: function () {
  7100. // vars
  7101. var val = [];
  7102. var $options = this.$el.find('option:selected');
  7103. // bail early if no selected
  7104. if (!$options.exists()) {
  7105. return val;
  7106. }
  7107. // sort by attribute
  7108. $options = $options.sort(function (a, b) {
  7109. return +a.getAttribute('data-i') - +b.getAttribute('data-i');
  7110. });
  7111. // loop
  7112. $options.each(function () {
  7113. var $el = $(this);
  7114. val.push({
  7115. $el: $el,
  7116. id: $el.attr('value'),
  7117. text: $el.text()
  7118. });
  7119. });
  7120. // return
  7121. return val;
  7122. },
  7123. mergeOptions: function () {},
  7124. getChoices: function () {
  7125. // callback
  7126. var crawl = function ($parent) {
  7127. // vars
  7128. var choices = [];
  7129. // loop
  7130. $parent.children().each(function () {
  7131. // vars
  7132. var $child = $(this);
  7133. // optgroup
  7134. if ($child.is('optgroup')) {
  7135. choices.push({
  7136. text: $child.attr('label'),
  7137. children: crawl($child)
  7138. });
  7139. // option
  7140. } else {
  7141. choices.push({
  7142. id: $child.attr('value'),
  7143. text: $child.text()
  7144. });
  7145. }
  7146. });
  7147. // return
  7148. return choices;
  7149. };
  7150. // crawl
  7151. return crawl(this.$el);
  7152. },
  7153. getAjaxData: function (params) {
  7154. // vars
  7155. var ajaxData = {
  7156. action: this.get('ajaxAction'),
  7157. s: params.term || '',
  7158. paged: params.page || 1
  7159. };
  7160. // field helper
  7161. var field = this.get('field');
  7162. if (field) {
  7163. ajaxData.field_key = field.get('key');
  7164. }
  7165. // callback
  7166. var callback = this.get('ajaxData');
  7167. if (callback) {
  7168. ajaxData = callback.apply(this, [ajaxData, params]);
  7169. }
  7170. // filter
  7171. ajaxData = acf.applyFilters('select2_ajax_data', ajaxData, this.data, this.$el, field || false, this);
  7172. // return
  7173. return acf.prepareForAjax(ajaxData);
  7174. },
  7175. getAjaxResults: function (json, params) {
  7176. // defaults
  7177. json = acf.parseArgs(json, {
  7178. results: false,
  7179. more: false
  7180. });
  7181. // callback
  7182. var callback = this.get('ajaxResults');
  7183. if (callback) {
  7184. json = callback.apply(this, [json, params]);
  7185. }
  7186. // filter
  7187. json = acf.applyFilters('select2_ajax_results', json, params, this);
  7188. // return
  7189. return json;
  7190. },
  7191. processAjaxResults: function (json, params) {
  7192. // vars
  7193. var json = this.getAjaxResults(json, params);
  7194. // change more to pagination
  7195. if (json.more) {
  7196. json.pagination = {
  7197. more: true
  7198. };
  7199. }
  7200. // merge together groups
  7201. setTimeout($.proxy(this.mergeOptions, this), 1);
  7202. // return
  7203. return json;
  7204. },
  7205. destroy: function () {
  7206. // destroy via api
  7207. if (this.$el.data('select2')) {
  7208. this.$el.select2('destroy');
  7209. }
  7210. // destory via HTML (duplicating HTML does not contain data)
  7211. this.$el.siblings('.select2-container').remove();
  7212. }
  7213. });
  7214. /**
  7215. * Select2_4
  7216. *
  7217. * description
  7218. *
  7219. * @date 13/1/18
  7220. * @since 5.6.5
  7221. *
  7222. * @param type $var Description. Default.
  7223. * @return type Description.
  7224. */
  7225. var Select2_4 = Select2.extend({
  7226. initialize: function () {
  7227. // vars
  7228. var $select = this.$el;
  7229. var options = {
  7230. width: '100%',
  7231. allowClear: this.get('allowNull'),
  7232. placeholder: this.get('placeholder'),
  7233. multiple: this.get('multiple'),
  7234. data: [],
  7235. escapeMarkup: function (markup) {
  7236. if (typeof markup !== 'string') {
  7237. return markup;
  7238. }
  7239. return acf.escHtml(markup);
  7240. }
  7241. };
  7242. // Only use the template if SelectWoo is not loaded to work around https://github.com/woocommerce/woocommerce/pull/30473
  7243. if (!acf.isset(window, 'jQuery', 'fn', 'selectWoo')) {
  7244. options.templateSelection = function (selection) {
  7245. var $selection = $('<span class="acf-selection"></span>');
  7246. $selection.html(acf.escHtml(selection.text));
  7247. $selection.data('element', selection.element);
  7248. return $selection;
  7249. };
  7250. }
  7251. // multiple
  7252. if (options.multiple) {
  7253. // reorder options
  7254. this.getValue().map(function (item) {
  7255. item.$el.detach().appendTo($select);
  7256. });
  7257. }
  7258. // Temporarily remove conflicting attribute.
  7259. var attrAjax = $select.attr('data-ajax');
  7260. if (attrAjax !== undefined) {
  7261. $select.removeData('ajax');
  7262. $select.removeAttr('data-ajax');
  7263. }
  7264. // ajax
  7265. if (this.get('ajax')) {
  7266. options.ajax = {
  7267. url: acf.get('ajaxurl'),
  7268. delay: 250,
  7269. dataType: 'json',
  7270. type: 'post',
  7271. cache: false,
  7272. data: $.proxy(this.getAjaxData, this),
  7273. processResults: $.proxy(this.processAjaxResults, this)
  7274. };
  7275. }
  7276. // filter for 3rd party customization
  7277. //options = acf.applyFilters( 'select2_args', options, $select, this );
  7278. var field = this.get('field');
  7279. options = acf.applyFilters('select2_args', options, $select, this.data, field || false, this);
  7280. // add select2
  7281. $select.select2(options);
  7282. // get container (Select2 v4 does not return this from constructor)
  7283. var $container = $select.next('.select2-container');
  7284. // multiple
  7285. if (options.multiple) {
  7286. // vars
  7287. var $ul = $container.find('ul');
  7288. // sortable
  7289. $ul.sortable({
  7290. stop: function (e) {
  7291. // loop
  7292. $ul.find('.select2-selection__choice').each(function () {
  7293. // Attempt to use .data if it exists (select2 version < 4.0.6) or use our template data instead.
  7294. if ($(this).data('data')) {
  7295. var $option = $($(this).data('data').element);
  7296. } else {
  7297. var $option = $($(this).find('span.acf-selection').data('element'));
  7298. }
  7299. // detach and re-append to end
  7300. $option.detach().appendTo($select);
  7301. });
  7302. // trigger change on input (JS error if trigger on select)
  7303. $select.trigger('change');
  7304. }
  7305. });
  7306. // on select, move to end
  7307. $select.on('select2:select', this.proxy(function (e) {
  7308. this.getOption(e.params.data.id).detach().appendTo(this.$el);
  7309. }));
  7310. }
  7311. // add handler to auto-focus searchbox (for jQuery 3.6)
  7312. $select.on('select2:open', () => {
  7313. $('.select2-container--open .select2-search__field').get(-1).focus();
  7314. });
  7315. // add class
  7316. $container.addClass('-acf');
  7317. // Add back temporarily removed attr.
  7318. if (attrAjax !== undefined) {
  7319. $select.attr('data-ajax', attrAjax);
  7320. }
  7321. // action for 3rd party customization
  7322. acf.doAction('select2_init', $select, options, this.data, field || false, this);
  7323. },
  7324. mergeOptions: function () {
  7325. // vars
  7326. var $prevOptions = false;
  7327. var $prevGroup = false;
  7328. // loop
  7329. $('.select2-results__option[role="group"]').each(function () {
  7330. // vars
  7331. var $options = $(this).children('ul');
  7332. var $group = $(this).children('strong');
  7333. // compare to previous
  7334. if ($prevGroup && $prevGroup.text() === $group.text()) {
  7335. $prevOptions.append($options.children());
  7336. $(this).remove();
  7337. return;
  7338. }
  7339. // update vars
  7340. $prevOptions = $options;
  7341. $prevGroup = $group;
  7342. });
  7343. }
  7344. });
  7345. /**
  7346. * Select2_3
  7347. *
  7348. * description
  7349. *
  7350. * @date 13/1/18
  7351. * @since 5.6.5
  7352. *
  7353. * @param type $var Description. Default.
  7354. * @return type Description.
  7355. */
  7356. var Select2_3 = Select2.extend({
  7357. initialize: function () {
  7358. // vars
  7359. var $select = this.$el;
  7360. var value = this.getValue();
  7361. var multiple = this.get('multiple');
  7362. var options = {
  7363. width: '100%',
  7364. allowClear: this.get('allowNull'),
  7365. placeholder: this.get('placeholder'),
  7366. separator: '||',
  7367. multiple: this.get('multiple'),
  7368. data: this.getChoices(),
  7369. escapeMarkup: function (string) {
  7370. return acf.escHtml(string);
  7371. },
  7372. dropdownCss: {
  7373. 'z-index': '999999999'
  7374. },
  7375. initSelection: function (element, callback) {
  7376. if (multiple) {
  7377. callback(value);
  7378. } else {
  7379. callback(value.shift());
  7380. }
  7381. }
  7382. };
  7383. // get hidden input
  7384. var $input = $select.siblings('input');
  7385. if (!$input.length) {
  7386. $input = $('<input type="hidden" />');
  7387. $select.before($input);
  7388. }
  7389. // set input value
  7390. inputValue = value.map(function (item) {
  7391. return item.id;
  7392. }).join('||');
  7393. $input.val(inputValue);
  7394. // multiple
  7395. if (options.multiple) {
  7396. // reorder options
  7397. value.map(function (item) {
  7398. item.$el.detach().appendTo($select);
  7399. });
  7400. }
  7401. // remove blank option as we have a clear all button
  7402. if (options.allowClear) {
  7403. options.data = options.data.filter(function (item) {
  7404. return item.id !== '';
  7405. });
  7406. }
  7407. // remove conflicting atts
  7408. $select.removeData('ajax');
  7409. $select.removeAttr('data-ajax');
  7410. // ajax
  7411. if (this.get('ajax')) {
  7412. options.ajax = {
  7413. url: acf.get('ajaxurl'),
  7414. quietMillis: 250,
  7415. dataType: 'json',
  7416. type: 'post',
  7417. cache: false,
  7418. data: $.proxy(this.getAjaxData, this),
  7419. results: $.proxy(this.processAjaxResults, this)
  7420. };
  7421. }
  7422. // filter for 3rd party customization
  7423. var field = this.get('field');
  7424. options = acf.applyFilters('select2_args', options, $select, this.data, field || false, this);
  7425. // add select2
  7426. $input.select2(options);
  7427. // get container
  7428. var $container = $input.select2('container');
  7429. // helper to find this select's option
  7430. var getOption = $.proxy(this.getOption, this);
  7431. // multiple
  7432. if (options.multiple) {
  7433. // vars
  7434. var $ul = $container.find('ul');
  7435. // sortable
  7436. $ul.sortable({
  7437. stop: function () {
  7438. // loop
  7439. $ul.find('.select2-search-choice').each(function () {
  7440. // vars
  7441. var data = $(this).data('select2Data');
  7442. var $option = getOption(data.id);
  7443. // detach and re-append to end
  7444. $option.detach().appendTo($select);
  7445. });
  7446. // trigger change on input (JS error if trigger on select)
  7447. $select.trigger('change');
  7448. }
  7449. });
  7450. }
  7451. // on select, create option and move to end
  7452. $input.on('select2-selecting', function (e) {
  7453. // vars
  7454. var item = e.choice;
  7455. var $option = getOption(item.id);
  7456. // create if doesn't exist
  7457. if (!$option.length) {
  7458. $option = $('<option value="' + item.id + '">' + item.text + '</option>');
  7459. }
  7460. // detach and re-append to end
  7461. $option.detach().appendTo($select);
  7462. });
  7463. // add class
  7464. $container.addClass('-acf');
  7465. // action for 3rd party customization
  7466. acf.doAction('select2_init', $select, options, this.data, field || false, this);
  7467. // change
  7468. $input.on('change', function () {
  7469. var val = $input.val();
  7470. if (val.indexOf('||')) {
  7471. val = val.split('||');
  7472. }
  7473. $select.val(val).trigger('change');
  7474. });
  7475. // hide select
  7476. $select.hide();
  7477. },
  7478. mergeOptions: function () {
  7479. // vars
  7480. var $prevOptions = false;
  7481. var $prevGroup = false;
  7482. // loop
  7483. $('#select2-drop .select2-result-with-children').each(function () {
  7484. // vars
  7485. var $options = $(this).children('ul');
  7486. var $group = $(this).children('.select2-result-label');
  7487. // compare to previous
  7488. if ($prevGroup && $prevGroup.text() === $group.text()) {
  7489. $prevGroup.append($options.children());
  7490. $(this).remove();
  7491. return;
  7492. }
  7493. // update vars
  7494. $prevOptions = $options;
  7495. $prevGroup = $group;
  7496. });
  7497. },
  7498. getAjaxData: function (term, page) {
  7499. // create Select2 v4 params
  7500. var params = {
  7501. term: term,
  7502. page: page
  7503. };
  7504. // filter
  7505. var field = this.get('field');
  7506. params = acf.applyFilters('select2_ajax_data', params, this.data, this.$el, field || false, this);
  7507. // return
  7508. return Select2.prototype.getAjaxData.apply(this, [params]);
  7509. }
  7510. });
  7511. // manager
  7512. var select2Manager = new acf.Model({
  7513. priority: 5,
  7514. wait: 'prepare',
  7515. actions: {
  7516. duplicate: 'onDuplicate'
  7517. },
  7518. initialize: function () {
  7519. // vars
  7520. var locale = acf.get('locale');
  7521. var rtl = acf.get('rtl');
  7522. var l10n = acf.get('select2L10n');
  7523. var version = getVersion();
  7524. // bail early if no l10n
  7525. if (!l10n) {
  7526. return false;
  7527. }
  7528. // bail early if 'en'
  7529. if (locale.indexOf('en') === 0) {
  7530. return false;
  7531. }
  7532. // initialize
  7533. if (version == 4) {
  7534. this.addTranslations4();
  7535. } else if (version == 3) {
  7536. this.addTranslations3();
  7537. }
  7538. },
  7539. addTranslations4: function () {
  7540. // vars
  7541. var l10n = acf.get('select2L10n');
  7542. var locale = acf.get('locale');
  7543. // modify local to match html[lang] attribute (used by Select2)
  7544. locale = locale.replace('_', '-');
  7545. // select2L10n
  7546. var select2L10n = {
  7547. errorLoading: function () {
  7548. return l10n.load_fail;
  7549. },
  7550. inputTooLong: function (args) {
  7551. var overChars = args.input.length - args.maximum;
  7552. if (overChars > 1) {
  7553. return l10n.input_too_long_n.replace('%d', overChars);
  7554. }
  7555. return l10n.input_too_long_1;
  7556. },
  7557. inputTooShort: function (args) {
  7558. var remainingChars = args.minimum - args.input.length;
  7559. if (remainingChars > 1) {
  7560. return l10n.input_too_short_n.replace('%d', remainingChars);
  7561. }
  7562. return l10n.input_too_short_1;
  7563. },
  7564. loadingMore: function () {
  7565. return l10n.load_more;
  7566. },
  7567. maximumSelected: function (args) {
  7568. var maximum = args.maximum;
  7569. if (maximum > 1) {
  7570. return l10n.selection_too_long_n.replace('%d', maximum);
  7571. }
  7572. return l10n.selection_too_long_1;
  7573. },
  7574. noResults: function () {
  7575. return l10n.matches_0;
  7576. },
  7577. searching: function () {
  7578. return l10n.searching;
  7579. }
  7580. };
  7581. // append
  7582. jQuery.fn.select2.amd.define('select2/i18n/' + locale, [], function () {
  7583. return select2L10n;
  7584. });
  7585. },
  7586. addTranslations3: function () {
  7587. // vars
  7588. var l10n = acf.get('select2L10n');
  7589. var locale = acf.get('locale');
  7590. // modify local to match html[lang] attribute (used by Select2)
  7591. locale = locale.replace('_', '-');
  7592. // select2L10n
  7593. var select2L10n = {
  7594. formatMatches: function (matches) {
  7595. if (matches > 1) {
  7596. return l10n.matches_n.replace('%d', matches);
  7597. }
  7598. return l10n.matches_1;
  7599. },
  7600. formatNoMatches: function () {
  7601. return l10n.matches_0;
  7602. },
  7603. formatAjaxError: function () {
  7604. return l10n.load_fail;
  7605. },
  7606. formatInputTooShort: function (input, min) {
  7607. var remainingChars = min - input.length;
  7608. if (remainingChars > 1) {
  7609. return l10n.input_too_short_n.replace('%d', remainingChars);
  7610. }
  7611. return l10n.input_too_short_1;
  7612. },
  7613. formatInputTooLong: function (input, max) {
  7614. var overChars = input.length - max;
  7615. if (overChars > 1) {
  7616. return l10n.input_too_long_n.replace('%d', overChars);
  7617. }
  7618. return l10n.input_too_long_1;
  7619. },
  7620. formatSelectionTooBig: function (maximum) {
  7621. if (maximum > 1) {
  7622. return l10n.selection_too_long_n.replace('%d', maximum);
  7623. }
  7624. return l10n.selection_too_long_1;
  7625. },
  7626. formatLoadMore: function () {
  7627. return l10n.load_more;
  7628. },
  7629. formatSearching: function () {
  7630. return l10n.searching;
  7631. }
  7632. };
  7633. // ensure locales exists
  7634. $.fn.select2.locales = $.fn.select2.locales || {};
  7635. // append
  7636. $.fn.select2.locales[locale] = select2L10n;
  7637. $.extend($.fn.select2.defaults, select2L10n);
  7638. },
  7639. onDuplicate: function ($el, $el2) {
  7640. $el2.find('.select2-container').remove();
  7641. }
  7642. });
  7643. })(jQuery);
  7644. /***/ }),
  7645. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-tinymce.js":
  7646. /*!**********************************************************************!*\
  7647. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-tinymce.js ***!
  7648. \**********************************************************************/
  7649. /***/ (function() {
  7650. (function ($, undefined) {
  7651. acf.tinymce = {
  7652. /*
  7653. * defaults
  7654. *
  7655. * This function will return default mce and qt settings
  7656. *
  7657. * @type function
  7658. * @date 18/8/17
  7659. * @since 5.6.0
  7660. *
  7661. * @param $post_id (int)
  7662. * @return $post_id (int)
  7663. */
  7664. defaults: function () {
  7665. // bail early if no tinyMCEPreInit
  7666. if (typeof tinyMCEPreInit === 'undefined') return false;
  7667. // vars
  7668. var defaults = {
  7669. tinymce: tinyMCEPreInit.mceInit.acf_content,
  7670. quicktags: tinyMCEPreInit.qtInit.acf_content
  7671. };
  7672. // return
  7673. return defaults;
  7674. },
  7675. /*
  7676. * initialize
  7677. *
  7678. * This function will initialize the tinymce and quicktags instances
  7679. *
  7680. * @type function
  7681. * @date 18/8/17
  7682. * @since 5.6.0
  7683. *
  7684. * @param $post_id (int)
  7685. * @return $post_id (int)
  7686. */
  7687. initialize: function (id, args) {
  7688. // defaults
  7689. args = acf.parseArgs(args, {
  7690. tinymce: true,
  7691. quicktags: true,
  7692. toolbar: 'full',
  7693. mode: 'visual',
  7694. // visual,text
  7695. field: false
  7696. });
  7697. // tinymce
  7698. if (args.tinymce) {
  7699. this.initializeTinymce(id, args);
  7700. }
  7701. // quicktags
  7702. if (args.quicktags) {
  7703. this.initializeQuicktags(id, args);
  7704. }
  7705. },
  7706. /*
  7707. * initializeTinymce
  7708. *
  7709. * This function will initialize the tinymce instance
  7710. *
  7711. * @type function
  7712. * @date 18/8/17
  7713. * @since 5.6.0
  7714. *
  7715. * @param $post_id (int)
  7716. * @return $post_id (int)
  7717. */
  7718. initializeTinymce: function (id, args) {
  7719. // vars
  7720. var $textarea = $('#' + id);
  7721. var defaults = this.defaults();
  7722. var toolbars = acf.get('toolbars');
  7723. var field = args.field || false;
  7724. var $field = field.$el || false;
  7725. // bail early
  7726. if (typeof tinymce === 'undefined') return false;
  7727. if (!defaults) return false;
  7728. // check if exists
  7729. if (tinymce.get(id)) {
  7730. return this.enable(id);
  7731. }
  7732. // settings
  7733. var init = $.extend({}, defaults.tinymce, args.tinymce);
  7734. init.id = id;
  7735. init.selector = '#' + id;
  7736. // toolbar
  7737. var toolbar = args.toolbar;
  7738. if (toolbar && toolbars && toolbars[toolbar]) {
  7739. for (var i = 1; i <= 4; i++) {
  7740. init['toolbar' + i] = toolbars[toolbar][i] || '';
  7741. }
  7742. }
  7743. // event
  7744. init.setup = function (ed) {
  7745. ed.on('change', function (e) {
  7746. ed.save(); // save to textarea
  7747. $textarea.trigger('change');
  7748. });
  7749. // Fix bug where Gutenberg does not hear "mouseup" event and tries to select multiple blocks.
  7750. ed.on('mouseup', function (e) {
  7751. var event = new MouseEvent('mouseup');
  7752. window.dispatchEvent(event);
  7753. });
  7754. // Temporarily comment out. May not be necessary due to wysiwyg field actions.
  7755. //ed.on('unload', function(e) {
  7756. // acf.tinymce.remove( id );
  7757. //});
  7758. };
  7759. // disable wp_autoresize_on (no solution yet for fixed toolbar)
  7760. init.wp_autoresize_on = false;
  7761. // Enable wpautop allowing value to save without <p> tags.
  7762. // Only if the "TinyMCE Advanced" plugin hasn't already set this functionality.
  7763. if (!init.tadv_noautop) {
  7764. init.wpautop = true;
  7765. }
  7766. // hook for 3rd party customization
  7767. init = acf.applyFilters('wysiwyg_tinymce_settings', init, id, field);
  7768. // z-index fix (caused too many conflicts)
  7769. //if( acf.isset(tinymce,'ui','FloatPanel') ) {
  7770. // tinymce.ui.FloatPanel.zIndex = 900000;
  7771. //}
  7772. // store settings
  7773. tinyMCEPreInit.mceInit[id] = init;
  7774. // visual tab is active
  7775. if (args.mode == 'visual') {
  7776. // init
  7777. var result = tinymce.init(init);
  7778. // get editor
  7779. var ed = tinymce.get(id);
  7780. // validate
  7781. if (!ed) {
  7782. return false;
  7783. }
  7784. // add reference
  7785. ed.acf = args.field;
  7786. // action
  7787. acf.doAction('wysiwyg_tinymce_init', ed, ed.id, init, field);
  7788. }
  7789. },
  7790. /*
  7791. * initializeQuicktags
  7792. *
  7793. * This function will initialize the quicktags instance
  7794. *
  7795. * @type function
  7796. * @date 18/8/17
  7797. * @since 5.6.0
  7798. *
  7799. * @param $post_id (int)
  7800. * @return $post_id (int)
  7801. */
  7802. initializeQuicktags: function (id, args) {
  7803. // vars
  7804. var defaults = this.defaults();
  7805. // bail early
  7806. if (typeof quicktags === 'undefined') return false;
  7807. if (!defaults) return false;
  7808. // settings
  7809. var init = $.extend({}, defaults.quicktags, args.quicktags);
  7810. init.id = id;
  7811. // filter
  7812. var field = args.field || false;
  7813. var $field = field.$el || false;
  7814. init = acf.applyFilters('wysiwyg_quicktags_settings', init, init.id, field);
  7815. // store settings
  7816. tinyMCEPreInit.qtInit[id] = init;
  7817. // init
  7818. var ed = quicktags(init);
  7819. // validate
  7820. if (!ed) {
  7821. return false;
  7822. }
  7823. // generate HTML
  7824. this.buildQuicktags(ed);
  7825. // action for 3rd party customization
  7826. acf.doAction('wysiwyg_quicktags_init', ed, ed.id, init, field);
  7827. },
  7828. /*
  7829. * buildQuicktags
  7830. *
  7831. * This function will build the quicktags HTML
  7832. *
  7833. * @type function
  7834. * @date 18/8/17
  7835. * @since 5.6.0
  7836. *
  7837. * @param $post_id (int)
  7838. * @return $post_id (int)
  7839. */
  7840. buildQuicktags: function (ed) {
  7841. var canvas,
  7842. name,
  7843. settings,
  7844. theButtons,
  7845. html,
  7846. ed,
  7847. id,
  7848. i,
  7849. use,
  7850. instanceId,
  7851. defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
  7852. canvas = ed.canvas;
  7853. name = ed.name;
  7854. settings = ed.settings;
  7855. html = '';
  7856. theButtons = {};
  7857. use = '';
  7858. instanceId = ed.id;
  7859. // set buttons
  7860. if (settings.buttons) {
  7861. use = ',' + settings.buttons + ',';
  7862. }
  7863. for (i in edButtons) {
  7864. if (!edButtons[i]) {
  7865. continue;
  7866. }
  7867. id = edButtons[i].id;
  7868. if (use && defaults.indexOf(',' + id + ',') !== -1 && use.indexOf(',' + id + ',') === -1) {
  7869. continue;
  7870. }
  7871. if (!edButtons[i].instance || edButtons[i].instance === instanceId) {
  7872. theButtons[id] = edButtons[i];
  7873. if (edButtons[i].html) {
  7874. html += edButtons[i].html(name + '_');
  7875. }
  7876. }
  7877. }
  7878. if (use && use.indexOf(',dfw,') !== -1) {
  7879. theButtons.dfw = new QTags.DFWButton();
  7880. html += theButtons.dfw.html(name + '_');
  7881. }
  7882. if ('rtl' === document.getElementsByTagName('html')[0].dir) {
  7883. theButtons.textdirection = new QTags.TextDirectionButton();
  7884. html += theButtons.textdirection.html(name + '_');
  7885. }
  7886. ed.toolbar.innerHTML = html;
  7887. ed.theButtons = theButtons;
  7888. if (typeof jQuery !== 'undefined') {
  7889. jQuery(document).triggerHandler('quicktags-init', [ed]);
  7890. }
  7891. },
  7892. disable: function (id) {
  7893. this.destroyTinymce(id);
  7894. },
  7895. remove: function (id) {
  7896. this.destroyTinymce(id);
  7897. },
  7898. destroy: function (id) {
  7899. this.destroyTinymce(id);
  7900. },
  7901. destroyTinymce: function (id) {
  7902. // bail early
  7903. if (typeof tinymce === 'undefined') return false;
  7904. // get editor
  7905. var ed = tinymce.get(id);
  7906. // bail early if no editor
  7907. if (!ed) return false;
  7908. // save
  7909. ed.save();
  7910. // destroy editor
  7911. ed.destroy();
  7912. // return
  7913. return true;
  7914. },
  7915. enable: function (id) {
  7916. this.enableTinymce(id);
  7917. },
  7918. enableTinymce: function (id) {
  7919. // bail early
  7920. if (typeof switchEditors === 'undefined') return false;
  7921. // bail early if not initialized
  7922. if (typeof tinyMCEPreInit.mceInit[id] === 'undefined') return false;
  7923. // Ensure textarea element is visible
  7924. // - Fixes bug in block editor when switching between "Block" and "Document" tabs.
  7925. $('#' + id).show();
  7926. // toggle
  7927. switchEditors.go(id, 'tmce');
  7928. // return
  7929. return true;
  7930. }
  7931. };
  7932. var editorManager = new acf.Model({
  7933. // hook in before fieldsEventManager, conditions, etc
  7934. priority: 5,
  7935. actions: {
  7936. prepare: 'onPrepare',
  7937. ready: 'onReady'
  7938. },
  7939. onPrepare: function () {
  7940. // find hidden editor which may exist within a field
  7941. var $div = $('#acf-hidden-wp-editor');
  7942. // move to footer
  7943. if ($div.exists()) {
  7944. $div.appendTo('body');
  7945. }
  7946. },
  7947. onReady: function () {
  7948. // Restore wp.editor functions used by tinymce removed in WP5.
  7949. if (acf.isset(window, 'wp', 'oldEditor')) {
  7950. wp.editor.autop = wp.oldEditor.autop;
  7951. wp.editor.removep = wp.oldEditor.removep;
  7952. }
  7953. // bail early if no tinymce
  7954. if (!acf.isset(window, 'tinymce', 'on')) return;
  7955. // restore default activeEditor
  7956. tinymce.on('AddEditor', function (data) {
  7957. // vars
  7958. var editor = data.editor;
  7959. // bail early if not 'acf'
  7960. if (editor.id.substr(0, 3) !== 'acf') return;
  7961. // override if 'content' exists
  7962. editor = tinymce.editors.content || editor;
  7963. // update vars
  7964. tinymce.activeEditor = editor;
  7965. wpActiveEditor = editor.id;
  7966. });
  7967. }
  7968. });
  7969. })(jQuery);
  7970. /***/ }),
  7971. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-unload.js":
  7972. /*!*********************************************************************!*\
  7973. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-unload.js ***!
  7974. \*********************************************************************/
  7975. /***/ (function() {
  7976. (function ($, undefined) {
  7977. acf.unload = new acf.Model({
  7978. wait: 'load',
  7979. active: true,
  7980. changed: false,
  7981. actions: {
  7982. validation_failure: 'startListening',
  7983. validation_success: 'stopListening'
  7984. },
  7985. events: {
  7986. 'change form .acf-field': 'startListening',
  7987. 'submit form': 'stopListening'
  7988. },
  7989. enable: function () {
  7990. this.active = true;
  7991. },
  7992. disable: function () {
  7993. this.active = false;
  7994. },
  7995. reset: function () {
  7996. this.stopListening();
  7997. },
  7998. startListening: function () {
  7999. // bail early if already changed, not active
  8000. if (this.changed || !this.active) {
  8001. return;
  8002. }
  8003. // update
  8004. this.changed = true;
  8005. // add event
  8006. $(window).on('beforeunload', this.onUnload);
  8007. },
  8008. stopListening: function () {
  8009. // update
  8010. this.changed = false;
  8011. // remove event
  8012. $(window).off('beforeunload', this.onUnload);
  8013. },
  8014. onUnload: function () {
  8015. return acf.__('The changes you made will be lost if you navigate away from this page');
  8016. }
  8017. });
  8018. })(jQuery);
  8019. /***/ }),
  8020. /***/ "./src/advanced-custom-fields-pro/assets/src/js/_acf-validation.js":
  8021. /*!*************************************************************************!*\
  8022. !*** ./src/advanced-custom-fields-pro/assets/src/js/_acf-validation.js ***!
  8023. \*************************************************************************/
  8024. /***/ (function() {
  8025. (function ($, undefined) {
  8026. /**
  8027. * Validator
  8028. *
  8029. * The model for validating forms
  8030. *
  8031. * @date 4/9/18
  8032. * @since 5.7.5
  8033. *
  8034. * @param void
  8035. * @return void
  8036. */
  8037. var Validator = acf.Model.extend({
  8038. /** @var string The model identifier. */
  8039. id: 'Validator',
  8040. /** @var object The model data. */
  8041. data: {
  8042. /** @var array The form errors. */
  8043. errors: [],
  8044. /** @var object The form notice. */
  8045. notice: null,
  8046. /** @var string The form status. loading, invalid, valid */
  8047. status: ''
  8048. },
  8049. /** @var object The model events. */
  8050. events: {
  8051. 'changed:status': 'onChangeStatus'
  8052. },
  8053. /**
  8054. * addErrors
  8055. *
  8056. * Adds errors to the form.
  8057. *
  8058. * @date 4/9/18
  8059. * @since 5.7.5
  8060. *
  8061. * @param array errors An array of errors.
  8062. * @return void
  8063. */
  8064. addErrors: function (errors) {
  8065. errors.map(this.addError, this);
  8066. },
  8067. /**
  8068. * addError
  8069. *
  8070. * Adds and error to the form.
  8071. *
  8072. * @date 4/9/18
  8073. * @since 5.7.5
  8074. *
  8075. * @param object error An error object containing input and message.
  8076. * @return void
  8077. */
  8078. addError: function (error) {
  8079. this.data.errors.push(error);
  8080. },
  8081. /**
  8082. * hasErrors
  8083. *
  8084. * Returns true if the form has errors.
  8085. *
  8086. * @date 4/9/18
  8087. * @since 5.7.5
  8088. *
  8089. * @param void
  8090. * @return bool
  8091. */
  8092. hasErrors: function () {
  8093. return this.data.errors.length;
  8094. },
  8095. /**
  8096. * clearErrors
  8097. *
  8098. * Removes any errors.
  8099. *
  8100. * @date 4/9/18
  8101. * @since 5.7.5
  8102. *
  8103. * @param void
  8104. * @return void
  8105. */
  8106. clearErrors: function () {
  8107. return this.data.errors = [];
  8108. },
  8109. /**
  8110. * getErrors
  8111. *
  8112. * Returns the forms errors.
  8113. *
  8114. * @date 4/9/18
  8115. * @since 5.7.5
  8116. *
  8117. * @param void
  8118. * @return array
  8119. */
  8120. getErrors: function () {
  8121. return this.data.errors;
  8122. },
  8123. /**
  8124. * getFieldErrors
  8125. *
  8126. * Returns the forms field errors.
  8127. *
  8128. * @date 4/9/18
  8129. * @since 5.7.5
  8130. *
  8131. * @param void
  8132. * @return array
  8133. */
  8134. getFieldErrors: function () {
  8135. // vars
  8136. var errors = [];
  8137. var inputs = [];
  8138. // loop
  8139. this.getErrors().map(function (error) {
  8140. // bail early if global
  8141. if (!error.input) return;
  8142. // update if exists
  8143. var i = inputs.indexOf(error.input);
  8144. if (i > -1) {
  8145. errors[i] = error;
  8146. // update
  8147. } else {
  8148. errors.push(error);
  8149. inputs.push(error.input);
  8150. }
  8151. });
  8152. // return
  8153. return errors;
  8154. },
  8155. /**
  8156. * getGlobalErrors
  8157. *
  8158. * Returns the forms global errors (errors without a specific input).
  8159. *
  8160. * @date 4/9/18
  8161. * @since 5.7.5
  8162. *
  8163. * @param void
  8164. * @return array
  8165. */
  8166. getGlobalErrors: function () {
  8167. // return array of errors that contain no input
  8168. return this.getErrors().filter(function (error) {
  8169. return !error.input;
  8170. });
  8171. },
  8172. /**
  8173. * showErrors
  8174. *
  8175. * Displays all errors for this form.
  8176. *
  8177. * @date 4/9/18
  8178. * @since 5.7.5
  8179. *
  8180. * @param void
  8181. * @return void
  8182. */
  8183. showErrors: function () {
  8184. // bail early if no errors
  8185. if (!this.hasErrors()) {
  8186. return;
  8187. }
  8188. // vars
  8189. var fieldErrors = this.getFieldErrors();
  8190. var globalErrors = this.getGlobalErrors();
  8191. // vars
  8192. var errorCount = 0;
  8193. var $scrollTo = false;
  8194. // loop
  8195. fieldErrors.map(function (error) {
  8196. // get input
  8197. var $input = this.$('[name="' + error.input + '"]').first();
  8198. // if $_POST value was an array, this $input may not exist
  8199. if (!$input.length) {
  8200. $input = this.$('[name^="' + error.input + '"]').first();
  8201. }
  8202. // bail early if input doesn't exist
  8203. if (!$input.length) {
  8204. return;
  8205. }
  8206. // increase
  8207. errorCount++;
  8208. // get field
  8209. var field = acf.getClosestField($input);
  8210. // make sure the postbox containing this field is not hidden by screen options
  8211. ensureFieldPostBoxIsVisible(field.$el);
  8212. // show error
  8213. field.showError(error.message);
  8214. // set $scrollTo
  8215. if (!$scrollTo) {
  8216. $scrollTo = field.$el;
  8217. }
  8218. }, this);
  8219. // errorMessage
  8220. var errorMessage = acf.__('Validation failed');
  8221. globalErrors.map(function (error) {
  8222. errorMessage += '. ' + error.message;
  8223. });
  8224. if (errorCount == 1) {
  8225. errorMessage += '. ' + acf.__('1 field requires attention');
  8226. } else if (errorCount > 1) {
  8227. errorMessage += '. ' + acf.__('%d fields require attention').replace('%d', errorCount);
  8228. }
  8229. // notice
  8230. if (this.has('notice')) {
  8231. this.get('notice').update({
  8232. type: 'error',
  8233. text: errorMessage
  8234. });
  8235. } else {
  8236. var notice = acf.newNotice({
  8237. type: 'error',
  8238. text: errorMessage,
  8239. target: this.$el
  8240. });
  8241. this.set('notice', notice);
  8242. }
  8243. // if no $scrollTo, set to message
  8244. if (!$scrollTo) {
  8245. $scrollTo = this.get('notice').$el;
  8246. }
  8247. // timeout
  8248. setTimeout(function () {
  8249. $('html, body').animate({
  8250. scrollTop: $scrollTo.offset().top - $(window).height() / 2
  8251. }, 500);
  8252. }, 10);
  8253. },
  8254. /**
  8255. * onChangeStatus
  8256. *
  8257. * Update the form class when changing the 'status' data
  8258. *
  8259. * @date 4/9/18
  8260. * @since 5.7.5
  8261. *
  8262. * @param object e The event object.
  8263. * @param jQuery $el The form element.
  8264. * @param string value The new status.
  8265. * @param string prevValue The old status.
  8266. * @return void
  8267. */
  8268. onChangeStatus: function (e, $el, value, prevValue) {
  8269. this.$el.removeClass('is-' + prevValue).addClass('is-' + value);
  8270. },
  8271. /**
  8272. * validate
  8273. *
  8274. * Vaildates the form via AJAX.
  8275. *
  8276. * @date 4/9/18
  8277. * @since 5.7.5
  8278. *
  8279. * @param object args A list of settings to customize the validation process.
  8280. * @return bool True if the form is valid.
  8281. */
  8282. validate: function (args) {
  8283. // default args
  8284. args = acf.parseArgs(args, {
  8285. // trigger event
  8286. event: false,
  8287. // reset the form after submit
  8288. reset: false,
  8289. // loading callback
  8290. loading: function () {},
  8291. // complete callback
  8292. complete: function () {},
  8293. // failure callback
  8294. failure: function () {},
  8295. // success callback
  8296. success: function ($form) {
  8297. $form.submit();
  8298. }
  8299. });
  8300. // return true if is valid - allows form submit
  8301. if (this.get('status') == 'valid') {
  8302. return true;
  8303. }
  8304. // return false if is currently validating - prevents form submit
  8305. if (this.get('status') == 'validating') {
  8306. return false;
  8307. }
  8308. // return true if no ACF fields exist (no need to validate)
  8309. if (!this.$('.acf-field').length) {
  8310. return true;
  8311. }
  8312. // if event is provided, create a new success callback.
  8313. if (args.event) {
  8314. var event = $.Event(null, args.event);
  8315. args.success = function () {
  8316. acf.enableSubmit($(event.target)).trigger(event);
  8317. };
  8318. }
  8319. // action for 3rd party
  8320. acf.doAction('validation_begin', this.$el);
  8321. // lock form
  8322. acf.lockForm(this.$el);
  8323. // loading callback
  8324. args.loading(this.$el, this);
  8325. // update status
  8326. this.set('status', 'validating');
  8327. // success callback
  8328. var onSuccess = function (json) {
  8329. // validate
  8330. if (!acf.isAjaxSuccess(json)) {
  8331. return;
  8332. }
  8333. // filter
  8334. var data = acf.applyFilters('validation_complete', json.data, this.$el, this);
  8335. // add errors
  8336. if (!data.valid) {
  8337. this.addErrors(data.errors);
  8338. }
  8339. };
  8340. // complete
  8341. var onComplete = function () {
  8342. // unlock form
  8343. acf.unlockForm(this.$el);
  8344. // failure
  8345. if (this.hasErrors()) {
  8346. // update status
  8347. this.set('status', 'invalid');
  8348. // action
  8349. acf.doAction('validation_failure', this.$el, this);
  8350. // display errors
  8351. this.showErrors();
  8352. // failure callback
  8353. args.failure(this.$el, this);
  8354. // success
  8355. } else {
  8356. // update status
  8357. this.set('status', 'valid');
  8358. // remove previous error message
  8359. if (this.has('notice')) {
  8360. this.get('notice').update({
  8361. type: 'success',
  8362. text: acf.__('Validation successful'),
  8363. timeout: 1000
  8364. });
  8365. }
  8366. // action
  8367. acf.doAction('validation_success', this.$el, this);
  8368. acf.doAction('submit', this.$el);
  8369. // success callback (submit form)
  8370. args.success(this.$el, this);
  8371. // lock form
  8372. acf.lockForm(this.$el);
  8373. // reset
  8374. if (args.reset) {
  8375. this.reset();
  8376. }
  8377. }
  8378. // complete callback
  8379. args.complete(this.$el, this);
  8380. // clear errors
  8381. this.clearErrors();
  8382. };
  8383. // serialize form data
  8384. var data = acf.serialize(this.$el);
  8385. data.action = 'acf/validate_save_post';
  8386. // ajax
  8387. $.ajax({
  8388. url: acf.get('ajaxurl'),
  8389. data: acf.prepareForAjax(data),
  8390. type: 'post',
  8391. dataType: 'json',
  8392. context: this,
  8393. success: onSuccess,
  8394. complete: onComplete
  8395. });
  8396. // return false to fail validation and allow AJAX
  8397. return false;
  8398. },
  8399. /**
  8400. * setup
  8401. *
  8402. * Called during the constructor function to setup this instance
  8403. *
  8404. * @date 4/9/18
  8405. * @since 5.7.5
  8406. *
  8407. * @param jQuery $form The form element.
  8408. * @return void
  8409. */
  8410. setup: function ($form) {
  8411. // set $el
  8412. this.$el = $form;
  8413. },
  8414. /**
  8415. * reset
  8416. *
  8417. * Rests the validation to be used again.
  8418. *
  8419. * @date 6/9/18
  8420. * @since 5.7.5
  8421. *
  8422. * @param void
  8423. * @return void
  8424. */
  8425. reset: function () {
  8426. // reset data
  8427. this.set('errors', []);
  8428. this.set('notice', null);
  8429. this.set('status', '');
  8430. // unlock form
  8431. acf.unlockForm(this.$el);
  8432. }
  8433. });
  8434. /**
  8435. * getValidator
  8436. *
  8437. * Returns the instance for a given form element.
  8438. *
  8439. * @date 4/9/18
  8440. * @since 5.7.5
  8441. *
  8442. * @param jQuery $el The form element.
  8443. * @return object
  8444. */
  8445. var getValidator = function ($el) {
  8446. // instantiate
  8447. var validator = $el.data('acf');
  8448. if (!validator) {
  8449. validator = new Validator($el);
  8450. }
  8451. // return
  8452. return validator;
  8453. };
  8454. /**
  8455. * acf.validateForm
  8456. *
  8457. * A helper function for the Validator.validate() function.
  8458. * Returns true if form is valid, or fetches a validation request and returns false.
  8459. *
  8460. * @date 4/4/18
  8461. * @since 5.6.9
  8462. *
  8463. * @param object args A list of settings to customize the validation process.
  8464. * @return bool
  8465. */
  8466. acf.validateForm = function (args) {
  8467. return getValidator(args.form).validate(args);
  8468. };
  8469. /**
  8470. * acf.enableSubmit
  8471. *
  8472. * Enables a submit button and returns the element.
  8473. *
  8474. * @date 30/8/18
  8475. * @since 5.7.4
  8476. *
  8477. * @param jQuery $submit The submit button.
  8478. * @return jQuery
  8479. */
  8480. acf.enableSubmit = function ($submit) {
  8481. return $submit.removeClass('disabled').removeAttr('disabled');
  8482. };
  8483. /**
  8484. * acf.disableSubmit
  8485. *
  8486. * Disables a submit button and returns the element.
  8487. *
  8488. * @date 30/8/18
  8489. * @since 5.7.4
  8490. *
  8491. * @param jQuery $submit The submit button.
  8492. * @return jQuery
  8493. */
  8494. acf.disableSubmit = function ($submit) {
  8495. return $submit.addClass('disabled').attr('disabled', true);
  8496. };
  8497. /**
  8498. * acf.showSpinner
  8499. *
  8500. * Shows the spinner element.
  8501. *
  8502. * @date 4/9/18
  8503. * @since 5.7.5
  8504. *
  8505. * @param jQuery $spinner The spinner element.
  8506. * @return jQuery
  8507. */
  8508. acf.showSpinner = function ($spinner) {
  8509. $spinner.addClass('is-active'); // add class (WP > 4.2)
  8510. $spinner.css('display', 'inline-block'); // css (WP < 4.2)
  8511. return $spinner;
  8512. };
  8513. /**
  8514. * acf.hideSpinner
  8515. *
  8516. * Hides the spinner element.
  8517. *
  8518. * @date 4/9/18
  8519. * @since 5.7.5
  8520. *
  8521. * @param jQuery $spinner The spinner element.
  8522. * @return jQuery
  8523. */
  8524. acf.hideSpinner = function ($spinner) {
  8525. $spinner.removeClass('is-active'); // add class (WP > 4.2)
  8526. $spinner.css('display', 'none'); // css (WP < 4.2)
  8527. return $spinner;
  8528. };
  8529. /**
  8530. * acf.lockForm
  8531. *
  8532. * Locks a form by disabeling its primary inputs and showing a spinner.
  8533. *
  8534. * @date 4/9/18
  8535. * @since 5.7.5
  8536. *
  8537. * @param jQuery $form The form element.
  8538. * @return jQuery
  8539. */
  8540. acf.lockForm = function ($form) {
  8541. // vars
  8542. var $wrap = findSubmitWrap($form);
  8543. var $submit = $wrap.find('.button, [type="submit"]').not('.acf-nav, .acf-repeater-add-row');
  8544. var $spinner = $wrap.find('.spinner, .acf-spinner');
  8545. // hide all spinners (hides the preview spinner)
  8546. acf.hideSpinner($spinner);
  8547. // lock
  8548. acf.disableSubmit($submit);
  8549. acf.showSpinner($spinner.last());
  8550. return $form;
  8551. };
  8552. /**
  8553. * acf.unlockForm
  8554. *
  8555. * Unlocks a form by enabeling its primary inputs and hiding all spinners.
  8556. *
  8557. * @date 4/9/18
  8558. * @since 5.7.5
  8559. *
  8560. * @param jQuery $form The form element.
  8561. * @return jQuery
  8562. */
  8563. acf.unlockForm = function ($form) {
  8564. // vars
  8565. var $wrap = findSubmitWrap($form);
  8566. var $submit = $wrap.find('.button, [type="submit"]').not('.acf-nav, .acf-repeater-add-row');
  8567. var $spinner = $wrap.find('.spinner, .acf-spinner');
  8568. // unlock
  8569. acf.enableSubmit($submit);
  8570. acf.hideSpinner($spinner);
  8571. return $form;
  8572. };
  8573. /**
  8574. * findSubmitWrap
  8575. *
  8576. * An internal function to find the 'primary' form submit wrapping element.
  8577. *
  8578. * @date 4/9/18
  8579. * @since 5.7.5
  8580. *
  8581. * @param jQuery $form The form element.
  8582. * @return jQuery
  8583. */
  8584. var findSubmitWrap = function ($form) {
  8585. // default post submit div
  8586. var $wrap = $form.find('#submitdiv');
  8587. if ($wrap.length) {
  8588. return $wrap;
  8589. }
  8590. // 3rd party publish box
  8591. var $wrap = $form.find('#submitpost');
  8592. if ($wrap.length) {
  8593. return $wrap;
  8594. }
  8595. // term, user
  8596. var $wrap = $form.find('p.submit').last();
  8597. if ($wrap.length) {
  8598. return $wrap;
  8599. }
  8600. // front end form
  8601. var $wrap = $form.find('.acf-form-submit');
  8602. if ($wrap.length) {
  8603. return $wrap;
  8604. }
  8605. // default
  8606. return $form;
  8607. };
  8608. /**
  8609. * A debounced function to trigger a form submission.
  8610. *
  8611. * @date 15/07/2020
  8612. * @since 5.9.0
  8613. *
  8614. * @param type Var Description.
  8615. * @return type Description.
  8616. */
  8617. var submitFormDebounced = acf.debounce(function ($form) {
  8618. $form.submit();
  8619. });
  8620. /**
  8621. * Ensure field is visible for validation errors
  8622. *
  8623. * @date 20/10/2021
  8624. * @since 5.11.0
  8625. */
  8626. var ensureFieldPostBoxIsVisible = function ($el) {
  8627. // Find the postbox element containing this field.
  8628. var $postbox = $el.parents('.acf-postbox');
  8629. if ($postbox.length) {
  8630. var acf_postbox = acf.getPostbox($postbox);
  8631. if (acf_postbox && acf_postbox.isHiddenByScreenOptions()) {
  8632. // Rather than using .show() here, we don't want the field to appear next reload.
  8633. // So just temporarily show the field group so validation can complete.
  8634. acf_postbox.$el.removeClass('hide-if-js');
  8635. acf_postbox.$el.css('display', '');
  8636. }
  8637. }
  8638. };
  8639. /**
  8640. * Ensure metaboxes which contain browser validation failures are visible.
  8641. *
  8642. * @date 20/10/2021
  8643. * @since 5.11.0
  8644. */
  8645. var ensureInvalidFieldVisibility = function () {
  8646. // Load each ACF input field and check it's browser validation state.
  8647. var $inputs = $('.acf-field input');
  8648. $inputs.each(function () {
  8649. if (!this.checkValidity()) {
  8650. // Field is invalid, so we need to make sure it's metabox is visible.
  8651. ensureFieldPostBoxIsVisible($(this));
  8652. }
  8653. });
  8654. };
  8655. /**
  8656. * acf.validation
  8657. *
  8658. * Global validation logic
  8659. *
  8660. * @date 4/4/18
  8661. * @since 5.6.9
  8662. *
  8663. * @param void
  8664. * @return void
  8665. */
  8666. acf.validation = new acf.Model({
  8667. /** @var string The model identifier. */
  8668. id: 'validation',
  8669. /** @var bool The active state. Set to false before 'prepare' to prevent validation. */
  8670. active: true,
  8671. /** @var string The model initialize time. */
  8672. wait: 'prepare',
  8673. /** @var object The model actions. */
  8674. actions: {
  8675. ready: 'addInputEvents',
  8676. append: 'addInputEvents'
  8677. },
  8678. /** @var object The model events. */
  8679. events: {
  8680. 'click input[type="submit"]': 'onClickSubmit',
  8681. 'click button[type="submit"]': 'onClickSubmit',
  8682. //'click #editor .editor-post-publish-button': 'onClickSubmitGutenberg',
  8683. 'click #save-post': 'onClickSave',
  8684. 'submit form#post': 'onSubmitPost',
  8685. 'submit form': 'onSubmit'
  8686. },
  8687. /**
  8688. * initialize
  8689. *
  8690. * Called when initializing the model.
  8691. *
  8692. * @date 4/9/18
  8693. * @since 5.7.5
  8694. *
  8695. * @param void
  8696. * @return void
  8697. */
  8698. initialize: function () {
  8699. // check 'validation' setting
  8700. if (!acf.get('validation')) {
  8701. this.active = false;
  8702. this.actions = {};
  8703. this.events = {};
  8704. }
  8705. },
  8706. /**
  8707. * enable
  8708. *
  8709. * Enables validation.
  8710. *
  8711. * @date 4/9/18
  8712. * @since 5.7.5
  8713. *
  8714. * @param void
  8715. * @return void
  8716. */
  8717. enable: function () {
  8718. this.active = true;
  8719. },
  8720. /**
  8721. * disable
  8722. *
  8723. * Disables validation.
  8724. *
  8725. * @date 4/9/18
  8726. * @since 5.7.5
  8727. *
  8728. * @param void
  8729. * @return void
  8730. */
  8731. disable: function () {
  8732. this.active = false;
  8733. },
  8734. /**
  8735. * reset
  8736. *
  8737. * Rests the form validation to be used again
  8738. *
  8739. * @date 6/9/18
  8740. * @since 5.7.5
  8741. *
  8742. * @param jQuery $form The form element.
  8743. * @return void
  8744. */
  8745. reset: function ($form) {
  8746. getValidator($form).reset();
  8747. },
  8748. /**
  8749. * addInputEvents
  8750. *
  8751. * Adds 'invalid' event listeners to HTML inputs.
  8752. *
  8753. * @date 4/9/18
  8754. * @since 5.7.5
  8755. *
  8756. * @param jQuery $el The element being added / readied.
  8757. * @return void
  8758. */
  8759. addInputEvents: function ($el) {
  8760. // Bug exists in Safari where custom "invalid" handling prevents draft from saving.
  8761. if (acf.get('browser') === 'safari') return;
  8762. // vars
  8763. var $inputs = $('.acf-field [name]', $el);
  8764. // check
  8765. if ($inputs.length) {
  8766. this.on($inputs, 'invalid', 'onInvalid');
  8767. }
  8768. },
  8769. /**
  8770. * onInvalid
  8771. *
  8772. * Callback for the 'invalid' event.
  8773. *
  8774. * @date 4/9/18
  8775. * @since 5.7.5
  8776. *
  8777. * @param object e The event object.
  8778. * @param jQuery $el The input element.
  8779. * @return void
  8780. */
  8781. onInvalid: function (e, $el) {
  8782. // prevent default
  8783. // - prevents browser error message
  8784. // - also fixes chrome bug where 'hidden-by-tab' field throws focus error
  8785. e.preventDefault();
  8786. // vars
  8787. var $form = $el.closest('form');
  8788. // check form exists
  8789. if ($form.length) {
  8790. // add error to validator
  8791. getValidator($form).addError({
  8792. input: $el.attr('name'),
  8793. message: acf.strEscape(e.target.validationMessage)
  8794. });
  8795. // trigger submit on $form
  8796. // - allows for "save", "preview" and "publish" to work
  8797. submitFormDebounced($form);
  8798. }
  8799. },
  8800. /**
  8801. * onClickSubmit
  8802. *
  8803. * Callback when clicking submit.
  8804. *
  8805. * @date 4/9/18
  8806. * @since 5.7.5
  8807. *
  8808. * @param object e The event object.
  8809. * @param jQuery $el The input element.
  8810. * @return void
  8811. */
  8812. onClickSubmit: function (e, $el) {
  8813. // Some browsers (safari) force their browser validation before our AJAX validation,
  8814. // so we need to make sure fields are visible earlier than showErrors()
  8815. ensureInvalidFieldVisibility();
  8816. // store the "click event" for later use in this.onSubmit()
  8817. this.set('originalEvent', e);
  8818. },
  8819. /**
  8820. * onClickSave
  8821. *
  8822. * Set ignore to true when saving a draft.
  8823. *
  8824. * @date 4/9/18
  8825. * @since 5.7.5
  8826. *
  8827. * @param object e The event object.
  8828. * @param jQuery $el The input element.
  8829. * @return void
  8830. */
  8831. onClickSave: function (e, $el) {
  8832. this.set('ignore', true);
  8833. },
  8834. /**
  8835. * onClickSubmitGutenberg
  8836. *
  8837. * Custom validation event for the gutenberg editor.
  8838. *
  8839. * @date 29/10/18
  8840. * @since 5.8.0
  8841. *
  8842. * @param object e The event object.
  8843. * @param jQuery $el The input element.
  8844. * @return void
  8845. */
  8846. onClickSubmitGutenberg: function (e, $el) {
  8847. // validate
  8848. var valid = acf.validateForm({
  8849. form: $('#editor'),
  8850. event: e,
  8851. reset: true,
  8852. failure: function ($form, validator) {
  8853. var $notice = validator.get('notice').$el;
  8854. $notice.appendTo('.components-notice-list');
  8855. $notice.find('.acf-notice-dismiss').removeClass('small');
  8856. }
  8857. });
  8858. // if not valid, stop event and allow validation to continue
  8859. if (!valid) {
  8860. e.preventDefault();
  8861. e.stopImmediatePropagation();
  8862. }
  8863. },
  8864. /**
  8865. * onSubmitPost
  8866. *
  8867. * Callback when the 'post' form is submit.
  8868. *
  8869. * @date 5/3/19
  8870. * @since 5.7.13
  8871. *
  8872. * @param object e The event object.
  8873. * @param jQuery $el The input element.
  8874. * @return void
  8875. */
  8876. onSubmitPost: function (e, $el) {
  8877. // Check if is preview.
  8878. if ($('input#wp-preview').val() === 'dopreview') {
  8879. // Ignore validation.
  8880. this.set('ignore', true);
  8881. // Unlock form to fix conflict with core "submit.edit-post" event causing all submit buttons to be disabled.
  8882. acf.unlockForm($el);
  8883. }
  8884. },
  8885. /**
  8886. * onSubmit
  8887. *
  8888. * Callback when the form is submit.
  8889. *
  8890. * @date 4/9/18
  8891. * @since 5.7.5
  8892. *
  8893. * @param object e The event object.
  8894. * @param jQuery $el The input element.
  8895. * @return void
  8896. */
  8897. onSubmit: function (e, $el) {
  8898. // Allow form to submit if...
  8899. if (
  8900. // Validation has been disabled.
  8901. !this.active ||
  8902. // Or this event is to be ignored.
  8903. this.get('ignore') ||
  8904. // Or this event has already been prevented.
  8905. e.isDefaultPrevented()) {
  8906. // Return early and call reset function.
  8907. return this.allowSubmit();
  8908. }
  8909. // Validate form.
  8910. var valid = acf.validateForm({
  8911. form: $el,
  8912. event: this.get('originalEvent')
  8913. });
  8914. // If not valid, stop event to prevent form submit.
  8915. if (!valid) {
  8916. e.preventDefault();
  8917. }
  8918. },
  8919. /**
  8920. * allowSubmit
  8921. *
  8922. * Resets data during onSubmit when the form is allowed to submit.
  8923. *
  8924. * @date 5/3/19
  8925. * @since 5.7.13
  8926. *
  8927. * @param void
  8928. * @return void
  8929. */
  8930. allowSubmit: function () {
  8931. // Reset "ignore" state.
  8932. this.set('ignore', false);
  8933. // Reset "originalEvent" object.
  8934. this.set('originalEvent', false);
  8935. // Return true
  8936. return true;
  8937. }
  8938. });
  8939. var gutenbergValidation = new acf.Model({
  8940. wait: 'prepare',
  8941. initialize: function () {
  8942. // Bail early if not Gutenberg.
  8943. if (!acf.isGutenberg()) {
  8944. return;
  8945. }
  8946. // Custommize the editor.
  8947. this.customizeEditor();
  8948. },
  8949. customizeEditor: function () {
  8950. // Extract vars.
  8951. var editor = wp.data.dispatch('core/editor');
  8952. var editorSelect = wp.data.select('core/editor');
  8953. var notices = wp.data.dispatch('core/notices');
  8954. // Backup original method.
  8955. var savePost = editor.savePost;
  8956. // Listen for changes to post status and perform actions:
  8957. // a) Enable validation for "publish" action.
  8958. // b) Remember last non "publish" status used for restoring after validation fail.
  8959. var useValidation = false;
  8960. var lastPostStatus = '';
  8961. wp.data.subscribe(function () {
  8962. var postStatus = editorSelect.getEditedPostAttribute('status');
  8963. useValidation = postStatus === 'publish' || postStatus === 'future';
  8964. lastPostStatus = postStatus !== 'publish' ? postStatus : lastPostStatus;
  8965. });
  8966. // Create validation version.
  8967. editor.savePost = function (options) {
  8968. options = options || {};
  8969. // Backup vars.
  8970. var _this = this;
  8971. var _args = arguments;
  8972. // Perform validation within a Promise.
  8973. return new Promise(function (resolve, reject) {
  8974. // Bail early if is autosave or preview.
  8975. if (options.isAutosave || options.isPreview) {
  8976. return resolve('Validation ignored (autosave).');
  8977. }
  8978. // Bail early if validation is not needed.
  8979. if (!useValidation) {
  8980. return resolve('Validation ignored (draft).');
  8981. }
  8982. // Validate the editor form.
  8983. var valid = acf.validateForm({
  8984. form: $('#editor'),
  8985. reset: true,
  8986. complete: function ($form, validator) {
  8987. // Always unlock the form after AJAX.
  8988. editor.unlockPostSaving('acf');
  8989. },
  8990. failure: function ($form, validator) {
  8991. // Get validation error and append to Gutenberg notices.
  8992. var notice = validator.get('notice');
  8993. notices.createErrorNotice(notice.get('text'), {
  8994. id: 'acf-validation',
  8995. isDismissible: true
  8996. });
  8997. notice.remove();
  8998. // Restore last non "publish" status.
  8999. if (lastPostStatus) {
  9000. editor.editPost({
  9001. status: lastPostStatus
  9002. });
  9003. }
  9004. // Rejext promise and prevent savePost().
  9005. reject('Validation failed.');
  9006. },
  9007. success: function () {
  9008. notices.removeNotice('acf-validation');
  9009. // Resolve promise and allow savePost().
  9010. resolve('Validation success.');
  9011. }
  9012. });
  9013. // Resolve promise and allow savePost() if no validation is needed.
  9014. if (valid) {
  9015. resolve('Validation bypassed.');
  9016. // Otherwise, lock the form and wait for AJAX response.
  9017. } else {
  9018. editor.lockPostSaving('acf');
  9019. }
  9020. }).then(function () {
  9021. return savePost.apply(_this, _args);
  9022. }).catch(function (err) {
  9023. // Nothing to do here, user is alerted of validation issues.
  9024. });
  9025. };
  9026. }
  9027. });
  9028. })(jQuery);
  9029. /***/ })
  9030. /******/ });
  9031. /************************************************************************/
  9032. /******/ // The module cache
  9033. /******/ var __webpack_module_cache__ = {};
  9034. /******/
  9035. /******/ // The require function
  9036. /******/ function __webpack_require__(moduleId) {
  9037. /******/ // Check if module is in cache
  9038. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  9039. /******/ if (cachedModule !== undefined) {
  9040. /******/ return cachedModule.exports;
  9041. /******/ }
  9042. /******/ // Create a new module (and put it into the cache)
  9043. /******/ var module = __webpack_module_cache__[moduleId] = {
  9044. /******/ // no module.id needed
  9045. /******/ // no module.loaded needed
  9046. /******/ exports: {}
  9047. /******/ };
  9048. /******/
  9049. /******/ // Execute the module function
  9050. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  9051. /******/
  9052. /******/ // Return the exports of the module
  9053. /******/ return module.exports;
  9054. /******/ }
  9055. /******/
  9056. /************************************************************************/
  9057. /******/ /* webpack/runtime/compat get default export */
  9058. /******/ !function() {
  9059. /******/ // getDefaultExport function for compatibility with non-harmony modules
  9060. /******/ __webpack_require__.n = function(module) {
  9061. /******/ var getter = module && module.__esModule ?
  9062. /******/ function() { return module['default']; } :
  9063. /******/ function() { return module; };
  9064. /******/ __webpack_require__.d(getter, { a: getter });
  9065. /******/ return getter;
  9066. /******/ };
  9067. /******/ }();
  9068. /******/
  9069. /******/ /* webpack/runtime/define property getters */
  9070. /******/ !function() {
  9071. /******/ // define getter functions for harmony exports
  9072. /******/ __webpack_require__.d = function(exports, definition) {
  9073. /******/ for(var key in definition) {
  9074. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  9075. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  9076. /******/ }
  9077. /******/ }
  9078. /******/ };
  9079. /******/ }();
  9080. /******/
  9081. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  9082. /******/ !function() {
  9083. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  9084. /******/ }();
  9085. /******/
  9086. /******/ /* webpack/runtime/make namespace object */
  9087. /******/ !function() {
  9088. /******/ // define __esModule on exports
  9089. /******/ __webpack_require__.r = function(exports) {
  9090. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  9091. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  9092. /******/ }
  9093. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  9094. /******/ };
  9095. /******/ }();
  9096. /******/
  9097. /************************************************************************/
  9098. var __webpack_exports__ = {};
  9099. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  9100. !function() {
  9101. "use strict";
  9102. /*!*******************************************************************!*\
  9103. !*** ./src/advanced-custom-fields-pro/assets/src/js/acf-input.js ***!
  9104. \*******************************************************************/
  9105. __webpack_require__.r(__webpack_exports__);
  9106. /* harmony import */ var _acf_field_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_acf-field.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field.js");
  9107. /* harmony import */ var _acf_field_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_acf_field_js__WEBPACK_IMPORTED_MODULE_0__);
  9108. /* harmony import */ var _acf_fields_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_acf-fields.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-fields.js");
  9109. /* harmony import */ var _acf_fields_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_acf_fields_js__WEBPACK_IMPORTED_MODULE_1__);
  9110. /* harmony import */ var _acf_field_accordion_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_acf-field-accordion.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-accordion.js");
  9111. /* harmony import */ var _acf_field_accordion_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_acf_field_accordion_js__WEBPACK_IMPORTED_MODULE_2__);
  9112. /* harmony import */ var _acf_field_button_group_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_acf-field-button-group.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-button-group.js");
  9113. /* harmony import */ var _acf_field_button_group_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_acf_field_button_group_js__WEBPACK_IMPORTED_MODULE_3__);
  9114. /* harmony import */ var _acf_field_checkbox_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_acf-field-checkbox.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-checkbox.js");
  9115. /* harmony import */ var _acf_field_checkbox_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_acf_field_checkbox_js__WEBPACK_IMPORTED_MODULE_4__);
  9116. /* harmony import */ var _acf_field_color_picker_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_acf-field-color-picker.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-color-picker.js");
  9117. /* harmony import */ var _acf_field_color_picker_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_acf_field_color_picker_js__WEBPACK_IMPORTED_MODULE_5__);
  9118. /* harmony import */ var _acf_field_date_picker_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_acf-field-date-picker.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-date-picker.js");
  9119. /* harmony import */ var _acf_field_date_picker_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_acf_field_date_picker_js__WEBPACK_IMPORTED_MODULE_6__);
  9120. /* harmony import */ var _acf_field_date_time_picker_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./_acf-field-date-time-picker.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-date-time-picker.js");
  9121. /* harmony import */ var _acf_field_date_time_picker_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_acf_field_date_time_picker_js__WEBPACK_IMPORTED_MODULE_7__);
  9122. /* harmony import */ var _acf_field_google_map_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./_acf-field-google-map.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-google-map.js");
  9123. /* harmony import */ var _acf_field_google_map_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_acf_field_google_map_js__WEBPACK_IMPORTED_MODULE_8__);
  9124. /* harmony import */ var _acf_field_image_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_acf-field-image.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-image.js");
  9125. /* harmony import */ var _acf_field_image_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_acf_field_image_js__WEBPACK_IMPORTED_MODULE_9__);
  9126. /* harmony import */ var _acf_field_file_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./_acf-field-file.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-file.js");
  9127. /* harmony import */ var _acf_field_file_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_acf_field_file_js__WEBPACK_IMPORTED_MODULE_10__);
  9128. /* harmony import */ var _acf_field_link_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./_acf-field-link.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-link.js");
  9129. /* harmony import */ var _acf_field_link_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_acf_field_link_js__WEBPACK_IMPORTED_MODULE_11__);
  9130. /* harmony import */ var _acf_field_oembed_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./_acf-field-oembed.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-oembed.js");
  9131. /* harmony import */ var _acf_field_oembed_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_acf_field_oembed_js__WEBPACK_IMPORTED_MODULE_12__);
  9132. /* harmony import */ var _acf_field_radio_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./_acf-field-radio.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-radio.js");
  9133. /* harmony import */ var _acf_field_radio_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_acf_field_radio_js__WEBPACK_IMPORTED_MODULE_13__);
  9134. /* harmony import */ var _acf_field_range_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./_acf-field-range.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-range.js");
  9135. /* harmony import */ var _acf_field_range_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_acf_field_range_js__WEBPACK_IMPORTED_MODULE_14__);
  9136. /* harmony import */ var _acf_field_relationship_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./_acf-field-relationship.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-relationship.js");
  9137. /* harmony import */ var _acf_field_relationship_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_acf_field_relationship_js__WEBPACK_IMPORTED_MODULE_15__);
  9138. /* harmony import */ var _acf_field_select_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./_acf-field-select.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-select.js");
  9139. /* harmony import */ var _acf_field_select_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_acf_field_select_js__WEBPACK_IMPORTED_MODULE_16__);
  9140. /* harmony import */ var _acf_field_tab_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./_acf-field-tab.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-tab.js");
  9141. /* harmony import */ var _acf_field_tab_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_acf_field_tab_js__WEBPACK_IMPORTED_MODULE_17__);
  9142. /* harmony import */ var _acf_field_post_object_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./_acf-field-post-object.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-post-object.js");
  9143. /* harmony import */ var _acf_field_post_object_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_acf_field_post_object_js__WEBPACK_IMPORTED_MODULE_18__);
  9144. /* harmony import */ var _acf_field_page_link_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./_acf-field-page-link.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-page-link.js");
  9145. /* harmony import */ var _acf_field_page_link_js__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(_acf_field_page_link_js__WEBPACK_IMPORTED_MODULE_19__);
  9146. /* harmony import */ var _acf_field_user_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./_acf-field-user.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-user.js");
  9147. /* harmony import */ var _acf_field_user_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_acf_field_user_js__WEBPACK_IMPORTED_MODULE_20__);
  9148. /* harmony import */ var _acf_field_taxonomy_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./_acf-field-taxonomy.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-taxonomy.js");
  9149. /* harmony import */ var _acf_field_taxonomy_js__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_acf_field_taxonomy_js__WEBPACK_IMPORTED_MODULE_21__);
  9150. /* harmony import */ var _acf_field_time_picker_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./_acf-field-time-picker.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-time-picker.js");
  9151. /* harmony import */ var _acf_field_time_picker_js__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(_acf_field_time_picker_js__WEBPACK_IMPORTED_MODULE_22__);
  9152. /* harmony import */ var _acf_field_true_false_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./_acf-field-true-false.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-true-false.js");
  9153. /* harmony import */ var _acf_field_true_false_js__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_acf_field_true_false_js__WEBPACK_IMPORTED_MODULE_23__);
  9154. /* harmony import */ var _acf_field_url_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./_acf-field-url.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-url.js");
  9155. /* harmony import */ var _acf_field_url_js__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_acf_field_url_js__WEBPACK_IMPORTED_MODULE_24__);
  9156. /* harmony import */ var _acf_field_wysiwyg_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./_acf-field-wysiwyg.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-field-wysiwyg.js");
  9157. /* harmony import */ var _acf_field_wysiwyg_js__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(_acf_field_wysiwyg_js__WEBPACK_IMPORTED_MODULE_25__);
  9158. /* harmony import */ var _acf_condition_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./_acf-condition.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-condition.js");
  9159. /* harmony import */ var _acf_condition_js__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(_acf_condition_js__WEBPACK_IMPORTED_MODULE_26__);
  9160. /* harmony import */ var _acf_conditions_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./_acf-conditions.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-conditions.js");
  9161. /* harmony import */ var _acf_conditions_js__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(_acf_conditions_js__WEBPACK_IMPORTED_MODULE_27__);
  9162. /* harmony import */ var _acf_condition_types_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./_acf-condition-types.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-condition-types.js");
  9163. /* harmony import */ var _acf_condition_types_js__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_acf_condition_types_js__WEBPACK_IMPORTED_MODULE_28__);
  9164. /* harmony import */ var _acf_unload_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./_acf-unload.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-unload.js");
  9165. /* harmony import */ var _acf_unload_js__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_acf_unload_js__WEBPACK_IMPORTED_MODULE_29__);
  9166. /* harmony import */ var _acf_postbox_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./_acf-postbox.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-postbox.js");
  9167. /* harmony import */ var _acf_postbox_js__WEBPACK_IMPORTED_MODULE_30___default = /*#__PURE__*/__webpack_require__.n(_acf_postbox_js__WEBPACK_IMPORTED_MODULE_30__);
  9168. /* harmony import */ var _acf_media_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./_acf-media.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-media.js");
  9169. /* harmony import */ var _acf_media_js__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_acf_media_js__WEBPACK_IMPORTED_MODULE_31__);
  9170. /* harmony import */ var _acf_screen_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./_acf-screen.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-screen.js");
  9171. /* harmony import */ var _acf_screen_js__WEBPACK_IMPORTED_MODULE_32___default = /*#__PURE__*/__webpack_require__.n(_acf_screen_js__WEBPACK_IMPORTED_MODULE_32__);
  9172. /* harmony import */ var _acf_select2_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./_acf-select2.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-select2.js");
  9173. /* harmony import */ var _acf_select2_js__WEBPACK_IMPORTED_MODULE_33___default = /*#__PURE__*/__webpack_require__.n(_acf_select2_js__WEBPACK_IMPORTED_MODULE_33__);
  9174. /* harmony import */ var _acf_tinymce_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./_acf-tinymce.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-tinymce.js");
  9175. /* harmony import */ var _acf_tinymce_js__WEBPACK_IMPORTED_MODULE_34___default = /*#__PURE__*/__webpack_require__.n(_acf_tinymce_js__WEBPACK_IMPORTED_MODULE_34__);
  9176. /* harmony import */ var _acf_validation_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./_acf-validation.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-validation.js");
  9177. /* harmony import */ var _acf_validation_js__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_acf_validation_js__WEBPACK_IMPORTED_MODULE_35__);
  9178. /* harmony import */ var _acf_helpers_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./_acf-helpers.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-helpers.js");
  9179. /* harmony import */ var _acf_helpers_js__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_acf_helpers_js__WEBPACK_IMPORTED_MODULE_36__);
  9180. /* harmony import */ var _acf_compatibility_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./_acf-compatibility.js */ "./src/advanced-custom-fields-pro/assets/src/js/_acf-compatibility.js");
  9181. /* harmony import */ var _acf_compatibility_js__WEBPACK_IMPORTED_MODULE_37___default = /*#__PURE__*/__webpack_require__.n(_acf_compatibility_js__WEBPACK_IMPORTED_MODULE_37__);
  9182. }();
  9183. /******/ })()
  9184. ;
  9185. //# sourceMappingURL=acf-input.js.map