mirror of
https://github.com/open-webui/open-webui
synced 2024-11-29 07:21:01 +00:00
4 lines
122 KiB
JavaScript
4 lines
122 KiB
JavaScript
|
const e=(e,t,n=globalThis)=>{const r=Symbol.for(e),s=r in n;return[s?n[r]:Object.defineProperty(n,r,{value:t})[r],s]};Promise.withResolvers||(Promise.withResolvers=function(){var e,t,n=new this((function(n,r){e=n,t=r}));return{resolve:e,reject:t,promise:n}});const t=(e,t=document)=>[...t.querySelectorAll(e)],n=(e,t=document)=>{const n=(new XPathEvaluator).createExpression(e).evaluate(t,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE),r=[];for(let e=0,{snapshotLength:t}=n;e<t;e++)r.push(n.snapshotItem(e));return r},r=Object.getOwnPropertyDescriptors(Response.prototype),s=e=>"function"==typeof e,o={get:(e,t)=>r.hasOwnProperty(t)?((e,t,{get:n,value:r})=>n||!s(r)?e.then((e=>e[t])):(...n)=>e.then((e=>e[t](...n))))(e,t,r[t]):((e,t)=>s(t)?t.bind(e):t)(e,e[t])};var a=(e,...t)=>new Proxy(fetch(e,...t),o);const i="object"==typeof self?self:globalThis,l=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=s=>{if(e.has(s))return e.get(s);const[o,a]=t[s];switch(o){case 0:case-1:return n(a,s);case 1:{const e=n([],s);for(const t of a)e.push(r(t));return e}case 2:{const e=n({},s);for(const[t,n]of a)e[r(t)]=r(n);return e}case 3:return n(new Date(a),s);case 4:{const{source:e,flags:t}=a;return n(new RegExp(e,t),s)}case 5:{const e=n(new Map,s);for(const[t,n]of a)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,s);for(const t of a)e.add(r(t));return e}case 7:{const{name:e,message:t}=a;return n(new i[e](t),s)}case 8:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s)}return n(new i[o](a),s)};return r})(new Map,e)(0),c="",{toString:p}={},{keys:f}=Object,u=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=p.call(e).slice(8,-1);switch(n){case"Array":return[1,c];case"Object":return[2,c];case"Date":return[3,c];case"RegExp":return[4,c];case"Map":return[5,c];case"Set":return[6,c]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},d=([e,t])=>0===e&&("function"===t||"symbol"===t),h=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const s=(e,t)=>{const s=r.push(e)-1;return n.set(t,s),s},o=r=>{if(n.has(r))return n.get(r);let[a,i]=u(r);switch(a){case 0:{let t=r;switch(i){case"bigint":a=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+i);t=null;break;case"undefined":return s([-1],r)}return s([a,t],r)}case 1:{if(i)return s([i,[...r]],r);const e=[],t=s([a,e],r);for(const t of r)e.push(o(t));return t}case 2:{if(i)switch(i){case"BigInt":return s([i,r.toString()],r);case"Boolean":case"Number":case"String":return s([i,r.valueOf()],r)}if(t&&"toJSON"in r)return o(r.toJSON());const n=[],l=s([a,n],r);for(const t of f(r))!e&&d(u(r[t]))||n.push([o(t),o(r[t])]);return l}case 3:return s([a,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return s([a,{source:e,flags:t}],r)}case 5:{const t=[],n=s([a,t],r);for(const[n,s]of r)(e||!d(u(n))&&!d(u(s)))&&t.push([o(n),o(s)]);return n}case 6:{const t=[],n=s([a,t],r);for(const n of r)!e&&d(u(n))||t.push(o(n));return n}}const{message:l}=r;return s([a,{name:i,message:l}],r)};return o})(!(t||n),!!t,new Map,r)(e),r},{parse:m,stringify:y}=JSON,g={json:!0,lossy:!0};var _=Object.freeze({__proto__:null,parse:e=>l(m(e)),stringify:e=>y(h(e,g))});const w="64e10b34-2bf7-4616-9668-f99de5aa046e",b="M"+w,v="T"+w,E="array",k="function",j="null",x="number",R="object",A="string",T="symbol",S="undefined",N="apply",O="construct",P="defineProperty",I="deleteProperty",$="get",M="getOwnPropertyDescriptor",F="getPrototypeOf",C="has",W="isExtensible",D="ownKeys",L="preventExtensions",H="set",B="setPrototypeOf",U="delete",{isArray:J}=Array;let{SharedArrayBuffer:q,window:G}=globalThis,{notify:z,wait:Y,waitAsync:V}=Atomics,K=null;V||(V=e=>({value:new Promise((t=>{let n=new Worker("data:application/javascript,onmessage%3D(%7Bdata%3Ab%7D)%3D%3E(Atomics.wait(b%2C0)%2CpostMessage(0))");n.onmessage=t,n.postMessage(e)}))}));try{new q(4)}catch(e){q=ArrayBuffer;const t=new WeakMap;if(G){const e=new Map,{prototype:{postMessage:n}}=Worker,r=t=>{const n=t.data?.[w];if(!J(n)){t.stopImmediatePropagation();const{id:r,sb:s}=n;e.get(r)(s)}};K=function(e,...s){const o=e?.[w];if(J(o)){cons
|
||
|
/*! (c) Andrea Giammarchi - ISC */const{Int32Array:X,Map:Z,Uint16Array:Q}=globalThis,{BYTES_PER_ELEMENT:ee}=X,{BYTES_PER_ELEMENT:te}=Q,ne=new WeakSet,re=new WeakMap,se={value:{then:e=>e()}};let oe=0;const ae=(e,{parse:t=JSON.parse,stringify:n=JSON.stringify,transform:r,interrupt:s}=JSON)=>{if(!re.has(e)){const o=K||e.postMessage,a=(t,...n)=>o.call(e,{[w]:n},{transfer:t}),i=typeof s===k?s:s?.handler,l=s?.delay||42,c=new TextDecoder("utf-16"),p=(e,t)=>e?V(t,0):(i?((e,t,n)=>{for(;"timed-out"===Y(e,0,0,t);)n()})(t,l,i):Y(t,0),se);let f=!1;re.set(e,new Proxy(new Z,{[C]:(e,t)=>"string"==typeof t&&!t.startsWith("_"),[$]:(n,s)=>"then"===s?null:(...n)=>{const o=oe++;let i=new X(new q(2*ee)),l=[];ne.has(n.at(-1)||l)&&ne.delete(l=n.pop()),a(l,o,i,s,r?n.map(r):n);const u=e!==globalThis;let d=0;return f&&u&&(d=setTimeout(console.warn,1e3,`💀🔒 - Possible deadlock if proxy.${s}(...args) is awaited`)),p(u,i).value.then((()=>{clearTimeout(d);const e=i[1];if(!e)return;const n=te*e;return i=new X(new q(n+n%ee)),a([],o,i),p(u,i).value.then((()=>t(c.decode(new Q(i.buffer).slice(0,e)))))}))},[H](t,s,o){const a=typeof o;if(a!==k)throw new Error(`Unable to assign ${s} as ${a}`);if(!t.size){const s=new Z;e.addEventListener("message",(async e=>{const o=e.data?.[w];if(J(o)){e.stopImmediatePropagation();const[a,i,...l]=o;let c;if(l.length){const[e,o]=l;if(t.has(e)){f=!0;try{const l=await t.get(e)(...o);if(void 0!==l){const e=n(r?r(l):l);s.set(a,e),i[1]=e.length}}catch(e){c=e}finally{f=!1}}else c=new Error(`Unsupported action: ${e}`);i[0]=1}else{const e=s.get(a);s.delete(a);for(let t=new Q(i.buffer),n=0;n<e.length;n++)t[n]=e.charCodeAt(n)}if(z(i,0),c)throw c}}))}return!!t.set(s,o)}}))}return re.get(e)};ae.transfer=(...e)=>(ne.add(e),e);const{isArray:ie}=Array,le=(e,t)=>t,ce=e=>typeof e===k?(e=>e())(e):e;function pe(){return this}const fe=(e,t)=>e===E?[t]:{t:e,v:t},ue=(e,t=le)=>{let n=typeof e,r=e;return n===R&&(ie(e)?(n=E,r=e.at(0)):({t:n,v:r}=e)),t(n,r)},de=(e,t)=>e===k?t:fe(e,t),he=(e,t=de)=>{const n=null===e?j:typeof e;return t(n===R&&ie(e)?E:n,e)},me=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),ye=Object.create(null),ge=(e,t,{debug:n,handler:r,return:s,token:o=e}=ye)=>{const a=s||new Proxy(e,r||ye),i=[a,[t,e,!!n]];return!1!==o&&i.push(o),me.register(...i),a},{defineProperty:_e,deleteProperty:we,getOwnPropertyDescriptor:be,getPrototypeOf:ve,isExtensible:Ee,ownKeys:ke,preventExtensions:je,set:xe,setPrototypeOf:Re}=Reflect,{assign:Ae,create:Te}=Object,Se=ve(Int8Array),Ne=(e,t)=>{const{get:n,set:r,value:s}=e;return n&&(e.get=t(n)),r&&(e.set=t(r)),s&&(e.value=t(s)),e},Oe=e=>t=>he(t,((t,n)=>{switch(t){case j:return fe(j,n);case R:if(n===globalThis)return fe(t,null);case E:case k:return e(t,n);case"boolean":case x:case A:case S:case"bigint":return fe(t,n);case T:{if(Pe.has(n))return fe(t,Pe.get(n));let e=Symbol.keyFor(n);if(e)return fe(t,`.${e}`)}}throw new TypeError(`Unable to handle this ${t}: ${String(n)}`)})),Pe=new Map(ke(Symbol).filter((e=>typeof Symbol[e]===T)).map((e=>[Symbol[e],e]))),Ie=e=>{if(e.startsWith("."))return Symbol.for(e.slice(1));for(const[t,n]of Pe)if(n===e)return t},$e=e=>e;var Me=((e,t)=>{const n=new WeakMap;{const{addEventListener:e}=EventTarget.prototype;_e(EventTarget.prototype,"addEventListener",{value(t,r,...s){return s.at(0)?.invoke&&(n.has(this)||n.set(this,new Map),n.get(this).set(t,[].concat(s[0].invoke)),delete s[0].invoke),e.call(this,t,r,...s)}})}return function(t,r,s,...o){let a=0,i=this?.transform||$e;const l=new Map,c=new Map,{[s]:p}=t,f=o.length?Ae(Te(globalThis),...o):globalThis,u=Oe(((e,t)=>{if(!l.has(t)){let n;for(;c.has(n=a++););l.set(t,n),c.set(n,e===k?t:i(t))}return fe(e,l.get(t))})),d=e=>{p(U,fe(A,e))},h=(e,t)=>{switch(e){case R:if(null==t)return f;case E:if(typeof t===x)return c.get(t);if(!(t instanceof Se))for(const e in t)t[e]=m(t[e]);return t;case k:if(typeof t===A){const e=c.get(t)?.deref();if(e)return e;const r=function(...e){return e.at(0)instanceof Event&&(e=>{const{currentTarget:t,target:r,type:s}=e;for(const o of n.get(t||r)?.
|
||
|
//# sourceMappingURL=core-CPpjJT4b.js.map
|