"use strict";(self.webpackChunkgravityforms=self.webpackChunkgravityforms||[]).push([[954],{2954:function(t,e,n){n.d(e,{Z:function(){return m}});var r=n(7169),o=n(8950),a=n(2975),c=n.n(a),s=n(4203),i=n(4017),u=n(1583),f=n(6655);var l=n(2124),p=n(4506),d=n.n(p),h=n(7293),y=n.n(h),v=n(5212),w=n.n(v),b=n(2577),O=function t(e){return Object.entries(e).map((function(e){var n=(0,b.Z)(e,2),r=n[0],o=n[1];return[r,o&&"object"===(0,f.Z)(o)?t(o):o]})).reduce((function(t,e){var n=(0,b.Z)(e,2),r=n[0],o=n[1];return null==o||(t[r]=o),t}),{})};function g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function j(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach((function(e){(0,r.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function m(t){return P.apply(this,arguments)}function P(){return P=(0,o.Z)(c().mark((function t(e){var n,r,o,a,p,h,v,b,g,m,P,x,D=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=D.length>1&&void 0!==D[1]?D[1]:{},o=j({method:"GET"},r=D.length>2&&void 0!==D[2]?D[2]:{}),a=(0,s.Z)(["body"],o),p="GET"!==a.method&&"HEAD"!==a.method,h=a.baseUrl,p&&(v=r.body?r.body:{},n[e].nonce&&(v._ajax_nonce=n[e].nonce),n[e].action&&(v.action=n[e].action),a.body=(c=v,Z=void 0,k=void 0,E=void 0,E=new window.FormData,function t(e,n){if(!function(t){return Array.isArray(k)&&k.some((function(e){return e===t}))}(n))if(n=n||"",e instanceof window.File)E.append(n,e);else if(Array.isArray(e))for(var r=0;r<e.length;r++)t(e[r],n+"["+r+"]");else if("object"===(0,f.Z)(e)&&e)for(var o in e)e.hasOwnProperty(o)&&t(e[o],""===n?o:n+"."+o);else null!=e&&E.append(n,e)}(c,Z),E)),a.json&&(a.body=JSON.stringify(a.json)),b=a.params||{},!p&&n[e].nonce&&(b._ajax_nonce=n[e].nonce),!p&&n[e].action&&(b.action=n[e].action),b&&!(0,i.Z)(b)&&(g=O(b),m=(0,l.stringify)(g,{arrayFormat:"bracket"}),h="".concat(h,"?").concat(m)),P=a.headers?j({},a.headers):{},console.info("Fetching url: ".concat(h)),console.info("with options",j(j({},a),{},{body:a.body})),console.info("and headers: ",P),x=Date.now(),t.abrupt("return",window.fetch(h,j(j({},a),{},{headers:P})).then((function(t){return t.ok?t.text().then((function(n){try{var r=JSON.parse(n),o=Date.now()-x;return console.info("Data for ".concat(e," in ").concat(o,"ms:"),r),{data:r,status:t.status,totalPages:t.headers.get("x-wp-totalpages"),totalPosts:t.headers.get("x-wp-total")}}catch(e){var a=y()(d()(w()(n))),c=new Error("Invalid server response. ".concat(a));throw c.detail={url:h,data:a,status:t.status,error:e,text:n},c}})):(0,u.Z)(t.headers.get("Content-Type"),"application/json")?t.text().then((function(n){try{var r=JSON.parse(n);return console.info("Data for ".concat(e,":"),r),{data:r,status:t.status}}catch(e){var o=y()(d()(w()(n))),a=new Error("Invalid server response. ".concat(o));throw a.detail={url:h,data:o,status:t.status,error:e,text:n},a}})):t.text().then((function(e){var n=y()(d()(w()(e))),r=new Error("Unknown server response. ".concat(n));throw r.detail={url:h,data:n,status:t.status},r}))})).catch((function(t){return console.info(JSON.stringify(t)),console.info(t.detail),{error:t}})));case 18:case"end":return t.stop()}var c,Z,k,E}),t)}))),P.apply(this,arguments)}}}]);
//# sourceMappingURL=954.c3c46a1f2a7f54cbaa89.js.map