1"use strict";(self.webpackChunknodebb=self.webpackChunknodebb||[]).push([[1091,18314,22067,34271,43602,45663,49897,87212,99127],{34043(p,O,n){n.r(O),n.d(O,{init:()=>M});var d=n(49897),y=n(29930),l=n(81335),f=n.n(l),o=n(17459),P=n.n(o),w=n(65303),g=n(70106);g.t1.register(g.ZT,g.PP,g.kc,g.No,g.FN,g.m_,g.dN,g.s$);let v;const _=new Map([["hourly",utils.getHoursArray().map(function(u,i){return i%3?"":u})],["daily",utils.getDaysArray().map(function(u,i){return i%3?"":u})]]);async function M(){e(),v=await b();const u=document.getElementById("hostFilter"),i=document.getElementById("term");u&&u.addEventListener("change",m),i&&i.addEventListener("change",m)}function e(){const u=document.getElementById("relays");u&&u.addEventListener("click",i=>{const t=i.target.closest("[data-action]");if(t)switch(t.getAttribute("data-action")){case"relays.add":{s();break}case"relays.remove":{const a=t.closest("tr").getAttribute("data-url");(0,d.del)(`/admin/activitypub/relays/${encodeURIComponent(a)}`,{}).then(async c=>{const D=await app.parseAndTranslate("admin/federation/relays","relays",{relays:c}),h=document.querySelector("#relays tbody");h&&$(h).html(D)}).catch(y.error)}}})}function s(){(0,l.render)("admin/partials/activitypub/relays",{}).then(async function(u){const i=function(){const r=t.find("form").get(0);if(!r.reportValidity())return!1;const a=Object.fromEntries(new FormData(r));(0,d.post)("/admin/activitypub/relays",a).then(async c=>{const D=await app.parseAndTranslate("admin/federation/relays","relays",{relays:c}),h=document.querySelector("#relays tbody");h&&$(h).html(D)}).catch(y.error)},t=await w.dialog({title:"[[admin/settings/activitypub:relays.add]]",message:u,buttons:{save:{label:"[[global:save]]",className:"btn-primary",callback:i}}});t.on("shown.bs.modal",function(){t.find("input").focus()})})}async function m(){const u=document.getElementById("hostFilter"),i=document.getElementById("term");console.log(u.value,i.value);const t=await(0,d.get)(`/api${ajaxify.data.url}?relay=${u.value}&term=${i.value}`);v.data.labels=_.get(i.value||"hourly"),v.data.datasets[0].data=t.data.in,v.data.datasets[1].data=t.data.out,v.update()}async function b(){const u=document.querySelector("canvas");utils.isMobile()&&(g.t1.defaults.plugins.tooltip.enabled=!1);const i={label:"",fill:!0,tension:.25,pointHoverBackgroundColor:"#fff",pointBorderColor:"#fff"},t={labels:_.get("hourly"),datasets:[{...i,label:await(0,o.translate)("[[admin/settings/activitypub:analytics.in]]"),backgroundColor:"rgba(161,181,108,0.2)",borderColor:"rgba(161,181,108,1)",pointBackgroun
1dColor:"rgba(161,181,108,1)",pointHoverBorderColor:"rgba(161,181,108,1)",data:ajaxify.data.data.in},{...i,label:await(0,o.translate)("[[admin/settings/activitypub:analytics.out]]"),backgroundColor:"rgba(151,187,205,0.2)",borderColor:"rgba(151,187,205,1)",pointBackgroundColor:"rgba(151,187,205,1)",pointHoverBorderColor:"rgba(151,187,205,1)",data:ajaxify.data.data.out}]};u.width=$(u).parent().width();const r={responsive:!0,animation:!1,scales:{y:{beginAtZero:!0}},plugins:{legend:{position:"bottom"}}};return new g.t1(u.getContext("2d"),{type:"line",data:t,options:r})}},49897(p,O,n){n.r(O),n.d(O,{del:()=>u,get:()=>M,head:()=>e,patch:()=>m,post:()=>s,put:()=>b});var d=n(91749),y=n.n(d),l=n(65303),f=n(17459),o=n.n(f),P=n(68636),w=n.n(P);const g=config.relative_path+"/api/v3";async function v(t,r){if(t.url=t.url.startsWith("/api")?config.relative_path+t.url:g+t.url,t.headers=t.headers||{},t.headers["x-return-to"]||(t.headers["x-return-to"]=`${window.location.pathname.slice(config.relative_path.length)}${window.location.search}`),typeof r=="function"){_(t).then(a=>r(null,a),a=>r(a));return}try{return await _(t)}catch(a){if(a.message===await f.translate("[[error:api.401]]",config.userLang)){const{url:c}=await(0,d.fire)("filter:admin.reauth",{url:"login"}),D=await f.translate("[[error:api.reauth-required]]",config.userLang);(0,l.confirm)(D,h=>{h&&(P.setItem("location-hash",window.location.hash),ajaxify.go(c))})}throw a}}async function _(t){const{url:r}=t;delete t.url,t.data&&!(t.data instanceof FormData)&&(t.data=JSON.stringify(t.data||{}),t.headers["content-type"]="application/json; charset=utf-8"),{options:t}=await(0,d.fire)("filter:api.options",{options:t}),t.data&&(t.body=t.data,delete t.data);const a=await fetch(r,t),{headers:c}=a;if(c.get("x-redirect"))return _({url:c.get("x-redirect"),...t});const D=c.get("content-type"),h=D&&D.startsWith("application/json");let E;if(t.method!=="HEAD"&&(h?E=await a.json():E=await a.text()),!a.ok){if(E){const C=h&&(E.status?.message||E.error||""),I=typeof E=="string"?E:a.statusText||`[[error:api.${a.status}]]`;throw new Error(h&&C?C:I)}throw new Error(a.statusText)}return h&&E&&E.hasOwnProperty("status")&&E.hasOwnProperty("response")?E.response:E}function M(t,r,a){return v({url:t+(r&&Object.keys(r).length?"?"+$.param(r):"")},a)}function e(t,r,a){return v({url:t+(r&&Object.keys(r).length?"?"+$.param(r):""),method:"HEAD"},a)}function s(t,r,a,c){return i("POST",t,r,a,c)}function m(t,r,a,c){return i("PATCH",t,r,a,c)}function b(t,r,a,c){return i("PUT",t,r,a,c)}function u(t,r,a,c){return i("DELETE",t,r,a,c)}function i(t,r,a,c,D){return typeof c=="function"&&(D=c,c={}),v({url:r,method:t,data:a,headers:{"x-csrf-token":config.csrf_token,...c}},D)}},65303(p,O,n){n.r(O),n.d(O,{alert:()=>P,confirm:()=>w,dialog:()=>o,prompt:()=>g,promptPassword:()=>v});var d=n(33530),y=n.n(d),l=n(17459),f=n.n(l);d.setDefaults({locale:config.userLang}),l.translateKeys(["modules:bootbox.ok","modules:bootbox.cancel","modules:bootbox.confirm"]).then(e=>{d.addLocale(config.userLang,{OK:e[0],CANCEL:e[1],CONFIRM:e[2]}),d.setLocale(config.userLang)});async function o(e){const[s,m,b]=await Promise.all([l.translate(e.title||""),_(e)||"",M(e.buttons)]);return d.dialog({...e,title:s,message:m,buttons:b})}async function P(e,s){const[m,b]=await Promise.all([e&&e.title?l.translate(e.title):null,_(e)]);return s=typeof s=="function"?s:e.callback,d.alert({...e,title:m,message:b,callback:s})}async function w(e,s){const[m,b]=await Promise.all([e&&e.title?l.translate(e.title):null,_(e)]);return s=typeof s=="function"?s:e.callback,d.confirm({...e,title:m,message:b,callback:s})}async function g(e,s){const[m,b]=await Promise.all([l.translate(typeof e=="string"?e:e.title),e&&e.message?_(e):null]);return s=typeof s=="function"?s:e.callback,d.prompt({...e,title:m,message:b,callback:s})}async function v(e){return typeof e=="string"&&(e={title:e}),e=e||{title:"[[user:current-password]]",message:"[[user:emailUpdate.password-challenge]]"},await new Promise(s=>{g({...e,inputType:"password",required:!0,value:"",callback:s})})}function _(e){const s=e&&e.message?e.message:e;return s instanceof jQuery?s:l.translate(s||"")}async function M(e){if(!Object.keys(e||{}).length)return;const s=Object.values(e);return await Promise.all(s.map(async m=>({...m,label:await l.translateKey(m.label)})))}},68636(p,O,n){var d;d=(function(){function y(){this._store={},this._keys=[]}y.prototype.isMock=!0,y.prototype.setItem=function(o,P){o=String(o),this._keys.indexOf(o)===-1&&this._keys.push(o),this._store[o]=P},y.prototype.getItem=function(o){return o=String(o),this._keys.indexOf(o)===-1?null:this._store[o]},y.prototype.removeItem=function(o){o=String(o),this._keys=this._keys.filter(function(P){return P!==o}),this._store[o]=null},y.prototype.clear=function(){this._keys=[],this._store={}},y.prototype.key=function(o){return o=parseInt(o,10)||0,this._keys[o]},Object.defineProperty&&Object.defineProperty(y.prototype,"length",{get:function(){return this._keys.length}});let l;const f=Date.now().toString();try{if(l=window.localStorage,l.setItem(f,f),l.getItem(f)!==f)throw Error("localStorage behaved unexpectedly");return l.removeItem(f),l}catch(o){console.warn(o),console.warn("localStorage failed, falling back on sessionStorage");try{if(l=window.sessionStorage,l.setItem(f,f),l.getItem(f)!==f)throw Error("sessionStorage behaved unexpectedly");return l.removeItem(f),l}catch(P){return console.warn(P),console.warn("sessionStorage failed, falling back on memory storage"),new y}}}).call(O,n,O,p),d!==void 0&&(p.exports=d)}}]);
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.