@basmilius/http-client 1.5.5 → 1.6.0
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/dist/adapter/HttpAdapter.d.ts +3 -3
- package/dist/adapter/index.d.ts +1 -1
- package/dist/decorator/adapter.d.ts +2 -2
- package/dist/decorator/bound.d.ts +1 -1
- package/dist/decorator/debounce.d.ts +1 -1
- package/dist/decorator/dto/arrayProxy.d.ts +15 -15
- package/dist/decorator/dto/classProxy.d.ts +8 -8
- package/dist/decorator/dto/clone.d.ts +4 -4
- package/dist/decorator/dto/constant.d.ts +7 -7
- package/dist/decorator/dto/fill.d.ts +4 -4
- package/dist/decorator/dto/helper/areEqual.d.ts +4 -4
- package/dist/decorator/dto/helper/assertDto.d.ts +4 -4
- package/dist/decorator/dto/helper/circularProtect.d.ts +1 -1
- package/dist/decorator/dto/helper/cloneDto.d.ts +3 -3
- package/dist/decorator/dto/helper/executeIfDtoDirtyAndMarkClean.d.ts +7 -4
- package/dist/decorator/dto/helper/index.d.ts +17 -17
- package/dist/decorator/dto/helper/instance.d.ts +2 -2
- package/dist/decorator/dto/helper/isDto.d.ts +4 -4
- package/dist/decorator/dto/helper/isDtoClean.d.ts +3 -3
- package/dist/decorator/dto/helper/isDtoDirty.d.ts +3 -3
- package/dist/decorator/dto/helper/markDtoClean.d.ts +3 -3
- package/dist/decorator/dto/helper/markDtoDirty.d.ts +3 -3
- package/dist/decorator/dto/helper/relateDtoTo.d.ts +4 -4
- package/dist/decorator/dto/helper/relateValueTo.d.ts +4 -4
- package/dist/decorator/dto/helper/trackDto.d.ts +3 -3
- package/dist/decorator/dto/helper/triggerDto.d.ts +3 -4
- package/dist/decorator/dto/helper/unrelateDtoFrom.d.ts +4 -4
- package/dist/decorator/dto/helper/unrelateValueFrom.d.ts +4 -4
- package/dist/decorator/dto/index.d.ts +6 -6
- package/dist/decorator/dto/instanceProxy.d.ts +21 -21
- package/dist/decorator/dto/map.d.ts +2 -2
- package/dist/decorator/dto/refProxy.d.ts +30 -30
- package/dist/decorator/dto/serialize/deserialize.d.ts +1 -1
- package/dist/decorator/dto/serialize/deserializeArray.d.ts +1 -1
- package/dist/decorator/dto/serialize/deserializeDateTime.d.ts +3 -3
- package/dist/decorator/dto/serialize/deserializeDto.d.ts +3 -3
- package/dist/decorator/dto/serialize/deserializeObject.d.ts +1 -1
- package/dist/decorator/dto/serialize/deserializeUnknown.d.ts +1 -1
- package/dist/decorator/dto/serialize/index.d.ts +2 -2
- package/dist/decorator/dto/serialize/isSerializedDateTime.d.ts +2 -2
- package/dist/decorator/dto/serialize/isSerializedDto.d.ts +2 -2
- package/dist/decorator/dto/serialize/serialize.d.ts +1 -1
- package/dist/decorator/dto/serialize/serializeArray.d.ts +2 -2
- package/dist/decorator/dto/serialize/serializeDateTime.d.ts +3 -3
- package/dist/decorator/dto/serialize/serializeDto.d.ts +3 -3
- package/dist/decorator/dto/serialize/serializeObject.d.ts +1 -1
- package/dist/decorator/dto/serialize/serializeUnknown.d.ts +2 -2
- package/dist/decorator/dto/serialize/uuid.d.ts +1 -1
- package/dist/decorator/dto/symbols.d.ts +11 -11
- package/dist/decorator/dto/toJSON.d.ts +4 -4
- package/dist/decorator/index.d.ts +7 -7
- package/dist/dto/BlobResponse.d.ts +4 -4
- package/dist/dto/Paginated.d.ts +7 -7
- package/dist/dto/index.d.ts +2 -2
- package/dist/http/BaseResponse.d.ts +8 -8
- package/dist/http/BaseService.d.ts +3 -3
- package/dist/http/HttpClient.d.ts +8 -8
- package/dist/http/QueryString.d.ts +11 -12
- package/dist/http/RequestBuilder.d.ts +31 -28
- package/dist/http/RequestError.d.ts +7 -7
- package/dist/http/helpers.d.ts +1 -1
- package/dist/http/index.d.ts +7 -7
- package/dist/http-client.js +3638 -1
- package/dist/http-client.js.map +68 -5
- package/dist/index.d.ts +5 -5
- package/package.json +56 -57
- package/dist/decorator/dto/instance.d.ts +0 -31
- package/dist/decorator/dto/serialize/types.d.ts +0 -3
- package/dist/type/index.d.ts +0 -2
- package/dist/util/datetime.d.ts +0 -2
- package/dist/util/index.d.ts +0 -2
- package/dist/util/reflection.d.ts +0 -5
package/dist/http-client.js
CHANGED
|
@@ -1,2 +1,3639 @@
|
|
|
1
|
-
var Ut=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var bt=t=>{throw TypeError(t)};var b=(t,e,r,o)=>{for(var n=o>1?void 0:o?Vt(e,r):e,s=t.length-1,a;s>=0;s--)(a=t[s])&&(n=(o?a(e,r,n):a(n))||n);return o&&n&&Ut(e,r,n),n};var St=(t,e,r)=>e.has(t)||bt("Cannot "+r);var l=(t,e,r)=>(St(t,e,"read from private field"),r?r.call(t):e.get(t)),f=(t,e,r)=>e.has(t)?bt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),d=(t,e,r,o)=>(St(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r);function ft(t){return class extends t{constructor(...e){throw new Error("@adapter: cannot create instance of class.")}}}function $t(){return(t,e)=>{t[e]=t[e].bind(t)}}function Jt(t){return(e,r,o)=>{o.value=vt(o.value,t,e)}}function vt(t,e,r){let o=[],n=[],s=null;return(...a)=>(clearTimeout(s),s=setTimeout(async()=>{try{let p=await t.apply(r,a);o.forEach(g=>g(p))}catch(p){n.forEach(g=>g(p))}o=[],n=[]},e),new Promise((p,g)=>{o.push(p),n.push(g)}))}import{DateTime as Wt}from"luxon";function z(t){return t=t||Wt.now(),t.toFormat("yyyy-MM-dd HH-mm-ss")}function It(t){let e={};do{if(t.name==="")break;for(let[r,o]of Object.entries(Object.getOwnPropertyDescriptors(t.prototype)))["constructor","clone","toJSON"].includes(r)||!o.get&&!o.set||(e[r]=o)}while(t=Object.getPrototypeOf(t));return e}function j(t,e,r){t.prototype[e]=r}function q(t,e,r){Object.defineProperty(t,e,{value:r})}var O=Symbol(),w=Symbol(),T=Symbol(),y=Symbol(),u=Symbol(),m=Symbol(),c=Symbol(),N=Symbol(),I=Symbol(),tt=Symbol(),et=Symbol();function i(t){return t&&typeof t=="object"&&!!t[u]}function dt(t,e){return!i(t)||!i(e)?t===e:JSON.stringify(t)===JSON.stringify(e)}function h(t){if(!i(t))throw new Error("@dto assert given object is not a class decorated with @Dto.")}var yt=Symbol();function _(t,e=0,r){return function(...o){let n=yt in t,s=t[yt]??=new WeakMap,a=o[e],p=r!==void 0?o[r]:"self";if(typeof a!="object")return t.call(this,...o);if(s.has(a)||s.set(a,[]),s.get(a).includes(p)){!1;return}s.get(a).push(p);let g=t.call(this,...o);return!n&&delete t[yt],g}}function Et(t){return h(t),t.clone()}function H(t){return h(t),t[y]}var At=_(function(t,e,r,o){let n=t[et];n(t,e,r,o),!1,t[m]&&At(t[m],t[c],t[m][t[c]])},0,1),x=At;var Pt=_(function(t){h(t),t[y]&&(t[y]=!1,!1,x(t,y,!1,!0)),!(!t[w]||t[w].length===0)&&t[w].filter(H).forEach(Pt)}),rt=Pt;async function kt(t,e){!i(t)||!H(t)||(await e(t),rt(t))}function ht(t){return t?.value??t}function Ct(t){return h(t),!t[y]}var Ot=_(function(t,e){h(t),t[y]||(t[y]=!0,!1,x(t,y,!0,!1)),t[m]&&Ot(t[m],t[c])}),E=Ot;function Dt(t,e,r){e[w]??=[],!e[w].includes(t)&&e[w].push(t),t[m]!==e&&(t[m]=e),t[c]!==r&&(t[c]=r)}function ot(t,e,r){i(r)?Dt(r,t,e):Array.isArray(r)&&(r.some(i)&&r.filter(i).forEach(o=>Dt(o,t,e)),r[m]=t,r[c]=e)}function G(t,e){let r=t[tt];r(t,e),!1}function Rt(t,e){if(w in e){let r=e[w].indexOf(t);e[w].splice(r,1)}t[m]=void 0,t[c]=void 0}function wt(t,e){i(e)?Rt(e,t):Array.isArray(e)&&(e.some(i)&&e.filter(i).forEach(r=>Rt(r,t)),e[m]=void 0,e[c]=void 0)}var A={};import{customRef as jt,markRaw as te}from"vue";var nt={deleteProperty(t,e){if(Reflect.deleteProperty(t,e),gt(t,e))return!0;let r=t[m];return r&&x(r,t[c],r[t[c]]),r&&E(r,t[c]),!0},get(t,e,r){if(e===I)return!0;if(gt(t,e))return Reflect.get(t,e,r);let o=t[m];return o&&G(o,t[c]),Reflect.get(t,e)},set(t,e,r,o){if(gt(t,e))return Reflect.set(t,e,r,o);let n=t[m];return n&&x(n,t[c],n[t[c]]),n&&E(n,t[c]),Reflect.set(t,e,r)}};function gt(t,e){return typeof e=="symbol"||typeof t[e]=="function"||e==="length"}var Nt={get(t,e,r){if(e===I)return!0;if(typeof e=="symbol")return Reflect.get(t,e,r);let o=t[T][e];if(!o||!o.get)return Reflect.get(t,e,r);let n=o.get.call(t);return!1,G(t,e),ot(t,e,n),n},getOwnPropertyDescriptor(t,e){return t[T][e]},ownKeys(t){return t[N]},set(t,e,r,o){if(typeof e=="symbol")return Reflect.set(t,e,r,o);let n=t[T][e];if(!n||!n.set)return Reflect.set(t,e,r,o);let s=n.get?.call(t)??void 0;return dt(r,s)||(wt(t,s),Array.isArray(r)&&!r[I]&&(r=new Proxy(r,nt)),!1,n.set.call(t,r),ot(t,e,r),E(t,e),x(t,e,r,s)),!0}};var _t={get(t,e,r){return e==="__v_isRef"?!1:e===I?!0:e in t?Reflect.get(t,e,r):Reflect.get(t.value,e)},getOwnPropertyDescriptor(t,e){return Reflect.getOwnPropertyDescriptor(t.value,e)},ownKeys(t){return Reflect.ownKeys(t.value)},set(t,e,r,o){return e in t?Reflect.set(t,e,r,o):Reflect.set(t.value,e,r)}};var Ht={construct(t,e,r){e=e.map(n=>Array.isArray(n)?new Proxy(n,nt):n);let o=jt((n,s)=>{let a=te(Reflect.construct(t,e,r));a[O]=e,a[y]=!1,a[tt]=n,a[et]=s;let p=new Proxy(a,Nt);return{get:()=>(n(),p),set:()=>{}}});return new Proxy(o,_t)}};function Gt(){let t=this;h(t);let e=A[t[u]],r=new e(...t[O]);return Object.entries(this[T]).filter(([,o])=>!!o.set).map(([o])=>o).forEach(o=>r[o]=i(this[o])?this[o].clone():this[o]),r}function Bt(t){for(let e in t){let r=this[T][e];i(this[e])&&typeof t[e]=="object"?this[e].fill(t[e]):r&&r.set&&(this[e]=t[e])}}function Lt(){return Object.fromEntries(this[N].map(t=>{let e=Reflect.get.call(this,this,t,this);return i(e)&&(e=e.toJSON()),[t,e]}))}function P(t){re(t);let e=Object.freeze(It(t)),r=Object.keys(e);return q(t.prototype,T,e),q(t.prototype,u,t.name),q(t.prototype,N,r),q(t,Symbol.hasInstance,o=>typeof o=="object"&&o?.[u]===t.name),j(t,"clone",Gt),j(t,"fill",Bt),j(t,"toJSON",Lt),ee(t)}function ee(t){let e=new Proxy(t,Ht);return A[t.name]=e,e}function re(t){let e=Object.getPrototypeOf(t.prototype);if(u in e)throw new Error(`\u26D4\uFE0F @dto ${t.name} cannot extend parent class which is also decorated with @dto ${e[u]}.`)}if(!1){let t=console.error.bind(console),e=console.info.bind(console),r=console.log.bind(console),o=console.warn.bind(console),n=s=>(...a)=>{for(let p=a.length-1;p>=0;--p){let g=a[p];if(!i(g))continue;let xt=ht(g);a.splice(p,1,`\u{1F4E6} ${xt[u]}`,xt.toJSON())}return s(...a)};console.error=n(t),console.info=n(e),console.log=n(r),console.warn=n(o)}function it(t){return t.map(B)}import{DateTime as oe}from"luxon";function Ft([,t]){return oe.fromISO(t)}function st(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,B(r)]).filter(([,e])=>e!==void 0))}var Tt={};function Mt([,t,e,r,o]){if(!(e in A))throw new Error(`[@marveld/http] Cannot restore @dto. Dto ${e} was not found.`);if(t in Tt)return Tt[t];!1;let n=A[e],s=new n(...it(o));return s.fill(st(r)),!1,Tt[t]=s,s}function zt(t){return Array.isArray(t)&&t[0]===3058}function qt(t){return Array.isArray(t)&&t[0]===3057}function B(t){switch(!0){case t===null:return null;case Array.isArray(t):switch(!0){case zt(t):return Ft(t);case qt(t):return Mt(t);default:return it(t)}case typeof t=="object":return st(t);default:return t}}function Yt(t){return B(JSON.parse(t))}import{DateTime as ae}from"luxon";import{DateTime as se}from"luxon";function at(t){return[3058,t.toISO({extendedZone:!0,includeOffset:!0})]}import{toRaw as ie}from"vue";function ut(t){return Object.fromEntries(Object.entries(t).map(([e,r])=>[e,L(r)]).filter(([,e])=>e!==void 0))}function Kt(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,t=>(+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4).toString(16))}function ct(t){t=ie(t);let e=t.toJSON();return[3057,Kt(),t[u],ut(e),mt(t[O])]}function mt(t){switch(!0){case t.every(i):return t.map(ct);case t.every(se.isDateTime):return t.map(at);default:return t.map(L)}}function L(t){switch(!0){case t===null:return null;case Array.isArray(t):return mt(t);case i(t):return ct(t);case ae.isDateTime(t):return at(t);case typeof t=="object":return ut(t);case typeof t=="boolean":case typeof t=="number":case typeof t=="string":return t;default:return}}function Qt(t){return JSON.stringify(L(t))}var Y,K,k=class{constructor(e,r){f(this,Y);f(this,K);d(this,Y,e),d(this,K,r)}get blob(){return l(this,Y)}get name(){return l(this,K)}};Y=new WeakMap,K=new WeakMap,k=b([P],k);var Q,U,V,$,J,C=class{constructor(e,r,o,n,s){f(this,Q);f(this,U);f(this,V);f(this,$);f(this,J);d(this,Q,e),d(this,U,r),d(this,V,o),d(this,$,n),d(this,J,s)}get items(){return l(this,Q)}get page(){return l(this,U)}get pageSize(){return l(this,V)}get pages(){return l(this,$)}get totalItems(){return l(this,J)}};Q=new WeakMap,U=new WeakMap,V=new WeakMap,$=new WeakMap,J=new WeakMap,C=b([P],C);var S=class{static parsePaginatedAdapter(e,r){return new C(e.items.map(r),e.page,e.page_size,e.pages,e.total_items)}static parseFileNameFromContentDispositionHeader(e){if(!e.startsWith("attachment"))return`download-${z()}`;let o=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(e);return(o?.length||0)<2?`download-${z()}`:o[1].replaceAll("'","").replaceAll('"',"").replaceAll("/","-").replaceAll(":","-")}};S=b([ft],S);var R=class{get data(){return this.#t}get headers(){return this.#e.headers}get ok(){return this.statusCode>=200&&this.statusCode<300}get response(){return this.#e}get statusCode(){return this.#e.status}#t;#e;constructor(e,r){this.#t=e,this.#e=r}};var F=class t{get authToken(){return this.#t}set authToken(e){this.#t=e}get baseUrl(){return this.#e}get dataField(){return this.#r}#t;#e;#r;constructor(e,r,o=!1){this.#t=e,this.#e=r,this.#r=o}static get instance(){if(t.#o===null)throw new Error("There is currently no HttpClient instance registered. Register one using the HttpClient.register() function.");return t.#o}static#o=null;static register(e){t.#o=e}};var v,W,X,Z,D=class{constructor(e,r,o,n){f(this,v);f(this,W);f(this,X);f(this,Z);d(this,v,e),d(this,W,r),d(this,X,o),d(this,Z,n)}get code(){return l(this,v)}get error(){return l(this,W)}get errorDescription(){return l(this,X)}get statusCode(){return l(this,Z)}};v=new WeakMap,W=new WeakMap,X=new WeakMap,Z=new WeakMap,D=b([P],D);var M=class t{get client(){return this.#t}get options(){return this.#r}get path(){return this.#e}set path(e){this.#e=e}get query(){return this.#o}set query(e){this.#o=e}#t;#e;#r={};#o=null;constructor(e,r){this.#t=r??F.instance,this.#r.cache="no-cache",this.#r.method="GET",this.#e=e}bearerToken(e){return e=e??this.#t.authToken,e?this.header("Authorization",`Bearer ${e}`):(this.#r.headers&&"Authorization"in this.#r.headers&&delete this.#r.headers.Authorization,this)}body(e,r="application/octet-stream"){return e instanceof FormData?r=null:(Array.isArray(e)||typeof e=="object")&&(e=JSON.stringify(e),r="application/json"),this.#r.body=e,r!==null?this.header("Content-Type",r):this}header(e,r){return this.#r.headers=this.#r.headers||{},this.#r.headers[e]=r,this}method(e){return this.#r.method=e.toUpperCase(),this}queryString(e){return this.#o=e,this}async fetch(){return this.#i().then(e=>e.json())}async fetchBlob(){let e=await this.#i();if(e.status!==200){let o=await e.json();throw"code"in o&&"error"in o&&"error_description"in o?new D(o.code,o.error,o.error_description,e.status):new D(-1,"failed_without_info","Request failed without any information from the backend.",e.status)}let r=e.headers.has("content-disposition")?S.parseFileNameFromContentDispositionHeader(e.headers.get("content-disposition")):`download-${z()}`;return new k(await e.blob(),r)}async run(){let{data:e,response:r}=await this.#n();return new R(e,r)}async runAdapter(e){let{data:r,response:o}=await this.#n();return new R(e(r),o)}async runArrayAdapter(e){return this.runAdapter(r=>r.map(e))}async runEmpty(){return await this.#n()}async runPaginatedAdapter(e){return this.runAdapter(r=>S.parsePaginatedAdapter(r,e))}async runData(){return await this.#n()}async runDataKey(e){let{data:r,response:o}=await this.#n();return new R(r[e],o)}async runStatusCode(){return(await this.#n()).statusCode}async#i(){let e=this.path;return this.query!==null&&(e+=`?${this.query.build()}`),await fetch(this.client.baseUrl+e,this.options)}async#n(){return await this.#i().then(e=>t.#s(e,this.client.dataField))}static async#s(e,r){if(e.status===204)return new R(null,e);if(e.headers.has("content-type")&&e.headers.get("content-type").startsWith("application/json")){let n=await e.json();if("code"in n&&"error"in n&&"error_description"in n)throw new D(n.code,n.error,n.error_description,e.status);return r&&"data"in n?new R(n.data,e):new R(n,e)}if(e.status===401||e.status===403)return new R(null,e);if((await e.text()).length===0&&e.status>=200&&e.status<300)return new R(null,e);throw new D(-1,"not_a_json_response","The response was not a JSON response.",e.status)}};var pt=class{request(e,r){return new M(e,r)}};var lt=class t{#t;constructor(){this.#t=new URLSearchParams}build(){return this.#t.toString()}append(e,r){return this.#e(this.#t.append.bind(this.#t),e,r)}appendArray(e,r){return r==null?this:(r.forEach(o=>this.append(e,o)),this)}delete(e){return this.#t.delete(e),this}get(e){return this.#t.get(e)}getAll(e){return this.#t.getAll(e)}has(e){return this.#t.has(e)}set(e,r){return this.#e(this.#t.set.bind(this.#t),e,r)}#e(e,r,o){if(!o&&o!==!1)return this;switch(typeof o){case"boolean":e(r,o?"true":"false");break;case"number":e(r,o.toString(10));break;case"string":e(r,o);break}return this}static builder(){return new t}};function ue(t){return t instanceof D}function ce(t){return t instanceof D&&(t=t.statusCode),t===403||t===401}export{R as BaseResponse,pt as BaseService,k as BlobResponse,S as HttpAdapter,F as HttpClient,C as Paginated,lt as QueryString,M as RequestBuilder,D as RequestError,ft as adapter,h as assertDto,$t as bound,Et as cloneDto,Jt as debounce,Yt as deserialize,P as dto,kt as executeIfDtoDirtyAndMarkClean,i as isDto,Ct as isDtoClean,H as isDtoDirty,ue as isRequestError,ce as isUnsanctionedRequest,rt as markDtoClean,E as markDtoDirty,Qt as serialize};
|
|
1
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else
|
|
6
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
7
|
+
if (d = decorators[i])
|
|
8
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/adapter/HttpAdapter.ts
|
|
13
|
+
import { DateTime as DateTime4 } from "luxon";
|
|
14
|
+
|
|
15
|
+
// src/decorator/adapter.ts
|
|
16
|
+
function adapter_default(Parent) {
|
|
17
|
+
return class extends Parent {
|
|
18
|
+
constructor(...args) {
|
|
19
|
+
throw new Error("@adapter: cannot create instance of class.");
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/decorator/bound.ts
|
|
25
|
+
function bound_default() {
|
|
26
|
+
return (target, method) => {
|
|
27
|
+
target[method] = target[method].bind(target);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/decorator/debounce.ts
|
|
32
|
+
function debounce_default(interval) {
|
|
33
|
+
return (target, _, descriptor) => {
|
|
34
|
+
descriptor.value = debounce(descriptor.value, interval, target);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function debounce(fn, interval, $this) {
|
|
38
|
+
let resolvers = [], rejecters = [], timeout = null;
|
|
39
|
+
return (...args) => {
|
|
40
|
+
clearTimeout(timeout);
|
|
41
|
+
timeout = setTimeout(async () => {
|
|
42
|
+
try {
|
|
43
|
+
let result = await fn.apply($this, args);
|
|
44
|
+
resolvers.forEach((resolve) => resolve(result));
|
|
45
|
+
} catch (err) {
|
|
46
|
+
rejecters.forEach((reject) => reject(err));
|
|
47
|
+
}
|
|
48
|
+
resolvers = [];
|
|
49
|
+
rejecters = [];
|
|
50
|
+
}, interval);
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
resolvers.push(resolve);
|
|
53
|
+
rejecters.push(reject);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// node_modules/@basmilius/utils/dist/utils.js
|
|
59
|
+
import { defineStore, storeToRefs } from "pinia";
|
|
60
|
+
function getPrototypeChain_default(obj) {
|
|
61
|
+
const entries = {};
|
|
62
|
+
do {
|
|
63
|
+
if (obj.name === "") {
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(obj.prototype))) {
|
|
67
|
+
if (["constructor", "clone", "toJSON"].includes(key)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!descriptor.get && !descriptor.set) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
entries[key] = descriptor;
|
|
74
|
+
}
|
|
75
|
+
} while (obj = Object.getPrototypeOf(obj));
|
|
76
|
+
return entries;
|
|
77
|
+
}
|
|
78
|
+
function setObjectMethod_default(obj, key, fn) {
|
|
79
|
+
obj.prototype[key] = fn;
|
|
80
|
+
}
|
|
81
|
+
function setObjectValue_default(obj, key, value) {
|
|
82
|
+
Object.defineProperty(obj, key, { value });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/decorator/dto/constant.ts
|
|
86
|
+
var ENABLE_CIRCULAR_LOGGING = false;
|
|
87
|
+
var ENABLE_DIRTY_LOGGING = false;
|
|
88
|
+
var ENABLE_REACTIVE_LOGGING = false;
|
|
89
|
+
var ENABLE_GET_LOGGING = false;
|
|
90
|
+
var ENABLE_SET_LOGGING = false;
|
|
91
|
+
var ENABLE_SERIALIZATION_LOGGING = false;
|
|
92
|
+
var OVERRIDE_CONSOLE_LOG = false;
|
|
93
|
+
|
|
94
|
+
// src/decorator/dto/symbols.ts
|
|
95
|
+
var ARGS = Symbol();
|
|
96
|
+
var CHILDREN = Symbol();
|
|
97
|
+
var DESCRIPTORS = Symbol();
|
|
98
|
+
var DIRTY = Symbol();
|
|
99
|
+
var NAME = Symbol();
|
|
100
|
+
var PARENT = Symbol();
|
|
101
|
+
var PARENT_KEY = Symbol();
|
|
102
|
+
var PROPERTIES = Symbol();
|
|
103
|
+
var PROXY = Symbol();
|
|
104
|
+
var TRACK = Symbol();
|
|
105
|
+
var TRIGGER = Symbol();
|
|
106
|
+
|
|
107
|
+
// src/decorator/dto/helper/isDto.ts
|
|
108
|
+
function isDto_default(obj) {
|
|
109
|
+
return obj && typeof obj === "object" && !!obj[NAME];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/decorator/dto/helper/areEqual.ts
|
|
113
|
+
function areEqual_default(a, b) {
|
|
114
|
+
if (!isDto_default(a) || !isDto_default(b)) {
|
|
115
|
+
return a === b;
|
|
116
|
+
}
|
|
117
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/decorator/dto/helper/assertDto.ts
|
|
121
|
+
function assertDto_default(obj) {
|
|
122
|
+
if (!isDto_default(obj)) {
|
|
123
|
+
throw new Error("@dto assert given object is not a class decorated with @Dto.");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/decorator/dto/helper/circularProtect.ts
|
|
128
|
+
var CIRCULAR_MAP = Symbol();
|
|
129
|
+
function circularProtect_default(fn, arg1 = 0, arg2) {
|
|
130
|
+
return function(...args) {
|
|
131
|
+
const hasMap = CIRCULAR_MAP in fn;
|
|
132
|
+
const map = fn[CIRCULAR_MAP] ??= new WeakMap;
|
|
133
|
+
const primary = args[arg1];
|
|
134
|
+
const secondary = arg2 !== undefined ? args[arg2] : "self";
|
|
135
|
+
if (typeof primary !== "object") {
|
|
136
|
+
return fn.call(this, ...args);
|
|
137
|
+
}
|
|
138
|
+
if (!map.has(primary)) {
|
|
139
|
+
map.set(primary, []);
|
|
140
|
+
}
|
|
141
|
+
if (map.get(primary).includes(secondary)) {
|
|
142
|
+
ENABLE_CIRCULAR_LOGGING && console.log(`%c@dto %ccircular protect %cdetected a circular reference`, "color: #0891b2", "color: #059669", "color: #1d4ed8", { fn, primary, secondary });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
map.get(primary).push(secondary);
|
|
146
|
+
const result = fn.call(this, ...args);
|
|
147
|
+
!hasMap && delete fn[CIRCULAR_MAP];
|
|
148
|
+
return result;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/decorator/dto/helper/cloneDto.ts
|
|
153
|
+
function cloneDto_default(obj) {
|
|
154
|
+
assertDto_default(obj);
|
|
155
|
+
return obj.clone();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/decorator/dto/helper/isDtoDirty.ts
|
|
159
|
+
function isDtoDirty_default(obj) {
|
|
160
|
+
assertDto_default(obj);
|
|
161
|
+
return obj[DIRTY];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/decorator/dto/helper/triggerDto.ts
|
|
165
|
+
var triggerDto = circularProtect_default(function(dto, key, value, oldValue) {
|
|
166
|
+
const trigger = dto[TRIGGER];
|
|
167
|
+
trigger(dto, key, value, oldValue);
|
|
168
|
+
ENABLE_REACTIVE_LOGGING && console.log(`%c@dto %c${dto[NAME]} %ctrigger`, "color: #0891b2", "color: #059669", "color: #1d4ed8", key, { dto, value, oldValue });
|
|
169
|
+
dto[PARENT] && triggerDto(dto[PARENT], dto[PARENT_KEY], dto[PARENT][dto[PARENT_KEY]]);
|
|
170
|
+
}, 0, 1);
|
|
171
|
+
var triggerDto_default = triggerDto;
|
|
172
|
+
|
|
173
|
+
// src/decorator/dto/helper/markDtoClean.ts
|
|
174
|
+
var markDtoClean = circularProtect_default(function(obj) {
|
|
175
|
+
assertDto_default(obj);
|
|
176
|
+
if (obj[DIRTY]) {
|
|
177
|
+
obj[DIRTY] = false;
|
|
178
|
+
ENABLE_DIRTY_LOGGING && console.log(`%c@dto %c${obj[NAME]} %cdirty`, "color: #0891b2", "color: #059669", "color: #1d4ed8", "marked clean", { obj });
|
|
179
|
+
triggerDto_default(obj, DIRTY, false, true);
|
|
180
|
+
}
|
|
181
|
+
if (!obj[CHILDREN] || obj[CHILDREN].length === 0) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
obj[CHILDREN].filter(isDtoDirty_default).forEach(markDtoClean);
|
|
185
|
+
});
|
|
186
|
+
var markDtoClean_default = markDtoClean;
|
|
187
|
+
|
|
188
|
+
// src/decorator/dto/helper/executeIfDtoDirtyAndMarkClean.ts
|
|
189
|
+
async function executeIfDtoDirtyAndMarkClean_default(obj, fn) {
|
|
190
|
+
if (!isDto_default(obj) || !isDtoDirty_default(obj)) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
await fn(obj);
|
|
194
|
+
markDtoClean_default(obj);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/decorator/dto/helper/instance.ts
|
|
198
|
+
function instance_default(dto) {
|
|
199
|
+
return dto?.value ?? dto;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// src/decorator/dto/helper/isDtoClean.ts
|
|
203
|
+
function isDtoClean_default(obj) {
|
|
204
|
+
assertDto_default(obj);
|
|
205
|
+
return !obj[DIRTY];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/decorator/dto/helper/markDtoDirty.ts
|
|
209
|
+
var markDtoDirty = circularProtect_default(function(obj, key) {
|
|
210
|
+
assertDto_default(obj);
|
|
211
|
+
if (!obj[DIRTY]) {
|
|
212
|
+
obj[DIRTY] = true;
|
|
213
|
+
ENABLE_DIRTY_LOGGING && console.log(`%c@dto %c${obj[NAME]} %cdirty`, "color: #0891b2", "color: #059669", "color: #1d4ed8", "marked dirty", { obj, key });
|
|
214
|
+
triggerDto_default(obj, DIRTY, true, false);
|
|
215
|
+
}
|
|
216
|
+
if (!obj[PARENT]) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
markDtoDirty(obj[PARENT], obj[PARENT_KEY]);
|
|
220
|
+
});
|
|
221
|
+
var markDtoDirty_default = markDtoDirty;
|
|
222
|
+
|
|
223
|
+
// src/decorator/dto/helper/relateDtoTo.ts
|
|
224
|
+
function relateDtoTo_default(dto, parent, key) {
|
|
225
|
+
parent[CHILDREN] ??= [];
|
|
226
|
+
!parent[CHILDREN].includes(dto) && parent[CHILDREN].push(dto);
|
|
227
|
+
dto[PARENT] !== parent && (dto[PARENT] = parent);
|
|
228
|
+
dto[PARENT_KEY] !== key && (dto[PARENT_KEY] = key);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// src/decorator/dto/helper/relateValueTo.ts
|
|
232
|
+
function relateValueTo_default(dto, key, value) {
|
|
233
|
+
if (isDto_default(value)) {
|
|
234
|
+
relateDtoTo_default(value, dto, key);
|
|
235
|
+
} else if (Array.isArray(value)) {
|
|
236
|
+
if (value.some(isDto_default)) {
|
|
237
|
+
value.filter(isDto_default).forEach((val) => relateDtoTo_default(val, dto, key));
|
|
238
|
+
}
|
|
239
|
+
value[PARENT] = dto;
|
|
240
|
+
value[PARENT_KEY] = key;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/decorator/dto/helper/trackDto.ts
|
|
245
|
+
function trackDto(dto, key) {
|
|
246
|
+
const track = dto[TRACK];
|
|
247
|
+
track(dto, key);
|
|
248
|
+
ENABLE_REACTIVE_LOGGING && console.log(`%c@dto %c${dto[NAME]} %ctrack`, "color: #0891b2", "color: #059669", "color: #1d4ed8", key, { dto });
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// src/decorator/dto/helper/unrelateDtoFrom.ts
|
|
252
|
+
function unrelateDtoFrom_default(dto, parent) {
|
|
253
|
+
if (CHILDREN in parent) {
|
|
254
|
+
const index = parent[CHILDREN].indexOf(dto);
|
|
255
|
+
parent[CHILDREN].splice(index, 1);
|
|
256
|
+
}
|
|
257
|
+
dto[PARENT] = undefined;
|
|
258
|
+
dto[PARENT_KEY] = undefined;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/decorator/dto/helper/unrelateValueFrom.ts
|
|
262
|
+
function unrelateValueFrom_default(dto, value) {
|
|
263
|
+
if (isDto_default(value)) {
|
|
264
|
+
unrelateDtoFrom_default(value, dto);
|
|
265
|
+
} else if (Array.isArray(value)) {
|
|
266
|
+
if (value.some(isDto_default)) {
|
|
267
|
+
value.filter(isDto_default).forEach((val) => unrelateDtoFrom_default(val, dto));
|
|
268
|
+
}
|
|
269
|
+
value[PARENT] = undefined;
|
|
270
|
+
value[PARENT_KEY] = undefined;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// src/decorator/dto/map.ts
|
|
275
|
+
var DTO_CLASS_MAP = {};
|
|
276
|
+
|
|
277
|
+
// node_modules/@vue/shared/dist/shared.esm-bundler.js
|
|
278
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
279
|
+
function makeMap(str) {
|
|
280
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
281
|
+
for (const key of str.split(","))
|
|
282
|
+
map[key] = 1;
|
|
283
|
+
return (val) => (val in map);
|
|
284
|
+
}
|
|
285
|
+
var EMPTY_OBJ = Object.freeze({});
|
|
286
|
+
var EMPTY_ARR = Object.freeze([]);
|
|
287
|
+
var NOOP = () => {
|
|
288
|
+
};
|
|
289
|
+
var NO = () => false;
|
|
290
|
+
var extend = Object.assign;
|
|
291
|
+
var remove = (arr, el) => {
|
|
292
|
+
const i = arr.indexOf(el);
|
|
293
|
+
if (i > -1) {
|
|
294
|
+
arr.splice(i, 1);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
298
|
+
var hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
299
|
+
var isArray = Array.isArray;
|
|
300
|
+
var isMap = (val) => toTypeString(val) === "[object Map]";
|
|
301
|
+
var isSet = (val) => toTypeString(val) === "[object Set]";
|
|
302
|
+
var isFunction = (val) => typeof val === "function";
|
|
303
|
+
var isString = (val) => typeof val === "string";
|
|
304
|
+
var isSymbol = (val) => typeof val === "symbol";
|
|
305
|
+
var isObject = (val) => val !== null && typeof val === "object";
|
|
306
|
+
var isPromise = (val) => {
|
|
307
|
+
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
|
308
|
+
};
|
|
309
|
+
var objectToString = Object.prototype.toString;
|
|
310
|
+
var toTypeString = (value) => objectToString.call(value);
|
|
311
|
+
var toRawType = (value) => {
|
|
312
|
+
return toTypeString(value).slice(8, -1);
|
|
313
|
+
};
|
|
314
|
+
var isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
315
|
+
var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
316
|
+
var cacheStringFunction = (fn) => {
|
|
317
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
318
|
+
return (str) => {
|
|
319
|
+
const hit = cache[str];
|
|
320
|
+
return hit || (cache[str] = fn(str));
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
var camelizeRE = /-(\w)/g;
|
|
324
|
+
var camelize = cacheStringFunction((str) => {
|
|
325
|
+
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
326
|
+
});
|
|
327
|
+
var hyphenateRE = /\B([A-Z])/g;
|
|
328
|
+
var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
329
|
+
var capitalize = cacheStringFunction((str) => {
|
|
330
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
331
|
+
});
|
|
332
|
+
var toHandlerKey = cacheStringFunction((str) => {
|
|
333
|
+
const s = str ? `on${capitalize(str)}` : ``;
|
|
334
|
+
return s;
|
|
335
|
+
});
|
|
336
|
+
var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
337
|
+
var def = (obj, key, value, writable = false) => {
|
|
338
|
+
Object.defineProperty(obj, key, {
|
|
339
|
+
configurable: true,
|
|
340
|
+
enumerable: false,
|
|
341
|
+
writable,
|
|
342
|
+
value
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
var _globalThis;
|
|
346
|
+
var getGlobalThis = () => {
|
|
347
|
+
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
348
|
+
};
|
|
349
|
+
var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
350
|
+
var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
|
|
351
|
+
|
|
352
|
+
// node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
|
|
353
|
+
function warn(msg, ...args) {
|
|
354
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
355
|
+
}
|
|
356
|
+
var activeEffectScope;
|
|
357
|
+
function getCurrentScope() {
|
|
358
|
+
return activeEffectScope;
|
|
359
|
+
}
|
|
360
|
+
var activeSub;
|
|
361
|
+
var pausedQueueEffects = /* @__PURE__ */ new WeakSet;
|
|
362
|
+
|
|
363
|
+
class ReactiveEffect {
|
|
364
|
+
constructor(fn) {
|
|
365
|
+
this.fn = fn;
|
|
366
|
+
this.deps = undefined;
|
|
367
|
+
this.depsTail = undefined;
|
|
368
|
+
this.flags = 1 | 4;
|
|
369
|
+
this.next = undefined;
|
|
370
|
+
this.cleanup = undefined;
|
|
371
|
+
this.scheduler = undefined;
|
|
372
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
373
|
+
activeEffectScope.effects.push(this);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
pause() {
|
|
377
|
+
this.flags |= 64;
|
|
378
|
+
}
|
|
379
|
+
resume() {
|
|
380
|
+
if (this.flags & 64) {
|
|
381
|
+
this.flags &= ~64;
|
|
382
|
+
if (pausedQueueEffects.has(this)) {
|
|
383
|
+
pausedQueueEffects.delete(this);
|
|
384
|
+
this.trigger();
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
notify() {
|
|
389
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (!(this.flags & 8)) {
|
|
393
|
+
batch(this);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
run() {
|
|
397
|
+
if (!(this.flags & 1)) {
|
|
398
|
+
return this.fn();
|
|
399
|
+
}
|
|
400
|
+
this.flags |= 2;
|
|
401
|
+
cleanupEffect(this);
|
|
402
|
+
prepareDeps(this);
|
|
403
|
+
const prevEffect = activeSub;
|
|
404
|
+
const prevShouldTrack = shouldTrack;
|
|
405
|
+
activeSub = this;
|
|
406
|
+
shouldTrack = true;
|
|
407
|
+
try {
|
|
408
|
+
return this.fn();
|
|
409
|
+
} finally {
|
|
410
|
+
if (activeSub !== this) {
|
|
411
|
+
warn("Active effect was not restored correctly - this is likely a Vue internal bug.");
|
|
412
|
+
}
|
|
413
|
+
cleanupDeps(this);
|
|
414
|
+
activeSub = prevEffect;
|
|
415
|
+
shouldTrack = prevShouldTrack;
|
|
416
|
+
this.flags &= ~2;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
stop() {
|
|
420
|
+
if (this.flags & 1) {
|
|
421
|
+
for (let link = this.deps;link; link = link.nextDep) {
|
|
422
|
+
removeSub(link);
|
|
423
|
+
}
|
|
424
|
+
this.deps = this.depsTail = undefined;
|
|
425
|
+
cleanupEffect(this);
|
|
426
|
+
this.onStop && this.onStop();
|
|
427
|
+
this.flags &= ~1;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
trigger() {
|
|
431
|
+
if (this.flags & 64) {
|
|
432
|
+
pausedQueueEffects.add(this);
|
|
433
|
+
} else if (this.scheduler) {
|
|
434
|
+
this.scheduler();
|
|
435
|
+
} else {
|
|
436
|
+
this.runIfDirty();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
runIfDirty() {
|
|
440
|
+
if (isDirty(this)) {
|
|
441
|
+
this.run();
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
get dirty() {
|
|
445
|
+
return isDirty(this);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
var batchDepth = 0;
|
|
449
|
+
var batchedSub;
|
|
450
|
+
var batchedComputed;
|
|
451
|
+
function batch(sub, isComputed = false) {
|
|
452
|
+
sub.flags |= 8;
|
|
453
|
+
if (isComputed) {
|
|
454
|
+
sub.next = batchedComputed;
|
|
455
|
+
batchedComputed = sub;
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
sub.next = batchedSub;
|
|
459
|
+
batchedSub = sub;
|
|
460
|
+
}
|
|
461
|
+
function startBatch() {
|
|
462
|
+
batchDepth++;
|
|
463
|
+
}
|
|
464
|
+
function endBatch() {
|
|
465
|
+
if (--batchDepth > 0) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (batchedComputed) {
|
|
469
|
+
let e = batchedComputed;
|
|
470
|
+
batchedComputed = undefined;
|
|
471
|
+
while (e) {
|
|
472
|
+
const next = e.next;
|
|
473
|
+
e.next = undefined;
|
|
474
|
+
e.flags &= ~8;
|
|
475
|
+
e = next;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
let error;
|
|
479
|
+
while (batchedSub) {
|
|
480
|
+
let e = batchedSub;
|
|
481
|
+
batchedSub = undefined;
|
|
482
|
+
while (e) {
|
|
483
|
+
const next = e.next;
|
|
484
|
+
e.next = undefined;
|
|
485
|
+
e.flags &= ~8;
|
|
486
|
+
if (e.flags & 1) {
|
|
487
|
+
try {
|
|
488
|
+
e.trigger();
|
|
489
|
+
} catch (err) {
|
|
490
|
+
if (!error)
|
|
491
|
+
error = err;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
e = next;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (error)
|
|
498
|
+
throw error;
|
|
499
|
+
}
|
|
500
|
+
function prepareDeps(sub) {
|
|
501
|
+
for (let link = sub.deps;link; link = link.nextDep) {
|
|
502
|
+
link.version = -1;
|
|
503
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
504
|
+
link.dep.activeLink = link;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function cleanupDeps(sub) {
|
|
508
|
+
let head;
|
|
509
|
+
let tail = sub.depsTail;
|
|
510
|
+
let link = tail;
|
|
511
|
+
while (link) {
|
|
512
|
+
const prev = link.prevDep;
|
|
513
|
+
if (link.version === -1) {
|
|
514
|
+
if (link === tail)
|
|
515
|
+
tail = prev;
|
|
516
|
+
removeSub(link);
|
|
517
|
+
removeDep(link);
|
|
518
|
+
} else {
|
|
519
|
+
head = link;
|
|
520
|
+
}
|
|
521
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
522
|
+
link.prevActiveLink = undefined;
|
|
523
|
+
link = prev;
|
|
524
|
+
}
|
|
525
|
+
sub.deps = head;
|
|
526
|
+
sub.depsTail = tail;
|
|
527
|
+
}
|
|
528
|
+
function isDirty(sub) {
|
|
529
|
+
for (let link = sub.deps;link; link = link.nextDep) {
|
|
530
|
+
if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
if (sub._dirty) {
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
function refreshComputed(computed) {
|
|
540
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
computed.flags &= ~16;
|
|
544
|
+
if (computed.globalVersion === globalVersion) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
computed.globalVersion = globalVersion;
|
|
548
|
+
const dep = computed.dep;
|
|
549
|
+
computed.flags |= 2;
|
|
550
|
+
if (dep.version > 0 && !computed.isSSR && computed.deps && !isDirty(computed)) {
|
|
551
|
+
computed.flags &= ~2;
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
const prevSub = activeSub;
|
|
555
|
+
const prevShouldTrack = shouldTrack;
|
|
556
|
+
activeSub = computed;
|
|
557
|
+
shouldTrack = true;
|
|
558
|
+
try {
|
|
559
|
+
prepareDeps(computed);
|
|
560
|
+
const value = computed.fn(computed._value);
|
|
561
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
562
|
+
computed._value = value;
|
|
563
|
+
dep.version++;
|
|
564
|
+
}
|
|
565
|
+
} catch (err) {
|
|
566
|
+
dep.version++;
|
|
567
|
+
throw err;
|
|
568
|
+
} finally {
|
|
569
|
+
activeSub = prevSub;
|
|
570
|
+
shouldTrack = prevShouldTrack;
|
|
571
|
+
cleanupDeps(computed);
|
|
572
|
+
computed.flags &= ~2;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
function removeSub(link, soft = false) {
|
|
576
|
+
const { dep, prevSub, nextSub } = link;
|
|
577
|
+
if (prevSub) {
|
|
578
|
+
prevSub.nextSub = nextSub;
|
|
579
|
+
link.prevSub = undefined;
|
|
580
|
+
}
|
|
581
|
+
if (nextSub) {
|
|
582
|
+
nextSub.prevSub = prevSub;
|
|
583
|
+
link.nextSub = undefined;
|
|
584
|
+
}
|
|
585
|
+
if (dep.subsHead === link) {
|
|
586
|
+
dep.subsHead = nextSub;
|
|
587
|
+
}
|
|
588
|
+
if (dep.subs === link) {
|
|
589
|
+
dep.subs = prevSub;
|
|
590
|
+
if (!prevSub && dep.computed) {
|
|
591
|
+
dep.computed.flags &= ~4;
|
|
592
|
+
for (let l = dep.computed.deps;l; l = l.nextDep) {
|
|
593
|
+
removeSub(l, true);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
if (!soft && !--dep.sc && dep.map) {
|
|
598
|
+
dep.map.delete(dep.key);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function removeDep(link) {
|
|
602
|
+
const { prevDep, nextDep } = link;
|
|
603
|
+
if (prevDep) {
|
|
604
|
+
prevDep.nextDep = nextDep;
|
|
605
|
+
link.prevDep = undefined;
|
|
606
|
+
}
|
|
607
|
+
if (nextDep) {
|
|
608
|
+
nextDep.prevDep = prevDep;
|
|
609
|
+
link.nextDep = undefined;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
var shouldTrack = true;
|
|
613
|
+
var trackStack = [];
|
|
614
|
+
function pauseTracking() {
|
|
615
|
+
trackStack.push(shouldTrack);
|
|
616
|
+
shouldTrack = false;
|
|
617
|
+
}
|
|
618
|
+
function resetTracking() {
|
|
619
|
+
const last = trackStack.pop();
|
|
620
|
+
shouldTrack = last === undefined ? true : last;
|
|
621
|
+
}
|
|
622
|
+
function cleanupEffect(e) {
|
|
623
|
+
const { cleanup } = e;
|
|
624
|
+
e.cleanup = undefined;
|
|
625
|
+
if (cleanup) {
|
|
626
|
+
const prevSub = activeSub;
|
|
627
|
+
activeSub = undefined;
|
|
628
|
+
try {
|
|
629
|
+
cleanup();
|
|
630
|
+
} finally {
|
|
631
|
+
activeSub = prevSub;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
var globalVersion = 0;
|
|
636
|
+
|
|
637
|
+
class Link {
|
|
638
|
+
constructor(sub, dep) {
|
|
639
|
+
this.sub = sub;
|
|
640
|
+
this.dep = dep;
|
|
641
|
+
this.version = dep.version;
|
|
642
|
+
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = undefined;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
class Dep {
|
|
647
|
+
constructor(computed) {
|
|
648
|
+
this.computed = computed;
|
|
649
|
+
this.version = 0;
|
|
650
|
+
this.activeLink = undefined;
|
|
651
|
+
this.subs = undefined;
|
|
652
|
+
this.map = undefined;
|
|
653
|
+
this.key = undefined;
|
|
654
|
+
this.sc = 0;
|
|
655
|
+
if (true) {
|
|
656
|
+
this.subsHead = undefined;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
track(debugInfo) {
|
|
660
|
+
if (!activeSub || !shouldTrack || activeSub === this.computed) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
let link = this.activeLink;
|
|
664
|
+
if (link === undefined || link.sub !== activeSub) {
|
|
665
|
+
link = this.activeLink = new Link(activeSub, this);
|
|
666
|
+
if (!activeSub.deps) {
|
|
667
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
668
|
+
} else {
|
|
669
|
+
link.prevDep = activeSub.depsTail;
|
|
670
|
+
activeSub.depsTail.nextDep = link;
|
|
671
|
+
activeSub.depsTail = link;
|
|
672
|
+
}
|
|
673
|
+
addSub(link);
|
|
674
|
+
} else if (link.version === -1) {
|
|
675
|
+
link.version = this.version;
|
|
676
|
+
if (link.nextDep) {
|
|
677
|
+
const next = link.nextDep;
|
|
678
|
+
next.prevDep = link.prevDep;
|
|
679
|
+
if (link.prevDep) {
|
|
680
|
+
link.prevDep.nextDep = next;
|
|
681
|
+
}
|
|
682
|
+
link.prevDep = activeSub.depsTail;
|
|
683
|
+
link.nextDep = undefined;
|
|
684
|
+
activeSub.depsTail.nextDep = link;
|
|
685
|
+
activeSub.depsTail = link;
|
|
686
|
+
if (activeSub.deps === link) {
|
|
687
|
+
activeSub.deps = next;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (activeSub.onTrack) {
|
|
692
|
+
activeSub.onTrack(extend({
|
|
693
|
+
effect: activeSub
|
|
694
|
+
}, debugInfo));
|
|
695
|
+
}
|
|
696
|
+
return link;
|
|
697
|
+
}
|
|
698
|
+
trigger(debugInfo) {
|
|
699
|
+
this.version++;
|
|
700
|
+
globalVersion++;
|
|
701
|
+
this.notify(debugInfo);
|
|
702
|
+
}
|
|
703
|
+
notify(debugInfo) {
|
|
704
|
+
startBatch();
|
|
705
|
+
try {
|
|
706
|
+
if (true) {
|
|
707
|
+
for (let head = this.subsHead;head; head = head.nextSub) {
|
|
708
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
709
|
+
head.sub.onTrigger(extend({
|
|
710
|
+
effect: head.sub
|
|
711
|
+
}, debugInfo));
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
for (let link = this.subs;link; link = link.prevSub) {
|
|
716
|
+
if (link.sub.notify()) {
|
|
717
|
+
link.sub.dep.notify();
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
} finally {
|
|
721
|
+
endBatch();
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
function addSub(link) {
|
|
726
|
+
link.dep.sc++;
|
|
727
|
+
if (link.sub.flags & 4) {
|
|
728
|
+
const computed = link.dep.computed;
|
|
729
|
+
if (computed && !link.dep.subs) {
|
|
730
|
+
computed.flags |= 4 | 16;
|
|
731
|
+
for (let l = computed.deps;l; l = l.nextDep) {
|
|
732
|
+
addSub(l);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const currentTail = link.dep.subs;
|
|
736
|
+
if (currentTail !== link) {
|
|
737
|
+
link.prevSub = currentTail;
|
|
738
|
+
if (currentTail)
|
|
739
|
+
currentTail.nextSub = link;
|
|
740
|
+
}
|
|
741
|
+
if (link.dep.subsHead === undefined) {
|
|
742
|
+
link.dep.subsHead = link;
|
|
743
|
+
}
|
|
744
|
+
link.dep.subs = link;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
var targetMap = /* @__PURE__ */ new WeakMap;
|
|
748
|
+
var ITERATE_KEY = Symbol("Object iterate");
|
|
749
|
+
var MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate");
|
|
750
|
+
var ARRAY_ITERATE_KEY = Symbol("Array iterate");
|
|
751
|
+
function track(target, type, key) {
|
|
752
|
+
if (shouldTrack && activeSub) {
|
|
753
|
+
let depsMap = targetMap.get(target);
|
|
754
|
+
if (!depsMap) {
|
|
755
|
+
targetMap.set(target, depsMap = /* @__PURE__ */ new Map);
|
|
756
|
+
}
|
|
757
|
+
let dep = depsMap.get(key);
|
|
758
|
+
if (!dep) {
|
|
759
|
+
depsMap.set(key, dep = new Dep);
|
|
760
|
+
dep.map = depsMap;
|
|
761
|
+
dep.key = key;
|
|
762
|
+
}
|
|
763
|
+
if (true) {
|
|
764
|
+
dep.track({
|
|
765
|
+
target,
|
|
766
|
+
type,
|
|
767
|
+
key
|
|
768
|
+
});
|
|
769
|
+
} else {
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
774
|
+
const depsMap = targetMap.get(target);
|
|
775
|
+
if (!depsMap) {
|
|
776
|
+
globalVersion++;
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
const run = (dep) => {
|
|
780
|
+
if (dep) {
|
|
781
|
+
if (true) {
|
|
782
|
+
dep.trigger({
|
|
783
|
+
target,
|
|
784
|
+
type,
|
|
785
|
+
key,
|
|
786
|
+
newValue,
|
|
787
|
+
oldValue,
|
|
788
|
+
oldTarget
|
|
789
|
+
});
|
|
790
|
+
} else {
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
startBatch();
|
|
795
|
+
if (type === "clear") {
|
|
796
|
+
depsMap.forEach(run);
|
|
797
|
+
} else {
|
|
798
|
+
const targetIsArray = isArray(target);
|
|
799
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
800
|
+
if (targetIsArray && key === "length") {
|
|
801
|
+
const newLength = Number(newValue);
|
|
802
|
+
depsMap.forEach((dep, key2) => {
|
|
803
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
804
|
+
run(dep);
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
} else {
|
|
808
|
+
if (key !== undefined || depsMap.has(undefined)) {
|
|
809
|
+
run(depsMap.get(key));
|
|
810
|
+
}
|
|
811
|
+
if (isArrayIndex) {
|
|
812
|
+
run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
813
|
+
}
|
|
814
|
+
switch (type) {
|
|
815
|
+
case "add":
|
|
816
|
+
if (!targetIsArray) {
|
|
817
|
+
run(depsMap.get(ITERATE_KEY));
|
|
818
|
+
if (isMap(target)) {
|
|
819
|
+
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
820
|
+
}
|
|
821
|
+
} else if (isArrayIndex) {
|
|
822
|
+
run(depsMap.get("length"));
|
|
823
|
+
}
|
|
824
|
+
break;
|
|
825
|
+
case "delete":
|
|
826
|
+
if (!targetIsArray) {
|
|
827
|
+
run(depsMap.get(ITERATE_KEY));
|
|
828
|
+
if (isMap(target)) {
|
|
829
|
+
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
break;
|
|
833
|
+
case "set":
|
|
834
|
+
if (isMap(target)) {
|
|
835
|
+
run(depsMap.get(ITERATE_KEY));
|
|
836
|
+
}
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
endBatch();
|
|
842
|
+
}
|
|
843
|
+
function reactiveReadArray(array) {
|
|
844
|
+
const raw = toRaw(array);
|
|
845
|
+
if (raw === array)
|
|
846
|
+
return raw;
|
|
847
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
848
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
849
|
+
}
|
|
850
|
+
function shallowReadArray(arr) {
|
|
851
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
852
|
+
return arr;
|
|
853
|
+
}
|
|
854
|
+
var arrayInstrumentations = {
|
|
855
|
+
__proto__: null,
|
|
856
|
+
[Symbol.iterator]() {
|
|
857
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
858
|
+
},
|
|
859
|
+
concat(...args) {
|
|
860
|
+
return reactiveReadArray(this).concat(...args.map((x) => isArray(x) ? reactiveReadArray(x) : x));
|
|
861
|
+
},
|
|
862
|
+
entries() {
|
|
863
|
+
return iterator(this, "entries", (value) => {
|
|
864
|
+
value[1] = toReactive(value[1]);
|
|
865
|
+
return value;
|
|
866
|
+
});
|
|
867
|
+
},
|
|
868
|
+
every(fn, thisArg) {
|
|
869
|
+
return apply(this, "every", fn, thisArg, undefined, arguments);
|
|
870
|
+
},
|
|
871
|
+
filter(fn, thisArg) {
|
|
872
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
873
|
+
},
|
|
874
|
+
find(fn, thisArg) {
|
|
875
|
+
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
876
|
+
},
|
|
877
|
+
findIndex(fn, thisArg) {
|
|
878
|
+
return apply(this, "findIndex", fn, thisArg, undefined, arguments);
|
|
879
|
+
},
|
|
880
|
+
findLast(fn, thisArg) {
|
|
881
|
+
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
882
|
+
},
|
|
883
|
+
findLastIndex(fn, thisArg) {
|
|
884
|
+
return apply(this, "findLastIndex", fn, thisArg, undefined, arguments);
|
|
885
|
+
},
|
|
886
|
+
forEach(fn, thisArg) {
|
|
887
|
+
return apply(this, "forEach", fn, thisArg, undefined, arguments);
|
|
888
|
+
},
|
|
889
|
+
includes(...args) {
|
|
890
|
+
return searchProxy(this, "includes", args);
|
|
891
|
+
},
|
|
892
|
+
indexOf(...args) {
|
|
893
|
+
return searchProxy(this, "indexOf", args);
|
|
894
|
+
},
|
|
895
|
+
join(separator) {
|
|
896
|
+
return reactiveReadArray(this).join(separator);
|
|
897
|
+
},
|
|
898
|
+
lastIndexOf(...args) {
|
|
899
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
900
|
+
},
|
|
901
|
+
map(fn, thisArg) {
|
|
902
|
+
return apply(this, "map", fn, thisArg, undefined, arguments);
|
|
903
|
+
},
|
|
904
|
+
pop() {
|
|
905
|
+
return noTracking(this, "pop");
|
|
906
|
+
},
|
|
907
|
+
push(...args) {
|
|
908
|
+
return noTracking(this, "push", args);
|
|
909
|
+
},
|
|
910
|
+
reduce(fn, ...args) {
|
|
911
|
+
return reduce(this, "reduce", fn, args);
|
|
912
|
+
},
|
|
913
|
+
reduceRight(fn, ...args) {
|
|
914
|
+
return reduce(this, "reduceRight", fn, args);
|
|
915
|
+
},
|
|
916
|
+
shift() {
|
|
917
|
+
return noTracking(this, "shift");
|
|
918
|
+
},
|
|
919
|
+
some(fn, thisArg) {
|
|
920
|
+
return apply(this, "some", fn, thisArg, undefined, arguments);
|
|
921
|
+
},
|
|
922
|
+
splice(...args) {
|
|
923
|
+
return noTracking(this, "splice", args);
|
|
924
|
+
},
|
|
925
|
+
toReversed() {
|
|
926
|
+
return reactiveReadArray(this).toReversed();
|
|
927
|
+
},
|
|
928
|
+
toSorted(comparer) {
|
|
929
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
930
|
+
},
|
|
931
|
+
toSpliced(...args) {
|
|
932
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
933
|
+
},
|
|
934
|
+
unshift(...args) {
|
|
935
|
+
return noTracking(this, "unshift", args);
|
|
936
|
+
},
|
|
937
|
+
values() {
|
|
938
|
+
return iterator(this, "values", toReactive);
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
function iterator(self2, method, wrapValue) {
|
|
942
|
+
const arr = shallowReadArray(self2);
|
|
943
|
+
const iter = arr[method]();
|
|
944
|
+
if (arr !== self2 && !isShallow(self2)) {
|
|
945
|
+
iter._next = iter.next;
|
|
946
|
+
iter.next = () => {
|
|
947
|
+
const result = iter._next();
|
|
948
|
+
if (result.value) {
|
|
949
|
+
result.value = wrapValue(result.value);
|
|
950
|
+
}
|
|
951
|
+
return result;
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
return iter;
|
|
955
|
+
}
|
|
956
|
+
var arrayProto = Array.prototype;
|
|
957
|
+
function apply(self2, method, fn, thisArg, wrappedRetFn, args) {
|
|
958
|
+
const arr = shallowReadArray(self2);
|
|
959
|
+
const needsWrap = arr !== self2 && !isShallow(self2);
|
|
960
|
+
const methodFn = arr[method];
|
|
961
|
+
if (methodFn !== arrayProto[method]) {
|
|
962
|
+
const result2 = methodFn.apply(self2, args);
|
|
963
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
964
|
+
}
|
|
965
|
+
let wrappedFn = fn;
|
|
966
|
+
if (arr !== self2) {
|
|
967
|
+
if (needsWrap) {
|
|
968
|
+
wrappedFn = function(item, index) {
|
|
969
|
+
return fn.call(this, toReactive(item), index, self2);
|
|
970
|
+
};
|
|
971
|
+
} else if (fn.length > 2) {
|
|
972
|
+
wrappedFn = function(item, index) {
|
|
973
|
+
return fn.call(this, item, index, self2);
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
978
|
+
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
979
|
+
}
|
|
980
|
+
function reduce(self2, method, fn, args) {
|
|
981
|
+
const arr = shallowReadArray(self2);
|
|
982
|
+
let wrappedFn = fn;
|
|
983
|
+
if (arr !== self2) {
|
|
984
|
+
if (!isShallow(self2)) {
|
|
985
|
+
wrappedFn = function(acc, item, index) {
|
|
986
|
+
return fn.call(this, acc, toReactive(item), index, self2);
|
|
987
|
+
};
|
|
988
|
+
} else if (fn.length > 3) {
|
|
989
|
+
wrappedFn = function(acc, item, index) {
|
|
990
|
+
return fn.call(this, acc, item, index, self2);
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return arr[method](wrappedFn, ...args);
|
|
995
|
+
}
|
|
996
|
+
function searchProxy(self2, method, args) {
|
|
997
|
+
const arr = toRaw(self2);
|
|
998
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
999
|
+
const res = arr[method](...args);
|
|
1000
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1001
|
+
args[0] = toRaw(args[0]);
|
|
1002
|
+
return arr[method](...args);
|
|
1003
|
+
}
|
|
1004
|
+
return res;
|
|
1005
|
+
}
|
|
1006
|
+
function noTracking(self2, method, args = []) {
|
|
1007
|
+
pauseTracking();
|
|
1008
|
+
startBatch();
|
|
1009
|
+
const res = toRaw(self2)[method].apply(self2, args);
|
|
1010
|
+
endBatch();
|
|
1011
|
+
resetTracking();
|
|
1012
|
+
return res;
|
|
1013
|
+
}
|
|
1014
|
+
var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
1015
|
+
var builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
|
|
1016
|
+
function hasOwnProperty2(key) {
|
|
1017
|
+
if (!isSymbol(key))
|
|
1018
|
+
key = String(key);
|
|
1019
|
+
const obj = toRaw(this);
|
|
1020
|
+
track(obj, "has", key);
|
|
1021
|
+
return obj.hasOwnProperty(key);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
class BaseReactiveHandler {
|
|
1025
|
+
constructor(_isReadonly = false, _isShallow = false) {
|
|
1026
|
+
this._isReadonly = _isReadonly;
|
|
1027
|
+
this._isShallow = _isShallow;
|
|
1028
|
+
}
|
|
1029
|
+
get(target, key, receiver) {
|
|
1030
|
+
if (key === "__v_skip")
|
|
1031
|
+
return target["__v_skip"];
|
|
1032
|
+
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
1033
|
+
if (key === "__v_isReactive") {
|
|
1034
|
+
return !isReadonly2;
|
|
1035
|
+
} else if (key === "__v_isReadonly") {
|
|
1036
|
+
return isReadonly2;
|
|
1037
|
+
} else if (key === "__v_isShallow") {
|
|
1038
|
+
return isShallow2;
|
|
1039
|
+
} else if (key === "__v_raw") {
|
|
1040
|
+
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
1041
|
+
return target;
|
|
1042
|
+
}
|
|
1043
|
+
return;
|
|
1044
|
+
}
|
|
1045
|
+
const targetIsArray = isArray(target);
|
|
1046
|
+
if (!isReadonly2) {
|
|
1047
|
+
let fn;
|
|
1048
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1049
|
+
return fn;
|
|
1050
|
+
}
|
|
1051
|
+
if (key === "hasOwnProperty") {
|
|
1052
|
+
return hasOwnProperty2;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
const res = Reflect.get(target, key, isRef(target) ? target : receiver);
|
|
1056
|
+
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
1057
|
+
return res;
|
|
1058
|
+
}
|
|
1059
|
+
if (!isReadonly2) {
|
|
1060
|
+
track(target, "get", key);
|
|
1061
|
+
}
|
|
1062
|
+
if (isShallow2) {
|
|
1063
|
+
return res;
|
|
1064
|
+
}
|
|
1065
|
+
if (isRef(res)) {
|
|
1066
|
+
return targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
1067
|
+
}
|
|
1068
|
+
if (isObject(res)) {
|
|
1069
|
+
return isReadonly2 ? readonly(res) : reactive(res);
|
|
1070
|
+
}
|
|
1071
|
+
return res;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
1076
|
+
constructor(isShallow2 = false) {
|
|
1077
|
+
super(false, isShallow2);
|
|
1078
|
+
}
|
|
1079
|
+
set(target, key, value, receiver) {
|
|
1080
|
+
let oldValue = target[key];
|
|
1081
|
+
if (!this._isShallow) {
|
|
1082
|
+
const isOldValueReadonly = isReadonly(oldValue);
|
|
1083
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
1084
|
+
oldValue = toRaw(oldValue);
|
|
1085
|
+
value = toRaw(value);
|
|
1086
|
+
}
|
|
1087
|
+
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
1088
|
+
if (isOldValueReadonly) {
|
|
1089
|
+
return false;
|
|
1090
|
+
} else {
|
|
1091
|
+
oldValue.value = value;
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);
|
|
1097
|
+
const result = Reflect.set(target, key, value, isRef(target) ? target : receiver);
|
|
1098
|
+
if (target === toRaw(receiver)) {
|
|
1099
|
+
if (!hadKey) {
|
|
1100
|
+
trigger(target, "add", key, value);
|
|
1101
|
+
} else if (hasChanged(value, oldValue)) {
|
|
1102
|
+
trigger(target, "set", key, value, oldValue);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
return result;
|
|
1106
|
+
}
|
|
1107
|
+
deleteProperty(target, key) {
|
|
1108
|
+
const hadKey = hasOwn(target, key);
|
|
1109
|
+
const oldValue = target[key];
|
|
1110
|
+
const result = Reflect.deleteProperty(target, key);
|
|
1111
|
+
if (result && hadKey) {
|
|
1112
|
+
trigger(target, "delete", key, undefined, oldValue);
|
|
1113
|
+
}
|
|
1114
|
+
return result;
|
|
1115
|
+
}
|
|
1116
|
+
has(target, key) {
|
|
1117
|
+
const result = Reflect.has(target, key);
|
|
1118
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
1119
|
+
track(target, "has", key);
|
|
1120
|
+
}
|
|
1121
|
+
return result;
|
|
1122
|
+
}
|
|
1123
|
+
ownKeys(target) {
|
|
1124
|
+
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
|
1125
|
+
return Reflect.ownKeys(target);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
1130
|
+
constructor(isShallow2 = false) {
|
|
1131
|
+
super(true, isShallow2);
|
|
1132
|
+
}
|
|
1133
|
+
set(target, key) {
|
|
1134
|
+
if (true) {
|
|
1135
|
+
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
1136
|
+
}
|
|
1137
|
+
return true;
|
|
1138
|
+
}
|
|
1139
|
+
deleteProperty(target, key) {
|
|
1140
|
+
if (true) {
|
|
1141
|
+
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
1142
|
+
}
|
|
1143
|
+
return true;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
var mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler;
|
|
1147
|
+
var readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler;
|
|
1148
|
+
var shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
1149
|
+
var toShallow = (value) => value;
|
|
1150
|
+
var getProto = (v) => Reflect.getPrototypeOf(v);
|
|
1151
|
+
function createIterableMethod(method, isReadonly2, isShallow2) {
|
|
1152
|
+
return function(...args) {
|
|
1153
|
+
const target = this["__v_raw"];
|
|
1154
|
+
const rawTarget = toRaw(target);
|
|
1155
|
+
const targetIsMap = isMap(rawTarget);
|
|
1156
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
1157
|
+
const isKeyOnly = method === "keys" && targetIsMap;
|
|
1158
|
+
const innerIterator = target[method](...args);
|
|
1159
|
+
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
|
1160
|
+
!isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1161
|
+
return {
|
|
1162
|
+
next() {
|
|
1163
|
+
const { value, done } = innerIterator.next();
|
|
1164
|
+
return done ? { value, done } : {
|
|
1165
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
1166
|
+
done
|
|
1167
|
+
};
|
|
1168
|
+
},
|
|
1169
|
+
[Symbol.iterator]() {
|
|
1170
|
+
return this;
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function createReadonlyMethod(type) {
|
|
1176
|
+
return function(...args) {
|
|
1177
|
+
if (true) {
|
|
1178
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
1179
|
+
warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
|
1180
|
+
}
|
|
1181
|
+
return type === "delete" ? false : type === "clear" ? undefined : this;
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
function createInstrumentations(readonly, shallow) {
|
|
1185
|
+
const instrumentations = {
|
|
1186
|
+
get(key) {
|
|
1187
|
+
const target = this["__v_raw"];
|
|
1188
|
+
const rawTarget = toRaw(target);
|
|
1189
|
+
const rawKey = toRaw(key);
|
|
1190
|
+
if (!readonly) {
|
|
1191
|
+
if (hasChanged(key, rawKey)) {
|
|
1192
|
+
track(rawTarget, "get", key);
|
|
1193
|
+
}
|
|
1194
|
+
track(rawTarget, "get", rawKey);
|
|
1195
|
+
}
|
|
1196
|
+
const { has } = getProto(rawTarget);
|
|
1197
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
1198
|
+
if (has.call(rawTarget, key)) {
|
|
1199
|
+
return wrap(target.get(key));
|
|
1200
|
+
} else if (has.call(rawTarget, rawKey)) {
|
|
1201
|
+
return wrap(target.get(rawKey));
|
|
1202
|
+
} else if (target !== rawTarget) {
|
|
1203
|
+
target.get(key);
|
|
1204
|
+
}
|
|
1205
|
+
},
|
|
1206
|
+
get size() {
|
|
1207
|
+
const target = this["__v_raw"];
|
|
1208
|
+
!readonly && track(toRaw(target), "iterate", ITERATE_KEY);
|
|
1209
|
+
return Reflect.get(target, "size", target);
|
|
1210
|
+
},
|
|
1211
|
+
has(key) {
|
|
1212
|
+
const target = this["__v_raw"];
|
|
1213
|
+
const rawTarget = toRaw(target);
|
|
1214
|
+
const rawKey = toRaw(key);
|
|
1215
|
+
if (!readonly) {
|
|
1216
|
+
if (hasChanged(key, rawKey)) {
|
|
1217
|
+
track(rawTarget, "has", key);
|
|
1218
|
+
}
|
|
1219
|
+
track(rawTarget, "has", rawKey);
|
|
1220
|
+
}
|
|
1221
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
1222
|
+
},
|
|
1223
|
+
forEach(callback, thisArg) {
|
|
1224
|
+
const observed = this;
|
|
1225
|
+
const target = observed["__v_raw"];
|
|
1226
|
+
const rawTarget = toRaw(target);
|
|
1227
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
1228
|
+
!readonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
1229
|
+
return target.forEach((value, key) => {
|
|
1230
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
extend(instrumentations, readonly ? {
|
|
1235
|
+
add: createReadonlyMethod("add"),
|
|
1236
|
+
set: createReadonlyMethod("set"),
|
|
1237
|
+
delete: createReadonlyMethod("delete"),
|
|
1238
|
+
clear: createReadonlyMethod("clear")
|
|
1239
|
+
} : {
|
|
1240
|
+
add(value) {
|
|
1241
|
+
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
1242
|
+
value = toRaw(value);
|
|
1243
|
+
}
|
|
1244
|
+
const target = toRaw(this);
|
|
1245
|
+
const proto = getProto(target);
|
|
1246
|
+
const hadKey = proto.has.call(target, value);
|
|
1247
|
+
if (!hadKey) {
|
|
1248
|
+
target.add(value);
|
|
1249
|
+
trigger(target, "add", value, value);
|
|
1250
|
+
}
|
|
1251
|
+
return this;
|
|
1252
|
+
},
|
|
1253
|
+
set(key, value) {
|
|
1254
|
+
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
1255
|
+
value = toRaw(value);
|
|
1256
|
+
}
|
|
1257
|
+
const target = toRaw(this);
|
|
1258
|
+
const { has, get } = getProto(target);
|
|
1259
|
+
let hadKey = has.call(target, key);
|
|
1260
|
+
if (!hadKey) {
|
|
1261
|
+
key = toRaw(key);
|
|
1262
|
+
hadKey = has.call(target, key);
|
|
1263
|
+
} else if (true) {
|
|
1264
|
+
checkIdentityKeys(target, has, key);
|
|
1265
|
+
}
|
|
1266
|
+
const oldValue = get.call(target, key);
|
|
1267
|
+
target.set(key, value);
|
|
1268
|
+
if (!hadKey) {
|
|
1269
|
+
trigger(target, "add", key, value);
|
|
1270
|
+
} else if (hasChanged(value, oldValue)) {
|
|
1271
|
+
trigger(target, "set", key, value, oldValue);
|
|
1272
|
+
}
|
|
1273
|
+
return this;
|
|
1274
|
+
},
|
|
1275
|
+
delete(key) {
|
|
1276
|
+
const target = toRaw(this);
|
|
1277
|
+
const { has, get } = getProto(target);
|
|
1278
|
+
let hadKey = has.call(target, key);
|
|
1279
|
+
if (!hadKey) {
|
|
1280
|
+
key = toRaw(key);
|
|
1281
|
+
hadKey = has.call(target, key);
|
|
1282
|
+
} else if (true) {
|
|
1283
|
+
checkIdentityKeys(target, has, key);
|
|
1284
|
+
}
|
|
1285
|
+
const oldValue = get ? get.call(target, key) : undefined;
|
|
1286
|
+
const result = target.delete(key);
|
|
1287
|
+
if (hadKey) {
|
|
1288
|
+
trigger(target, "delete", key, undefined, oldValue);
|
|
1289
|
+
}
|
|
1290
|
+
return result;
|
|
1291
|
+
},
|
|
1292
|
+
clear() {
|
|
1293
|
+
const target = toRaw(this);
|
|
1294
|
+
const hadItems = target.size !== 0;
|
|
1295
|
+
const oldTarget = isMap(target) ? new Map(target) : new Set(target);
|
|
1296
|
+
const result = target.clear();
|
|
1297
|
+
if (hadItems) {
|
|
1298
|
+
trigger(target, "clear", undefined, undefined, oldTarget);
|
|
1299
|
+
}
|
|
1300
|
+
return result;
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
const iteratorMethods = [
|
|
1304
|
+
"keys",
|
|
1305
|
+
"values",
|
|
1306
|
+
"entries",
|
|
1307
|
+
Symbol.iterator
|
|
1308
|
+
];
|
|
1309
|
+
iteratorMethods.forEach((method) => {
|
|
1310
|
+
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
1311
|
+
});
|
|
1312
|
+
return instrumentations;
|
|
1313
|
+
}
|
|
1314
|
+
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
1315
|
+
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
1316
|
+
return (target, key, receiver) => {
|
|
1317
|
+
if (key === "__v_isReactive") {
|
|
1318
|
+
return !isReadonly2;
|
|
1319
|
+
} else if (key === "__v_isReadonly") {
|
|
1320
|
+
return isReadonly2;
|
|
1321
|
+
} else if (key === "__v_raw") {
|
|
1322
|
+
return target;
|
|
1323
|
+
}
|
|
1324
|
+
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
var mutableCollectionHandlers = {
|
|
1328
|
+
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
1329
|
+
};
|
|
1330
|
+
var readonlyCollectionHandlers = {
|
|
1331
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
1332
|
+
};
|
|
1333
|
+
var shallowReadonlyCollectionHandlers = {
|
|
1334
|
+
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
1335
|
+
};
|
|
1336
|
+
function checkIdentityKeys(target, has, key) {
|
|
1337
|
+
const rawKey = toRaw(key);
|
|
1338
|
+
if (rawKey !== key && has.call(target, rawKey)) {
|
|
1339
|
+
const type = toRawType(target);
|
|
1340
|
+
warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
var reactiveMap = /* @__PURE__ */ new WeakMap;
|
|
1344
|
+
var shallowReactiveMap = /* @__PURE__ */ new WeakMap;
|
|
1345
|
+
var readonlyMap = /* @__PURE__ */ new WeakMap;
|
|
1346
|
+
var shallowReadonlyMap = /* @__PURE__ */ new WeakMap;
|
|
1347
|
+
function targetTypeMap(rawType) {
|
|
1348
|
+
switch (rawType) {
|
|
1349
|
+
case "Object":
|
|
1350
|
+
case "Array":
|
|
1351
|
+
return 1;
|
|
1352
|
+
case "Map":
|
|
1353
|
+
case "Set":
|
|
1354
|
+
case "WeakMap":
|
|
1355
|
+
case "WeakSet":
|
|
1356
|
+
return 2;
|
|
1357
|
+
default:
|
|
1358
|
+
return 0;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
function getTargetType(value) {
|
|
1362
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
|
1363
|
+
}
|
|
1364
|
+
function reactive(target) {
|
|
1365
|
+
if (isReadonly(target)) {
|
|
1366
|
+
return target;
|
|
1367
|
+
}
|
|
1368
|
+
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
1369
|
+
}
|
|
1370
|
+
function readonly(target) {
|
|
1371
|
+
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
1372
|
+
}
|
|
1373
|
+
function shallowReadonly(target) {
|
|
1374
|
+
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
1375
|
+
}
|
|
1376
|
+
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1377
|
+
if (!isObject(target)) {
|
|
1378
|
+
if (true) {
|
|
1379
|
+
warn(`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(target)}`);
|
|
1380
|
+
}
|
|
1381
|
+
return target;
|
|
1382
|
+
}
|
|
1383
|
+
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1384
|
+
return target;
|
|
1385
|
+
}
|
|
1386
|
+
const existingProxy = proxyMap.get(target);
|
|
1387
|
+
if (existingProxy) {
|
|
1388
|
+
return existingProxy;
|
|
1389
|
+
}
|
|
1390
|
+
const targetType = getTargetType(target);
|
|
1391
|
+
if (targetType === 0) {
|
|
1392
|
+
return target;
|
|
1393
|
+
}
|
|
1394
|
+
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1395
|
+
proxyMap.set(target, proxy);
|
|
1396
|
+
return proxy;
|
|
1397
|
+
}
|
|
1398
|
+
function isReactive(value) {
|
|
1399
|
+
if (isReadonly(value)) {
|
|
1400
|
+
return isReactive(value["__v_raw"]);
|
|
1401
|
+
}
|
|
1402
|
+
return !!(value && value["__v_isReactive"]);
|
|
1403
|
+
}
|
|
1404
|
+
function isReadonly(value) {
|
|
1405
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1406
|
+
}
|
|
1407
|
+
function isShallow(value) {
|
|
1408
|
+
return !!(value && value["__v_isShallow"]);
|
|
1409
|
+
}
|
|
1410
|
+
function isProxy(value) {
|
|
1411
|
+
return value ? !!value["__v_raw"] : false;
|
|
1412
|
+
}
|
|
1413
|
+
function toRaw(observed) {
|
|
1414
|
+
const raw = observed && observed["__v_raw"];
|
|
1415
|
+
return raw ? toRaw(raw) : observed;
|
|
1416
|
+
}
|
|
1417
|
+
function markRaw(value) {
|
|
1418
|
+
if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
|
|
1419
|
+
def(value, "__v_skip", true);
|
|
1420
|
+
}
|
|
1421
|
+
return value;
|
|
1422
|
+
}
|
|
1423
|
+
var toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1424
|
+
var toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1425
|
+
function isRef(r) {
|
|
1426
|
+
return r ? r["__v_isRef"] === true : false;
|
|
1427
|
+
}
|
|
1428
|
+
function unref(ref2) {
|
|
1429
|
+
return isRef(ref2) ? ref2.value : ref2;
|
|
1430
|
+
}
|
|
1431
|
+
var shallowUnwrapHandlers = {
|
|
1432
|
+
get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
|
|
1433
|
+
set: (target, key, value, receiver) => {
|
|
1434
|
+
const oldValue = target[key];
|
|
1435
|
+
if (isRef(oldValue) && !isRef(value)) {
|
|
1436
|
+
oldValue.value = value;
|
|
1437
|
+
return true;
|
|
1438
|
+
} else {
|
|
1439
|
+
return Reflect.set(target, key, value, receiver);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
function proxyRefs(objectWithRefs) {
|
|
1444
|
+
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
class CustomRefImpl {
|
|
1448
|
+
constructor(factory) {
|
|
1449
|
+
this["__v_isRef"] = true;
|
|
1450
|
+
this._value = undefined;
|
|
1451
|
+
const dep = this.dep = new Dep;
|
|
1452
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1453
|
+
this._get = get;
|
|
1454
|
+
this._set = set;
|
|
1455
|
+
}
|
|
1456
|
+
get value() {
|
|
1457
|
+
return this._value = this._get();
|
|
1458
|
+
}
|
|
1459
|
+
set value(newVal) {
|
|
1460
|
+
this._set(newVal);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
function customRef(factory) {
|
|
1464
|
+
return new CustomRefImpl(factory);
|
|
1465
|
+
}
|
|
1466
|
+
var INITIAL_WATCHER_VALUE = {};
|
|
1467
|
+
var cleanupMap = /* @__PURE__ */ new WeakMap;
|
|
1468
|
+
var activeWatcher = undefined;
|
|
1469
|
+
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1470
|
+
if (owner) {
|
|
1471
|
+
let cleanups = cleanupMap.get(owner);
|
|
1472
|
+
if (!cleanups)
|
|
1473
|
+
cleanupMap.set(owner, cleanups = []);
|
|
1474
|
+
cleanups.push(cleanupFn);
|
|
1475
|
+
} else if (!failSilently) {
|
|
1476
|
+
warn(`onWatcherCleanup() was called when there was no active watcher to associate with.`);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
function watch(source, cb, options = EMPTY_OBJ) {
|
|
1480
|
+
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
1481
|
+
const warnInvalidSource = (s) => {
|
|
1482
|
+
(options.onWarn || warn)(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`);
|
|
1483
|
+
};
|
|
1484
|
+
const reactiveGetter = (source2) => {
|
|
1485
|
+
if (deep)
|
|
1486
|
+
return source2;
|
|
1487
|
+
if (isShallow(source2) || deep === false || deep === 0)
|
|
1488
|
+
return traverse(source2, 1);
|
|
1489
|
+
return traverse(source2);
|
|
1490
|
+
};
|
|
1491
|
+
let effect;
|
|
1492
|
+
let getter;
|
|
1493
|
+
let cleanup;
|
|
1494
|
+
let boundCleanup;
|
|
1495
|
+
let forceTrigger = false;
|
|
1496
|
+
let isMultiSource = false;
|
|
1497
|
+
if (isRef(source)) {
|
|
1498
|
+
getter = () => source.value;
|
|
1499
|
+
forceTrigger = isShallow(source);
|
|
1500
|
+
} else if (isReactive(source)) {
|
|
1501
|
+
getter = () => reactiveGetter(source);
|
|
1502
|
+
forceTrigger = true;
|
|
1503
|
+
} else if (isArray(source)) {
|
|
1504
|
+
isMultiSource = true;
|
|
1505
|
+
forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
|
|
1506
|
+
getter = () => source.map((s) => {
|
|
1507
|
+
if (isRef(s)) {
|
|
1508
|
+
return s.value;
|
|
1509
|
+
} else if (isReactive(s)) {
|
|
1510
|
+
return reactiveGetter(s);
|
|
1511
|
+
} else if (isFunction(s)) {
|
|
1512
|
+
return call ? call(s, 2) : s();
|
|
1513
|
+
} else {
|
|
1514
|
+
warnInvalidSource(s);
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
} else if (isFunction(source)) {
|
|
1518
|
+
if (cb) {
|
|
1519
|
+
getter = call ? () => call(source, 2) : source;
|
|
1520
|
+
} else {
|
|
1521
|
+
getter = () => {
|
|
1522
|
+
if (cleanup) {
|
|
1523
|
+
pauseTracking();
|
|
1524
|
+
try {
|
|
1525
|
+
cleanup();
|
|
1526
|
+
} finally {
|
|
1527
|
+
resetTracking();
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
const currentEffect = activeWatcher;
|
|
1531
|
+
activeWatcher = effect;
|
|
1532
|
+
try {
|
|
1533
|
+
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
1534
|
+
} finally {
|
|
1535
|
+
activeWatcher = currentEffect;
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
} else {
|
|
1540
|
+
getter = NOOP;
|
|
1541
|
+
warnInvalidSource(source);
|
|
1542
|
+
}
|
|
1543
|
+
if (cb && deep) {
|
|
1544
|
+
const baseGetter = getter;
|
|
1545
|
+
const depth = deep === true ? Infinity : deep;
|
|
1546
|
+
getter = () => traverse(baseGetter(), depth);
|
|
1547
|
+
}
|
|
1548
|
+
const scope = getCurrentScope();
|
|
1549
|
+
const watchHandle = () => {
|
|
1550
|
+
effect.stop();
|
|
1551
|
+
if (scope && scope.active) {
|
|
1552
|
+
remove(scope.effects, effect);
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
if (once && cb) {
|
|
1556
|
+
const _cb = cb;
|
|
1557
|
+
cb = (...args) => {
|
|
1558
|
+
_cb(...args);
|
|
1559
|
+
watchHandle();
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1563
|
+
const job = (immediateFirstRun) => {
|
|
1564
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
if (cb) {
|
|
1568
|
+
const newValue = effect.run();
|
|
1569
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
1570
|
+
if (cleanup) {
|
|
1571
|
+
cleanup();
|
|
1572
|
+
}
|
|
1573
|
+
const currentWatcher = activeWatcher;
|
|
1574
|
+
activeWatcher = effect;
|
|
1575
|
+
try {
|
|
1576
|
+
const args = [
|
|
1577
|
+
newValue,
|
|
1578
|
+
oldValue === INITIAL_WATCHER_VALUE ? undefined : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
1579
|
+
boundCleanup
|
|
1580
|
+
];
|
|
1581
|
+
call ? call(cb, 3, args) : cb(...args);
|
|
1582
|
+
oldValue = newValue;
|
|
1583
|
+
} finally {
|
|
1584
|
+
activeWatcher = currentWatcher;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
} else {
|
|
1588
|
+
effect.run();
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
if (augmentJob) {
|
|
1592
|
+
augmentJob(job);
|
|
1593
|
+
}
|
|
1594
|
+
effect = new ReactiveEffect(getter);
|
|
1595
|
+
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
1596
|
+
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
1597
|
+
cleanup = effect.onStop = () => {
|
|
1598
|
+
const cleanups = cleanupMap.get(effect);
|
|
1599
|
+
if (cleanups) {
|
|
1600
|
+
if (call) {
|
|
1601
|
+
call(cleanups, 4);
|
|
1602
|
+
} else {
|
|
1603
|
+
for (const cleanup2 of cleanups)
|
|
1604
|
+
cleanup2();
|
|
1605
|
+
}
|
|
1606
|
+
cleanupMap.delete(effect);
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
if (true) {
|
|
1610
|
+
effect.onTrack = options.onTrack;
|
|
1611
|
+
effect.onTrigger = options.onTrigger;
|
|
1612
|
+
}
|
|
1613
|
+
if (cb) {
|
|
1614
|
+
if (immediate) {
|
|
1615
|
+
job(true);
|
|
1616
|
+
} else {
|
|
1617
|
+
oldValue = effect.run();
|
|
1618
|
+
}
|
|
1619
|
+
} else if (scheduler) {
|
|
1620
|
+
scheduler(job.bind(null, true), true);
|
|
1621
|
+
} else {
|
|
1622
|
+
effect.run();
|
|
1623
|
+
}
|
|
1624
|
+
watchHandle.pause = effect.pause.bind(effect);
|
|
1625
|
+
watchHandle.resume = effect.resume.bind(effect);
|
|
1626
|
+
watchHandle.stop = watchHandle;
|
|
1627
|
+
return watchHandle;
|
|
1628
|
+
}
|
|
1629
|
+
function traverse(value, depth = Infinity, seen) {
|
|
1630
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
|
|
1631
|
+
return value;
|
|
1632
|
+
}
|
|
1633
|
+
seen = seen || /* @__PURE__ */ new Set;
|
|
1634
|
+
if (seen.has(value)) {
|
|
1635
|
+
return value;
|
|
1636
|
+
}
|
|
1637
|
+
seen.add(value);
|
|
1638
|
+
depth--;
|
|
1639
|
+
if (isRef(value)) {
|
|
1640
|
+
traverse(value.value, depth, seen);
|
|
1641
|
+
} else if (isArray(value)) {
|
|
1642
|
+
for (let i = 0;i < value.length; i++) {
|
|
1643
|
+
traverse(value[i], depth, seen);
|
|
1644
|
+
}
|
|
1645
|
+
} else if (isSet(value) || isMap(value)) {
|
|
1646
|
+
value.forEach((v) => {
|
|
1647
|
+
traverse(v, depth, seen);
|
|
1648
|
+
});
|
|
1649
|
+
} else if (isPlainObject(value)) {
|
|
1650
|
+
for (const key in value) {
|
|
1651
|
+
traverse(value[key], depth, seen);
|
|
1652
|
+
}
|
|
1653
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
1654
|
+
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
1655
|
+
traverse(value[key], depth, seen);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
return value;
|
|
1660
|
+
}
|
|
1661
|
+
// node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
|
|
1662
|
+
var stack = [];
|
|
1663
|
+
function pushWarningContext(vnode) {
|
|
1664
|
+
stack.push(vnode);
|
|
1665
|
+
}
|
|
1666
|
+
function popWarningContext() {
|
|
1667
|
+
stack.pop();
|
|
1668
|
+
}
|
|
1669
|
+
var isWarning = false;
|
|
1670
|
+
function warn$1(msg, ...args) {
|
|
1671
|
+
if (isWarning)
|
|
1672
|
+
return;
|
|
1673
|
+
isWarning = true;
|
|
1674
|
+
pauseTracking();
|
|
1675
|
+
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1676
|
+
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1677
|
+
const trace = getComponentTrace();
|
|
1678
|
+
if (appWarnHandler) {
|
|
1679
|
+
callWithErrorHandling(appWarnHandler, instance, 11, [
|
|
1680
|
+
msg + args.map((a) => {
|
|
1681
|
+
var _a, _b;
|
|
1682
|
+
return (_b = (_a = a.toString) == null ? undefined : _a.call(a)) != null ? _b : JSON.stringify(a);
|
|
1683
|
+
}).join(""),
|
|
1684
|
+
instance && instance.proxy,
|
|
1685
|
+
trace.map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`).join(`
|
|
1686
|
+
`),
|
|
1687
|
+
trace
|
|
1688
|
+
]);
|
|
1689
|
+
} else {
|
|
1690
|
+
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
|
1691
|
+
if (trace.length && true) {
|
|
1692
|
+
warnArgs.push(`
|
|
1693
|
+
`, ...formatTrace(trace));
|
|
1694
|
+
}
|
|
1695
|
+
console.warn(...warnArgs);
|
|
1696
|
+
}
|
|
1697
|
+
resetTracking();
|
|
1698
|
+
isWarning = false;
|
|
1699
|
+
}
|
|
1700
|
+
function getComponentTrace() {
|
|
1701
|
+
let currentVNode = stack[stack.length - 1];
|
|
1702
|
+
if (!currentVNode) {
|
|
1703
|
+
return [];
|
|
1704
|
+
}
|
|
1705
|
+
const normalizedStack = [];
|
|
1706
|
+
while (currentVNode) {
|
|
1707
|
+
const last = normalizedStack[0];
|
|
1708
|
+
if (last && last.vnode === currentVNode) {
|
|
1709
|
+
last.recurseCount++;
|
|
1710
|
+
} else {
|
|
1711
|
+
normalizedStack.push({
|
|
1712
|
+
vnode: currentVNode,
|
|
1713
|
+
recurseCount: 0
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
const parentInstance = currentVNode.component && currentVNode.component.parent;
|
|
1717
|
+
currentVNode = parentInstance && parentInstance.vnode;
|
|
1718
|
+
}
|
|
1719
|
+
return normalizedStack;
|
|
1720
|
+
}
|
|
1721
|
+
function formatTrace(trace) {
|
|
1722
|
+
const logs = [];
|
|
1723
|
+
trace.forEach((entry, i) => {
|
|
1724
|
+
logs.push(...i === 0 ? [] : [`
|
|
1725
|
+
`], ...formatTraceEntry(entry));
|
|
1726
|
+
});
|
|
1727
|
+
return logs;
|
|
1728
|
+
}
|
|
1729
|
+
function formatTraceEntry({ vnode, recurseCount }) {
|
|
1730
|
+
const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;
|
|
1731
|
+
const isRoot = vnode.component ? vnode.component.parent == null : false;
|
|
1732
|
+
const open = ` at <${formatComponentName(vnode.component, vnode.type, isRoot)}`;
|
|
1733
|
+
const close = `>` + postfix;
|
|
1734
|
+
return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];
|
|
1735
|
+
}
|
|
1736
|
+
function formatProps(props) {
|
|
1737
|
+
const res = [];
|
|
1738
|
+
const keys = Object.keys(props);
|
|
1739
|
+
keys.slice(0, 3).forEach((key) => {
|
|
1740
|
+
res.push(...formatProp(key, props[key]));
|
|
1741
|
+
});
|
|
1742
|
+
if (keys.length > 3) {
|
|
1743
|
+
res.push(` ...`);
|
|
1744
|
+
}
|
|
1745
|
+
return res;
|
|
1746
|
+
}
|
|
1747
|
+
function formatProp(key, value, raw) {
|
|
1748
|
+
if (isString(value)) {
|
|
1749
|
+
value = JSON.stringify(value);
|
|
1750
|
+
return raw ? value : [`${key}=${value}`];
|
|
1751
|
+
} else if (typeof value === "number" || typeof value === "boolean" || value == null) {
|
|
1752
|
+
return raw ? value : [`${key}=${value}`];
|
|
1753
|
+
} else if (isRef(value)) {
|
|
1754
|
+
value = formatProp(key, toRaw(value.value), true);
|
|
1755
|
+
return raw ? value : [`${key}=Ref<`, value, `>`];
|
|
1756
|
+
} else if (isFunction(value)) {
|
|
1757
|
+
return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];
|
|
1758
|
+
} else {
|
|
1759
|
+
value = toRaw(value);
|
|
1760
|
+
return raw ? value : [`${key}=`, value];
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
var ErrorTypeStrings$1 = {
|
|
1764
|
+
["sp"]: "serverPrefetch hook",
|
|
1765
|
+
["bc"]: "beforeCreate hook",
|
|
1766
|
+
["c"]: "created hook",
|
|
1767
|
+
["bm"]: "beforeMount hook",
|
|
1768
|
+
["m"]: "mounted hook",
|
|
1769
|
+
["bu"]: "beforeUpdate hook",
|
|
1770
|
+
["u"]: "updated",
|
|
1771
|
+
["bum"]: "beforeUnmount hook",
|
|
1772
|
+
["um"]: "unmounted hook",
|
|
1773
|
+
["a"]: "activated hook",
|
|
1774
|
+
["da"]: "deactivated hook",
|
|
1775
|
+
["ec"]: "errorCaptured hook",
|
|
1776
|
+
["rtc"]: "renderTracked hook",
|
|
1777
|
+
["rtg"]: "renderTriggered hook",
|
|
1778
|
+
[0]: "setup function",
|
|
1779
|
+
[1]: "render function",
|
|
1780
|
+
[2]: "watcher getter",
|
|
1781
|
+
[3]: "watcher callback",
|
|
1782
|
+
[4]: "watcher cleanup function",
|
|
1783
|
+
[5]: "native event handler",
|
|
1784
|
+
[6]: "component event handler",
|
|
1785
|
+
[7]: "vnode hook",
|
|
1786
|
+
[8]: "directive hook",
|
|
1787
|
+
[9]: "transition hook",
|
|
1788
|
+
[10]: "app errorHandler",
|
|
1789
|
+
[11]: "app warnHandler",
|
|
1790
|
+
[12]: "ref function",
|
|
1791
|
+
[13]: "async component loader",
|
|
1792
|
+
[14]: "scheduler flush",
|
|
1793
|
+
[15]: "component update",
|
|
1794
|
+
[16]: "app unmount cleanup function"
|
|
1795
|
+
};
|
|
1796
|
+
function callWithErrorHandling(fn, instance, type, args) {
|
|
1797
|
+
try {
|
|
1798
|
+
return args ? fn(...args) : fn();
|
|
1799
|
+
} catch (err) {
|
|
1800
|
+
handleError(err, instance, type);
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
1804
|
+
if (isFunction(fn)) {
|
|
1805
|
+
const res = callWithErrorHandling(fn, instance, type, args);
|
|
1806
|
+
if (res && isPromise(res)) {
|
|
1807
|
+
res.catch((err) => {
|
|
1808
|
+
handleError(err, instance, type);
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
return res;
|
|
1812
|
+
}
|
|
1813
|
+
if (isArray(fn)) {
|
|
1814
|
+
const values = [];
|
|
1815
|
+
for (let i = 0;i < fn.length; i++) {
|
|
1816
|
+
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1817
|
+
}
|
|
1818
|
+
return values;
|
|
1819
|
+
} else if (true) {
|
|
1820
|
+
warn$1(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
function handleError(err, instance, type, throwInDev = true) {
|
|
1824
|
+
const contextVNode = instance ? instance.vnode : null;
|
|
1825
|
+
const { errorHandler, throwUnhandledErrorInProduction } = instance && instance.appContext.config || EMPTY_OBJ;
|
|
1826
|
+
if (instance) {
|
|
1827
|
+
let cur = instance.parent;
|
|
1828
|
+
const exposedInstance = instance.proxy;
|
|
1829
|
+
const errorInfo = ErrorTypeStrings$1[type];
|
|
1830
|
+
while (cur) {
|
|
1831
|
+
const errorCapturedHooks = cur.ec;
|
|
1832
|
+
if (errorCapturedHooks) {
|
|
1833
|
+
for (let i = 0;i < errorCapturedHooks.length; i++) {
|
|
1834
|
+
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
cur = cur.parent;
|
|
1840
|
+
}
|
|
1841
|
+
if (errorHandler) {
|
|
1842
|
+
pauseTracking();
|
|
1843
|
+
callWithErrorHandling(errorHandler, null, 10, [
|
|
1844
|
+
err,
|
|
1845
|
+
exposedInstance,
|
|
1846
|
+
errorInfo
|
|
1847
|
+
]);
|
|
1848
|
+
resetTracking();
|
|
1849
|
+
return;
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
logError(err, type, contextVNode, throwInDev, throwUnhandledErrorInProduction);
|
|
1853
|
+
}
|
|
1854
|
+
function logError(err, type, contextVNode, throwInDev = true, throwInProd = false) {
|
|
1855
|
+
if (true) {
|
|
1856
|
+
const info = ErrorTypeStrings$1[type];
|
|
1857
|
+
if (contextVNode) {
|
|
1858
|
+
pushWarningContext(contextVNode);
|
|
1859
|
+
}
|
|
1860
|
+
warn$1(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1861
|
+
if (contextVNode) {
|
|
1862
|
+
popWarningContext();
|
|
1863
|
+
}
|
|
1864
|
+
if (throwInDev) {
|
|
1865
|
+
throw err;
|
|
1866
|
+
} else {
|
|
1867
|
+
console.error(err);
|
|
1868
|
+
}
|
|
1869
|
+
} else
|
|
1870
|
+
;
|
|
1871
|
+
}
|
|
1872
|
+
var queue = [];
|
|
1873
|
+
var flushIndex = -1;
|
|
1874
|
+
var pendingPostFlushCbs = [];
|
|
1875
|
+
var activePostFlushCbs = null;
|
|
1876
|
+
var postFlushIndex = 0;
|
|
1877
|
+
var resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1878
|
+
var currentFlushPromise = null;
|
|
1879
|
+
var RECURSION_LIMIT = 100;
|
|
1880
|
+
function nextTick(fn) {
|
|
1881
|
+
const p = currentFlushPromise || resolvedPromise;
|
|
1882
|
+
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
1883
|
+
}
|
|
1884
|
+
function findInsertionIndex(id) {
|
|
1885
|
+
let start = flushIndex + 1;
|
|
1886
|
+
let end = queue.length;
|
|
1887
|
+
while (start < end) {
|
|
1888
|
+
const middle = start + end >>> 1;
|
|
1889
|
+
const middleJob = queue[middle];
|
|
1890
|
+
const middleJobId = getId(middleJob);
|
|
1891
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1892
|
+
start = middle + 1;
|
|
1893
|
+
} else {
|
|
1894
|
+
end = middle;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
return start;
|
|
1898
|
+
}
|
|
1899
|
+
function queueJob(job) {
|
|
1900
|
+
if (!(job.flags & 1)) {
|
|
1901
|
+
const jobId = getId(job);
|
|
1902
|
+
const lastJob = queue[queue.length - 1];
|
|
1903
|
+
if (!lastJob || !(job.flags & 2) && jobId >= getId(lastJob)) {
|
|
1904
|
+
queue.push(job);
|
|
1905
|
+
} else {
|
|
1906
|
+
queue.splice(findInsertionIndex(jobId), 0, job);
|
|
1907
|
+
}
|
|
1908
|
+
job.flags |= 1;
|
|
1909
|
+
queueFlush();
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
function queueFlush() {
|
|
1913
|
+
if (!currentFlushPromise) {
|
|
1914
|
+
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function queuePostFlushCb(cb) {
|
|
1918
|
+
if (!isArray(cb)) {
|
|
1919
|
+
if (activePostFlushCbs && cb.id === -1) {
|
|
1920
|
+
activePostFlushCbs.splice(postFlushIndex + 1, 0, cb);
|
|
1921
|
+
} else if (!(cb.flags & 1)) {
|
|
1922
|
+
pendingPostFlushCbs.push(cb);
|
|
1923
|
+
cb.flags |= 1;
|
|
1924
|
+
}
|
|
1925
|
+
} else {
|
|
1926
|
+
pendingPostFlushCbs.push(...cb);
|
|
1927
|
+
}
|
|
1928
|
+
queueFlush();
|
|
1929
|
+
}
|
|
1930
|
+
function flushPostFlushCbs(seen) {
|
|
1931
|
+
if (pendingPostFlushCbs.length) {
|
|
1932
|
+
const deduped = [...new Set(pendingPostFlushCbs)].sort((a, b) => getId(a) - getId(b));
|
|
1933
|
+
pendingPostFlushCbs.length = 0;
|
|
1934
|
+
if (activePostFlushCbs) {
|
|
1935
|
+
activePostFlushCbs.push(...deduped);
|
|
1936
|
+
return;
|
|
1937
|
+
}
|
|
1938
|
+
activePostFlushCbs = deduped;
|
|
1939
|
+
if (true) {
|
|
1940
|
+
seen = seen || /* @__PURE__ */ new Map;
|
|
1941
|
+
}
|
|
1942
|
+
for (postFlushIndex = 0;postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1943
|
+
const cb = activePostFlushCbs[postFlushIndex];
|
|
1944
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
1945
|
+
continue;
|
|
1946
|
+
}
|
|
1947
|
+
if (cb.flags & 4) {
|
|
1948
|
+
cb.flags &= ~1;
|
|
1949
|
+
}
|
|
1950
|
+
if (!(cb.flags & 8))
|
|
1951
|
+
cb();
|
|
1952
|
+
cb.flags &= ~1;
|
|
1953
|
+
}
|
|
1954
|
+
activePostFlushCbs = null;
|
|
1955
|
+
postFlushIndex = 0;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
var getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
1959
|
+
function flushJobs(seen) {
|
|
1960
|
+
if (true) {
|
|
1961
|
+
seen = seen || /* @__PURE__ */ new Map;
|
|
1962
|
+
}
|
|
1963
|
+
const check = (job) => checkRecursiveUpdates(seen, job);
|
|
1964
|
+
try {
|
|
1965
|
+
for (flushIndex = 0;flushIndex < queue.length; flushIndex++) {
|
|
1966
|
+
const job = queue[flushIndex];
|
|
1967
|
+
if (job && !(job.flags & 8)) {
|
|
1968
|
+
if (check(job)) {
|
|
1969
|
+
continue;
|
|
1970
|
+
}
|
|
1971
|
+
if (job.flags & 4) {
|
|
1972
|
+
job.flags &= ~1;
|
|
1973
|
+
}
|
|
1974
|
+
callWithErrorHandling(job, job.i, job.i ? 15 : 14);
|
|
1975
|
+
if (!(job.flags & 4)) {
|
|
1976
|
+
job.flags &= ~1;
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
} finally {
|
|
1981
|
+
for (;flushIndex < queue.length; flushIndex++) {
|
|
1982
|
+
const job = queue[flushIndex];
|
|
1983
|
+
if (job) {
|
|
1984
|
+
job.flags &= ~1;
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
flushIndex = -1;
|
|
1988
|
+
queue.length = 0;
|
|
1989
|
+
flushPostFlushCbs(seen);
|
|
1990
|
+
currentFlushPromise = null;
|
|
1991
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1992
|
+
flushJobs(seen);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
function checkRecursiveUpdates(seen, fn) {
|
|
1997
|
+
const count = seen.get(fn) || 0;
|
|
1998
|
+
if (count > RECURSION_LIMIT) {
|
|
1999
|
+
const instance = fn.i;
|
|
2000
|
+
const componentName = instance && getComponentName(instance.type);
|
|
2001
|
+
handleError(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`, null, 10);
|
|
2002
|
+
return true;
|
|
2003
|
+
}
|
|
2004
|
+
seen.set(fn, count + 1);
|
|
2005
|
+
return false;
|
|
2006
|
+
}
|
|
2007
|
+
var isHmrUpdating = false;
|
|
2008
|
+
var hmrDirtyComponents = /* @__PURE__ */ new Map;
|
|
2009
|
+
if (true) {
|
|
2010
|
+
getGlobalThis().__VUE_HMR_RUNTIME__ = {
|
|
2011
|
+
createRecord: tryWrap(createRecord),
|
|
2012
|
+
rerender: tryWrap(rerender),
|
|
2013
|
+
reload: tryWrap(reload)
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
var map = /* @__PURE__ */ new Map;
|
|
2017
|
+
function createRecord(id, initialDef) {
|
|
2018
|
+
if (map.has(id)) {
|
|
2019
|
+
return false;
|
|
2020
|
+
}
|
|
2021
|
+
map.set(id, {
|
|
2022
|
+
initialDef: normalizeClassComponent(initialDef),
|
|
2023
|
+
instances: /* @__PURE__ */ new Set
|
|
2024
|
+
});
|
|
2025
|
+
return true;
|
|
2026
|
+
}
|
|
2027
|
+
function normalizeClassComponent(component) {
|
|
2028
|
+
return isClassComponent(component) ? component.__vccOpts : component;
|
|
2029
|
+
}
|
|
2030
|
+
function rerender(id, newRender) {
|
|
2031
|
+
const record = map.get(id);
|
|
2032
|
+
if (!record) {
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
record.initialDef.render = newRender;
|
|
2036
|
+
[...record.instances].forEach((instance) => {
|
|
2037
|
+
if (newRender) {
|
|
2038
|
+
instance.render = newRender;
|
|
2039
|
+
normalizeClassComponent(instance.type).render = newRender;
|
|
2040
|
+
}
|
|
2041
|
+
instance.renderCache = [];
|
|
2042
|
+
isHmrUpdating = true;
|
|
2043
|
+
instance.update();
|
|
2044
|
+
isHmrUpdating = false;
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
function reload(id, newComp) {
|
|
2048
|
+
const record = map.get(id);
|
|
2049
|
+
if (!record)
|
|
2050
|
+
return;
|
|
2051
|
+
newComp = normalizeClassComponent(newComp);
|
|
2052
|
+
updateComponentDef(record.initialDef, newComp);
|
|
2053
|
+
const instances = [...record.instances];
|
|
2054
|
+
for (let i = 0;i < instances.length; i++) {
|
|
2055
|
+
const instance = instances[i];
|
|
2056
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
2057
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
2058
|
+
if (!dirtyInstances) {
|
|
2059
|
+
if (oldComp !== record.initialDef) {
|
|
2060
|
+
updateComponentDef(oldComp, newComp);
|
|
2061
|
+
}
|
|
2062
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set);
|
|
2063
|
+
}
|
|
2064
|
+
dirtyInstances.add(instance);
|
|
2065
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
2066
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
2067
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
2068
|
+
if (instance.ceReload) {
|
|
2069
|
+
dirtyInstances.add(instance);
|
|
2070
|
+
instance.ceReload(newComp.styles);
|
|
2071
|
+
dirtyInstances.delete(instance);
|
|
2072
|
+
} else if (instance.parent) {
|
|
2073
|
+
queueJob(() => {
|
|
2074
|
+
isHmrUpdating = true;
|
|
2075
|
+
instance.parent.update();
|
|
2076
|
+
isHmrUpdating = false;
|
|
2077
|
+
dirtyInstances.delete(instance);
|
|
2078
|
+
});
|
|
2079
|
+
} else if (instance.appContext.reload) {
|
|
2080
|
+
instance.appContext.reload();
|
|
2081
|
+
} else if (typeof window !== "undefined") {
|
|
2082
|
+
window.location.reload();
|
|
2083
|
+
} else {
|
|
2084
|
+
console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
2085
|
+
}
|
|
2086
|
+
if (instance.root.ce && instance !== instance.root) {
|
|
2087
|
+
instance.root.ce._removeChildStyle(oldComp);
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
queuePostFlushCb(() => {
|
|
2091
|
+
hmrDirtyComponents.clear();
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
function updateComponentDef(oldComp, newComp) {
|
|
2095
|
+
extend(oldComp, newComp);
|
|
2096
|
+
for (const key in oldComp) {
|
|
2097
|
+
if (key !== "__file" && !(key in newComp)) {
|
|
2098
|
+
delete oldComp[key];
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
function tryWrap(fn) {
|
|
2103
|
+
return (id, arg) => {
|
|
2104
|
+
try {
|
|
2105
|
+
return fn(id, arg);
|
|
2106
|
+
} catch (e) {
|
|
2107
|
+
console.error(e);
|
|
2108
|
+
console.warn(`[HMR] Something went wrong during Vue component hot-reload. Full reload required.`);
|
|
2109
|
+
}
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
2113
|
+
var currentRenderingInstance = null;
|
|
2114
|
+
var TeleportEndKey = Symbol("_vte");
|
|
2115
|
+
var leaveCbKey = Symbol("_leaveCb");
|
|
2116
|
+
var enterCbKey = Symbol("_enterCb");
|
|
2117
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
2118
|
+
var requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
|
2119
|
+
var cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
|
|
2120
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
2121
|
+
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
2122
|
+
if (target) {
|
|
2123
|
+
const hooks = target[type] || (target[type] = []);
|
|
2124
|
+
const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
|
|
2125
|
+
pauseTracking();
|
|
2126
|
+
const reset = setCurrentInstance(target);
|
|
2127
|
+
const res = callWithAsyncErrorHandling(hook, target, type, args);
|
|
2128
|
+
reset();
|
|
2129
|
+
resetTracking();
|
|
2130
|
+
return res;
|
|
2131
|
+
});
|
|
2132
|
+
if (prepend) {
|
|
2133
|
+
hooks.unshift(wrappedHook);
|
|
2134
|
+
} else {
|
|
2135
|
+
hooks.push(wrappedHook);
|
|
2136
|
+
}
|
|
2137
|
+
return wrappedHook;
|
|
2138
|
+
} else if (true) {
|
|
2139
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
2140
|
+
warn$1(`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + ` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
var createHook = (lifecycle) => (hook, target = currentInstance) => {
|
|
2144
|
+
if (!isInSSRComponentSetup || lifecycle === "sp") {
|
|
2145
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
2146
|
+
}
|
|
2147
|
+
};
|
|
2148
|
+
var onBeforeMount = createHook("bm");
|
|
2149
|
+
var onMounted = createHook("m");
|
|
2150
|
+
var onBeforeUpdate = createHook("bu");
|
|
2151
|
+
var onUpdated = createHook("u");
|
|
2152
|
+
var onBeforeUnmount = createHook("bum");
|
|
2153
|
+
var onUnmounted = createHook("um");
|
|
2154
|
+
var onServerPrefetch = createHook("sp");
|
|
2155
|
+
var onRenderTriggered = createHook("rtg");
|
|
2156
|
+
var onRenderTracked = createHook("rtc");
|
|
2157
|
+
var NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
2158
|
+
var getPublicInstance = (i) => {
|
|
2159
|
+
if (!i)
|
|
2160
|
+
return null;
|
|
2161
|
+
if (isStatefulComponent(i))
|
|
2162
|
+
return getComponentPublicInstance(i);
|
|
2163
|
+
return getPublicInstance(i.parent);
|
|
2164
|
+
};
|
|
2165
|
+
var publicPropertiesMap = /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {
|
|
2166
|
+
$: (i) => i,
|
|
2167
|
+
$el: (i) => i.vnode.el,
|
|
2168
|
+
$data: (i) => i.data,
|
|
2169
|
+
$props: (i) => shallowReadonly(i.props),
|
|
2170
|
+
$attrs: (i) => shallowReadonly(i.attrs),
|
|
2171
|
+
$slots: (i) => shallowReadonly(i.slots),
|
|
2172
|
+
$refs: (i) => shallowReadonly(i.refs),
|
|
2173
|
+
$parent: (i) => getPublicInstance(i.parent),
|
|
2174
|
+
$root: (i) => getPublicInstance(i.root),
|
|
2175
|
+
$host: (i) => i.ce,
|
|
2176
|
+
$emit: (i) => i.emit,
|
|
2177
|
+
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
|
|
2178
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
2179
|
+
queueJob(i.update);
|
|
2180
|
+
}),
|
|
2181
|
+
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
2182
|
+
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
|
|
2183
|
+
});
|
|
2184
|
+
var isReservedPrefix = (key) => key === "_" || key === "$";
|
|
2185
|
+
var hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);
|
|
2186
|
+
var PublicInstanceProxyHandlers = {
|
|
2187
|
+
get({ _: instance }, key) {
|
|
2188
|
+
if (key === "__v_skip") {
|
|
2189
|
+
return true;
|
|
2190
|
+
}
|
|
2191
|
+
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
|
2192
|
+
if (key === "__isVue") {
|
|
2193
|
+
return true;
|
|
2194
|
+
}
|
|
2195
|
+
let normalizedProps;
|
|
2196
|
+
if (key[0] !== "$") {
|
|
2197
|
+
const n = accessCache[key];
|
|
2198
|
+
if (n !== undefined) {
|
|
2199
|
+
switch (n) {
|
|
2200
|
+
case 1:
|
|
2201
|
+
return setupState[key];
|
|
2202
|
+
case 2:
|
|
2203
|
+
return data[key];
|
|
2204
|
+
case 4:
|
|
2205
|
+
return ctx[key];
|
|
2206
|
+
case 3:
|
|
2207
|
+
return props[key];
|
|
2208
|
+
}
|
|
2209
|
+
} else if (hasSetupBinding(setupState, key)) {
|
|
2210
|
+
accessCache[key] = 1;
|
|
2211
|
+
return setupState[key];
|
|
2212
|
+
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
2213
|
+
accessCache[key] = 2;
|
|
2214
|
+
return data[key];
|
|
2215
|
+
} else if ((normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)) {
|
|
2216
|
+
accessCache[key] = 3;
|
|
2217
|
+
return props[key];
|
|
2218
|
+
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
2219
|
+
accessCache[key] = 4;
|
|
2220
|
+
return ctx[key];
|
|
2221
|
+
} else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
|
|
2222
|
+
accessCache[key] = 0;
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
const publicGetter = publicPropertiesMap[key];
|
|
2226
|
+
let cssModule, globalProperties;
|
|
2227
|
+
if (publicGetter) {
|
|
2228
|
+
if (key === "$attrs") {
|
|
2229
|
+
track(instance.attrs, "get", "");
|
|
2230
|
+
markAttrsAccessed();
|
|
2231
|
+
} else if (key === "$slots") {
|
|
2232
|
+
track(instance, "get", key);
|
|
2233
|
+
}
|
|
2234
|
+
return publicGetter(instance);
|
|
2235
|
+
} else if ((cssModule = type.__cssModules) && (cssModule = cssModule[key])) {
|
|
2236
|
+
return cssModule;
|
|
2237
|
+
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
2238
|
+
accessCache[key] = 4;
|
|
2239
|
+
return ctx[key];
|
|
2240
|
+
} else if (globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)) {
|
|
2241
|
+
{
|
|
2242
|
+
return globalProperties[key];
|
|
2243
|
+
}
|
|
2244
|
+
} else if (currentRenderingInstance && (!isString(key) || key.indexOf("__v") !== 0)) {
|
|
2245
|
+
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
|
2246
|
+
warn$1(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`);
|
|
2247
|
+
} else if (instance === currentRenderingInstance) {
|
|
2248
|
+
warn$1(`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`);
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
},
|
|
2252
|
+
set({ _: instance }, key, value) {
|
|
2253
|
+
const { data, setupState, ctx } = instance;
|
|
2254
|
+
if (hasSetupBinding(setupState, key)) {
|
|
2255
|
+
setupState[key] = value;
|
|
2256
|
+
return true;
|
|
2257
|
+
} else if (setupState.__isScriptSetup && hasOwn(setupState, key)) {
|
|
2258
|
+
warn$1(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
|
2259
|
+
return false;
|
|
2260
|
+
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
2261
|
+
data[key] = value;
|
|
2262
|
+
return true;
|
|
2263
|
+
} else if (hasOwn(instance.props, key)) {
|
|
2264
|
+
warn$1(`Attempting to mutate prop "${key}". Props are readonly.`);
|
|
2265
|
+
return false;
|
|
2266
|
+
}
|
|
2267
|
+
if (key[0] === "$" && key.slice(1) in instance) {
|
|
2268
|
+
warn$1(`Attempting to mutate public property "${key}". Properties starting with $ are reserved and readonly.`);
|
|
2269
|
+
return false;
|
|
2270
|
+
} else {
|
|
2271
|
+
if (key in instance.appContext.config.globalProperties) {
|
|
2272
|
+
Object.defineProperty(ctx, key, {
|
|
2273
|
+
enumerable: true,
|
|
2274
|
+
configurable: true,
|
|
2275
|
+
value
|
|
2276
|
+
});
|
|
2277
|
+
} else {
|
|
2278
|
+
ctx[key] = value;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
return true;
|
|
2282
|
+
},
|
|
2283
|
+
has({
|
|
2284
|
+
_: { data, setupState, accessCache, ctx, appContext, propsOptions }
|
|
2285
|
+
}, key) {
|
|
2286
|
+
let normalizedProps;
|
|
2287
|
+
return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
|
|
2288
|
+
},
|
|
2289
|
+
defineProperty(target, key, descriptor) {
|
|
2290
|
+
if (descriptor.get != null) {
|
|
2291
|
+
target._.accessCache[key] = 0;
|
|
2292
|
+
} else if (hasOwn(descriptor, "value")) {
|
|
2293
|
+
this.set(target, key, descriptor.value, null);
|
|
2294
|
+
}
|
|
2295
|
+
return Reflect.defineProperty(target, key, descriptor);
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
if (true) {
|
|
2299
|
+
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
2300
|
+
warn$1(`Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead.`);
|
|
2301
|
+
return Reflect.ownKeys(target);
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
function normalizePropsOrEmits(props) {
|
|
2305
|
+
return isArray(props) ? props.reduce((normalized, p) => (normalized[p] = null, normalized), {}) : props;
|
|
2306
|
+
}
|
|
2307
|
+
var shouldCacheAccess = true;
|
|
2308
|
+
function resolveMergedOptions(instance) {
|
|
2309
|
+
const base = instance.type;
|
|
2310
|
+
const { mixins, extends: extendsOptions } = base;
|
|
2311
|
+
const {
|
|
2312
|
+
mixins: globalMixins,
|
|
2313
|
+
optionsCache: cache,
|
|
2314
|
+
config: { optionMergeStrategies }
|
|
2315
|
+
} = instance.appContext;
|
|
2316
|
+
const cached = cache.get(base);
|
|
2317
|
+
let resolved;
|
|
2318
|
+
if (cached) {
|
|
2319
|
+
resolved = cached;
|
|
2320
|
+
} else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
2321
|
+
{
|
|
2322
|
+
resolved = base;
|
|
2323
|
+
}
|
|
2324
|
+
} else {
|
|
2325
|
+
resolved = {};
|
|
2326
|
+
if (globalMixins.length) {
|
|
2327
|
+
globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
2328
|
+
}
|
|
2329
|
+
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2330
|
+
}
|
|
2331
|
+
if (isObject(base)) {
|
|
2332
|
+
cache.set(base, resolved);
|
|
2333
|
+
}
|
|
2334
|
+
return resolved;
|
|
2335
|
+
}
|
|
2336
|
+
function mergeOptions(to, from, strats, asMixin = false) {
|
|
2337
|
+
const { mixins, extends: extendsOptions } = from;
|
|
2338
|
+
if (extendsOptions) {
|
|
2339
|
+
mergeOptions(to, extendsOptions, strats, true);
|
|
2340
|
+
}
|
|
2341
|
+
if (mixins) {
|
|
2342
|
+
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
2343
|
+
}
|
|
2344
|
+
for (const key in from) {
|
|
2345
|
+
if (asMixin && key === "expose") {
|
|
2346
|
+
warn$1(`"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`);
|
|
2347
|
+
} else {
|
|
2348
|
+
const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
|
2349
|
+
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
return to;
|
|
2353
|
+
}
|
|
2354
|
+
var internalOptionMergeStrats = {
|
|
2355
|
+
data: mergeDataFn,
|
|
2356
|
+
props: mergeEmitsOrPropsOptions,
|
|
2357
|
+
emits: mergeEmitsOrPropsOptions,
|
|
2358
|
+
methods: mergeObjectOptions,
|
|
2359
|
+
computed: mergeObjectOptions,
|
|
2360
|
+
beforeCreate: mergeAsArray,
|
|
2361
|
+
created: mergeAsArray,
|
|
2362
|
+
beforeMount: mergeAsArray,
|
|
2363
|
+
mounted: mergeAsArray,
|
|
2364
|
+
beforeUpdate: mergeAsArray,
|
|
2365
|
+
updated: mergeAsArray,
|
|
2366
|
+
beforeDestroy: mergeAsArray,
|
|
2367
|
+
beforeUnmount: mergeAsArray,
|
|
2368
|
+
destroyed: mergeAsArray,
|
|
2369
|
+
unmounted: mergeAsArray,
|
|
2370
|
+
activated: mergeAsArray,
|
|
2371
|
+
deactivated: mergeAsArray,
|
|
2372
|
+
errorCaptured: mergeAsArray,
|
|
2373
|
+
serverPrefetch: mergeAsArray,
|
|
2374
|
+
components: mergeObjectOptions,
|
|
2375
|
+
directives: mergeObjectOptions,
|
|
2376
|
+
watch: mergeWatchOptions,
|
|
2377
|
+
provide: mergeDataFn,
|
|
2378
|
+
inject: mergeInject
|
|
2379
|
+
};
|
|
2380
|
+
function mergeDataFn(to, from) {
|
|
2381
|
+
if (!from) {
|
|
2382
|
+
return to;
|
|
2383
|
+
}
|
|
2384
|
+
if (!to) {
|
|
2385
|
+
return from;
|
|
2386
|
+
}
|
|
2387
|
+
return function mergedDataFn() {
|
|
2388
|
+
return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
function mergeInject(to, from) {
|
|
2392
|
+
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
2393
|
+
}
|
|
2394
|
+
function normalizeInject(raw) {
|
|
2395
|
+
if (isArray(raw)) {
|
|
2396
|
+
const res = {};
|
|
2397
|
+
for (let i = 0;i < raw.length; i++) {
|
|
2398
|
+
res[raw[i]] = raw[i];
|
|
2399
|
+
}
|
|
2400
|
+
return res;
|
|
2401
|
+
}
|
|
2402
|
+
return raw;
|
|
2403
|
+
}
|
|
2404
|
+
function mergeAsArray(to, from) {
|
|
2405
|
+
return to ? [...new Set([].concat(to, from))] : from;
|
|
2406
|
+
}
|
|
2407
|
+
function mergeObjectOptions(to, from) {
|
|
2408
|
+
return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
|
|
2409
|
+
}
|
|
2410
|
+
function mergeEmitsOrPropsOptions(to, from) {
|
|
2411
|
+
if (to) {
|
|
2412
|
+
if (isArray(to) && isArray(from)) {
|
|
2413
|
+
return [.../* @__PURE__ */ new Set([...to, ...from])];
|
|
2414
|
+
}
|
|
2415
|
+
return extend(/* @__PURE__ */ Object.create(null), normalizePropsOrEmits(to), normalizePropsOrEmits(from != null ? from : {}));
|
|
2416
|
+
} else {
|
|
2417
|
+
return from;
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
function mergeWatchOptions(to, from) {
|
|
2421
|
+
if (!to)
|
|
2422
|
+
return from;
|
|
2423
|
+
if (!from)
|
|
2424
|
+
return to;
|
|
2425
|
+
const merged = extend(/* @__PURE__ */ Object.create(null), to);
|
|
2426
|
+
for (const key in from) {
|
|
2427
|
+
merged[key] = mergeAsArray(to[key], from[key]);
|
|
2428
|
+
}
|
|
2429
|
+
return merged;
|
|
2430
|
+
}
|
|
2431
|
+
function createAppContext() {
|
|
2432
|
+
return {
|
|
2433
|
+
app: null,
|
|
2434
|
+
config: {
|
|
2435
|
+
isNativeTag: NO,
|
|
2436
|
+
performance: false,
|
|
2437
|
+
globalProperties: {},
|
|
2438
|
+
optionMergeStrategies: {},
|
|
2439
|
+
errorHandler: undefined,
|
|
2440
|
+
warnHandler: undefined,
|
|
2441
|
+
compilerOptions: {}
|
|
2442
|
+
},
|
|
2443
|
+
mixins: [],
|
|
2444
|
+
components: {},
|
|
2445
|
+
directives: {},
|
|
2446
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
2447
|
+
optionsCache: /* @__PURE__ */ new WeakMap,
|
|
2448
|
+
propsCache: /* @__PURE__ */ new WeakMap,
|
|
2449
|
+
emitsCache: /* @__PURE__ */ new WeakMap
|
|
2450
|
+
};
|
|
2451
|
+
}
|
|
2452
|
+
var currentApp = null;
|
|
2453
|
+
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
2454
|
+
const instance = currentInstance || currentRenderingInstance;
|
|
2455
|
+
if (instance || currentApp) {
|
|
2456
|
+
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : undefined;
|
|
2457
|
+
if (provides && key in provides) {
|
|
2458
|
+
return provides[key];
|
|
2459
|
+
} else if (arguments.length > 1) {
|
|
2460
|
+
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue;
|
|
2461
|
+
} else if (true) {
|
|
2462
|
+
warn$1(`injection "${String(key)}" not found.`);
|
|
2463
|
+
}
|
|
2464
|
+
} else if (true) {
|
|
2465
|
+
warn$1(`inject() can only be used inside setup() or functional components.`);
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
var queuePostRenderEffect = queueEffectWithSuspense;
|
|
2469
|
+
var ssrContextKey = Symbol.for("v-scx");
|
|
2470
|
+
var useSSRContext = () => {
|
|
2471
|
+
{
|
|
2472
|
+
const ctx = inject(ssrContextKey);
|
|
2473
|
+
if (!ctx) {
|
|
2474
|
+
warn$1(`Server rendering context not provided. Make sure to only call useSSRContext() conditionally in the server build.`);
|
|
2475
|
+
}
|
|
2476
|
+
return ctx;
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
2480
|
+
const { immediate, deep, flush, once } = options;
|
|
2481
|
+
if (!cb) {
|
|
2482
|
+
if (immediate !== undefined) {
|
|
2483
|
+
warn$1(`watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.`);
|
|
2484
|
+
}
|
|
2485
|
+
if (deep !== undefined) {
|
|
2486
|
+
warn$1(`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`);
|
|
2487
|
+
}
|
|
2488
|
+
if (once !== undefined) {
|
|
2489
|
+
warn$1(`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
const baseWatchOptions = extend({}, options);
|
|
2493
|
+
if (true)
|
|
2494
|
+
baseWatchOptions.onWarn = warn$1;
|
|
2495
|
+
const runsImmediately = cb && immediate || !cb && flush !== "post";
|
|
2496
|
+
let ssrCleanup;
|
|
2497
|
+
if (isInSSRComponentSetup) {
|
|
2498
|
+
if (flush === "sync") {
|
|
2499
|
+
const ctx = useSSRContext();
|
|
2500
|
+
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);
|
|
2501
|
+
} else if (!runsImmediately) {
|
|
2502
|
+
const watchStopHandle = () => {
|
|
2503
|
+
};
|
|
2504
|
+
watchStopHandle.stop = NOOP;
|
|
2505
|
+
watchStopHandle.resume = NOOP;
|
|
2506
|
+
watchStopHandle.pause = NOOP;
|
|
2507
|
+
return watchStopHandle;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
const instance = currentInstance;
|
|
2511
|
+
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, instance, type, args);
|
|
2512
|
+
let isPre = false;
|
|
2513
|
+
if (flush === "post") {
|
|
2514
|
+
baseWatchOptions.scheduler = (job) => {
|
|
2515
|
+
queuePostRenderEffect(job, instance && instance.suspense);
|
|
2516
|
+
};
|
|
2517
|
+
} else if (flush !== "sync") {
|
|
2518
|
+
isPre = true;
|
|
2519
|
+
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
2520
|
+
if (isFirstRun) {
|
|
2521
|
+
job();
|
|
2522
|
+
} else {
|
|
2523
|
+
queueJob(job);
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
baseWatchOptions.augmentJob = (job) => {
|
|
2528
|
+
if (cb) {
|
|
2529
|
+
job.flags |= 4;
|
|
2530
|
+
}
|
|
2531
|
+
if (isPre) {
|
|
2532
|
+
job.flags |= 2;
|
|
2533
|
+
if (instance) {
|
|
2534
|
+
job.id = instance.uid;
|
|
2535
|
+
job.i = instance;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
const watchHandle = watch(source, cb, baseWatchOptions);
|
|
2540
|
+
if (isInSSRComponentSetup) {
|
|
2541
|
+
if (ssrCleanup) {
|
|
2542
|
+
ssrCleanup.push(watchHandle);
|
|
2543
|
+
} else if (runsImmediately) {
|
|
2544
|
+
watchHandle();
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
return watchHandle;
|
|
2548
|
+
}
|
|
2549
|
+
function instanceWatch(source, value, options) {
|
|
2550
|
+
const publicThis = this.proxy;
|
|
2551
|
+
const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
|
2552
|
+
let cb;
|
|
2553
|
+
if (isFunction(value)) {
|
|
2554
|
+
cb = value;
|
|
2555
|
+
} else {
|
|
2556
|
+
cb = value.handler;
|
|
2557
|
+
options = value;
|
|
2558
|
+
}
|
|
2559
|
+
const reset = setCurrentInstance(this);
|
|
2560
|
+
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
2561
|
+
reset();
|
|
2562
|
+
return res;
|
|
2563
|
+
}
|
|
2564
|
+
function createPathGetter(ctx, path) {
|
|
2565
|
+
const segments = path.split(".");
|
|
2566
|
+
return () => {
|
|
2567
|
+
let cur = ctx;
|
|
2568
|
+
for (let i = 0;i < segments.length && cur; i++) {
|
|
2569
|
+
cur = cur[segments[i]];
|
|
2570
|
+
}
|
|
2571
|
+
return cur;
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
var accessedAttrs = false;
|
|
2575
|
+
function markAttrsAccessed() {
|
|
2576
|
+
accessedAttrs = true;
|
|
2577
|
+
}
|
|
2578
|
+
function queueEffectWithSuspense(fn, suspense) {
|
|
2579
|
+
if (suspense && suspense.pendingBranch) {
|
|
2580
|
+
if (isArray(fn)) {
|
|
2581
|
+
suspense.effects.push(...fn);
|
|
2582
|
+
} else {
|
|
2583
|
+
suspense.effects.push(fn);
|
|
2584
|
+
}
|
|
2585
|
+
} else {
|
|
2586
|
+
queuePostFlushCb(fn);
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
var Fragment = Symbol.for("v-fgt");
|
|
2590
|
+
var Text = Symbol.for("v-txt");
|
|
2591
|
+
var Comment = Symbol.for("v-cmt");
|
|
2592
|
+
var Static = Symbol.for("v-stc");
|
|
2593
|
+
var emptyAppContext = createAppContext();
|
|
2594
|
+
var currentInstance = null;
|
|
2595
|
+
var internalSetCurrentInstance;
|
|
2596
|
+
var setInSSRSetupState;
|
|
2597
|
+
{
|
|
2598
|
+
const g = getGlobalThis();
|
|
2599
|
+
const registerGlobalSetter = (key, setter) => {
|
|
2600
|
+
let setters;
|
|
2601
|
+
if (!(setters = g[key]))
|
|
2602
|
+
setters = g[key] = [];
|
|
2603
|
+
setters.push(setter);
|
|
2604
|
+
return (v) => {
|
|
2605
|
+
if (setters.length > 1)
|
|
2606
|
+
setters.forEach((set) => set(v));
|
|
2607
|
+
else
|
|
2608
|
+
setters[0](v);
|
|
2609
|
+
};
|
|
2610
|
+
};
|
|
2611
|
+
internalSetCurrentInstance = registerGlobalSetter(`__VUE_INSTANCE_SETTERS__`, (v) => currentInstance = v);
|
|
2612
|
+
setInSSRSetupState = registerGlobalSetter(`__VUE_SSR_SETTERS__`, (v) => isInSSRComponentSetup = v);
|
|
2613
|
+
}
|
|
2614
|
+
var setCurrentInstance = (instance) => {
|
|
2615
|
+
const prev = currentInstance;
|
|
2616
|
+
internalSetCurrentInstance(instance);
|
|
2617
|
+
instance.scope.on();
|
|
2618
|
+
return () => {
|
|
2619
|
+
instance.scope.off();
|
|
2620
|
+
internalSetCurrentInstance(prev);
|
|
2621
|
+
};
|
|
2622
|
+
};
|
|
2623
|
+
function isStatefulComponent(instance) {
|
|
2624
|
+
return instance.vnode.shapeFlag & 4;
|
|
2625
|
+
}
|
|
2626
|
+
var isInSSRComponentSetup = false;
|
|
2627
|
+
function getComponentPublicInstance(instance) {
|
|
2628
|
+
if (instance.exposed) {
|
|
2629
|
+
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
2630
|
+
get(target, key) {
|
|
2631
|
+
if (key in target) {
|
|
2632
|
+
return target[key];
|
|
2633
|
+
} else if (key in publicPropertiesMap) {
|
|
2634
|
+
return publicPropertiesMap[key](instance);
|
|
2635
|
+
}
|
|
2636
|
+
},
|
|
2637
|
+
has(target, key) {
|
|
2638
|
+
return key in target || key in publicPropertiesMap;
|
|
2639
|
+
}
|
|
2640
|
+
}));
|
|
2641
|
+
} else {
|
|
2642
|
+
return instance.proxy;
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
|
2646
|
+
var classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
|
|
2647
|
+
function getComponentName(Component, includeInferred = true) {
|
|
2648
|
+
return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
|
|
2649
|
+
}
|
|
2650
|
+
function formatComponentName(instance, Component, isRoot = false) {
|
|
2651
|
+
let name = getComponentName(Component);
|
|
2652
|
+
if (!name && Component.__file) {
|
|
2653
|
+
const match = Component.__file.match(/([^/\\]+)\.\w+$/);
|
|
2654
|
+
if (match) {
|
|
2655
|
+
name = match[1];
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
if (!name && instance && instance.parent) {
|
|
2659
|
+
const inferFromRegistry = (registry) => {
|
|
2660
|
+
for (const key in registry) {
|
|
2661
|
+
if (registry[key] === Component) {
|
|
2662
|
+
return key;
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
};
|
|
2666
|
+
name = inferFromRegistry(instance.components || instance.parent.type.components) || inferFromRegistry(instance.appContext.components);
|
|
2667
|
+
}
|
|
2668
|
+
return name ? classify(name) : isRoot ? `App` : `Anonymous`;
|
|
2669
|
+
}
|
|
2670
|
+
function isClassComponent(value) {
|
|
2671
|
+
return isFunction(value) && "__vccOpts" in value;
|
|
2672
|
+
}
|
|
2673
|
+
function initCustomFormatter() {
|
|
2674
|
+
if (typeof window === "undefined") {
|
|
2675
|
+
return;
|
|
2676
|
+
}
|
|
2677
|
+
const vueStyle = { style: "color:#3ba776" };
|
|
2678
|
+
const numberStyle = { style: "color:#1677ff" };
|
|
2679
|
+
const stringStyle = { style: "color:#f5222d" };
|
|
2680
|
+
const keywordStyle = { style: "color:#eb2f96" };
|
|
2681
|
+
const formatter = {
|
|
2682
|
+
__vue_custom_formatter: true,
|
|
2683
|
+
header(obj) {
|
|
2684
|
+
if (!isObject(obj)) {
|
|
2685
|
+
return null;
|
|
2686
|
+
}
|
|
2687
|
+
if (obj.__isVue) {
|
|
2688
|
+
return ["div", vueStyle, `VueInstance`];
|
|
2689
|
+
} else if (isRef(obj)) {
|
|
2690
|
+
return [
|
|
2691
|
+
"div",
|
|
2692
|
+
{},
|
|
2693
|
+
["span", vueStyle, genRefFlag(obj)],
|
|
2694
|
+
"<",
|
|
2695
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
2696
|
+
`>`
|
|
2697
|
+
];
|
|
2698
|
+
} else if (isReactive(obj)) {
|
|
2699
|
+
return [
|
|
2700
|
+
"div",
|
|
2701
|
+
{},
|
|
2702
|
+
["span", vueStyle, isShallow(obj) ? "ShallowReactive" : "Reactive"],
|
|
2703
|
+
"<",
|
|
2704
|
+
formatValue(obj),
|
|
2705
|
+
`>${isReadonly(obj) ? ` (readonly)` : ``}`
|
|
2706
|
+
];
|
|
2707
|
+
} else if (isReadonly(obj)) {
|
|
2708
|
+
return [
|
|
2709
|
+
"div",
|
|
2710
|
+
{},
|
|
2711
|
+
["span", vueStyle, isShallow(obj) ? "ShallowReadonly" : "Readonly"],
|
|
2712
|
+
"<",
|
|
2713
|
+
formatValue(obj),
|
|
2714
|
+
">"
|
|
2715
|
+
];
|
|
2716
|
+
}
|
|
2717
|
+
return null;
|
|
2718
|
+
},
|
|
2719
|
+
hasBody(obj) {
|
|
2720
|
+
return obj && obj.__isVue;
|
|
2721
|
+
},
|
|
2722
|
+
body(obj) {
|
|
2723
|
+
if (obj && obj.__isVue) {
|
|
2724
|
+
return [
|
|
2725
|
+
"div",
|
|
2726
|
+
{},
|
|
2727
|
+
...formatInstance(obj.$)
|
|
2728
|
+
];
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
};
|
|
2732
|
+
function formatInstance(instance) {
|
|
2733
|
+
const blocks = [];
|
|
2734
|
+
if (instance.type.props && instance.props) {
|
|
2735
|
+
blocks.push(createInstanceBlock("props", toRaw(instance.props)));
|
|
2736
|
+
}
|
|
2737
|
+
if (instance.setupState !== EMPTY_OBJ) {
|
|
2738
|
+
blocks.push(createInstanceBlock("setup", instance.setupState));
|
|
2739
|
+
}
|
|
2740
|
+
if (instance.data !== EMPTY_OBJ) {
|
|
2741
|
+
blocks.push(createInstanceBlock("data", toRaw(instance.data)));
|
|
2742
|
+
}
|
|
2743
|
+
const computed2 = extractKeys(instance, "computed");
|
|
2744
|
+
if (computed2) {
|
|
2745
|
+
blocks.push(createInstanceBlock("computed", computed2));
|
|
2746
|
+
}
|
|
2747
|
+
const injected = extractKeys(instance, "inject");
|
|
2748
|
+
if (injected) {
|
|
2749
|
+
blocks.push(createInstanceBlock("injected", injected));
|
|
2750
|
+
}
|
|
2751
|
+
blocks.push([
|
|
2752
|
+
"div",
|
|
2753
|
+
{},
|
|
2754
|
+
[
|
|
2755
|
+
"span",
|
|
2756
|
+
{
|
|
2757
|
+
style: keywordStyle.style + ";opacity:0.66"
|
|
2758
|
+
},
|
|
2759
|
+
"$ (internal): "
|
|
2760
|
+
],
|
|
2761
|
+
["object", { object: instance }]
|
|
2762
|
+
]);
|
|
2763
|
+
return blocks;
|
|
2764
|
+
}
|
|
2765
|
+
function createInstanceBlock(type, target) {
|
|
2766
|
+
target = extend({}, target);
|
|
2767
|
+
if (!Object.keys(target).length) {
|
|
2768
|
+
return ["span", {}];
|
|
2769
|
+
}
|
|
2770
|
+
return [
|
|
2771
|
+
"div",
|
|
2772
|
+
{ style: "line-height:1.25em;margin-bottom:0.6em" },
|
|
2773
|
+
[
|
|
2774
|
+
"div",
|
|
2775
|
+
{
|
|
2776
|
+
style: "color:#476582"
|
|
2777
|
+
},
|
|
2778
|
+
type
|
|
2779
|
+
],
|
|
2780
|
+
[
|
|
2781
|
+
"div",
|
|
2782
|
+
{
|
|
2783
|
+
style: "padding-left:1.25em"
|
|
2784
|
+
},
|
|
2785
|
+
...Object.keys(target).map((key) => {
|
|
2786
|
+
return [
|
|
2787
|
+
"div",
|
|
2788
|
+
{},
|
|
2789
|
+
["span", keywordStyle, key + ": "],
|
|
2790
|
+
formatValue(target[key], false)
|
|
2791
|
+
];
|
|
2792
|
+
})
|
|
2793
|
+
]
|
|
2794
|
+
];
|
|
2795
|
+
}
|
|
2796
|
+
function formatValue(v, asRaw = true) {
|
|
2797
|
+
if (typeof v === "number") {
|
|
2798
|
+
return ["span", numberStyle, v];
|
|
2799
|
+
} else if (typeof v === "string") {
|
|
2800
|
+
return ["span", stringStyle, JSON.stringify(v)];
|
|
2801
|
+
} else if (typeof v === "boolean") {
|
|
2802
|
+
return ["span", keywordStyle, v];
|
|
2803
|
+
} else if (isObject(v)) {
|
|
2804
|
+
return ["object", { object: asRaw ? toRaw(v) : v }];
|
|
2805
|
+
} else {
|
|
2806
|
+
return ["span", stringStyle, String(v)];
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
function extractKeys(instance, type) {
|
|
2810
|
+
const Comp = instance.type;
|
|
2811
|
+
if (isFunction(Comp)) {
|
|
2812
|
+
return;
|
|
2813
|
+
}
|
|
2814
|
+
const extracted = {};
|
|
2815
|
+
for (const key in instance.ctx) {
|
|
2816
|
+
if (isKeyOfType(Comp, key, type)) {
|
|
2817
|
+
extracted[key] = instance.ctx[key];
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
return extracted;
|
|
2821
|
+
}
|
|
2822
|
+
function isKeyOfType(Comp, key, type) {
|
|
2823
|
+
const opts = Comp[type];
|
|
2824
|
+
if (isArray(opts) && opts.includes(key) || isObject(opts) && key in opts) {
|
|
2825
|
+
return true;
|
|
2826
|
+
}
|
|
2827
|
+
if (Comp.extends && isKeyOfType(Comp.extends, key, type)) {
|
|
2828
|
+
return true;
|
|
2829
|
+
}
|
|
2830
|
+
if (Comp.mixins && Comp.mixins.some((m) => isKeyOfType(m, key, type))) {
|
|
2831
|
+
return true;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
function genRefFlag(v) {
|
|
2835
|
+
if (isShallow(v)) {
|
|
2836
|
+
return `ShallowRef`;
|
|
2837
|
+
}
|
|
2838
|
+
if (v.effect) {
|
|
2839
|
+
return `ComputedRef`;
|
|
2840
|
+
}
|
|
2841
|
+
return `Ref`;
|
|
2842
|
+
}
|
|
2843
|
+
if (window.devtoolsFormatters) {
|
|
2844
|
+
window.devtoolsFormatters.push(formatter);
|
|
2845
|
+
} else {
|
|
2846
|
+
window.devtoolsFormatters = [formatter];
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
// node_modules/vue/dist/vue.runtime.esm-bundler.js
|
|
2851
|
+
function initDev() {
|
|
2852
|
+
{
|
|
2853
|
+
initCustomFormatter();
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
if (true) {
|
|
2857
|
+
initDev();
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
// src/decorator/dto/arrayProxy.ts
|
|
2861
|
+
var arrayProxy_default = {
|
|
2862
|
+
deleteProperty(target, key) {
|
|
2863
|
+
Reflect.deleteProperty(target, key);
|
|
2864
|
+
if (ignored(target, key)) {
|
|
2865
|
+
return true;
|
|
2866
|
+
}
|
|
2867
|
+
const dto = target[PARENT];
|
|
2868
|
+
dto && triggerDto_default(dto, target[PARENT_KEY], dto[target[PARENT_KEY]]);
|
|
2869
|
+
dto && markDtoDirty_default(dto, target[PARENT_KEY]);
|
|
2870
|
+
return true;
|
|
2871
|
+
},
|
|
2872
|
+
get(target, key, receiver) {
|
|
2873
|
+
if (key === PROXY) {
|
|
2874
|
+
return true;
|
|
2875
|
+
}
|
|
2876
|
+
if (ignored(target, key)) {
|
|
2877
|
+
return Reflect.get(target, key, receiver);
|
|
2878
|
+
}
|
|
2879
|
+
const dto = target[PARENT];
|
|
2880
|
+
dto && trackDto(dto, target[PARENT_KEY]);
|
|
2881
|
+
return Reflect.get(target, key);
|
|
2882
|
+
},
|
|
2883
|
+
set(target, key, value, receiver) {
|
|
2884
|
+
if (ignored(target, key)) {
|
|
2885
|
+
return Reflect.set(target, key, value, receiver);
|
|
2886
|
+
}
|
|
2887
|
+
const dto = target[PARENT];
|
|
2888
|
+
dto && triggerDto_default(dto, target[PARENT_KEY], dto[target[PARENT_KEY]]);
|
|
2889
|
+
dto && markDtoDirty_default(dto, target[PARENT_KEY]);
|
|
2890
|
+
return Reflect.set(target, key, value);
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
function ignored(target, key) {
|
|
2894
|
+
return typeof key === "symbol" || typeof target[key] === "function" || key === "length";
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
// src/decorator/dto/instanceProxy.ts
|
|
2898
|
+
var instanceProxy_default = {
|
|
2899
|
+
get(target, key, receiver) {
|
|
2900
|
+
if (key === PROXY) {
|
|
2901
|
+
return true;
|
|
2902
|
+
}
|
|
2903
|
+
if (typeof key === "symbol") {
|
|
2904
|
+
return Reflect.get(target, key, receiver);
|
|
2905
|
+
}
|
|
2906
|
+
const descriptor = target[DESCRIPTORS][key];
|
|
2907
|
+
if (!descriptor || !descriptor.get) {
|
|
2908
|
+
return Reflect.get(target, key, receiver);
|
|
2909
|
+
}
|
|
2910
|
+
const value = descriptor.get.call(target);
|
|
2911
|
+
ENABLE_GET_LOGGING && console.log(`%c@dto %c${target[NAME]} %cget`, "color: #0891b2", "color: #059669", "color: #1d4ed8", key);
|
|
2912
|
+
trackDto(target, key);
|
|
2913
|
+
relateValueTo_default(target, key, value);
|
|
2914
|
+
return value;
|
|
2915
|
+
},
|
|
2916
|
+
getOwnPropertyDescriptor(target, key) {
|
|
2917
|
+
return target[DESCRIPTORS][key];
|
|
2918
|
+
},
|
|
2919
|
+
ownKeys(target) {
|
|
2920
|
+
return target[PROPERTIES];
|
|
2921
|
+
},
|
|
2922
|
+
set(target, key, value, receiver) {
|
|
2923
|
+
if (typeof key === "symbol") {
|
|
2924
|
+
return Reflect.set(target, key, value, receiver);
|
|
2925
|
+
}
|
|
2926
|
+
const descriptor = target[DESCRIPTORS][key];
|
|
2927
|
+
if (!descriptor || !descriptor.set) {
|
|
2928
|
+
return Reflect.set(target, key, value, receiver);
|
|
2929
|
+
}
|
|
2930
|
+
const oldValue = descriptor.get?.call(target) ?? undefined;
|
|
2931
|
+
if (areEqual_default(value, oldValue)) {
|
|
2932
|
+
return true;
|
|
2933
|
+
}
|
|
2934
|
+
unrelateValueFrom_default(target, oldValue);
|
|
2935
|
+
if (Array.isArray(value) && !value[PROXY]) {
|
|
2936
|
+
value = new Proxy(value, arrayProxy_default);
|
|
2937
|
+
}
|
|
2938
|
+
ENABLE_SET_LOGGING && console.log(`%c@dto %c${target[NAME]} %cset`, "color: #0891b2", "color: #059669", "color: #1d4ed8", key, { value });
|
|
2939
|
+
descriptor.set.call(target, value);
|
|
2940
|
+
relateValueTo_default(target, key, value);
|
|
2941
|
+
markDtoDirty_default(target, key);
|
|
2942
|
+
triggerDto_default(target, key, value, oldValue);
|
|
2943
|
+
return true;
|
|
2944
|
+
}
|
|
2945
|
+
};
|
|
2946
|
+
|
|
2947
|
+
// src/decorator/dto/refProxy.ts
|
|
2948
|
+
var refProxy_default = {
|
|
2949
|
+
get(target, key, receiver) {
|
|
2950
|
+
if (key === "__v_isRef") {
|
|
2951
|
+
return false;
|
|
2952
|
+
}
|
|
2953
|
+
if (key === PROXY) {
|
|
2954
|
+
return true;
|
|
2955
|
+
}
|
|
2956
|
+
if (key in target) {
|
|
2957
|
+
return Reflect.get(target, key, receiver);
|
|
2958
|
+
}
|
|
2959
|
+
return Reflect.get(target.value, key);
|
|
2960
|
+
},
|
|
2961
|
+
getOwnPropertyDescriptor(target, key) {
|
|
2962
|
+
return Reflect.getOwnPropertyDescriptor(target.value, key);
|
|
2963
|
+
},
|
|
2964
|
+
ownKeys(target) {
|
|
2965
|
+
return Reflect.ownKeys(target.value);
|
|
2966
|
+
},
|
|
2967
|
+
set(target, key, value, receiver) {
|
|
2968
|
+
if (key in target) {
|
|
2969
|
+
return Reflect.set(target, key, value, receiver);
|
|
2970
|
+
}
|
|
2971
|
+
return Reflect.set(target.value, key, value);
|
|
2972
|
+
}
|
|
2973
|
+
};
|
|
2974
|
+
|
|
2975
|
+
// src/decorator/dto/classProxy.ts
|
|
2976
|
+
var classProxy_default = {
|
|
2977
|
+
construct(target, argsArray, newTarget) {
|
|
2978
|
+
argsArray = argsArray.map((arg) => {
|
|
2979
|
+
if (!Array.isArray(arg)) {
|
|
2980
|
+
return arg;
|
|
2981
|
+
}
|
|
2982
|
+
return new Proxy(arg, arrayProxy_default);
|
|
2983
|
+
});
|
|
2984
|
+
const ref2 = customRef((track2, trigger2) => {
|
|
2985
|
+
const instance = markRaw(Reflect.construct(target, argsArray, newTarget));
|
|
2986
|
+
instance[ARGS] = argsArray;
|
|
2987
|
+
instance[DIRTY] = false;
|
|
2988
|
+
instance[TRACK] = track2;
|
|
2989
|
+
instance[TRIGGER] = trigger2;
|
|
2990
|
+
const proxied = new Proxy(instance, instanceProxy_default);
|
|
2991
|
+
return {
|
|
2992
|
+
get: () => {
|
|
2993
|
+
track2();
|
|
2994
|
+
return proxied;
|
|
2995
|
+
},
|
|
2996
|
+
set: () => {
|
|
2997
|
+
return;
|
|
2998
|
+
}
|
|
2999
|
+
};
|
|
3000
|
+
});
|
|
3001
|
+
return new Proxy(ref2, refProxy_default);
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
|
|
3005
|
+
// src/decorator/dto/clone.ts
|
|
3006
|
+
function clone_default() {
|
|
3007
|
+
const instance = this;
|
|
3008
|
+
assertDto_default(instance);
|
|
3009
|
+
const clazz = DTO_CLASS_MAP[instance[NAME]];
|
|
3010
|
+
const clone = new clazz(...instance[ARGS]);
|
|
3011
|
+
Object.entries(this[DESCRIPTORS]).filter(([, descriptor]) => !!descriptor.set).map(([name]) => name).forEach((key) => clone[key] = isDto_default(this[key]) ? this[key].clone() : this[key]);
|
|
3012
|
+
return clone;
|
|
3013
|
+
}
|
|
3014
|
+
|
|
3015
|
+
// src/decorator/dto/fill.ts
|
|
3016
|
+
function fill_default(data) {
|
|
3017
|
+
for (let key in data) {
|
|
3018
|
+
const descriptor = this[DESCRIPTORS][key];
|
|
3019
|
+
if (isDto_default(this[key]) && typeof data[key] === "object") {
|
|
3020
|
+
this[key].fill(data[key]);
|
|
3021
|
+
} else if (descriptor && descriptor.set) {
|
|
3022
|
+
this[key] = data[key];
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
// src/decorator/dto/toJSON.ts
|
|
3028
|
+
function toJSON_default() {
|
|
3029
|
+
return Object.fromEntries(this[PROPERTIES].map((property) => {
|
|
3030
|
+
let value = Reflect.get.call(this, this, property, this);
|
|
3031
|
+
if (isDto_default(value)) {
|
|
3032
|
+
value = value.toJSON();
|
|
3033
|
+
}
|
|
3034
|
+
return [property, value];
|
|
3035
|
+
}));
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
// src/decorator/dto/index.ts
|
|
3039
|
+
function dto_default(clazz) {
|
|
3040
|
+
validate(clazz);
|
|
3041
|
+
const descriptors = Object.freeze(getPrototypeChain_default(clazz));
|
|
3042
|
+
const properties = Object.keys(descriptors);
|
|
3043
|
+
setObjectValue_default(clazz.prototype, DESCRIPTORS, descriptors);
|
|
3044
|
+
setObjectValue_default(clazz.prototype, NAME, clazz.name);
|
|
3045
|
+
setObjectValue_default(clazz.prototype, PROPERTIES, properties);
|
|
3046
|
+
setObjectValue_default(clazz, Symbol.hasInstance, (instance) => typeof instance === "object" && instance?.[NAME] === clazz.name);
|
|
3047
|
+
setObjectMethod_default(clazz, "clone", clone_default);
|
|
3048
|
+
setObjectMethod_default(clazz, "fill", fill_default);
|
|
3049
|
+
setObjectMethod_default(clazz, "toJSON", toJSON_default);
|
|
3050
|
+
return proxy(clazz);
|
|
3051
|
+
}
|
|
3052
|
+
function proxy(clazz) {
|
|
3053
|
+
const proxied = new Proxy(clazz, classProxy_default);
|
|
3054
|
+
DTO_CLASS_MAP[clazz.name] = proxied;
|
|
3055
|
+
return proxied;
|
|
3056
|
+
}
|
|
3057
|
+
function validate(clazz) {
|
|
3058
|
+
const parent = Object.getPrototypeOf(clazz.prototype);
|
|
3059
|
+
if (NAME in parent) {
|
|
3060
|
+
throw new Error(`⛔️ @dto ${clazz.name} cannot extend parent class which is also decorated with @dto ${parent[NAME]}.`);
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
if (OVERRIDE_CONSOLE_LOG) {
|
|
3064
|
+
const _error = console.error.bind(console);
|
|
3065
|
+
const _info = console.info.bind(console);
|
|
3066
|
+
const _log = console.log.bind(console);
|
|
3067
|
+
const _warn = console.warn.bind(console);
|
|
3068
|
+
const override = (fn) => (...args) => {
|
|
3069
|
+
for (let i = args.length - 1;i >= 0; --i) {
|
|
3070
|
+
const arg = args[i];
|
|
3071
|
+
if (!isDto_default(arg)) {
|
|
3072
|
+
continue;
|
|
3073
|
+
}
|
|
3074
|
+
const dto = instance_default(arg);
|
|
3075
|
+
args.splice(i, 1, `\uD83D\uDCE6 ${dto[NAME]}`, dto.toJSON());
|
|
3076
|
+
}
|
|
3077
|
+
return fn(...args);
|
|
3078
|
+
};
|
|
3079
|
+
console.error = override(_error);
|
|
3080
|
+
console.info = override(_info);
|
|
3081
|
+
console.log = override(_log);
|
|
3082
|
+
console.warn = override(_warn);
|
|
3083
|
+
}
|
|
3084
|
+
// src/decorator/dto/serialize/deserializeArray.ts
|
|
3085
|
+
function deserializeArray_default(obj) {
|
|
3086
|
+
return obj.map(deserializeUnknown_default);
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
// src/decorator/dto/serialize/deserializeDateTime.ts
|
|
3090
|
+
import { DateTime } from "luxon";
|
|
3091
|
+
function deserializeDateTime_default([, iso]) {
|
|
3092
|
+
return DateTime.fromISO(iso);
|
|
3093
|
+
}
|
|
3094
|
+
|
|
3095
|
+
// src/decorator/dto/serialize/deserializeObject.ts
|
|
3096
|
+
function deserializeObject_default(obj) {
|
|
3097
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, deserializeUnknown_default(value)]).filter(([, value]) => value !== undefined));
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
// src/decorator/dto/serialize/deserializeDto.ts
|
|
3101
|
+
var CACHE = {};
|
|
3102
|
+
function deserializeDto_default([, id, name, state, args]) {
|
|
3103
|
+
if (!(name in DTO_CLASS_MAP)) {
|
|
3104
|
+
throw new Error(`[@marveld/http] Cannot restore @dto. Dto ${name} was not found.`);
|
|
3105
|
+
}
|
|
3106
|
+
if (id in CACHE) {
|
|
3107
|
+
return CACHE[id];
|
|
3108
|
+
}
|
|
3109
|
+
ENABLE_SERIALIZATION_LOGGING && console.group("⭐️", name, id);
|
|
3110
|
+
const Dto = DTO_CLASS_MAP[name];
|
|
3111
|
+
const instance = new Dto(...deserializeArray_default(args));
|
|
3112
|
+
instance.fill(deserializeObject_default(state));
|
|
3113
|
+
ENABLE_SERIALIZATION_LOGGING && console.groupEnd();
|
|
3114
|
+
CACHE[id] = instance;
|
|
3115
|
+
return instance;
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
// src/decorator/dto/serialize/isSerializedDateTime.ts
|
|
3119
|
+
function isSerializedDateTime_default(obj) {
|
|
3120
|
+
return Array.isArray(obj) && obj[0] === 3058;
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
// src/decorator/dto/serialize/isSerializedDto.ts
|
|
3124
|
+
function isSerializedDto_default(obj) {
|
|
3125
|
+
return Array.isArray(obj) && obj[0] === 3057;
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
// src/decorator/dto/serialize/deserializeUnknown.ts
|
|
3129
|
+
function deserializeUnknown_default(obj) {
|
|
3130
|
+
switch (true) {
|
|
3131
|
+
case obj === null:
|
|
3132
|
+
return null;
|
|
3133
|
+
case Array.isArray(obj):
|
|
3134
|
+
switch (true) {
|
|
3135
|
+
case isSerializedDateTime_default(obj):
|
|
3136
|
+
return deserializeDateTime_default(obj);
|
|
3137
|
+
case isSerializedDto_default(obj):
|
|
3138
|
+
return deserializeDto_default(obj);
|
|
3139
|
+
default:
|
|
3140
|
+
return deserializeArray_default(obj);
|
|
3141
|
+
}
|
|
3142
|
+
case typeof obj === "object":
|
|
3143
|
+
return deserializeObject_default(obj);
|
|
3144
|
+
default:
|
|
3145
|
+
return obj;
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
// src/decorator/dto/serialize/deserialize.ts
|
|
3150
|
+
function deserialize_default(serialized) {
|
|
3151
|
+
return deserializeUnknown_default(JSON.parse(serialized));
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
// src/decorator/dto/serialize/serializeUnknown.ts
|
|
3155
|
+
import { DateTime as DateTime3 } from "luxon";
|
|
3156
|
+
|
|
3157
|
+
// src/decorator/dto/serialize/serializeArray.ts
|
|
3158
|
+
import { DateTime as DateTime2 } from "luxon";
|
|
3159
|
+
|
|
3160
|
+
// src/decorator/dto/serialize/serializeDateTime.ts
|
|
3161
|
+
function serializeDateTime_default(obj) {
|
|
3162
|
+
return [3058, obj.toISO({
|
|
3163
|
+
extendedZone: true,
|
|
3164
|
+
includeOffset: true
|
|
3165
|
+
})];
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3168
|
+
// src/decorator/dto/serialize/serializeObject.ts
|
|
3169
|
+
function serializeObject_default(obj) {
|
|
3170
|
+
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, serializeUnknown_default(value)]).filter(([, value]) => value !== undefined));
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
// src/decorator/dto/serialize/uuid.ts
|
|
3174
|
+
function uuid_default() {
|
|
3175
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16));
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
// src/decorator/dto/serialize/serializeDto.ts
|
|
3179
|
+
function serializeDto_default(obj) {
|
|
3180
|
+
obj = toRaw(obj);
|
|
3181
|
+
const json = obj.toJSON();
|
|
3182
|
+
return [
|
|
3183
|
+
3057,
|
|
3184
|
+
uuid_default(),
|
|
3185
|
+
obj[NAME],
|
|
3186
|
+
serializeObject_default(json),
|
|
3187
|
+
serializeArray_default(obj[ARGS])
|
|
3188
|
+
];
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
// src/decorator/dto/serialize/serializeArray.ts
|
|
3192
|
+
function serializeArray_default(obj) {
|
|
3193
|
+
switch (true) {
|
|
3194
|
+
case obj.every(isDto_default):
|
|
3195
|
+
return obj.map(serializeDto_default);
|
|
3196
|
+
case obj.every(DateTime2.isDateTime):
|
|
3197
|
+
return obj.map(serializeDateTime_default);
|
|
3198
|
+
default:
|
|
3199
|
+
return obj.map(serializeUnknown_default);
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
|
|
3203
|
+
// src/decorator/dto/serialize/serializeUnknown.ts
|
|
3204
|
+
function serializeUnknown_default(obj) {
|
|
3205
|
+
switch (true) {
|
|
3206
|
+
case obj === null:
|
|
3207
|
+
return null;
|
|
3208
|
+
case Array.isArray(obj):
|
|
3209
|
+
return serializeArray_default(obj);
|
|
3210
|
+
case isDto_default(obj):
|
|
3211
|
+
return serializeDto_default(obj);
|
|
3212
|
+
case DateTime3.isDateTime(obj):
|
|
3213
|
+
return serializeDateTime_default(obj);
|
|
3214
|
+
case typeof obj === "object":
|
|
3215
|
+
return serializeObject_default(obj);
|
|
3216
|
+
case typeof obj === "boolean":
|
|
3217
|
+
case typeof obj === "number":
|
|
3218
|
+
case typeof obj === "string":
|
|
3219
|
+
return obj;
|
|
3220
|
+
default:
|
|
3221
|
+
return;
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3225
|
+
// src/decorator/dto/serialize/serialize.ts
|
|
3226
|
+
function serialize_default(obj) {
|
|
3227
|
+
return JSON.stringify(serializeUnknown_default(obj));
|
|
3228
|
+
}
|
|
3229
|
+
// src/dto/BlobResponse.ts
|
|
3230
|
+
class BlobResponse {
|
|
3231
|
+
get blob() {
|
|
3232
|
+
return this.#blob;
|
|
3233
|
+
}
|
|
3234
|
+
get name() {
|
|
3235
|
+
return this.#name;
|
|
3236
|
+
}
|
|
3237
|
+
#blob;
|
|
3238
|
+
#name;
|
|
3239
|
+
constructor(blob, name) {
|
|
3240
|
+
this.#blob = blob;
|
|
3241
|
+
this.#name = name;
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
BlobResponse = __legacyDecorateClassTS([
|
|
3245
|
+
dto_default
|
|
3246
|
+
], BlobResponse);
|
|
3247
|
+
// src/dto/Paginated.ts
|
|
3248
|
+
class Paginated {
|
|
3249
|
+
get items() {
|
|
3250
|
+
return this.#items;
|
|
3251
|
+
}
|
|
3252
|
+
get page() {
|
|
3253
|
+
return this.#page;
|
|
3254
|
+
}
|
|
3255
|
+
get pageSize() {
|
|
3256
|
+
return this.#pageSize;
|
|
3257
|
+
}
|
|
3258
|
+
get pages() {
|
|
3259
|
+
return this.#pages;
|
|
3260
|
+
}
|
|
3261
|
+
get totalItems() {
|
|
3262
|
+
return this.#totalItems;
|
|
3263
|
+
}
|
|
3264
|
+
#items;
|
|
3265
|
+
#page;
|
|
3266
|
+
#pageSize;
|
|
3267
|
+
#pages;
|
|
3268
|
+
#totalItems;
|
|
3269
|
+
constructor(items, page, pageSize, pages, totalItems) {
|
|
3270
|
+
this.#items = items;
|
|
3271
|
+
this.#page = page;
|
|
3272
|
+
this.#pageSize = pageSize;
|
|
3273
|
+
this.#pages = pages;
|
|
3274
|
+
this.#totalItems = totalItems;
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
Paginated = __legacyDecorateClassTS([
|
|
3278
|
+
dto_default
|
|
3279
|
+
], Paginated);
|
|
3280
|
+
// src/adapter/HttpAdapter.ts
|
|
3281
|
+
class HttpAdapter {
|
|
3282
|
+
static parsePaginatedAdapter(response, adapterMethod) {
|
|
3283
|
+
return new Paginated(response["items"].map(adapterMethod), response["page"], response["page_size"], response["pages"], response["total_items"]);
|
|
3284
|
+
}
|
|
3285
|
+
static parseFileNameFromContentDispositionHeader(header) {
|
|
3286
|
+
const defaultFilename = `download-${DateTime4.now().toFormat("yyyy-MM-dd HH-mm-ss")}`;
|
|
3287
|
+
if (!header.startsWith("attachment")) {
|
|
3288
|
+
return defaultFilename;
|
|
3289
|
+
}
|
|
3290
|
+
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
|
3291
|
+
const matches = filenameRegex.exec(header);
|
|
3292
|
+
if ((matches?.length || 0) < 2) {
|
|
3293
|
+
return defaultFilename;
|
|
3294
|
+
}
|
|
3295
|
+
return matches[1].replaceAll("'", "").replaceAll('"', "").replaceAll("/", "-").replaceAll(":", "-");
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
HttpAdapter = __legacyDecorateClassTS([
|
|
3299
|
+
adapter_default
|
|
3300
|
+
], HttpAdapter);
|
|
3301
|
+
// src/http/BaseResponse.ts
|
|
3302
|
+
class BaseResponse {
|
|
3303
|
+
get data() {
|
|
3304
|
+
return this.#data;
|
|
3305
|
+
}
|
|
3306
|
+
get headers() {
|
|
3307
|
+
return this.#response.headers;
|
|
3308
|
+
}
|
|
3309
|
+
get ok() {
|
|
3310
|
+
return this.statusCode >= 200 && this.statusCode < 300;
|
|
3311
|
+
}
|
|
3312
|
+
get response() {
|
|
3313
|
+
return this.#response;
|
|
3314
|
+
}
|
|
3315
|
+
get statusCode() {
|
|
3316
|
+
return this.#response.status;
|
|
3317
|
+
}
|
|
3318
|
+
#data;
|
|
3319
|
+
#response;
|
|
3320
|
+
constructor(data, response) {
|
|
3321
|
+
this.#data = data;
|
|
3322
|
+
this.#response = response;
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
|
|
3326
|
+
// src/http/RequestBuilder.ts
|
|
3327
|
+
import { DateTime as DateTime5 } from "luxon";
|
|
3328
|
+
|
|
3329
|
+
// src/http/HttpClient.ts
|
|
3330
|
+
class HttpClient {
|
|
3331
|
+
get authToken() {
|
|
3332
|
+
return this.#authToken;
|
|
3333
|
+
}
|
|
3334
|
+
set authToken(value) {
|
|
3335
|
+
this.#authToken = value;
|
|
3336
|
+
}
|
|
3337
|
+
get baseUrl() {
|
|
3338
|
+
return this.#baseUrl;
|
|
3339
|
+
}
|
|
3340
|
+
get dataField() {
|
|
3341
|
+
return this.#dataField;
|
|
3342
|
+
}
|
|
3343
|
+
#authToken;
|
|
3344
|
+
#baseUrl;
|
|
3345
|
+
#dataField;
|
|
3346
|
+
constructor(authToken, baseUrl, dataField = false) {
|
|
3347
|
+
this.#authToken = authToken;
|
|
3348
|
+
this.#baseUrl = baseUrl;
|
|
3349
|
+
this.#dataField = dataField;
|
|
3350
|
+
}
|
|
3351
|
+
static get instance() {
|
|
3352
|
+
if (HttpClient.#instance === null) {
|
|
3353
|
+
throw new Error("There is currently no HttpClient instance registered. Register one using the HttpClient.register() function.");
|
|
3354
|
+
}
|
|
3355
|
+
return HttpClient.#instance;
|
|
3356
|
+
}
|
|
3357
|
+
static #instance = null;
|
|
3358
|
+
static register(client) {
|
|
3359
|
+
HttpClient.#instance = client;
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
// src/http/RequestError.ts
|
|
3364
|
+
class RequestError {
|
|
3365
|
+
get code() {
|
|
3366
|
+
return this.#code;
|
|
3367
|
+
}
|
|
3368
|
+
get error() {
|
|
3369
|
+
return this.#error;
|
|
3370
|
+
}
|
|
3371
|
+
get errorDescription() {
|
|
3372
|
+
return this.#errorDescription;
|
|
3373
|
+
}
|
|
3374
|
+
get statusCode() {
|
|
3375
|
+
return this.#statusCode;
|
|
3376
|
+
}
|
|
3377
|
+
#code;
|
|
3378
|
+
#error;
|
|
3379
|
+
#errorDescription;
|
|
3380
|
+
#statusCode;
|
|
3381
|
+
constructor(code, error, errorDescription, statusCode) {
|
|
3382
|
+
this.#code = code;
|
|
3383
|
+
this.#error = error;
|
|
3384
|
+
this.#errorDescription = errorDescription;
|
|
3385
|
+
this.#statusCode = statusCode;
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
RequestError = __legacyDecorateClassTS([
|
|
3389
|
+
dto_default
|
|
3390
|
+
], RequestError);
|
|
3391
|
+
|
|
3392
|
+
// src/http/RequestBuilder.ts
|
|
3393
|
+
class RequestBuilder {
|
|
3394
|
+
get client() {
|
|
3395
|
+
return this.#client;
|
|
3396
|
+
}
|
|
3397
|
+
get options() {
|
|
3398
|
+
return this.#options;
|
|
3399
|
+
}
|
|
3400
|
+
get path() {
|
|
3401
|
+
return this.#path;
|
|
3402
|
+
}
|
|
3403
|
+
set path(value) {
|
|
3404
|
+
this.#path = value;
|
|
3405
|
+
}
|
|
3406
|
+
get query() {
|
|
3407
|
+
return this.#query;
|
|
3408
|
+
}
|
|
3409
|
+
set query(value) {
|
|
3410
|
+
this.#query = value;
|
|
3411
|
+
}
|
|
3412
|
+
#client;
|
|
3413
|
+
#path;
|
|
3414
|
+
#options = {};
|
|
3415
|
+
#query = null;
|
|
3416
|
+
constructor(path, client) {
|
|
3417
|
+
this.#client = client ?? HttpClient.instance;
|
|
3418
|
+
this.#options.cache = "no-cache";
|
|
3419
|
+
this.#options.method = "GET";
|
|
3420
|
+
this.#path = path;
|
|
3421
|
+
}
|
|
3422
|
+
bearerToken(token) {
|
|
3423
|
+
token = token ?? this.#client.authToken;
|
|
3424
|
+
if (token) {
|
|
3425
|
+
return this.header("Authorization", `Bearer ${token}`);
|
|
3426
|
+
}
|
|
3427
|
+
if (this.#options.headers && "Authorization" in this.#options.headers) {
|
|
3428
|
+
delete this.#options.headers["Authorization"];
|
|
3429
|
+
}
|
|
3430
|
+
return this;
|
|
3431
|
+
}
|
|
3432
|
+
body(body, contentType = "application/octet-stream") {
|
|
3433
|
+
if (body instanceof FormData) {
|
|
3434
|
+
contentType = null;
|
|
3435
|
+
} else if (Array.isArray(body) || typeof body === "object") {
|
|
3436
|
+
body = JSON.stringify(body);
|
|
3437
|
+
contentType = "application/json";
|
|
3438
|
+
}
|
|
3439
|
+
this.#options.body = body;
|
|
3440
|
+
if (contentType !== null) {
|
|
3441
|
+
return this.header("Content-Type", contentType);
|
|
3442
|
+
}
|
|
3443
|
+
return this;
|
|
3444
|
+
}
|
|
3445
|
+
header(name, value) {
|
|
3446
|
+
this.#options.headers = this.#options.headers || {};
|
|
3447
|
+
this.#options.headers[name] = value;
|
|
3448
|
+
return this;
|
|
3449
|
+
}
|
|
3450
|
+
method(method) {
|
|
3451
|
+
this.#options.method = method.toUpperCase();
|
|
3452
|
+
return this;
|
|
3453
|
+
}
|
|
3454
|
+
queryString(queryString) {
|
|
3455
|
+
this.#query = queryString;
|
|
3456
|
+
return this;
|
|
3457
|
+
}
|
|
3458
|
+
async fetch() {
|
|
3459
|
+
return this.#execute().then((r) => r.json());
|
|
3460
|
+
}
|
|
3461
|
+
async fetchBlob() {
|
|
3462
|
+
let response = await this.#execute();
|
|
3463
|
+
if (response.status !== 200) {
|
|
3464
|
+
const data = await response.json();
|
|
3465
|
+
if ("code" in data && "error" in data && "error_description" in data) {
|
|
3466
|
+
throw new RequestError(data.code, data.error, data.error_description, response.status);
|
|
3467
|
+
}
|
|
3468
|
+
throw new RequestError(-1, "failed_without_info", "Request failed without any information from the backend.", response.status);
|
|
3469
|
+
}
|
|
3470
|
+
let filename = response.headers.has("content-disposition") ? HttpAdapter.parseFileNameFromContentDispositionHeader(response.headers.get("content-disposition")) : `download-${DateTime5.now().toFormat("yyyy-MM-dd HH-mm-ss")}`;
|
|
3471
|
+
return new BlobResponse(await response.blob(), filename);
|
|
3472
|
+
}
|
|
3473
|
+
async run() {
|
|
3474
|
+
const { data, response } = await this.#executeSafe();
|
|
3475
|
+
return new BaseResponse(data, response);
|
|
3476
|
+
}
|
|
3477
|
+
async runAdapter(adapterMethod) {
|
|
3478
|
+
const { data, response } = await this.#executeSafe();
|
|
3479
|
+
return new BaseResponse(adapterMethod(data), response);
|
|
3480
|
+
}
|
|
3481
|
+
async runArrayAdapter(adapterMethod) {
|
|
3482
|
+
return this.runAdapter((data) => data.map(adapterMethod));
|
|
3483
|
+
}
|
|
3484
|
+
async runEmpty() {
|
|
3485
|
+
return await this.#executeSafe();
|
|
3486
|
+
}
|
|
3487
|
+
async runPaginatedAdapter(adapterMethod) {
|
|
3488
|
+
return this.runAdapter((response) => HttpAdapter.parsePaginatedAdapter(response, adapterMethod));
|
|
3489
|
+
}
|
|
3490
|
+
async runData() {
|
|
3491
|
+
return await this.#executeSafe();
|
|
3492
|
+
}
|
|
3493
|
+
async runDataKey(key) {
|
|
3494
|
+
const { data, response } = await this.#executeSafe();
|
|
3495
|
+
return new BaseResponse(data[key], response);
|
|
3496
|
+
}
|
|
3497
|
+
async runStatusCode() {
|
|
3498
|
+
const response = await this.#executeSafe();
|
|
3499
|
+
return response.statusCode;
|
|
3500
|
+
}
|
|
3501
|
+
async#execute() {
|
|
3502
|
+
let path = this.path;
|
|
3503
|
+
if (this.query !== null) {
|
|
3504
|
+
path += `?${this.query.build()}`;
|
|
3505
|
+
}
|
|
3506
|
+
return await fetch(this.client.baseUrl + path, this.options);
|
|
3507
|
+
}
|
|
3508
|
+
async#executeSafe() {
|
|
3509
|
+
return await this.#execute().then((response) => RequestBuilder.#handleResponse(response, this.client.dataField));
|
|
3510
|
+
}
|
|
3511
|
+
static async#handleResponse(response, dataField) {
|
|
3512
|
+
if (response.status === 204) {
|
|
3513
|
+
return new BaseResponse(null, response);
|
|
3514
|
+
}
|
|
3515
|
+
if (response.headers.has("content-type") && response.headers.get("content-type").startsWith("application/json")) {
|
|
3516
|
+
const data2 = await response.json();
|
|
3517
|
+
if ("code" in data2 && "error" in data2 && "error_description" in data2) {
|
|
3518
|
+
throw new RequestError(data2.code, data2.error, data2.error_description, response.status);
|
|
3519
|
+
}
|
|
3520
|
+
if (dataField && "data" in data2) {
|
|
3521
|
+
return new BaseResponse(data2.data, response);
|
|
3522
|
+
}
|
|
3523
|
+
return new BaseResponse(data2, response);
|
|
3524
|
+
}
|
|
3525
|
+
if (response.status === 401 || response.status === 403) {
|
|
3526
|
+
return new BaseResponse(null, response);
|
|
3527
|
+
}
|
|
3528
|
+
const data = await response.text();
|
|
3529
|
+
if (data.length === 0 && response.status >= 200 && response.status < 300) {
|
|
3530
|
+
return new BaseResponse(null, response);
|
|
3531
|
+
}
|
|
3532
|
+
throw new RequestError(-1, "not_a_json_response", "The response was not a JSON response.", response.status);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
// src/http/BaseService.ts
|
|
3537
|
+
class BaseService {
|
|
3538
|
+
request(path, client) {
|
|
3539
|
+
return new RequestBuilder(path, client);
|
|
3540
|
+
}
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
// src/http/QueryString.ts
|
|
3544
|
+
class QueryString {
|
|
3545
|
+
#builder;
|
|
3546
|
+
constructor() {
|
|
3547
|
+
this.#builder = new URLSearchParams;
|
|
3548
|
+
}
|
|
3549
|
+
build() {
|
|
3550
|
+
return this.#builder.toString();
|
|
3551
|
+
}
|
|
3552
|
+
append(name, value) {
|
|
3553
|
+
return this.#add(this.#builder.append.bind(this.#builder), name, value);
|
|
3554
|
+
}
|
|
3555
|
+
appendArray(name, values) {
|
|
3556
|
+
if (values === undefined || values === null) {
|
|
3557
|
+
return this;
|
|
3558
|
+
}
|
|
3559
|
+
values.forEach((value) => this.append(name, value));
|
|
3560
|
+
return this;
|
|
3561
|
+
}
|
|
3562
|
+
delete(name) {
|
|
3563
|
+
this.#builder.delete(name);
|
|
3564
|
+
return this;
|
|
3565
|
+
}
|
|
3566
|
+
get(name) {
|
|
3567
|
+
return this.#builder.get(name);
|
|
3568
|
+
}
|
|
3569
|
+
getAll(name) {
|
|
3570
|
+
return this.#builder.getAll(name);
|
|
3571
|
+
}
|
|
3572
|
+
has(name) {
|
|
3573
|
+
return this.#builder.has(name);
|
|
3574
|
+
}
|
|
3575
|
+
set(name, value) {
|
|
3576
|
+
return this.#add(this.#builder.set.bind(this.#builder), name, value);
|
|
3577
|
+
}
|
|
3578
|
+
#add(fn, name, value) {
|
|
3579
|
+
if (!value && value !== false) {
|
|
3580
|
+
return this;
|
|
3581
|
+
}
|
|
3582
|
+
switch (typeof value) {
|
|
3583
|
+
case "boolean":
|
|
3584
|
+
fn(name, value ? "true" : "false");
|
|
3585
|
+
break;
|
|
3586
|
+
case "number":
|
|
3587
|
+
fn(name, value.toString(10));
|
|
3588
|
+
break;
|
|
3589
|
+
case "string":
|
|
3590
|
+
fn(name, value);
|
|
3591
|
+
break;
|
|
3592
|
+
}
|
|
3593
|
+
return this;
|
|
3594
|
+
}
|
|
3595
|
+
static builder() {
|
|
3596
|
+
return new QueryString;
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
// src/http/helpers.ts
|
|
3601
|
+
function isRequestError(obj) {
|
|
3602
|
+
return obj instanceof RequestError;
|
|
3603
|
+
}
|
|
3604
|
+
function isUnsanctionedRequest(statusCode) {
|
|
3605
|
+
if (statusCode instanceof RequestError) {
|
|
3606
|
+
statusCode = statusCode.statusCode;
|
|
3607
|
+
}
|
|
3608
|
+
return statusCode === 403 || statusCode === 401;
|
|
3609
|
+
}
|
|
3610
|
+
export {
|
|
3611
|
+
serialize_default as serialize,
|
|
3612
|
+
markDtoDirty_default as markDtoDirty,
|
|
3613
|
+
markDtoClean_default as markDtoClean,
|
|
3614
|
+
isUnsanctionedRequest,
|
|
3615
|
+
isRequestError,
|
|
3616
|
+
isDtoDirty_default as isDtoDirty,
|
|
3617
|
+
isDtoClean_default as isDtoClean,
|
|
3618
|
+
isDto_default as isDto,
|
|
3619
|
+
executeIfDtoDirtyAndMarkClean_default as executeIfDtoDirtyAndMarkClean,
|
|
3620
|
+
dto_default as dto,
|
|
3621
|
+
deserialize_default as deserialize,
|
|
3622
|
+
debounce_default as debounce,
|
|
3623
|
+
cloneDto_default as cloneDto,
|
|
3624
|
+
bound_default as bound,
|
|
3625
|
+
assertDto_default as assertDto,
|
|
3626
|
+
adapter_default as adapter,
|
|
3627
|
+
RequestError,
|
|
3628
|
+
RequestBuilder,
|
|
3629
|
+
QueryString,
|
|
3630
|
+
Paginated,
|
|
3631
|
+
HttpClient,
|
|
3632
|
+
HttpAdapter,
|
|
3633
|
+
BlobResponse,
|
|
3634
|
+
BaseService,
|
|
3635
|
+
BaseResponse
|
|
3636
|
+
};
|
|
3637
|
+
|
|
3638
|
+
//# debugId=F0BB74B8B3687CB464756E2164756E21
|
|
2
3639
|
//# sourceMappingURL=http-client.js.map
|