1import objectToFormData from"object-to-form-data";const request={requestURL:(method,url,data,options)=>{var href=window.location.href,hash=window.location.hash,href=(url=new URL(url||href.substring(0,href.length-hash.length),window.location),new Promise((resolve,reject)=>{var defaultHeaders={Accept:"application/json, application/jsonl, text/html"};(options=Object.assign({method:method,mode:"same-origin",cache:"no-cache",credentials:"same-origin",headers:defaultHeaders,redirect:"follow",referrerPolicy:"no-referrer",bodyType:"form"},options)).headers=Object.assign({},defaultHeaders,options.headers||{}),"POST"===options.method?"json"!==options.bodyType||data instanceof FormData?(data instanceof FormData||(data=objectToFormData(data)),options.body=data):(options.headers["Content-Type"]="application/json",options.body=JSON.stringify(data)):(defaultHeaders=new URLSearchParams(data),url.search=defaultHeaders.toString());fetch(url,options).then(response=>{if(!(response instanceof Response))return reject(response);var contentTypes=(response.headers.get("Content-Type")||"").split("; ");if(!1===response.ok&&-1===contentTypes.indexOf("application/json")&&-1===contentTypes.indexOf("application/jsonl"))return reject(response);if(-1!==contentTypes.indexOf("application/json"))response.json().then(json=>{resolve(json,response)});else if(-1!==contentTypes.indexOf("text/html"))response.text().then(text=>{resolve(text,response)});else if(-1!==contentTypes.indexOf("application/jsonl")){const reader=response.body.getReader(),utf8decoder=new TextDecoder,dataDecode=value=>{try{return[JSON.parse(value),null]}catch(e){return console.error(e),[null,e]}};var buffer="",rStream=new ReadableStream({start(controller){!function push(){reader.read().then(({done,value})=>{var error;if(done)console.debug("Done"),buffer.trim()&&([done,error]=dataDecode(buffer),error&&console.error(error),console.debug("enqueue last",done),controller.enqueue(done)),controller.close();else{var lines=(buffer+=utf8decoder.decode(value,{stream:!0})).split("\n");for(let i=0;i<lines.length-1;i++){var line=lines[i].trim();if(line){const[decodedData,error]=dataDecode(line);error&&console.error(error),console.debug("enqueue",decodedData),controller.enqueue(decodedData)}}buffer=lines[lines.length-1],push()}})}()}}),rStream=new Response(rStream,{headers:{"Content-Type":"text/html"}});resolve(rStream.body.getReader())}else if(-1!==contentTypes.indexOf("application/octet-stream")){const reader=response.body.getReader(),utf8decoder=new TextDecoder,rStream=new ReadableStream({start(controller){!function push(){reader.read().then(({done,value})=>{value=utf8decoder.decode(value,{stream:!0}),controller.enqueue(value),done?(console.debug("Done"),controller.close()):push()})}()}}),res=new Response(rStream,{headers:{"Content-Type":"text/html"}});resolve(res.body.getReader())}else reject(new Error("Received unknown content type. ("+contentTypes.join("; ")+")"))},error=>{var host;return error instanceof TypeError&&(host=url.host===window.location.host?"":url.host,error.message+=" ["+options.method+" "+host+url.pathname+"]"),reject(error)}).catch(reject)}));return href},postURL:(url,data,options)=>request.requestURL("POST",url,data,options),post:(data,options)=>request.postURL(null,data,options),getURL:(url,data,options)=>request.requestURL("GET",url,data,options),get:(data,options)=>request.getURL(null,data,options)};export default request; 2//# sourceMappingURL=/resources/compiled/js/modules/request-promise.js.map
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.