-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6271.f3de02289377829b.js
1 lines (1 loc) · 12.6 KB
/
6271.f3de02289377829b.js
1
"use strict";(self.webpackChunkcheapflightclient=self.webpackChunkcheapflightclient||[]).push([[6271],{87067:(b,g,C)=>{C.d(g,{C:()=>f});var u=C(31061);function f(w={}){return function(N,s){u.m.addExposeMetadata({target:N instanceof Function?N:N.constructor,propertyName:s,options:w})}}},91415:(b,g,C)=>{C.d(g,{h:()=>u});var u=(()=>{return(f=u||(u={}))[f.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",f[f.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",f[f.CLASS_TO_CLASS=2]="CLASS_TO_CLASS",u;var f})()},50494:(b,g,C)=>{C.d(g,{ZE:()=>L,yE:()=>B});var u=C(31061),f=C(91415);class a{constructor(t,e){this.transformationType=t,this.options=e,this.recursionStack=new Set}transform(t,e,n,M,p,m=0){if(Array.isArray(e)||e instanceof Set){const c=M&&this.transformationType===f.h.PLAIN_TO_CLASS?function s(l){const t=new l;return t instanceof Set||"push"in t?t:[]}(M):[];return e.forEach((o,d)=>{const T=t?t[d]:void 0;if(this.options.enableCircularCheck&&this.isCircular(o))this.transformationType===f.h.CLASS_TO_CLASS&&(c instanceof Set?c.add(o):c.push(o));else{let y;if("function"!=typeof n&&n&&n.options&&n.options.discriminator&&n.options.discriminator.property&&n.options.discriminator.subTypes){if(this.transformationType===f.h.PLAIN_TO_CLASS){y=n.options.discriminator.subTypes.find(I=>I.name===o[n.options.discriminator.property]);const x=n.typeFunction({newObject:c,object:o,property:void 0});y=void 0===y?x:y.value,n.options.keepDiscriminatorProperty||delete o[n.options.discriminator.property]}this.transformationType===f.h.CLASS_TO_CLASS&&(y=o.constructor),this.transformationType===f.h.CLASS_TO_PLAIN&&(o[n.options.discriminator.property]=n.options.discriminator.subTypes.find(h=>h.value===o.constructor).name)}else y=n;const O=this.transform(T,o,y,void 0,o instanceof Map,m+1);c instanceof Set?c.add(O):c.push(O)}}),c}if(n===String&&!p)return null==e?e:String(e);if(n===Number&&!p)return null==e?e:Number(e);if(n===Boolean&&!p)return null==e?e:Boolean(e);if((n===Date||e instanceof Date)&&!p)return e instanceof Date?new Date(e.valueOf()):null==e?e:new Date(e);if(function w(){return typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:void 0}().Buffer&&(n===Buffer||e instanceof Buffer)&&!p)return null==e?e:Buffer.from(e);if(function N(l){return null!==l&&"object"==typeof l&&"function"==typeof l.then}(e)&&!p)return new Promise((c,o)=>{e.then(d=>c(this.transform(void 0,d,n,void 0,void 0,m+1)),o)});if(!p&&null!==e&&"object"==typeof e&&"function"==typeof e.then)return e;if("object"==typeof e&&null!==e){!n&&e.constructor!==Object&&(!Array.isArray(e)&&e.constructor===Array||(n=e.constructor)),!n&&t&&(n=t.constructor),this.options.enableCircularCheck&&this.recursionStack.add(e);const c=this.getKeys(n,e,p);let o=t||{};!t&&(this.transformationType===f.h.PLAIN_TO_CLASS||this.transformationType===f.h.CLASS_TO_CLASS)&&(o=p?new Map:n?new n:{});for(const d of c){if("__proto__"===d||"constructor"===d)continue;const T=d;let h,y=d,O=d;if(!this.options.ignoreDecorators&&n)if(this.transformationType===f.h.PLAIN_TO_CLASS){const r=u.m.findExposeMetadataByCustomName(n,d);r&&(O=r.propertyName,y=r.propertyName)}else if(this.transformationType===f.h.CLASS_TO_PLAIN||this.transformationType===f.h.CLASS_TO_CLASS){const r=u.m.findExposeMetadata(n,d);r&&r.options&&r.options.name&&(y=r.options.name)}h=this.transformationType===f.h.PLAIN_TO_CLASS?e[T]:e instanceof Map?e.get(T):e[T]instanceof Function?e[T]():e[T];let x,I=h instanceof Map;if(n&&p)x=n;else if(n){const r=u.m.findTypeMetadata(n,O);if(r){const z=r.typeFunction?r.typeFunction({newObject:o,object:e,property:O}):r.reflectedType;r.options&&r.options.discriminator&&r.options.discriminator.property&&r.options.discriminator.subTypes?e[T]instanceof Array?x=r:(this.transformationType===f.h.PLAIN_TO_CLASS&&(x=r.options.discriminator.subTypes.find(F=>{if(h&&h instanceof Object&&r.options.discriminator.property in h)return F.name===h[r.options.discriminator.property]}),x=void 0===x?z:x.value,r.options.keepDiscriminatorProperty||h&&h instanceof Object&&r.options.discriminator.property in h&&delete h[r.options.discriminator.property]),this.transformationType===f.h.CLASS_TO_CLASS&&(x=h.constructor),this.transformationType===f.h.CLASS_TO_PLAIN&&h&&(h[r.options.discriminator.property]=r.options.discriminator.subTypes.find(F=>F.value===h.constructor).name)):x=z,I=I||r.reflectedType===Map}else if(this.options.targetMaps)this.options.targetMaps.filter(_=>_.target===n&&!!_.properties[O]).forEach(_=>x=_.properties[O]);else if(this.options.enableImplicitConversion&&this.transformationType===f.h.PLAIN_TO_CLASS){const _=Reflect.getMetadata("design:type",n.prototype,O);_&&(x=_)}}const D=Array.isArray(e[T])?this.getReflectedType(n,O):void 0,j=t?t[T]:void 0;if(o.constructor.prototype){const r=Object.getOwnPropertyDescriptor(o.constructor.prototype,y);if((this.transformationType===f.h.PLAIN_TO_CLASS||this.transformationType===f.h.CLASS_TO_CLASS)&&(r&&!r.set||o[y]instanceof Function))continue}if(this.options.enableCircularCheck&&this.isCircular(h)){if(this.transformationType===f.h.CLASS_TO_CLASS){let r=h;r=this.applyCustomTransformations(r,n,d,e,this.transformationType),(void 0!==r||this.options.exposeUnsetFields)&&(o instanceof Map?o.set(y,r):o[y]=r)}}else{const r=this.transformationType===f.h.PLAIN_TO_CLASS?y:d;let _;this.transformationType===f.h.CLASS_TO_PLAIN?(_=e[r],_=this.applyCustomTransformations(_,n,r,e,this.transformationType),_=e[r]===_?h:_,_=this.transform(j,_,x,D,I,m+1)):void 0===h&&this.options.exposeDefaultValues?_=o[y]:(_=this.transform(j,h,x,D,I,m+1),_=this.applyCustomTransformations(_,n,r,e,this.transformationType)),(void 0!==_||this.options.exposeUnsetFields)&&(o instanceof Map?o.set(y,_):o[y]=_)}}return this.options.enableCircularCheck&&this.recursionStack.delete(e),o}return e}applyCustomTransformations(t,e,n,M,p){let m=u.m.findTransformMetadatas(e,n,this.transformationType);return void 0!==this.options.version&&(m=m.filter(c=>!c.options||this.checkVersion(c.options.since,c.options.until))),m=m.filter(this.options.groups&&this.options.groups.length?c=>!c.options||this.checkGroups(c.options.groups):c=>!c.options||!c.options.groups||!c.options.groups.length),m.forEach(c=>{t=c.transformFn({value:t,key:n,obj:M,type:p,options:this.options})}),t}isCircular(t){return this.recursionStack.has(t)}getReflectedType(t,e){if(!t)return;const n=u.m.findTypeMetadata(t,e);return n?n.reflectedType:void 0}getKeys(t,e,n){let M=u.m.getStrategy(t);"none"===M&&(M=this.options.strategy||"exposeAll");let p=[];if(("exposeAll"===M||n)&&(p=e instanceof Map?Array.from(e.keys()):Object.keys(e)),n)return p;if(this.options.ignoreDecorators&&this.options.excludeExtraneousValues&&t&&(p=[...u.m.getExposedProperties(t,this.transformationType),...u.m.getExcludedProperties(t,this.transformationType)]),!this.options.ignoreDecorators&&t){let m=u.m.getExposedProperties(t,this.transformationType);this.transformationType===f.h.PLAIN_TO_CLASS&&(m=m.map(o=>{const d=u.m.findExposeMetadata(t,o);return d&&d.options&&d.options.name?d.options.name:o})),p=this.options.excludeExtraneousValues?m:p.concat(m);const c=u.m.getExcludedProperties(t,this.transformationType);c.length>0&&(p=p.filter(o=>!c.includes(o))),void 0!==this.options.version&&(p=p.filter(o=>{const d=u.m.findExposeMetadata(t,o);return!d||!d.options||this.checkVersion(d.options.since,d.options.until)})),p=p.filter(this.options.groups&&this.options.groups.length?o=>{const d=u.m.findExposeMetadata(t,o);return!d||!d.options||this.checkGroups(d.options.groups)}:o=>{const d=u.m.findExposeMetadata(t,o);return!(d&&d.options&&d.options.groups&&d.options.groups.length)})}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(p=p.filter(m=>this.options.excludePrefixes.every(c=>m.substr(0,c.length)!==c))),p=p.filter((m,c,o)=>o.indexOf(m)===c),p}checkVersion(t,e){let n=!0;return n&&t&&(n=this.options.version>=t),n&&e&&(n=this.options.version<e),n}checkGroups(t){return!t||this.options.groups.some(e=>t.includes(e))}}const i={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},S=new class A{instanceToPlain(t,e){return new a(f.h.CLASS_TO_PLAIN,{...i,...e}).transform(void 0,t,void 0,void 0,void 0,void 0)}classToPlainFromExist(t,e,n){return new a(f.h.CLASS_TO_PLAIN,{...i,...n}).transform(e,t,void 0,void 0,void 0,void 0)}plainToInstance(t,e,n){return new a(f.h.PLAIN_TO_CLASS,{...i,...n}).transform(void 0,e,t,void 0,void 0,void 0)}plainToClassFromExist(t,e,n){return new a(f.h.PLAIN_TO_CLASS,{...i,...n}).transform(t,e,void 0,void 0,void 0,void 0)}instanceToInstance(t,e){return new a(f.h.CLASS_TO_CLASS,{...i,...e}).transform(void 0,t,void 0,void 0,void 0,void 0)}classToClassFromExist(t,e,n){return new a(f.h.CLASS_TO_CLASS,{...i,...n}).transform(e,t,void 0,void 0,void 0,void 0)}serialize(t,e){return JSON.stringify(this.instanceToPlain(t,e))}deserialize(t,e,n){const M=JSON.parse(e);return this.plainToInstance(t,M,n)}deserializeArray(t,e,n){const M=JSON.parse(e);return this.plainToInstance(t,M,n)}};function L(l,t){return S.instanceToPlain(l,t)}function B(l,t,e){return S.plainToInstance(l,t,e)}},31061:(b,g,C)=>{C.d(g,{m:()=>w});var u=C(91415);const w=new class f{constructor(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}addTypeMetadata(s){this._typeMetadatas.has(s.target)||this._typeMetadatas.set(s.target,new Map),this._typeMetadatas.get(s.target).set(s.propertyName,s)}addTransformMetadata(s){this._transformMetadatas.has(s.target)||this._transformMetadatas.set(s.target,new Map),this._transformMetadatas.get(s.target).has(s.propertyName)||this._transformMetadatas.get(s.target).set(s.propertyName,[]),this._transformMetadatas.get(s.target).get(s.propertyName).push(s)}addExposeMetadata(s){this._exposeMetadatas.has(s.target)||this._exposeMetadatas.set(s.target,new Map),this._exposeMetadatas.get(s.target).set(s.propertyName,s)}addExcludeMetadata(s){this._excludeMetadatas.has(s.target)||this._excludeMetadatas.set(s.target,new Map),this._excludeMetadatas.get(s.target).set(s.propertyName,s)}findTransformMetadatas(s,a,i){return this.findMetadatas(this._transformMetadatas,s,a).filter(A=>!A.options||!0===A.options.toClassOnly&&!0===A.options.toPlainOnly||(!0===A.options.toClassOnly?i===u.h.CLASS_TO_CLASS||i===u.h.PLAIN_TO_CLASS:!0!==A.options.toPlainOnly||i===u.h.CLASS_TO_PLAIN))}findExcludeMetadata(s,a){return this.findMetadata(this._excludeMetadatas,s,a)}findExposeMetadata(s,a){return this.findMetadata(this._exposeMetadatas,s,a)}findExposeMetadataByCustomName(s,a){return this.getExposedMetadatas(s).find(i=>i.options&&i.options.name===a)}findTypeMetadata(s,a){return this.findMetadata(this._typeMetadatas,s,a)}getStrategy(s){const a=this._excludeMetadatas.get(s),i=a&&a.get(void 0),A=this._exposeMetadatas.get(s),S=A&&A.get(void 0);return i&&S||!i&&!S?"none":i?"excludeAll":"exposeAll"}getExposedMetadatas(s){return this.getMetadata(this._exposeMetadatas,s)}getExcludedMetadatas(s){return this.getMetadata(this._excludeMetadatas,s)}getExposedProperties(s,a){return this.getExposedMetadatas(s).filter(i=>!i.options||!0===i.options.toClassOnly&&!0===i.options.toPlainOnly||(!0===i.options.toClassOnly?a===u.h.CLASS_TO_CLASS||a===u.h.PLAIN_TO_CLASS:!0!==i.options.toPlainOnly||a===u.h.CLASS_TO_PLAIN)).map(i=>i.propertyName)}getExcludedProperties(s,a){return this.getExcludedMetadatas(s).filter(i=>!i.options||!0===i.options.toClassOnly&&!0===i.options.toPlainOnly||(!0===i.options.toClassOnly?a===u.h.CLASS_TO_CLASS||a===u.h.PLAIN_TO_CLASS:!0!==i.options.toPlainOnly||a===u.h.CLASS_TO_PLAIN)).map(i=>i.propertyName)}clear(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()}getMetadata(s,a){const i=s.get(a);let A;i&&(A=Array.from(i.values()).filter(L=>void 0!==L.propertyName));const S=[];for(const L of this.getAncestors(a)){const P=s.get(L);if(P){const E=Array.from(P.values()).filter(k=>void 0!==k.propertyName);S.push(...E)}}return S.concat(A||[])}findMetadata(s,a,i){const A=s.get(a);if(A){const S=A.get(i);if(S)return S}for(const S of this.getAncestors(a)){const L=s.get(S);if(L){const P=L.get(i);if(P)return P}}}findMetadatas(s,a,i){const A=s.get(a);let S;A&&(S=A.get(i));const L=[];for(const P of this.getAncestors(a)){const E=s.get(P);E&&E.has(i)&&L.push(...E.get(i))}return L.slice().reverse().concat((S||[]).slice().reverse())}getAncestors(s){if(!s)return[];if(!this._ancestorsMap.has(s)){const a=[];for(let i=Object.getPrototypeOf(s.prototype.constructor);typeof i.prototype<"u";i=Object.getPrototypeOf(i.prototype.constructor))a.push(i);this._ancestorsMap.set(s,a)}return this._ancestorsMap.get(s)}}}}]);