1"use strict";(self.webpackChunk_chive_core_theme=self.webpackChunk_chive_core_theme||[]).push([[109],{4697:function(t,n,e){e.d(n,{U2:function(){return u},Xf:function(){return c},v_:function(){return f}});var a=e(9669),i=e.n(a),s=e(9124),o=e(7856);const{ajaxURL:r}=s.kh.endpoint,c=t=>{const n=new FormData;return Object.keys(t).forEach((e=>{Array.isArray(t[e])?(0===t[e].length&&n.set(e+"[]",""),t[e].map((t=>n.append((0,o.sanitize)(e+"[]"),(0,o.sanitize)(t))))):n.set(e,t[e])})),n},f=async(t,n,e)=>{n.action=t,n._ajax_nonce=e;const{data:a}=await i().post(r,c(n));if(!a.success)throw new Error(JSON.stringify(a.data)||"No response from the request");return a.data},u=async function(t,n){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=new URL(r);Object.entries(e).forEach((t=>{let[n,e]=t;a.searchParams.set(n,encodeURIComponent(e))})),a.searchParams.set("action",t),a.searchParams.set("_ajax_nonce",n);const{data:s}=await i().get(a.toString());if(!s.success)throw new Error(JSON.stringify(s.data));return s.data}},1921:function(t,n,e){e.d(n,{fu:function(){return r},gi:function(){return o},ix:function(){return s}});var a=e(4697),i=e(9124);async function s(){const{action:t,nonce:n}=i.kh.endpoint.mychive.favoritePosts.index,e=await(0,a.U2)(t,n);return Array.isArray(e)?e:[]}async function o(t){const{action:n,nonce:e}=i.kh.endpoint.mychive.favoritePosts.attach,s=await(0,a.v_)(n,{post_ids:t},e);return Array.isArray(s)?s:[]}async function r(t){const{action:n,nonce:e}=i.kh.endpoint.mychive.favoritePosts.delete,s=await(0,a.v_)(n,{post_ids:t},e);return Array.isArray(s)?s:[]}},1109:function(t,n,e){e.r(n),e.d(n,{default:function(){return c}});var a=e(9124),i=e(1921),s=e(5311);function o(){e.e(73).then(e.bind(e,3073)).then((t=>t.handleShow()))}function r(t,n){t.toggleClass("is-favorite",n),t.find("span").text(n?"Remove Favorite":"Add Favorite")}function c(){const t=s(".action-favorite[data-post-id]");t.length&&(a.kh.isUserLoggedIn?(0,i.ix)().then((n=>{t.each((function(){const t=parseInt(s(this).data("post-id"),10);t&&r(s(this),-1!==n.indexOf(t))}))})).catch((()=>{t.each((function(){r(s(this),!1)}))})).finally((()=>{t.removeClass("is-loading")})):t.each((function(){r(s(this),!1)})),t.on("click",(async function(t){t.preventDefault();const n=s(this);if(n.hasClass("is-loading"))return;const e=parseInt(n.data("post-id"),10);if(!e)return;if(!a.kh.isUserLoggedIn)return void o();const c=n.hasClass("is-favorite");n.addClass("is-loading");try{r(n,-1!==(c?await(0,i.fu)([e]):await(0,i.gi)([e])).indexOf(e))}catch(t){const n=t&&"string"==typeof t.message?t.message:"";try{(n?JSON.parse(n):{}).unauthorized&&o()}catch{}}finally{n.removeClass("is-loading")}})))}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.