1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5894],{72352:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/auth/upload/blog/page",function(){return n(16978)}])},34118:function(e,t,n){"use strict";var o=n(85893),r=n(67294),a=n(11163),u=n(60253),i=n(79912),l=n(22318),c=n(98530),s=n(13048),d=n(57308);t.Z=function(e){var t,n=e.content,f=(0,s.Z)(n.ID?c.Z.getPublicContent({id:n.ID}):null).data,v=(0,a.useRouter)(),p=v.defaultLocale,h=v.locale,g=(0,u.$G)().t,y=null===(t=n.Pages)||void 0===t?void 0:t[0],b=null===f||void 0===f?void 0:f.Pages,D=n.Published&&!(null===y||void 0===y?void 0:y.Unpublished),E=r.useMemo((function(){if(!n.ID)return"";var e="/post/".concat(n.ID.toString(36));return((null===b||void 0===b?void 0:b.length)||0)>1&&(null===y||void 0===y?void 0:y.ID)&&(e+="/page/".concat(y.ID)),e}),[n.ID,null===y||void 0===y?void 0:y.ID,null===b||void 0===b?void 0:b.length]),I=r.useMemo((function(){var e="https://baskadia.com";return h&&h!==p&&(e+="/".concat(h)),e+=E}),[p,E,h]),Z=r.useMemo((function(){return n.Published?g("this-page-is-unpublished"):g("this-post-is-unpublished")}),[n.Published,g]);return(0,o.jsxs)(i.Z,{children:[(0,o.jsx)(l.Z,{variant:"body1",style:{opacity:.7},children:g("published-url")}),D&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.Z,{variant:"body1",style:{marginTop:"8px",overflowWrap:"break-word"},children:(0,o.jsx)(d.Z,{href:E,textLink:!0,children:I})}),(0,o.jsx)(l.Z,{variant:"caption",style:{opacity:.7},children:g("share-button-is-in-upper-right")})]}),!D&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l.Z,{color:"error",variant:"body1",style:{marginTop:"8px",fontWeight:"bold"},children:Z}),(0,o.jsx)(l.Z,{variant:"caption",style:{opacity:.7},children:g("publish-button-is-in-upper-right")})]})]})}},94270:function(e,t,n){"use strict";n.d(t,{Z:function(){return v}});var o=n(85893),r=n(67294),a=n(36802),u=n(13048),i=n(26042),l=n(69396),c=n(41664),s=n.n(c),d=n(97250),f=function(e){var t,n=e.content,a=e.item,u=null===(t=e.pages[a.page-1])||void 0===t?void 0:t.ID,c=r.useMemo((function(){return n.Type&&u?"/auth/upload/".concat(n.Type,"/page?id=").concat(u):""}),[n.Type,u]);return(0,o.jsx)(s(),{href:c,passHref:!0,replace:!0,children:(0,o.jsx)(d.Z,(0,l.Z)((0,i.Z)({},a),{component:"a"}))})},v=function(e){var t=e.content,n=(0,u.Z)(t.ID?"/auth/content/".concat(t.ID):null).data,i=r.useMemo((function(){return(null===n||void 0===n?void 0:n.Pages)?n.Pages.filter((function(e){return!e.Header})):[]}),[null===n||void 0===n?void 0:n.Pages]),l=r.useMemo((function(){for(var e=0;e<i.length;e+=1){var n,o;if(i[e].ID===(null===(n=t.Pages)||void 0===n||null===(o=n[0])||void 0===o?void 0:o.ID))return e+1}}),[t.Pages,i]),c=r.useCallback((function(e){return(0,o.jsx)(f,{content:t,item:e,pages:i})}),[t,i]);return i.length<2?null:(0,o.jsx)(a.Z,{color:"primary",count:i.length,page:l,renderItem:c})}},94118:function(e,t,n){"use strict";var o=n(82670),r=n(26042),a=n(69396),u=n(828),i=n(67294),l=n(11163),c=n(36808),s=n.n(c);t.Z=function(){var e=(0,l.useRouter)().locale,t=(0,u.Z)(i.useState(null),2),n=t[0],c=t[1];return i.useEffect((function(){c(new XMLHttpRequest)}),[]),i.useMemo((function(){return{abort:function(){var e;null===n||void 0===n||null===(e=n.abort)||void 0===e||e.call(n)},send:function(t,i){if(null===n)return new Promise((function(e){return e(null)}));var l="".concat("https://api.baskadia.com").concat(t);n.open(i.method||"GET",l);var c={Accept:"application/json","Accept-Language":e||"en"},d=s().get("auth._token.local");return d&&(c=(0,a.Z)((0,r.Z)({},c),{Authorization:d}),n.withCredentials=!0),Object.entries(c).forEach((function(e){var t=(0,u.Z)(e,2),o=t[0],r=t[1];n.setRequestHeader(o,r)})),i.onAbort&&(n.upload.onabort=i.onAbort),i.onProgress&&(n.upload.onprogress=i.onProgress),new Promise((function(e,t){null!==n?(n.onload=function(n){if((0,o.Z)(n.target,XMLHttpRequest))if(200===n.target.status)try{var r=JSON.parse(n.target.responseText);e(r)}catch(a){e(null)}else t(new Error(n.target.responseText));else t(new Error("event.target must be XMLHttpRequest"))},n.onerror=function(e){(0,o.Z)(e.target,XMLHttpRequest)?t(new Error(e.target.responseText)):t(new Error("event.target must be XMLHttpRequest"))},n.send(i.body)):e(null)}))}}}),[e,n])}},16978:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSG:function(){return N},default:function(){return B}});var o=n(47568),r=n(20414),a=n(85893),u=n(67294),i=n(9008),l=n.n(i),c=n(11163),s=n(33681),d=n(49384),f=n(13048),v=n(828),p=n(60253),h=n(72091),g=n(18463),y=n(79912),b=n(39803),D=n(22318),E=n(61164),I=n(92674),Z=n(33876),m=n(34118),S=n(38584),_=n(29077),x=n(16382),T=n(96508),P=function(e){if("image"===e.type.n
1ame)return!0;for(var t=0;t<e.childCount;t+=1){var n=e.maybeChild(t);if(n&&P(n))return!0}return!1},w=function(e){var t=e.doc;return""===t.textContent.trim()&&!P(t)},C=function(e){var t,n=e.content,i=e.onContentUpdate,l=(0,c.useRouter)(),s=(0,p.$G)().t,f=(0,h.Ds)().enqueueSnackbar,P=(0,v.Z)((0,E.o)(),2),C=P[0],j=C.disabled,k=C.isEdited,L=P[1],A=(0,I.Z)(),N=(0,Z.Z)(),B=N.manager,M=N.state,U=N.setState,R=(0,v.Z)(u.useState(0),2),O=R[0],q=R[1],H=(0,v.Z)(u.useState(""),2),X=H[0],F=H[1],J=(0,v.Z)(u.useState(M),2),G=J[0],W=J[1],V=(0,v.Z)(u.useState(""),2),$=V[0],z=V[1],K=(0,v.Z)(u.useState(!1),2),Q=K[0],Y=K[1],ee=(0,v.Z)(u.useState(!1),2),te=ee[0],ne=ee[1],oe=(0,v.Z)(u.useState(!1),2),re=oe[0],ae=oe[1],ue=null===(t=n.Pages)||void 0===t?void 0:t[0],ie=u.useCallback((function(e){var t,n=null===e||void 0===e||null===(t=e.Pages)||void 0===t?void 0:t[0];if(F((null===n||void 0===n?void 0:n.Title)||""),null===n||void 0===n?void 0:n.Body){var o=B.createState({content:JSON.parse(n.Body)});U(o),W(o)}}),[B,U]);u.useEffect((function(){(null===ue||void 0===ue?void 0:ue.ID)&&ue.ID!==O&&(q(ue.ID),ie(n),A("/auth/page/".concat(ue.ID)).then((function(e){ie(e)})).catch((function(e){return(0,d.kg)(e)})))}),[n,A,O,null===ue||void 0===ue?void 0:ue.ID,ie]);var le=u.useMemo((function(){return!M.doc.eq(G.doc)}),[G,M]);u.useEffect((function(){X.trim().slice(0,100)===((null===ue||void 0===ue?void 0:ue.Title)||"")?L(le?{type:"SET_IS_EDITED",payload:!0}:{type:"SET_IS_EDITED",payload:!1}):L({type:"SET_IS_EDITED",payload:!0})}),[L,le,null===ue||void 0===ue?void 0:ue.Title,X]),u.useEffect((function(){if($&&!k){var e=$;z(""),l.push(e).catch((function(e){return(0,d.kg)(e)})).finally((function(){L({type:"SET_DISABLED",payload:!1})}))}}),[L,k,$,l]),u.useEffect((function(){var e=function(e){if(k){var t=s("you-have-unsaved-changes");return e.preventDefault(),e.returnValue=t,t}(null===ue||void 0===ue?void 0:ue.ID)&&A("/auth/page/".concat(ue.ID,"/files"),{method:"DELETE"}).catch((function(e){return(0,d.kg)(e)}))};return window.addEventListener("beforeunload",e),function(){window.removeEventListener("beforeunload",e)}}),[A,k,null===ue||void 0===ue?void 0:ue.ID,s]),u.useEffect((function(){var e=function(){if(k&&!window.confirm(s("you-have-unsaved-changes")))throw l.events.emit("routeChangeError"),"Route change was cancelled";(null===ue||void 0===ue?void 0:ue.ID)&&A("/auth/page/".concat(ue.ID,"/files"),{method:"DELETE"}).catch((function(e){return(0,d.kg)(e)}))};return l.events.on("routeChangeStart",e),function(){l.events.off("routeChangeStart",e)}}),[A,k,null===ue||void 0===ue?void 0:ue.ID,l.events,s]);var ce=u.useCallback((function(){return Y(!1)}),[]),se=u.useCallback((function(){return ne(!1)}),[]),de=u.useCallback((function(){return ae(!1)}),[]),fe=u.useCallback((function(){return L({type:"SET_DISABLED",payload:!0})}),[L]),ve=u.useCallback((function(){return L({type:"SET_DISABLED",payload:!1})}),[L]),pe=u.useCallback((function(e){return F(e.target.value)}),[]),he=u.useCallback((function(e){"Enter"===e.key&&e.preventDefault()}),[]),ge=u.useCallback((function(e){return U(e)}),[U]),ye=u.useCallback((0,o.Z)((function(){var e,t,n,o,a,u;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if(!k)return[2,!0];r.label=1;case 1:if(r.trys.push([1,3,,4]),!(null===ue||void 0===ue?void 0:ue.ID))throw new Error("page.ID is undefined");return t={},(n=X.trim().slice(0,100))!==((null===ue||void 0===ue?void 0:ue.Title)||"")&&(t.title=n),le&&(t.body=JSON.stringify(M.doc),M.doc.textContent.length>2e4)?(Y(!0),[2,!1]):[4,A("/auth/page/".concat(ue.ID),{method:"PUT",body:JSON.stringify(t)})];case 2:if(null===(o=r.sent()))throw new Error("newContent is null");return a=null===(e=o.Pages)||void 0===e?void 0:e[0],F((null===a||void 0===a?void 0:a.Title)||""),W(M),i(o),[2,!0];case 3:return u=r.sent(),(0,d.kg)(u),f(s("failed-to-save-changes"),{variant:"error"}),[2,!1];case 4:return[2]}}
1))})),[f,A,k,le,i,null===ue||void 0===ue?void 0:ue.ID,null===ue||void 0===ue?void 0:ue.Title,M,s,X]),be=u.useCallback((0,o.Z)((function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return n.Published&&!(null===ue||void 0===ue?void 0:ue.Unpublished)&&w(M)?(f(s("content-is-empty"),{variant:"error"}),[2]):(L({type:"SET_DISABLED",payload:!0}),[4,ye()]);case 1:return e.sent(),L({type:"SET_DISABLED",payload:!1}),[2]}}))})),[n.Published,L,f,null===ue||void 0===ue?void 0:ue.Unpublished,ye,M,s]);u.useEffect((function(){L({type:"SET_ON_SAVE",payload:be})}),[L,be]);var De=u.useCallback((0,o.Z)((function(){return(0,r.__generator)(this,(function(e){switch(e.label){case 0:return w(M)?(f(s("content-is-empty"),{variant:"error"}),[2]):(L({type:"SET_DISABLED",payload:!0}),[4,ye()]);case 1:if(!e.sent())return L({type:"SET_DISABLED",payload:!1}),[2];try{if(!n.Type)throw new Error("content.Type is undefined");return(n.PrevPageID||n.NextPageID)&&(null===ue||void 0===ue?void 0:ue.ID)?z("/auth/upload/".concat(n.Type,"/preview/page?id=").concat(ue.ID)):n.ID&&z("/auth/upload/".concat(n.Type,"/preview?id=").concat(n.ID)),[2]}catch(t){(0,d.kg)(t)}return L({type:"SET_DISABLED",payload:!1}),[2]}}))})),[n.ID,n.NextPageID,n.PrevPageID,n.Type,L,f,null===ue||void 0===ue?void 0:ue.ID,ye,M,s]);u.useEffect((function(){L({type:"SET_ON_PREVIEW",payload:De})}),[L,De]);var Ee=u.useCallback((0,o.Z)((function(){var e,t,o,a;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:return w(M)?(f(s("content-is-empty"),{variant:"error"}),[2]):(L({type:"SET_DISABLED",payload:!0}),[4,ye()]);case 1:if(!r.sent())return L({type:"SET_DISABLED",payload:!1}),[2];if(!(null===ue||void 0===ue?void 0:ue.Unpublished))return[3,5];r.label=2;case 2:if(r.trys.push([2,4,,5]),!ue.ID)throw new Error("page.ID is undefined");return[4,A("/auth/page/".concat(ue.ID),{method:"PUT",body:JSON.stringify({unpublished:!1})})];case 3:if(null===(t=r.sent()))throw new Error("newContent is null");return o=null===(e=t.Pages)||void 0===e?void 0:e[0],F((null===o||void 0===o?void 0:o.Title)||""),W(M),i(t),[3,5];case 4:return a=r.sent(),(0,d.kg)(a),f(n.Published?s("failed-to-publish-page"):s("failed-to-publish-post"),{variant:"error"}),L({type:"SET_DISABLED",payload:!1}),[2];case 5:return L({type:"SET_DISABLED",payload:!1}),n.Published?ae(!0):ne(!0),[2]}}))})),[n,L,f,A,i,null===ue||void 0===ue?void 0:ue.ID,null===ue||void 0===ue?void 0:ue.Unpublished,ye,M,s]);return u.useEffect((function(){L({type:"SET_ON_PUBLISH",payload:Ee})}),[L,Ee]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(g.Z,{children:[(0,a.jsx)(m.Z,{content:n}),(0,a.jsxs)(y.Z,{style:{padding:"16px"},children:[(0,a.jsx)(b.Z,{value:X,label:s("page-title"),error:X.length>100,autoComplete:"off",disabled:j,fullWidth:!0,multiline:!0,type:"text",variant:"outlined",onChange:pe,onKeyPress:he}),(0,a.jsx)(D.Z,{align:"right",color:X.length>100?"error":"inherit",display:"block",variant:"caption",children:"".concat(X.length," / 100")})]}),(0,a.jsx)(y.Z,{style:{padding:"16px"},children:(0,a.jsx)(x.Z,{content:n,disabled:j,manager:B,state:M,onChange:ge,onDisable:fe,onEnable:ve})})]}),(0,a.jsx)(T.Z,{open:Q,onClose:ce}),(0,a.jsx)(_.Z,{content:n,disabled:j,open:te,onClose:se,onDisable:fe,onEnable:ve,onContentUpdate:i}),(0,a.jsx)(S.Z,{content:n,open:re,onClose:de})]})},j=n(62284),k=n(86263),L=n(73844),A=n(94270),N=!0,B=function(){var e=(0,c.useRouter)().query,t="string"===typeof e.id?e.id:"",n=(0,f.Z)(t?"/auth/page/".concat(t):null),i=n.data,v=n.mutate;(0,f.Z)((null===i||void 0===i?void 0:i.PrevPageID)?"/auth/page/".concat(i.PrevPageID):null),(0,f.Z)((null===i||void 0===i?void 0:i.NextPageID)?"/auth/page/".concat(i.NextPageID):null);var p=u.useCallback(function(){var e=(0,o.Z)((function(e){var t;return(0,r.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,v(e,!1)];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),(0,d.kg)(t),[3,3];case 3:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}(),[v]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l(),{children:(0,a.jsx)("title",{children:"Baskadia"})}),!i&&(0,a.jsx)(s.Z,{}),i&&(0,a.jsx)(j.Z,{component:"main",style:{margin:"16px auto"},children:(0,a.jsxs)(k.Z,{children:[(0,a.jsx)(L.Z,{children:(0,a.jsx)(C,{content:i,onContentUpdate:p})}),(0,a.jsx)(L.Z,{children:(0,a.jsx)(A.Z,{content:i})})]})})]})}},98530:function(e,t){"use strict";t.Z={getPublicUsers:function(e){var t=e.offset,n=e.auth,o="/user?offset=".concat(t);return(null===n||void 0===n?void 0:n.ID)&&(o+="&user=".concat(n.ID)),o},getPublicUser:function(e){var t=e.id,n=e.auth,o="/user/".concat(t);return n&&(o+="?auth=true"),o},getPublicContents:function(e){var t=e.type,n=e.sortBy,o=e.offset,r=e.lang,a="/content?type=".concat(t,"&date=any&sort_by=").concat(n,"&offset=").concat(o);return r&&(a+="&lang=".concat(r)),a},getPublicContent:function(e){var t=e.id,n=e.auth,o="/content/".concat(t);return n&&(o+="?auth=true"),o},getContentsFromContent:function(e){var t=e.id,n=e.offset;return"/content/".concat(t,"/content?offset=").concat(n)},getCommentsFromContent:function(e){var t=e.contentId,n=e.lastId,o=e.auth,r="/content/".concat(t,"/comment?last_id=").concat(n);return o&&(r+="&auth=true"),r},getTags:function(e){var t=e.offset,n=e.lang,o="/tag?offset=".concat(t);return n&&(o+="&lang=".concat(n)),o}}}},function(e){e.O(0,[6911,3726,7333,3576,868,3138,2387,4794,9803,3322,3518,5992,7555,3934,4885,6254,8477,1153,9774,2888,179],(function(){return t=72352,e(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.