Нема описа

acf-input.js 263KB

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