1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[23053],{23053:(t,e,r)=>{r.r(e),r.d(e,{addAuthHeaderClient:()=>C,download:()=>P,fetchMembers:()=>j,getCommonHeaders:()=>F,getEventStatus:()=>R,logError:()=>k,logEvent:()=>A,removeAuthHeaderClient:()=>N,request:()=>b,requestMultipart:()=>T,upload:()=>S,useFetch:()=>w});var n=r(31337),o=r(65364);let a="https://api.u-school.org/api";o.env.NEXT_PUBLIC_ANALYTICS_CDN_URL,o.env.NEXT_PUBLIC_PROXY_URL,o.env.SKIP_STATIC_GENERATION,parseInt(o.env.FETCH_TIMEOUT||"10000",10);let i=new Set(["subtype","level","props"]),s=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.fromEntries(Object.entries(t).filter(t=>{let[e]=t;return!i.has(e)}))},l=RegExp("([?&](?:".concat("ct|code|token|invite",")=)([^&#\\s)\"']+)"),"gi"),c=t=>"string"==typeof t?t.replace(l,(t,e,r)=>"".concat(e).concat(r.slice(0,8),"...")):t,u=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if("string"==typeof t)return c(t);if(null===t||"object"!=typeof t||e>=6)return t;if(Array.isArray(t))return t.map(t=>u(t,e+1));let r=Object.getPrototypeOf(t);return r!==Object.prototype&&null!==r?t:Object.fromEntries(Object.entries(t).map(t=>{let[r,n]=t;return[r,u(n,e+1)]}))};r(37876),r(14232),new WeakSet;
1class h extends Error{toJson(){return{message:this.message,name:this.name,status:this.status,props:this.props}}toString(){return"".concat(this.name,": ").concat(this.message)}constructor(t,e={}){super(t),this.name="Error",this.status=500,this.message=t,this.props=e,Object.setPrototypeOf(this,h.prototype)}}class d extends h{constructor(t,e,r={}){super(e,r),this.name="FetchError",this.status=t,r.url&&(this.url=r.url),r.method&&(this.method=r.method),Object.setPrototypeOf(this,d.prototype)}}let p=async(t,e,r)=>{var n;let o,a=!1;try{o=await t.json()}catch(e){a=!0,(o={message:"Invalid response format"}).content_type=t.headers.get("content-type"),o.status_text=t.statusText}o.url=e,o.method=r;let i=["POST","PUT","DELETE"].includes(r)?"submitting":"fetching",s=a?null:o.message||(null==(n=o.error)?void 0:n.message),l=s?"".concat(s," (").concat(r," ").concat(e,")"):"An error occurred while ".concat(i," the data"),c=new d(t.status,l,o);return c.apiMessage=s||void 0,c},f=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET";return t&&"object"==typeof t&&Object.assign(t,{isNetworkError:!0,url:e,method:r}),t};r(75100),new Intl.RelativeTimeFormat("en",{numeric:"auto"});let m=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=[],r=t=>null!==t&&"object"==typeof t?"type"in t&&"id"in t?"".concat(t.type,":").concat(t.id):JSON.stringify(t):String(t);for(let[n,o]of Object.entries(t))o&&(Array.isArray(o)?o.forEach(t=>e.push("".concat(n,"[]=").concat(encodeURIComponent(r(t))))):e.push("".concat(n,"=").concat(encodeURIComponent(r(o)))));return e.join("&")};r(3422);let v=[401,403,404,410,422],g={shouldRetryOnError:!0,onErrorRetry:(t,e,r,n,o)=>{let{retryCount:a}=o;!v.includes(null==t?void 0:t.status)&&!(a>=6)&&setTimeout(()=>n({retryCount:a}),(Math.random()+.5)*Math.min(5e3*2**(a-1),6e4))}},E=async function(t,e){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw Error("invalid url");let o=e?t+"?"+m(e):t,a=n.external?{}:y;try{r=await fetch(o,{headers:a})}catch(t){throw f(t,o,"GET")}if(!r.ok)throw await p(r,o,"GET");return r.json()},y={"Content-Type":"application/json"},O=async function(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r.headers=r.headers||y;try{e=await fetch(t,r)}catch(e){throw f(e,t,r.method)}return e.ok?e.json():Promise.reject(await p(e,t,r.method))},w=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.external?t:"".concat(a).concat(t),i=t||null,s=e;e&&r.ignore&&(s={...e},r.ignore.forEach(t=>{s&&delete s[t]}));let l=s?Object.values(s).filter(t=>null!=t):[];i&&l.length&&(i=[i,...l.map(t=>String(t))]);let c={...g,fallbackData:r.fallbackData};void 0!==r.shouldRetryOnError&&(c.shouldRetryOnError=r.shouldRetryOnError),void 0!==r.revalidateOnMount&&(c.revalidateOnMount=r.revalidateOnMount),void 0!==r.revalidateIfStale&&(c.revalidateIfStale=r.revalidateIfStale),void 0!==r.revalidateOnFocus&&(c.revalidateOnFocus=r.revalidateOnFocus),void 0!==r.refreshInterval&&(c.refreshInterval=r.refreshInterval),void 0!==r.keepPreviousData&&(c.keepPreviousData=r.keepPreviousData);let{data:u,isLoading:h,error:d,mutate:p}=(0,n.u)(i,()=>E(o,s,r),c),f=!!d&&void 0!==u&&!v.includes(d.status);return{data:u,isLoading:h,isError:f?void 0:d,staleError:f?d:void 0,mutate:p}};function b(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return Promise.reject(Error("Invalid path"));let n=t.startsWith("http")?t:"".concat(a).concat(t);return r.method=r.method||"GET",e&&(r.body=JSON.stringify(e)),O(n,r)}function T(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="".concat(a).concat(t);if(r.method=r.method||"GET",e){let t=new FormData,n={},o=[];Object.keys(e).forEach(t=>{let r=e[t];if(r instanceof FileList)for(let e=0;e<r.length;e++)o.push(["files.".concat(t),r[e]]);else n[t]=r}),t.append("data",JSON.stringify(n)),o.forEach(e=>{let[r,n]=e;return t.append(r,n,n.name)}),r.body=t,r.headers={Authorization:y.Authorization}}return O(n,r)}function j(t){let{queryParams:e={},pageOffset:r=0,pageSize:n=30}=t,o=m({...e,_start:r,_limit:n});return b("/members?".concat(o))}function S(t){let e=new FormData;if(!t.files)return;if(t.files instanceof FileList)for(let r=0;r<t.files.length;r++){let n=t.files[r];e.append("files",n,n.name)}let r="".concat(a).concat(t.url);return fetch(r,{method:"POST",headers:{Authorization:y.Authorization},body:e}).catch(t=>{throw f(t,r,"POST")})}async function P(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"download";if(!t)return Promise.reject(Error("Invalid path"));let r=t.startsWith("http")?t:"".concat(a).concat(t);return fetch(r,{method:"GET",headers:{Authorization:y.Authorization}}).catch(t=>{throw f(t,r,"GET")}).then(async t=>{if(!t.ok)throw await p(t,r,"GET");return t.blob()}).then(t=>{let r=document.createElement("a");r.href=URL.createObjectURL(t),r.download=e,r.click()})}let I=new Map,_=0;function k(t){var e,r;let n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n=window.location.pathname+window.location.search+window.location.hash;let a={};
1(t.method||(null==(e=t.props)?void 0:e.method))&&(a.request_method=t.method||t.props.method),(t.url||(null==(r=t.props)?void 0:r.url))&&(a.request_url=t.url||t.props.url);let i=c(t.message),l=c(n);return!function(t){if(_>=20)return!1;let e=Date.now(),r=I.get(t);return(void 0===r||!(e-r<3e5))&&(I.set(t,e),_+=1,!0)}([t.name,t.status,o.subtype,i,l].join(" | "))?Promise.resolve(null):b("/errors",{name:t.name,message:i,subtype:o.subtype,level:o.level,status:t.status,stack:c(t.stack),url:l,props:u(Object.assign({},t.props,a,s(o),o.props))},{method:"POST"}).catch(t=>(console.warn("[logError] report not filed:",(null==t?void 0:t.message)||t),null))}function A(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return b("/event-logs",t,{method:"POST"})}function R(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=new URLSearchParams(t);return b("/event-logs/status?".concat(e.toString()),null,{method:"GET"})}function C(t){y.Authorization="Bearer ".concat(t)}function N(){delete y.Authorization}function F(){return y}}}]);
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.