@opra/client 1.27.1 → 1.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +3 -3
- package/core/backend.js +2 -0
- package/http/http-client-base.js +2 -1
- package/http/http-interceptor-handler.js +2 -0
- package/http/http-request-observable.js +2 -0
- package/http/interfaces/http-handler.js +2 -1
- package/http/interfaces/http-interceptor.js +2 -1
- package/package.json +2 -2
package/browser.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* http://www.panates.com
|
|
4
4
|
*****************************************/
|
|
5
5
|
|
|
6
|
-
var Wt=Object.create;var _=Object.defineProperty;var Yt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var Xt=(r,t,e)=>t in r?_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t)=>_(r,"name",{value:t,configurable:!0});var Q=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var Kt=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zt(t))!Vt.call(r,i)&&i!==e&&_(r,i,{get:()=>t[i],enumerable:!(n=Yt(t,i))||n.enumerable});return r};var Zt=(r,t,e)=>(e=r!=null?Wt(Jt(r)):{},Kt(t||!r||!r.__esModule?_(e,"default",{value:r,enumerable:!0}):e,r));var d=(r,t,e)=>Xt(r,typeof t!="symbol"?t+"":t,e);var gt=Q($=>{"use strict";$.byteLength=vt;$.toByteArray=ee;$.fromByteArray=ie;var F=[],w=[],Qt=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(b=0,wt=v.length;b<wt;++b)F[b]=v[b],w[v.charCodeAt(b)]=b;var b,wt;w[45]=62;w[95]=63;function Bt(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var n=e===t?0:4-e%4;return[e,n]}u(Bt,"getLens");function vt(r){var t=Bt(r),e=t[0],n=t[1];return(e+n)*3/4-n}u(vt,"byteLength");function te(r,t,e){return(t+e)*3/4-e}u(te,"_byteLength");function ee(r){var t,e=Bt(r),n=e[0],i=e[1],o=new Qt(te(r,n,i)),s=0,c=i>0?n-4:n,a;for(a=0;a<c;a+=4)t=w[r.charCodeAt(a)]<<18|w[r.charCodeAt(a+1)]<<12|w[r.charCodeAt(a+2)]<<6|w[r.charCodeAt(a+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=w[r.charCodeAt(a)]<<2|w[r.charCodeAt(a+1)]>>4,o[s++]=t&255),i===1&&(t=w[r.charCodeAt(a)]<<10|w[r.charCodeAt(a+1)]<<4|w[r.charCodeAt(a+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}u(ee,"toByteArray");function re(r){return F[r>>18&63]+F[r>>12&63]+F[r>>6&63]+F[r&63]}u(re,"tripletToBase64");function ne(r,t,e){for(var n,i=[],o=t;o<e;o+=3)n=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),i.push(re(n));return i.join("")}u(ne,"encodeChunk");function ie(r){for(var t,e=r.length,n=e%3,i=[],o=16383,s=0,c=e-n;s<c;s+=o)i.push(ne(r,s,s+o>c?c:s+o));return n===1?(t=r[e-1],i.push(F[t>>2]+F[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],i.push(F[t>>10]+F[t>>4&63]+F[t<<2&63]+"=")),i.join("")}u(ie,"fromByteArray")});var Et=Q(tt=>{"use strict";tt.read=function(r,t,e,n,i){var o,s,c=i*8-n-1,a=(1<<c)-1,l=a>>1,f=-7,p=e?i-1:0,I=e?-1:1,x=r[t+p];for(p+=I,o=x&(1<<-f)-1,x>>=-f,f+=c;f>0;o=o*256+r[t+p],p+=I,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+r[t+p],p+=I,f-=8);if(o===0)o=1-l;else{if(o===a)return s?NaN:(x?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(x?-1:1)*s*Math.pow(2,o-n)};tt.write=function(r,t,e,n,i,o){var s,c,a,l=o*8-i-1,f=(1<<l)-1,p=f>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:o-1,S=n?1:-1,C=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-s))<1&&(s--,a*=2),s+p>=1?t+=I/a:t+=I*Math.pow(2,1-p),t*a>=2&&(s++,a/=2),s+p>=f?(c=0,s=f):s+p>=1?(c=(t*a-1)*Math.pow(2,i),s=s+p):(c=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;r[e+x]=c&255,x+=S,c/=256,i-=8);for(s=s<<i|c,l+=i;l>0;r[e+x]=s&255,x+=S,s/=256,l-=8);r[e+x-S]|=C*128}});var $t=Q(N=>{"use strict";var et=gt(),P=Et(),It=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=h;N.SlowBuffer=ae;N.INSPECT_MAX_BYTES=50;var O=2147483647;N.kMaxLength=O;h.TYPED_ARRAY_SUPPORT=oe();!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function oe(){try{let r=new Uint8Array(1),t={foo:u(function(){return 42},"foo")};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}u(oe,"typedArraySupport");Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:u(function(){if(h.isBuffer(this))return this.buffer},"get")});Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:u(function(){if(h.isBuffer(this))return this.byteOffset},"get")});function R(r){if(r>O)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,h.prototype),t}u(R,"createBuffer");function h(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ot(r)}return Rt(r,t,e)}u(h,"Buffer");h.poolSize=8192;function Rt(r,t,e){if(typeof r=="string")return ue(r,t);if(ArrayBuffer.isView(r))return he(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(U(r,ArrayBuffer)||r&&U(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(U(r,SharedArrayBuffer)||r&&U(r.buffer,SharedArrayBuffer)))return nt(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return h.from(n,t,e);let i=ce(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return h.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}u(Rt,"from");h.from=function(r,t,e){return Rt(r,t,e)};Object.setPrototypeOf(h.prototype,Uint8Array.prototype);Object.setPrototypeOf(h,Uint8Array);function Tt(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}u(Tt,"assertSize");function se(r,t,e){return Tt(r),r<=0?R(r):t!==void 0?typeof e=="string"?R(r).fill(t,e):R(r).fill(t):R(r)}u(se,"alloc");h.alloc=function(r,t,e){return se(r,t,e)};function ot(r){return Tt(r),R(r<0?0:st(r)|0)}u(ot,"allocUnsafe");h.allocUnsafe=function(r){return ot(r)};h.allocUnsafeSlow=function(r){return ot(r)};function ue(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=St(r,t)|0,n=R(e),i=n.write(r,t);return i!==e&&(n=n.slice(0,i)),n}u(ue,"fromString");function rt(r){let t=r.length<0?0:st(r.length)|0,e=R(t);for(let n=0;n<t;n+=1)e[n]=r[n]&255;return e}u(rt,"fromArrayLike");function he(r){if(U(r,Uint8Array)){let t=new Uint8Array(r);return nt(t.buffer,t.byteOffset,t.byteLength)}return rt(r)}u(he,"fromArrayView");function nt(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&e===void 0?n=new Uint8Array(r):e===void 0?n=new Uint8Array(r,t):n=new Uint8Array(r,t,e),Object.setPrototypeOf(n,h.prototype),n}u(nt,"fromArrayBuffer");function ce(r){if(h.isBuffer(r)){let t=st(r.length)|0,e=R(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||ht(r.length)?R(0):rt(r);if(r.type==="Buffer"&&Array.isArray(r.data))return rt(r.data)}u(ce,"fromObject");function st(r){if(r>=O)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+O.toString(16)+" bytes");return r|0}u(st,"checked");function ae(r){return+r!=r&&(r=0),h.alloc(+r)}u(ae,"SlowBuffer");h.isBuffer=u(function(t){return t!=null&&t._isBuffer===!0&&t!==h.prototype},"isBuffer");h.compare=u(function(t,e){if(U(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),U(e,Uint8Array)&&(e=h.from(e,e.offset,e.byteLength)),!h.isBuffer(t)||!h.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==e[o]){n=t[o],i=e[o];break}return n<i?-1:i<n?1:0},"compare");h.isEncoding=u(function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");h.concat=u(function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return h.alloc(0);let n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;let i=h.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){let s=t[n];if(U(s,Uint8Array))o+s.length>i.length?(h.isBuffer(s)||(s=h.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(h.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i},"concat");function St(r,t){if(h.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||U(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&e===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return it(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return _t(r).length;default:if(i)return n?-1:it(r).length;t=(""+t).toLowerCase(),i=!0}}u(St,"byteLength");h.byteLength=St;function fe(r,t,e){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ee(this,t,e);case"utf8":case"utf-8":return bt(this,t,e);case"ascii":return Be(this,t,e);case"latin1":case"binary":return ge(this,t,e);case"base64":return me(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}u(fe,"slowToString");h.prototype._isBuffer=!0;function L(r,t,e){let n=r[t];r[t]=r[e],r[e]=n}u(L,"swap");h.prototype.swap16=u(function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)L(this,e,e+1);return this},"swap16");h.prototype.swap32=u(function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)L(this,e,e+3),L(this,e+1,e+2);return this},"swap32");h.prototype.swap64=u(function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)L(this,e,e+7),L(this,e+1,e+6),L(this,e+2,e+5),L(this,e+3,e+4);return this},"swap64");h.prototype.toString=u(function(){let t=this.length;return t===0?"":arguments.length===0?bt(this,0,t):fe.apply(this,arguments)},"toString");h.prototype.toLocaleString=h.prototype.toString;h.prototype.equals=u(function(t){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:h.compare(this,t)===0},"equals");h.prototype.inspect=u(function(){let t="",e=N.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},"inspect");It&&(h.prototype[It]=h.prototype.inspect);h.prototype.compare=u(function(t,e,n,i,o){if(U(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,c=n-e,a=Math.min(s,c),l=this.slice(i,o),f=t.slice(e,n);for(let p=0;p<a;++p)if(l[p]!==f[p]){s=l[p],c=f[p];break}return s<c?-1:c<s?1:0},"compare");function Ct(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,ht(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=h.from(t,n)),h.isBuffer(t))return t.length===0?-1:Ft(r,t,e,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Ft(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}u(Ct,"bidirectionalIndexOf");function Ft(r,t,e,n,i){let o=1,s=r.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;o=2,s/=2,c/=2,e/=2}function a(f,p){return o===1?f[p]:f.readUInt16BE(p*o)}u(a,"read");let l;if(i){let f=-1;for(l=e;l<s;l++)if(a(r,l)===a(t,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===c)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(e+c>s&&(e=s-c),l=e;l>=0;l--){let f=!0;for(let p=0;p<c;p++)if(a(r,l+p)!==a(t,p)){f=!1;break}if(f)return l}return-1}u(Ft,"arrayIndexOf");h.prototype.includes=u(function(t,e,n){return this.indexOf(t,e,n)!==-1},"includes");h.prototype.indexOf=u(function(t,e,n){return Ct(this,t,e,n,!0)},"indexOf");h.prototype.lastIndexOf=u(function(t,e,n){return Ct(this,t,e,n,!1)},"lastIndexOf");function pe(r,t,e,n){e=Number(e)||0;let i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;let o=t.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let c=parseInt(t.substr(s*2,2),16);if(ht(c))return s;r[e+s]=c}return s}u(pe,"hexWrite");function le(r,t,e,n){return q(it(t,r.length-e),r,e,n)}u(le,"utf8Write");function de(r,t,e,n){return q(Re(t),r,e,n)}u(de,"asciiWrite");function ye(r,t,e,n){return q(_t(t),r,e,n)}u(ye,"base64Write");function xe(r,t,e,n){return q(Te(t,r.length-e),r,e,n)}u(xe,"ucs2Write");h.prototype.write=u(function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-e;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return pe(this,t,e,n);case"utf8":case"utf-8":return le(this,t,e,n);case"ascii":case"latin1":case"binary":return de(this,t,e,n);case"base64":return ye(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xe(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},"write");h.prototype.toJSON=u(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function me(r,t,e){return t===0&&e===r.length?et.fromByteArray(r):et.fromByteArray(r.slice(t,e))}u(me,"base64Slice");function bt(r,t,e){e=Math.min(r.length,e);let n=[],i=t;for(;i<e;){let o=r[i],s=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=e){let a,l,f,p;switch(c){case 1:o<128&&(s=o);break;case 2:a=r[i+1],(a&192)===128&&(p=(o&31)<<6|a&63,p>127&&(s=p));break;case 3:a=r[i+1],l=r[i+2],(a&192)===128&&(l&192)===128&&(p=(o&15)<<12|(a&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:a=r[i+1],l=r[i+2],f=r[i+3],(a&192)===128&&(l&192)===128&&(f&192)===128&&(p=(o&15)<<18|(a&63)<<12|(l&63)<<6|f&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=c}return we(n)}u(bt,"utf8Slice");var Ut=4096;function we(r){let t=r.length;if(t<=Ut)return String.fromCharCode.apply(String,r);let e="",n=0;for(;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Ut));return e}u(we,"decodeCodePointsArray");function Be(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}u(Be,"asciiSlice");function ge(r,t,e){let n="";e=Math.min(r.length,e);for(let i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}u(ge,"latin1Slice");function Ee(r,t,e){let n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);let i="";for(let o=t;o<e;++o)i+=Se[r[o]];return i}u(Ee,"hexSlice");function Ie(r,t,e){let n=r.slice(t,e),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u(Ie,"utf16leSlice");h.prototype.slice=u(function(t,e){let n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,h.prototype),i},"slice");function y(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}u(y,"checkOffset");h.prototype.readUintLE=h.prototype.readUIntLE=u(function(t,e,n){t=t>>>0,e=e>>>0,n||y(t,e,this.length);let i=this[t],o=1,s=0;for(;++s<e&&(o*=256);)i+=this[t+s]*o;return i},"readUIntLE");h.prototype.readUintBE=h.prototype.readUIntBE=u(function(t,e,n){t=t>>>0,e=e>>>0,n||y(t,e,this.length);let i=this[t+--e],o=1;for(;e>0&&(o*=256);)i+=this[t+--e]*o;return i},"readUIntBE");h.prototype.readUint8=h.prototype.readUInt8=u(function(t,e){return t=t>>>0,e||y(t,1,this.length),this[t]},"readUInt8");h.prototype.readUint16LE=h.prototype.readUInt16LE=u(function(t,e){return t=t>>>0,e||y(t,2,this.length),this[t]|this[t+1]<<8},"readUInt16LE");h.prototype.readUint16BE=h.prototype.readUInt16BE=u(function(t,e){return t=t>>>0,e||y(t,2,this.length),this[t]<<8|this[t+1]},"readUInt16BE");h.prototype.readUint32LE=h.prototype.readUInt32LE=u(function(t,e){return t=t>>>0,e||y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},"readUInt32LE");h.prototype.readUint32BE=h.prototype.readUInt32BE=u(function(t,e){return t=t>>>0,e||y(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},"readUInt32BE");h.prototype.readBigUInt64LE=T(u(function(t){t=t>>>0,D(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&M(t,this.length-8);let i=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))},"readBigUInt64LE"));h.prototype.readBigUInt64BE=T(u(function(t){t=t>>>0,D(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&M(t,this.length-8);let i=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)},"readBigUInt64BE"));h.prototype.readIntLE=u(function(t,e,n){t=t>>>0,e=e>>>0,n||y(t,e,this.length);let i=this[t],o=1,s=0;for(;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},"readIntLE");h.prototype.readIntBE=u(function(t,e,n){t=t>>>0,e=e>>>0,n||y(t,e,this.length);let i=e,o=1,s=this[t+--i];for(;i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s},"readIntBE");h.prototype.readInt8=u(function(t,e){return t=t>>>0,e||y(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},"readInt8");h.prototype.readInt16LE=u(function(t,e){t=t>>>0,e||y(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},"readInt16LE");h.prototype.readInt16BE=u(function(t,e){t=t>>>0,e||y(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},"readInt16BE");h.prototype.readInt32LE=u(function(t,e){return t=t>>>0,e||y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},"readInt32LE");h.prototype.readInt32BE=u(function(t,e){return t=t>>>0,e||y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},"readInt32BE");h.prototype.readBigInt64LE=T(u(function(t){t=t>>>0,D(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&M(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)},"readBigInt64LE"));h.prototype.readBigInt64BE=T(u(function(t){t=t>>>0,D(t,"offset");let e=this[t],n=this[t+7];(e===void 0||n===void 0)&&M(t,this.length-8);let i=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)},"readBigInt64BE"));h.prototype.readFloatLE=u(function(t,e){return t=t>>>0,e||y(t,4,this.length),P.read(this,t,!0,23,4)},"readFloatLE");h.prototype.readFloatBE=u(function(t,e){return t=t>>>0,e||y(t,4,this.length),P.read(this,t,!1,23,4)},"readFloatBE");h.prototype.readDoubleLE=u(function(t,e){return t=t>>>0,e||y(t,8,this.length),P.read(this,t,!0,52,8)},"readDoubleLE");h.prototype.readDoubleBE=u(function(t,e){return t=t>>>0,e||y(t,8,this.length),P.read(this,t,!1,52,8)},"readDoubleBE");function m(r,t,e,n,i,o){if(!h.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}u(m,"checkInt");h.prototype.writeUintLE=h.prototype.writeUIntLE=u(function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;m(this,t,e,n,c,0)}let o=1,s=0;for(this[e]=t&255;++s<n&&(o*=256);)this[e+s]=t/o&255;return e+n},"writeUIntLE");h.prototype.writeUintBE=h.prototype.writeUIntBE=u(function(t,e,n,i){if(t=+t,e=e>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;m(this,t,e,n,c,0)}let o=n-1,s=1;for(this[e+o]=t&255;--o>=0&&(s*=256);)this[e+o]=t/s&255;return e+n},"writeUIntBE");h.prototype.writeUint8=h.prototype.writeUInt8=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,1,255,0),this[e]=t&255,e+1},"writeUInt8");h.prototype.writeUint16LE=h.prototype.writeUInt16LE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2},"writeUInt16LE");h.prototype.writeUint16BE=h.prototype.writeUInt16BE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2},"writeUInt16BE");h.prototype.writeUint32LE=h.prototype.writeUInt32LE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4},"writeUInt32LE");h.prototype.writeUint32BE=h.prototype.writeUInt32BE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},"writeUInt32BE");function Lt(r,t,e,n,i){Mt(t,n,i,r,e,7);let o=Number(t&BigInt(4294967295));r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,e}u(Lt,"wrtBigUInt64LE");function kt(r,t,e,n,i){Mt(t,n,i,r,e,7);let o=Number(t&BigInt(4294967295));r[e+7]=o,o=o>>8,r[e+6]=o,o=o>>8,r[e+5]=o,o=o>>8,r[e+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=s,s=s>>8,r[e+2]=s,s=s>>8,r[e+1]=s,s=s>>8,r[e]=s,e+8}u(kt,"wrtBigUInt64BE");h.prototype.writeBigUInt64LE=T(u(function(t,e=0){return Lt(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE"));h.prototype.writeBigUInt64BE=T(u(function(t,e=0){return kt(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));h.prototype.writeIntLE=u(function(t,e,n,i){if(t=+t,e=e>>>0,!i){let a=Math.pow(2,8*n-1);m(this,t,e,n,a-1,-a)}let o=0,s=1,c=0;for(this[e]=t&255;++o<n&&(s*=256);)t<0&&c===0&&this[e+o-1]!==0&&(c=1),this[e+o]=(t/s>>0)-c&255;return e+n},"writeIntLE");h.prototype.writeIntBE=u(function(t,e,n,i){if(t=+t,e=e>>>0,!i){let a=Math.pow(2,8*n-1);m(this,t,e,n,a-1,-a)}let o=n-1,s=1,c=0;for(this[e+o]=t&255;--o>=0&&(s*=256);)t<0&&c===0&&this[e+o+1]!==0&&(c=1),this[e+o]=(t/s>>0)-c&255;return e+n},"writeIntBE");h.prototype.writeInt8=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1},"writeInt8");h.prototype.writeInt16LE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2},"writeInt16LE");h.prototype.writeInt16BE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2},"writeInt16BE");h.prototype.writeInt32LE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},"writeInt32LE");h.prototype.writeInt32BE=u(function(t,e,n){return t=+t,e=e>>>0,n||m(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},"writeInt32BE");h.prototype.writeBigInt64LE=T(u(function(t,e=0){return Lt(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));h.prototype.writeBigInt64BE=T(u(function(t,e=0){return kt(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Pt(r,t,e,n,i,o){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}u(Pt,"checkIEEE754");function Dt(r,t,e,n,i){return t=+t,e=e>>>0,i||Pt(r,t,e,4,34028234663852886e22,-34028234663852886e22),P.write(r,t,e,n,23,4),e+4}u(Dt,"writeFloat");h.prototype.writeFloatLE=u(function(t,e,n){return Dt(this,t,e,!0,n)},"writeFloatLE");h.prototype.writeFloatBE=u(function(t,e,n){return Dt(this,t,e,!1,n)},"writeFloatBE");function Nt(r,t,e,n,i){return t=+t,e=e>>>0,i||Pt(r,t,e,8,17976931348623157e292,-17976931348623157e292),P.write(r,t,e,n,52,8),e+8}u(Nt,"writeDouble");h.prototype.writeDoubleLE=u(function(t,e,n){return Nt(this,t,e,!0,n)},"writeDoubleLE");h.prototype.writeDoubleBE=u(function(t,e,n){return Nt(this,t,e,!1,n)},"writeDoubleBE");h.prototype.copy=u(function(t,e,n,i){if(!h.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);let o=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),o},"copy");h.prototype.fill=u(function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!h.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let o;if(typeof t=="number")for(o=e;o<n;++o)this[o]=t;else{let s=h.isBuffer(t)?t:h.from(t,i),c=s.length;if(c===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-e;++o)this[o+e]=s[o%c]}return this},"fill");var k={};function ut(r,t,e){var n;k[r]=(n=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}},u(n,"NodeError"),n)}u(ut,"E");ut("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ut("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);ut("ERR_OUT_OF_RANGE",function(r,t,e){let n=`The value of "${r}" is out of range.`,i=e;return Number.isInteger(e)&&Math.abs(e)>2**32?i=At(String(e)):typeof e=="bigint"&&(i=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(i=At(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function At(r){let t="",e=r.length,n=r[0]==="-"?1:0;for(;e>=n+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}u(At,"addNumericalSeparator");function Fe(r,t,e){D(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&M(t,r.length-(e+1))}u(Fe,"checkBounds");function Mt(r,t,e,n,i,o){if(r>e||r<t){let s=typeof t=="bigint"?"n":"",c;throw o>3?t===0||t===BigInt(0)?c=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:c=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:c=`>= ${t}${s} and <= ${e}${s}`,new k.ERR_OUT_OF_RANGE("value",c,r)}Fe(n,i,o)}u(Mt,"checkIntBI");function D(r,t){if(typeof r!="number")throw new k.ERR_INVALID_ARG_TYPE(t,"number",r)}u(D,"validateNumber");function M(r,t,e){throw Math.floor(r)!==r?(D(r,e),new k.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new k.ERR_BUFFER_OUT_OF_BOUNDS:new k.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}u(M,"boundsError");var Ue=/[^+/0-9A-Za-z-_]/g;function Ae(r){if(r=r.split("=")[0],r=r.trim().replace(Ue,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}u(Ae,"base64clean");function it(r,t){t=t||1/0;let e,n=r.length,i=null,o=[];for(let s=0;s<n;++s){if(e=r.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}u(it,"utf8ToBytes");function Re(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}u(Re,"asciiToBytes");function Te(r,t){let e,n,i,o=[];for(let s=0;s<r.length&&!((t-=2)<0);++s)e=r.charCodeAt(s),n=e>>8,i=e%256,o.push(i),o.push(n);return o}u(Te,"utf16leToBytes");function _t(r){return et.toByteArray(Ae(r))}u(_t,"base64ToBytes");function q(r,t,e,n){let i;for(i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}u(q,"blitBuffer");function U(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}u(U,"isInstance");function ht(r){return r!==r}u(ht,"numberIsNaN");var Se=(function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let n=e*16;for(let i=0;i<16;++i)t[n+i]=r[e]+r[i]}return t})();function T(r){return typeof BigInt>"u"?Ce:r}u(T,"defineBigIntMethod");function Ce(){throw new Error("BigInt not supported")}u(Ce,"BufferBigIntNotDefined")});var Ht=Zt($t(),1);var be=Symbol.for("kClient"),B=Symbol.for("kBackend"),g=Symbol.for("kContext");var ct=class ct{constructor(t){d(this,"document");this.document=t?.document}};u(ct,"Backend");var j=ct;var at=class at extends Error{constructor(e,n){super(e.message);d(this,"cause");d(this,"issues");d(this,"status");this.cause=n,this.issues=e.issues||[],this.status=e.status,n&&(this.cause=n,n.stack&&(this.stack=n.stack))}};u(at,"ClientError");var H=at;var A;(function(r){r.ResponseHeader="response-header",r.Response="response",r.Body="body",r.Events="events"})(A||(A={}));import pt from"@browsery/type-is";import{omit as Le}from"@jsopen/objects";import{isBlob as ke,isFormData as Pe}from"@opra/common";import{Observable as De}from"rxjs";import{isReadableStreamLike as Ne}from"rxjs/internal/util/isReadableStreamLike";var ft=class ft extends j{constructor(e,n){super(n);d(this,"serviceUrl");d(this,"interceptors");let i=new URL(e);this.serviceUrl=i.toString().split("?")[0].split("#")[0],this.serviceUrl.endsWith("/")||(this.serviceUrl+="/")}};u(ft,"HttpBackend");var G=ft;var Y=class Y{constructor(t){d(this,"headers");d(this,"ok");d(this,"status");d(this,"statusText");d(this,"url");d(this,"body");d(this,"contentType");d(this,"hasBody",!1);this.headers=t?.headers instanceof Headers?t?.headers:new Headers(t?.headers),this.status=t?.status||200,this.statusText=t?.statusText||"OK",this.url=t?.url||null,this.ok=this.status>=200&&this.status<300,this.body=t?.body,this.hasBody=t?.body!=null||!!t?.hasBody,this.contentType=(this.headers.get("content-type")||"").split(";")[0]}clone(t){return new Y({...this,...t})}};u(Y,"HttpResponse");var W=Y;var E;(function(r){r.Sent="Sent",r.UploadProgress="UploadProgress",r.ResponseHeader="ResponseHeader",r.DownloadProgress="DownloadProgress",r.Response="Response",r.User="User"})(E||(E={}));var lt=class lt extends G{constructor(e,n){super(e,n);d(this,"interceptors");d(this,"defaults");this.interceptors=Array.from(new Set([...n?.interceptors||[]])),this.defaults={...n?.defaults,headers:n?.defaults?.headers instanceof Headers?n?.defaults?.headers:new Headers(n?.defaults?.headers),params:n?.defaults?.params instanceof URLSearchParams?n?.defaults?.params:new URLSearchParams(n?.defaults?.params)}}handle(e){return new De(n=>{(async()=>{let i=this.prepareRequest(e);if(i.body&&e.reportProgress){let f=i.body,p=i.headers.get("content-length")||"0",I=parseInt(p,10)||0,x=0,S=new TransformStream({transform(C,Z){Z.enqueue(C),x+=C.byteLength,n.next({type:E.UploadProgress,request:i,total:I,loaded:x})}});i=new Request(i.url,{cache:i.cache,credentials:i.credentials,headers:i.headers,integrity:i.integrity,keepalive:i.keepalive,method:i.method,mode:i.mode,redirect:i.redirect,referrer:i.referrer,referrerPolicy:i.referrerPolicy,signal:i.signal,body:f.pipeThrough(S),window:e.window,duplex:"half"})}let o=this.send(i);n.next({request:i,type:E.Sent});let s=await o,c=this.createResponse({url:s.url,headers:s.headers,status:s.status,statusText:s.statusText,hasBody:!!s.body});n.next({request:i,type:E.ResponseHeader,response:c});let a;if(s.body)if(e.reportProgress){let f=s.body,p=s.headers.get("content-length")||"0",I=parseInt(p,10)||0,x=0,S=new Response(new ReadableStream({async start(C){let Z=f.getReader();for(;;){let{done:Gt,value:mt}=await Z.read();if(Gt)break;x+=mt.byteLength,C.enqueue(mt),n.next({type:E.DownloadProgress,request:i,total:I,loaded:x})}C.close()}}));a=await this.parseBody(S)}else a=await this.parseBody(s);let l=this.createResponse({url:s.url,headers:s.headers,status:s.status,statusText:s.statusText,body:a});n.next({request:i,type:E.Response,response:l}),n.complete()})().catch(i=>n.error(i))})}send(e){return fetch(e)}prepareRequest(e){let n=e.headers||new Headers,i={...e,...Le(this.defaults,["headers","params"]),headers:n};this.defaults.headers.forEach((c,a)=>{n.has(a)||n.set(a,c)});let o=new URL(i.url,this.serviceUrl);this.defaults.params.size&&(this.defaults.params.forEach((c,a)=>{o.searchParams.has(a)||o.searchParams.set(a,c)}),i.url=o.toString());let s=i.body;if(s){let c="";typeof s=="string"||typeof s=="number"||typeof s=="boolean"?(c='text/plain; charset="UTF-8"',i.body=new Blob([String(s)],{type:c}),n.set("Content-Length",String(i.body.size)),delete i.duplex):Ne(s)?(c="application/octet-stream",i.duplex="half"):Buffer.isBuffer(s)?(c="application/octet-stream",n.set("Content-Length",String(s.length)),delete i.duplex):ke(s)?(c=s.type||"application/octet-stream",n.set("Content-Length",String(s.size)),delete i.duplex):(Pe(s)||(c='application/json;charset="UTF-8"',i.body=new Blob([JSON.stringify(s)],{type:c}),n.set("Content-Length",String(i.body.size))),delete i.duplex),c&&!n.has("Content-Type")&&n.set("Content-Type",c)}return new Request(o.toString(),i)}createResponse(e){return new W(e)}async parseBody(e){let n,i=e.headers.get("Content-Type")||"";if(pt.is(i,["json","application/*+json"]))n=await e.json(),typeof n=="string"&&(n=JSON.parse(n));else if(pt.is(i,["text"]))n=await e.text();else if(pt.is(i,["multipart"]))n=await e.formData();else{let o=await e.arrayBuffer();o.byteLength&&(n=o)}return n}};u(lt,"FetchBackend");var z=lt;import{updateErrorMessage as qt}from"@jsopen/objects";import{ApiDocumentFactory as qe}from"@opra/common";import _e from"@browsery/type-is";import{MimeTypes as $e}from"@opra/common";import{lastValueFrom as Ot,Observable as Oe}from"rxjs";var dt=class dt{constructor(t,e){d(this,"chain");d(this,"finalHandler");this.chain=t.reduceRight((n,i)=>(o,s)=>i.intercept(o,{handle:u(c=>n(c,s),"handle")}),Me),this.finalHandler=e}handle(t){return this.chain(t,e=>this.finalHandler.handle(e))}};u(dt,"HttpInterceptorHandler");var J=dt;function Me(r,t){return t(r)}u(Me,"chainEnd");var X=class X extends Oe{constructor(t,e){super(n=>{let i=this[g].observe;new J(t.interceptors||[],this[B]).handle(this[g]).subscribe({next(o){if(i===A.Events){n.next(o);return}if(i===A.ResponseHeader&&o.type===E.ResponseHeader){n.next(o.response),n.complete();return}if(o.type===E.Response){let{response:s}=o;if(i===A.Response){n.next(s),n.complete();return}let c=_e.is(o.response.contentType||"",[$e.opra_response_json]);if(s.status>=400&&s.status<600){n.error(new H({message:s.status+" "+s.statusText,status:s.status,issues:c?s.body.errors:void 0})),n.complete();return}n.next(o.response.body),n.complete()}},error(o){n.error(o)},complete(){n.complete()}})}),Object.defineProperty(this,B,{enumerable:!1,value:t}),Object.defineProperty(this,g,{enumerable:!1,value:{...e,observe:A.Body,headers:new Headers(e?.headers)}})}clone(){return new X(this[B],this[g])}options(t){return Object.assign(this[g],t),this}header(t,e){let n=this[g].headers;return typeof t=="object"?((t instanceof Headers?t:new Headers(t)).forEach((o,s)=>{s.toLowerCase()==="set-cookie"?n.append(s,o):n.set(s,o)}),this):(e==null||e===""?n.delete(t):n.append(t,String(e)),this)}param(t,e){e&&typeof e=="object"&&(e=JSON.stringify(e));let n=this[g].url.searchParams;return typeof t=="object"?(typeof t.forEach=="function"?t.forEach((i,o)=>n.set(String(o),String(i))):Object.entries(t).forEach(i=>n.set(String(i[0]),String(i[1]))),this):(e==null?n.delete(t):n.set(t,String(e)),this)}observe(t){if(t===this[g].observe)return this;let e=this.clone();return e[g].observe=t||A.Body,e}getBody(){return Ot(this.observe(A.Body))}getResponse(){return Ot(this.observe(A.Response))}};u(X,"HttpRequestObservable");var V=X;var je=/^(\/*)(.+)/,yt=class yt{constructor(t){Object.defineProperty(this,B,{enumerable:!1,value:t})}get serviceUrl(){return this[B].serviceUrl}async fetchDocument(t){let e={},n=u(async o=>{let s=this.request("$schema",{headers:new Headers({accept:"application/json"})});o&&s.param("id",o);let c=await s.getBody().catch(a=>{throw qt(a,"Error fetching api schema from url ("+this.serviceUrl+`).
|
|
7
|
-
`+a.message),a});if(c.references){let a=c.references;c.references={};for(let[l,f]of Object.entries(a)){if(
|
|
8
|
-
`+o.message),o})}request(t,
|
|
6
|
+
var Wt=Object.create;var _=Object.defineProperty;var Yt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var Xt=(e,t,r)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var u=(e,t)=>_(e,"name",{value:t,configurable:!0});var Q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Kt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zt(t))!Vt.call(e,i)&&i!==r&&_(e,i,{get:()=>t[i],enumerable:!(n=Yt(t,i))||n.enumerable});return e};var Zt=(e,t,r)=>(r=e!=null?Wt(Jt(e)):{},Kt(t||!e||!e.__esModule?_(r,"default",{value:e,enumerable:!0}):r,e));var d=(e,t,r)=>Xt(e,typeof t!="symbol"?t+"":t,r);var gt=Q($=>{"use strict";$.byteLength=vt;$.toByteArray=rr;$.fromByteArray=ir;var F=[],w=[],Qt=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(b=0,wt=v.length;b<wt;++b)F[b]=v[b],w[v.charCodeAt(b)]=b;var b,wt;w[45]=62;w[95]=63;function Bt(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}u(Bt,"getLens");function vt(e){var t=Bt(e),r=t[0],n=t[1];return(r+n)*3/4-n}u(vt,"byteLength");function tr(e,t,r){return(t+r)*3/4-r}u(tr,"_byteLength");function rr(e){var t,r=Bt(e),n=r[0],i=r[1],o=new Qt(tr(e,n,i)),s=0,c=i>0?n-4:n,a;for(a=0;a<c;a+=4)t=w[e.charCodeAt(a)]<<18|w[e.charCodeAt(a+1)]<<12|w[e.charCodeAt(a+2)]<<6|w[e.charCodeAt(a+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=w[e.charCodeAt(a)]<<2|w[e.charCodeAt(a+1)]>>4,o[s++]=t&255),i===1&&(t=w[e.charCodeAt(a)]<<10|w[e.charCodeAt(a+1)]<<4|w[e.charCodeAt(a+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}u(rr,"toByteArray");function er(e){return F[e>>18&63]+F[e>>12&63]+F[e>>6&63]+F[e&63]}u(er,"tripletToBase64");function nr(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),i.push(er(n));return i.join("")}u(nr,"encodeChunk");function ir(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,c=r-n;s<c;s+=o)i.push(nr(e,s,s+o>c?c:s+o));return n===1?(t=e[r-1],i.push(F[t>>2]+F[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(F[t>>10]+F[t>>4&63]+F[t<<2&63]+"=")),i.join("")}u(ir,"fromByteArray")});var Et=Q(tt=>{"use strict";tt.read=function(e,t,r,n,i){var o,s,c=i*8-n-1,a=(1<<c)-1,l=a>>1,f=-7,p=r?i-1:0,I=r?-1:1,m=e[t+p];for(p+=I,o=m&(1<<-f)-1,m>>=-f,f+=c;f>0;o=o*256+e[t+p],p+=I,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+e[t+p],p+=I,f-=8);if(o===0)o=1-l;else{if(o===a)return s?NaN:(m?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-l}return(m?-1:1)*s*Math.pow(2,o-n)};tt.write=function(e,t,r,n,i,o){var s,c,a,l=o*8-i-1,f=(1<<l)-1,p=f>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:o-1,S=n?1:-1,C=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-s))<1&&(s--,a*=2),s+p>=1?t+=I/a:t+=I*Math.pow(2,1-p),t*a>=2&&(s++,a/=2),s+p>=f?(c=0,s=f):s+p>=1?(c=(t*a-1)*Math.pow(2,i),s=s+p):(c=t*Math.pow(2,p-1)*Math.pow(2,i),s=0));i>=8;e[r+m]=c&255,m+=S,c/=256,i-=8);for(s=s<<i|c,l+=i;l>0;e[r+m]=s&255,m+=S,s/=256,l-=8);e[r+m-S]|=C*128}});var $t=Q(N=>{"use strict";var rt=gt(),P=Et(),It=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;N.Buffer=h;N.SlowBuffer=ar;N.INSPECT_MAX_BYTES=50;var O=2147483647;N.kMaxLength=O;h.TYPED_ARRAY_SUPPORT=or();!h.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function or(){try{let e=new Uint8Array(1),t={foo:u(function(){return 42},"foo")};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}u(or,"typedArraySupport");Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:u(function(){if(h.isBuffer(this))return this.buffer},"get")});Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:u(function(){if(h.isBuffer(this))return this.byteOffset},"get")});function R(e){if(e>O)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,h.prototype),t}u(R,"createBuffer");function h(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ot(e)}return Rt(e,t,r)}u(h,"Buffer");h.poolSize=8192;function Rt(e,t,r){if(typeof e=="string")return ur(e,t);if(ArrayBuffer.isView(e))return hr(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(U(e,ArrayBuffer)||e&&U(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(U(e,SharedArrayBuffer)||e&&U(e.buffer,SharedArrayBuffer)))return nt(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return h.from(n,t,r);let i=cr(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return h.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}u(Rt,"from");h.from=function(e,t,r){return Rt(e,t,r)};Object.setPrototypeOf(h.prototype,Uint8Array.prototype);Object.setPrototypeOf(h,Uint8Array);function Tt(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}u(Tt,"assertSize");function sr(e,t,r){return Tt(e),e<=0?R(e):t!==void 0?typeof r=="string"?R(e).fill(t,r):R(e).fill(t):R(e)}u(sr,"alloc");h.alloc=function(e,t,r){return sr(e,t,r)};function ot(e){return Tt(e),R(e<0?0:st(e)|0)}u(ot,"allocUnsafe");h.allocUnsafe=function(e){return ot(e)};h.allocUnsafeSlow=function(e){return ot(e)};function ur(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=St(e,t)|0,n=R(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}u(ur,"fromString");function et(e){let t=e.length<0?0:st(e.length)|0,r=R(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}u(et,"fromArrayLike");function hr(e){if(U(e,Uint8Array)){let t=new Uint8Array(e);return nt(t.buffer,t.byteOffset,t.byteLength)}return et(e)}u(hr,"fromArrayView");function nt(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,h.prototype),n}u(nt,"fromArrayBuffer");function cr(e){if(h.isBuffer(e)){let t=st(e.length)|0,r=R(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||ht(e.length)?R(0):et(e);if(e.type==="Buffer"&&Array.isArray(e.data))return et(e.data)}u(cr,"fromObject");function st(e){if(e>=O)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+O.toString(16)+" bytes");return e|0}u(st,"checked");function ar(e){return+e!=e&&(e=0),h.alloc(+e)}u(ar,"SlowBuffer");h.isBuffer=u(function(t){return t!=null&&t._isBuffer===!0&&t!==h.prototype},"isBuffer");h.compare=u(function(t,r){if(U(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),U(r,Uint8Array)&&(r=h.from(r,r.offset,r.byteLength)),!h.isBuffer(t)||!h.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==r[o]){n=t[o],i=r[o];break}return n<i?-1:i<n?1:0},"compare");h.isEncoding=u(function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},"isEncoding");h.concat=u(function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return h.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=h.allocUnsafe(r),o=0;for(n=0;n<t.length;++n){let s=t[n];if(U(s,Uint8Array))o+s.length>i.length?(h.isBuffer(s)||(s=h.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(h.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i},"concat");function St(e,t){if(h.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||U(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return it(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return _t(e).length;default:if(i)return n?-1:it(e).length;t=(""+t).toLowerCase(),i=!0}}u(St,"byteLength");h.byteLength=St;function fr(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Er(this,t,r);case"utf8":case"utf-8":return bt(this,t,r);case"ascii":return Br(this,t,r);case"latin1":case"binary":return gr(this,t,r);case"base64":return xr(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ir(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}u(fr,"slowToString");h.prototype._isBuffer=!0;function L(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}u(L,"swap");h.prototype.swap16=u(function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)L(this,r,r+1);return this},"swap16");h.prototype.swap32=u(function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)L(this,r,r+3),L(this,r+1,r+2);return this},"swap32");h.prototype.swap64=u(function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)L(this,r,r+7),L(this,r+1,r+6),L(this,r+2,r+5),L(this,r+3,r+4);return this},"swap64");h.prototype.toString=u(function(){let t=this.length;return t===0?"":arguments.length===0?bt(this,0,t):fr.apply(this,arguments)},"toString");h.prototype.toLocaleString=h.prototype.toString;h.prototype.equals=u(function(t){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:h.compare(this,t)===0},"equals");h.prototype.inspect=u(function(){let t="",r=N.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},"inspect");It&&(h.prototype[It]=h.prototype.inspect);h.prototype.compare=u(function(t,r,n,i,o){if(U(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;let s=o-i,c=n-r,a=Math.min(s,c),l=this.slice(i,o),f=t.slice(r,n);for(let p=0;p<a;++p)if(l[p]!==f[p]){s=l[p],c=f[p];break}return s<c?-1:c<s?1:0},"compare");function Ct(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ht(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=h.from(t,n)),h.isBuffer(t))return t.length===0?-1:Ft(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):Ft(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}u(Ct,"bidirectionalIndexOf");function Ft(e,t,r,n,i){let o=1,s=e.length,c=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,r/=2}function a(f,p){return o===1?f[p]:f.readUInt16BE(p*o)}u(a,"read");let l;if(i){let f=-1;for(l=r;l<s;l++)if(a(e,l)===a(t,f===-1?0:l-f)){if(f===-1&&(f=l),l-f+1===c)return f*o}else f!==-1&&(l-=l-f),f=-1}else for(r+c>s&&(r=s-c),l=r;l>=0;l--){let f=!0;for(let p=0;p<c;p++)if(a(e,l+p)!==a(t,p)){f=!1;break}if(f)return l}return-1}u(Ft,"arrayIndexOf");h.prototype.includes=u(function(t,r,n){return this.indexOf(t,r,n)!==-1},"includes");h.prototype.indexOf=u(function(t,r,n){return Ct(this,t,r,n,!0)},"indexOf");h.prototype.lastIndexOf=u(function(t,r,n){return Ct(this,t,r,n,!1)},"lastIndexOf");function pr(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let o=t.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let c=parseInt(t.substr(s*2,2),16);if(ht(c))return s;e[r+s]=c}return s}u(pr,"hexWrite");function lr(e,t,r,n){return q(it(t,e.length-r),e,r,n)}u(lr,"utf8Write");function dr(e,t,r,n){return q(Rr(t),e,r,n)}u(dr,"asciiWrite");function yr(e,t,r,n){return q(_t(t),e,r,n)}u(yr,"base64Write");function mr(e,t,r,n){return q(Tr(t,e.length-r),e,r,n)}u(mr,"ucs2Write");h.prototype.write=u(function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return pr(this,t,r,n);case"utf8":case"utf-8":return lr(this,t,r,n);case"ascii":case"latin1":case"binary":return dr(this,t,r,n);case"base64":return yr(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return mr(this,t,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},"write");h.prototype.toJSON=u(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function xr(e,t,r){return t===0&&r===e.length?rt.fromByteArray(e):rt.fromByteArray(e.slice(t,r))}u(xr,"base64Slice");function bt(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let o=e[i],s=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=r){let a,l,f,p;switch(c){case 1:o<128&&(s=o);break;case 2:a=e[i+1],(a&192)===128&&(p=(o&31)<<6|a&63,p>127&&(s=p));break;case 3:a=e[i+1],l=e[i+2],(a&192)===128&&(l&192)===128&&(p=(o&15)<<12|(a&63)<<6|l&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:a=e[i+1],l=e[i+2],f=e[i+3],(a&192)===128&&(l&192)===128&&(f&192)===128&&(p=(o&15)<<18|(a&63)<<12|(l&63)<<6|f&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=c}return wr(n)}u(bt,"utf8Slice");var Ut=4096;function wr(e){let t=e.length;if(t<=Ut)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ut));return r}u(wr,"decodeCodePointsArray");function Br(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}u(Br,"asciiSlice");function gr(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}u(gr,"latin1Slice");function Er(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=t;o<r;++o)i+=Sr[e[o]];return i}u(Er,"hexSlice");function Ir(e,t,r){let n=e.slice(t,r),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}u(Ir,"utf16leSlice");h.prototype.slice=u(function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let i=this.subarray(t,r);return Object.setPrototypeOf(i,h.prototype),i},"slice");function y(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}u(y,"checkOffset");h.prototype.readUintLE=h.prototype.readUIntLE=u(function(t,r,n){t=t>>>0,r=r>>>0,n||y(t,r,this.length);let i=this[t],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[t+s]*o;return i},"readUIntLE");h.prototype.readUintBE=h.prototype.readUIntBE=u(function(t,r,n){t=t>>>0,r=r>>>0,n||y(t,r,this.length);let i=this[t+--r],o=1;for(;r>0&&(o*=256);)i+=this[t+--r]*o;return i},"readUIntBE");h.prototype.readUint8=h.prototype.readUInt8=u(function(t,r){return t=t>>>0,r||y(t,1,this.length),this[t]},"readUInt8");h.prototype.readUint16LE=h.prototype.readUInt16LE=u(function(t,r){return t=t>>>0,r||y(t,2,this.length),this[t]|this[t+1]<<8},"readUInt16LE");h.prototype.readUint16BE=h.prototype.readUInt16BE=u(function(t,r){return t=t>>>0,r||y(t,2,this.length),this[t]<<8|this[t+1]},"readUInt16BE");h.prototype.readUint32LE=h.prototype.readUInt32LE=u(function(t,r){return t=t>>>0,r||y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},"readUInt32LE");h.prototype.readUint32BE=h.prototype.readUInt32BE=u(function(t,r){return t=t>>>0,r||y(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},"readUInt32BE");h.prototype.readBigUInt64LE=T(u(function(t){t=t>>>0,D(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&M(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))},"readBigUInt64LE"));h.prototype.readBigUInt64BE=T(u(function(t){t=t>>>0,D(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&M(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)},"readBigUInt64BE"));h.prototype.readIntLE=u(function(t,r,n){t=t>>>0,r=r>>>0,n||y(t,r,this.length);let i=this[t],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i},"readIntLE");h.prototype.readIntBE=u(function(t,r,n){t=t>>>0,r=r>>>0,n||y(t,r,this.length);let i=r,o=1,s=this[t+--i];for(;i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s},"readIntBE");h.prototype.readInt8=u(function(t,r){return t=t>>>0,r||y(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},"readInt8");h.prototype.readInt16LE=u(function(t,r){t=t>>>0,r||y(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},"readInt16LE");h.prototype.readInt16BE=u(function(t,r){t=t>>>0,r||y(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},"readInt16BE");h.prototype.readInt32LE=u(function(t,r){return t=t>>>0,r||y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},"readInt32LE");h.prototype.readInt32BE=u(function(t,r){return t=t>>>0,r||y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},"readInt32BE");h.prototype.readBigInt64LE=T(u(function(t){t=t>>>0,D(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&M(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)},"readBigInt64LE"));h.prototype.readBigInt64BE=T(u(function(t){t=t>>>0,D(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&M(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)},"readBigInt64BE"));h.prototype.readFloatLE=u(function(t,r){return t=t>>>0,r||y(t,4,this.length),P.read(this,t,!0,23,4)},"readFloatLE");h.prototype.readFloatBE=u(function(t,r){return t=t>>>0,r||y(t,4,this.length),P.read(this,t,!1,23,4)},"readFloatBE");h.prototype.readDoubleLE=u(function(t,r){return t=t>>>0,r||y(t,8,this.length),P.read(this,t,!0,52,8)},"readDoubleLE");h.prototype.readDoubleBE=u(function(t,r){return t=t>>>0,r||y(t,8,this.length),P.read(this,t,!1,52,8)},"readDoubleBE");function x(e,t,r,n,i,o){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}u(x,"checkInt");h.prototype.writeUintLE=h.prototype.writeUIntLE=u(function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;x(this,t,r,n,c,0)}let o=1,s=0;for(this[r]=t&255;++s<n&&(o*=256);)this[r+s]=t/o&255;return r+n},"writeUIntLE");h.prototype.writeUintBE=h.prototype.writeUIntBE=u(function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;x(this,t,r,n,c,0)}let o=n-1,s=1;for(this[r+o]=t&255;--o>=0&&(s*=256);)this[r+o]=t/s&255;return r+n},"writeUIntBE");h.prototype.writeUint8=h.prototype.writeUInt8=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,1,255,0),this[r]=t&255,r+1},"writeUInt8");h.prototype.writeUint16LE=h.prototype.writeUInt16LE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},"writeUInt16LE");h.prototype.writeUint16BE=h.prototype.writeUInt16BE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},"writeUInt16BE");h.prototype.writeUint32LE=h.prototype.writeUInt32LE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},"writeUInt32LE");h.prototype.writeUint32BE=h.prototype.writeUInt32BE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},"writeUInt32BE");function Lt(e,t,r,n,i){Mt(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}u(Lt,"wrtBigUInt64LE");function kt(e,t,r,n,i){Mt(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}u(kt,"wrtBigUInt64BE");h.prototype.writeBigUInt64LE=T(u(function(t,r=0){return Lt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64LE"));h.prototype.writeBigUInt64BE=T(u(function(t,r=0){return kt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));h.prototype.writeIntLE=u(function(t,r,n,i){if(t=+t,r=r>>>0,!i){let a=Math.pow(2,8*n-1);x(this,t,r,n,a-1,-a)}let o=0,s=1,c=0;for(this[r]=t&255;++o<n&&(s*=256);)t<0&&c===0&&this[r+o-1]!==0&&(c=1),this[r+o]=(t/s>>0)-c&255;return r+n},"writeIntLE");h.prototype.writeIntBE=u(function(t,r,n,i){if(t=+t,r=r>>>0,!i){let a=Math.pow(2,8*n-1);x(this,t,r,n,a-1,-a)}let o=n-1,s=1,c=0;for(this[r+o]=t&255;--o>=0&&(s*=256);)t<0&&c===0&&this[r+o+1]!==0&&(c=1),this[r+o]=(t/s>>0)-c&255;return r+n},"writeIntBE");h.prototype.writeInt8=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},"writeInt8");h.prototype.writeInt16LE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},"writeInt16LE");h.prototype.writeInt16BE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},"writeInt16BE");h.prototype.writeInt32LE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},"writeInt32LE");h.prototype.writeInt32BE=u(function(t,r,n){return t=+t,r=r>>>0,n||x(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},"writeInt32BE");h.prototype.writeBigInt64LE=T(u(function(t,r=0){return Lt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));h.prototype.writeBigInt64BE=T(u(function(t,r=0){return kt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Pt(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}u(Pt,"checkIEEE754");function Dt(e,t,r,n,i){return t=+t,r=r>>>0,i||Pt(e,t,r,4,34028234663852886e22,-34028234663852886e22),P.write(e,t,r,n,23,4),r+4}u(Dt,"writeFloat");h.prototype.writeFloatLE=u(function(t,r,n){return Dt(this,t,r,!0,n)},"writeFloatLE");h.prototype.writeFloatBE=u(function(t,r,n){return Dt(this,t,r,!1,n)},"writeFloatBE");function Nt(e,t,r,n,i){return t=+t,r=r>>>0,i||Pt(e,t,r,8,17976931348623157e292,-17976931348623157e292),P.write(e,t,r,n,52,8),r+8}u(Nt,"writeDouble");h.prototype.writeDoubleLE=u(function(t,r,n){return Nt(this,t,r,!0,n)},"writeDoubleLE");h.prototype.writeDoubleBE=u(function(t,r,n){return Nt(this,t,r,!1,n)},"writeDoubleBE");h.prototype.copy=u(function(t,r,n,i){if(!h.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);let o=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),o},"copy");h.prototype.fill=u(function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!h.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let s=t.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<n;++o)this[o]=t;else{let s=h.isBuffer(t)?t:h.from(t,i),c=s.length;if(c===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=s[o%c]}return this},"fill");var k={};function ut(e,t,r){var n;k[e]=(n=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}},u(n,"NodeError"),n)}u(ut,"E");ut("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ut("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);ut("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=At(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=At(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function At(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}u(At,"addNumericalSeparator");function Fr(e,t,r){D(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&M(t,e.length-(r+1))}u(Fr,"checkBounds");function Mt(e,t,r,n,i,o){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",c;throw o>3?t===0||t===BigInt(0)?c=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:c=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:c=`>= ${t}${s} and <= ${r}${s}`,new k.ERR_OUT_OF_RANGE("value",c,e)}Fr(n,i,o)}u(Mt,"checkIntBI");function D(e,t){if(typeof e!="number")throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}u(D,"validateNumber");function M(e,t,r){throw Math.floor(e)!==e?(D(e,r),new k.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new k.ERR_BUFFER_OUT_OF_BOUNDS:new k.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}u(M,"boundsError");var Ur=/[^+/0-9A-Za-z-_]/g;function Ar(e){if(e=e.split("=")[0],e=e.trim().replace(Ur,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}u(Ar,"base64clean");function it(e,t){t=t||1/0;let r,n=e.length,i=null,o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}u(it,"utf8ToBytes");function Rr(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}u(Rr,"asciiToBytes");function Tr(e,t){let r,n,i,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}u(Tr,"utf16leToBytes");function _t(e){return rt.toByteArray(Ar(e))}u(_t,"base64ToBytes");function q(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}u(q,"blitBuffer");function U(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}u(U,"isInstance");function ht(e){return e!==e}u(ht,"numberIsNaN");var Sr=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t})();function T(e){return typeof BigInt>"u"?Cr:e}u(T,"defineBigIntMethod");function Cr(){throw new Error("BigInt not supported")}u(Cr,"BufferBigIntNotDefined")});var Ht=Zt($t(),1);var br=Symbol.for("kClient"),B=Symbol.for("kBackend"),g=Symbol.for("kContext");import"@opra/common";import"rxjs";var ct=class ct{constructor(t){d(this,"document");this.document=t?.document}};u(ct,"Backend");var j=ct;var at=class at extends Error{constructor(r,n){super(r.message);d(this,"cause");d(this,"issues");d(this,"status");this.cause=n,this.issues=r.issues||[],this.status=r.status,n&&(this.cause=n,n.stack&&(this.stack=n.stack))}};u(at,"ClientError");var H=at;var A;(function(e){e.ResponseHeader="response-header",e.Response="response",e.Body="body",e.Events="events"})(A||(A={}));import pt from"@browsery/type-is";import{omit as Lr}from"@jsopen/objects";import{isBlob as kr,isFormData as Pr}from"@opra/common";import{Observable as Dr}from"rxjs";import{isReadableStreamLike as Nr}from"rxjs/internal/util/isReadableStreamLike";var ft=class ft extends j{constructor(r,n){super(n);d(this,"serviceUrl");d(this,"interceptors");let i=new URL(r);this.serviceUrl=i.toString().split("?")[0].split("#")[0],this.serviceUrl.endsWith("/")||(this.serviceUrl+="/")}};u(ft,"HttpBackend");var G=ft;var Y=class Y{constructor(t){d(this,"headers");d(this,"ok");d(this,"status");d(this,"statusText");d(this,"url");d(this,"body");d(this,"contentType");d(this,"hasBody",!1);this.headers=t?.headers instanceof Headers?t?.headers:new Headers(t?.headers),this.status=t?.status||200,this.statusText=t?.statusText||"OK",this.url=t?.url||null,this.ok=this.status>=200&&this.status<300,this.body=t?.body,this.hasBody=t?.body!=null||!!t?.hasBody,this.contentType=(this.headers.get("content-type")||"").split(";")[0]}clone(t){return new Y({...this,...t})}};u(Y,"HttpResponse");var W=Y;var E;(function(e){e.Sent="Sent",e.UploadProgress="UploadProgress",e.ResponseHeader="ResponseHeader",e.DownloadProgress="DownloadProgress",e.Response="Response",e.User="User"})(E||(E={}));var lt=class lt extends G{constructor(r,n){super(r,n);d(this,"interceptors");d(this,"defaults");this.interceptors=Array.from(new Set([...n?.interceptors||[]])),this.defaults={...n?.defaults,headers:n?.defaults?.headers instanceof Headers?n?.defaults?.headers:new Headers(n?.defaults?.headers),params:n?.defaults?.params instanceof URLSearchParams?n?.defaults?.params:new URLSearchParams(n?.defaults?.params)}}handle(r){return new Dr(n=>{(async()=>{let i=this.prepareRequest(r);if(i.body&&r.reportProgress){let f=i.body,p=i.headers.get("content-length")||"0",I=parseInt(p,10)||0,m=0,S=new TransformStream({transform(C,Z){Z.enqueue(C),m+=C.byteLength,n.next({type:E.UploadProgress,request:i,total:I,loaded:m})}});i=new Request(i.url,{cache:i.cache,credentials:i.credentials,headers:i.headers,integrity:i.integrity,keepalive:i.keepalive,method:i.method,mode:i.mode,redirect:i.redirect,referrer:i.referrer,referrerPolicy:i.referrerPolicy,signal:i.signal,body:f.pipeThrough(S),window:r.window,duplex:"half"})}let o=this.send(i);n.next({request:i,type:E.Sent});let s=await o,c=this.createResponse({url:s.url,headers:s.headers,status:s.status,statusText:s.statusText,hasBody:!!s.body});n.next({request:i,type:E.ResponseHeader,response:c});let a;if(s.body)if(r.reportProgress){let f=s.body,p=s.headers.get("content-length")||"0",I=parseInt(p,10)||0,m=0,S=new Response(new ReadableStream({async start(C){let Z=f.getReader();for(;;){let{done:Gt,value:xt}=await Z.read();if(Gt)break;m+=xt.byteLength,C.enqueue(xt),n.next({type:E.DownloadProgress,request:i,total:I,loaded:m})}C.close()}}));a=await this.parseBody(S)}else a=await this.parseBody(s);let l=this.createResponse({url:s.url,headers:s.headers,status:s.status,statusText:s.statusText,body:a});n.next({request:i,type:E.Response,response:l}),n.complete()})().catch(i=>n.error(i))})}send(r){return fetch(r)}prepareRequest(r){let n=r.headers||new Headers,i={...r,...Lr(this.defaults,["headers","params"]),headers:n};this.defaults.headers.forEach((c,a)=>{n.has(a)||n.set(a,c)});let o=new URL(i.url,this.serviceUrl);this.defaults.params.size&&(this.defaults.params.forEach((c,a)=>{o.searchParams.has(a)||o.searchParams.set(a,c)}),i.url=o.toString());let s=i.body;if(s){let c="";typeof s=="string"||typeof s=="number"||typeof s=="boolean"?(c='text/plain; charset="UTF-8"',i.body=new Blob([String(s)],{type:c}),n.set("Content-Length",String(i.body.size)),delete i.duplex):Nr(s)?(c="application/octet-stream",i.duplex="half"):Buffer.isBuffer(s)?(c="application/octet-stream",n.set("Content-Length",String(s.length)),delete i.duplex):kr(s)?(c=s.type||"application/octet-stream",n.set("Content-Length",String(s.size)),delete i.duplex):(Pr(s)||(c='application/json;charset="UTF-8"',i.body=new Blob([JSON.stringify(s)],{type:c}),n.set("Content-Length",String(i.body.size))),delete i.duplex),c&&!n.has("Content-Type")&&n.set("Content-Type",c)}return new Request(o.toString(),i)}createResponse(r){return new W(r)}async parseBody(r){let n,i=r.headers.get("Content-Type")||"";if(pt.is(i,["json","application/*+json"]))n=await r.json(),typeof n=="string"&&(n=JSON.parse(n));else if(pt.is(i,["text"]))n=await r.text();else if(pt.is(i,["multipart"]))n=await r.formData();else{let o=await r.arrayBuffer();o.byteLength&&(n=o)}return n}};u(lt,"FetchBackend");var z=lt;import{updateErrorMessage as qt}from"@jsopen/objects";import{ApiDocumentFactory as qr}from"@opra/common";import _r from"@browsery/type-is";import{MimeTypes as $r}from"@opra/common";import{lastValueFrom as Ot,Observable as Or}from"rxjs";import"rxjs";var dt=class dt{constructor(t,r){d(this,"chain");d(this,"finalHandler");this.chain=t.reduceRight((n,i)=>(o,s)=>i.intercept(o,{handle:u(c=>n(c,s),"handle")}),Mr),this.finalHandler=r}handle(t){return this.chain(t,r=>this.finalHandler.handle(r))}};u(dt,"HttpInterceptorHandler");var J=dt;function Mr(e,t){return t(e)}u(Mr,"chainEnd");var X=class X extends Or{constructor(t,r){super(n=>{let i=this[g].observe;new J(t.interceptors||[],this[B]).handle(this[g]).subscribe({next(o){if(i===A.Events){n.next(o);return}if(i===A.ResponseHeader&&o.type===E.ResponseHeader){n.next(o.response),n.complete();return}if(o.type===E.Response){let{response:s}=o;if(i===A.Response){n.next(s),n.complete();return}let c=_r.is(o.response.contentType||"",[$r.opra_response_json]);if(s.status>=400&&s.status<600){n.error(new H({message:s.status+" "+s.statusText,status:s.status,issues:c?s.body.errors:void 0})),n.complete();return}n.next(o.response.body),n.complete()}},error(o){n.error(o)},complete(){n.complete()}})}),Object.defineProperty(this,B,{enumerable:!1,value:t}),Object.defineProperty(this,g,{enumerable:!1,value:{...r,observe:A.Body,headers:new Headers(r?.headers)}})}clone(){return new X(this[B],this[g])}options(t){return Object.assign(this[g],t),this}header(t,r){let n=this[g].headers;return typeof t=="object"?((t instanceof Headers?t:new Headers(t)).forEach((o,s)=>{s.toLowerCase()==="set-cookie"?n.append(s,o):n.set(s,o)}),this):(r==null||r===""?n.delete(t):n.append(t,String(r)),this)}param(t,r){r&&typeof r=="object"&&(r=JSON.stringify(r));let n=this[g].url.searchParams;return typeof t=="object"?(typeof t.forEach=="function"?t.forEach((i,o)=>n.set(String(o),String(i))):Object.entries(t).forEach(i=>n.set(String(i[0]),String(i[1]))),this):(r==null?n.delete(t):n.set(t,String(r)),this)}observe(t){if(t===this[g].observe)return this;let r=this.clone();return r[g].observe=t||A.Body,r}getBody(){return Ot(this.observe(A.Body))}getResponse(){return Ot(this.observe(A.Response))}};u(X,"HttpRequestObservable");var V=X;var jr=/^(\/*)(.+)/,yt=class yt{constructor(t){Object.defineProperty(this,B,{enumerable:!1,value:t})}get serviceUrl(){return this[B].serviceUrl}async fetchDocument(t){let r={},n=u(async o=>{let s=this.request("$schema",{headers:new Headers({accept:"application/json"})});o&&s.param("id",o);let c=await s.getBody().catch(a=>{throw qt(a,"Error fetching api schema from url ("+this.serviceUrl+`).
|
|
7
|
+
`+a.message),a});if(c.references){let a=c.references;c.references={};for(let[l,f]of Object.entries(a)){if(r[f.id]===null)throw new Error("Circular reference detected");r[f.id]=null;let p=await n(f.id);c.references[l]=r[f.id]=p}}return c},"getDocument"),i=await n(t?.documentId);return await qr.createDocument(i).catch(o=>{throw qt(o,`Error loading api document.
|
|
8
|
+
`+o.message),o})}request(t,r){t=jr.exec(t)?.[2]||"";let n=new V(this[B],{...r,method:r?.method||"GET",url:new URL(t,this.serviceUrl)});return r?.params&&n.param(r.params),n}delete(t,r){return this.request(t,{...r,method:"DELETE"})}get(t,r){return this.request(t,{...r,method:"GET"})}patch(t,r,n){return this.request(t,{...n,method:"PATCH",body:r})}post(t,r,n){return this.request(t,{...n,method:"POST",body:r})}put(t,r,n){return this.request(t,{...n,method:"PUT",body:r})}};u(yt,"HttpClientBase");var K=yt;var mt=class mt extends K{constructor(t,r){super(new z(t,r))}get defaults(){return this[B].defaults}};u(mt,"OpraHttpClient");var jt=mt;function Je(e,...t){let r="",n;for(n=0;n<e.length;n++)r+=e[0]+encodeURIComponent(t[n]);return r}u(Je,"urlPath");globalThis.Buffer=Ht.Buffer;export{j as Backend,H as ClientError,z as FetchBackend,G as HttpBackend,K as HttpClientBase,E as HttpEventType,A as HttpObserveType,V as HttpRequestObservable,W as HttpResponse,jt as OpraHttpClient,B as kBackend,br as kClient,g as kContext,Je as urlPath};
|
|
9
9
|
/*! Bundled license information:
|
|
10
10
|
|
|
11
11
|
ieee754/index.js:
|
package/core/backend.js
CHANGED
package/http/http-client-base.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { updateErrorMessage } from '@jsopen/objects';
|
|
2
|
-
import { ApiDocumentFactory, } from '@opra/common';
|
|
2
|
+
import { ApiDocument, ApiDocumentFactory, OpraSchema, } from '@opra/common';
|
|
3
3
|
import { kBackend } from '../constants.js';
|
|
4
|
+
import { HttpBackend } from './http-backend.js';
|
|
4
5
|
import { HttpRequestObservable } from './http-request-observable.js';
|
|
5
6
|
const SPLIT_BACKSLASH_PATTERN = /^(\/*)(.+)/;
|
|
6
7
|
/**
|
|
@@ -4,7 +4,9 @@ import { lastValueFrom, Observable } from 'rxjs';
|
|
|
4
4
|
import { kBackend, kContext } from '../constants.js';
|
|
5
5
|
import { ClientError } from '../core/client-error.js';
|
|
6
6
|
import { HttpObserveType } from './enums/http-observable-type.enum.js';
|
|
7
|
+
import { HttpBackend } from './http-backend.js';
|
|
7
8
|
import { HttpInterceptorHandler } from './http-interceptor-handler.js';
|
|
9
|
+
import { HttpResponse } from './http-response.js';
|
|
8
10
|
import { HttpEventType } from './interfaces/http-event.js';
|
|
9
11
|
/**
|
|
10
12
|
*
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { HttpBackend } from '../http-backend.js';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { HttpBackend } from '../http-backend.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/client",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.4",
|
|
4
4
|
"description": "Opra Client package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"tslib": "^2.8.1"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@opra/common": "^1.27.
|
|
13
|
+
"@opra/common": "^1.27.4",
|
|
14
14
|
"rxjs": "^7.0.0 || ^8.0.0"
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|