@jctrans-materials/comps-vue2 1.0.0 → 1.0.1
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/components/search/hooks/useSearchHistory.d.ts +4 -2
- package/dist/components/search/hooks/useSearchLogic.d.ts +2 -0
- package/dist/components/search/index.d.ts +26 -7
- package/dist/index.cjs.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.esm.js +477 -427
- package/package.json +2 -2
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { SearchItem } from '../type';
|
|
3
3
|
|
|
4
|
-
export declare function useSearchHistory(historyKey: Ref<string>): {
|
|
4
|
+
export declare function useSearchHistory(historyKey: Ref<string | undefined | any>): {
|
|
5
5
|
searchHistory: Ref<{
|
|
6
6
|
[x: string]: any;
|
|
7
7
|
id?: string | number | undefined;
|
|
8
8
|
type: string;
|
|
9
9
|
display?: string | undefined;
|
|
10
|
+
displayEn?: string | undefined;
|
|
11
|
+
displayCn?: string | undefined;
|
|
10
12
|
name?: string | undefined;
|
|
11
13
|
nameEn?: string | undefined;
|
|
12
14
|
nameCn?: string | undefined;
|
|
13
15
|
}[]>;
|
|
14
16
|
saveToHistory: (item: SearchItem) => void;
|
|
15
17
|
clearHistory: () => void;
|
|
16
|
-
HasHistory: import('vue').ComputedRef<boolean
|
|
18
|
+
HasHistory: import('vue').ComputedRef<boolean>;
|
|
17
19
|
};
|
|
@@ -7,6 +7,8 @@ export declare function useSearchLogic(query: Ref<string>, searchTypeList: Ref<s
|
|
|
7
7
|
id?: string | number | undefined;
|
|
8
8
|
type: string;
|
|
9
9
|
display?: string | undefined;
|
|
10
|
+
displayEn?: string | undefined;
|
|
11
|
+
displayCn?: string | undefined;
|
|
10
12
|
name?: string | undefined;
|
|
11
13
|
nameEn?: string | undefined;
|
|
12
14
|
nameCn?: string | undefined;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SearchItem } from './type';
|
|
2
|
+
|
|
1
3
|
declare const _default: import('vue').DefineComponent<{
|
|
2
4
|
value: {
|
|
3
5
|
type: (ArrayConstructor | ObjectConstructor)[];
|
|
@@ -16,8 +18,13 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
16
18
|
default: () => string[];
|
|
17
19
|
};
|
|
18
20
|
historyKey: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
24
|
+
lang: {
|
|
19
25
|
type: StringConstructor;
|
|
20
26
|
default: string;
|
|
27
|
+
validator: (v: unknown) => boolean;
|
|
21
28
|
};
|
|
22
29
|
}, {
|
|
23
30
|
query: import('vue').Ref<string>;
|
|
@@ -32,6 +39,8 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
32
39
|
id?: string | number | undefined;
|
|
33
40
|
type: string;
|
|
34
41
|
display?: string | undefined;
|
|
42
|
+
displayEn?: string | undefined;
|
|
43
|
+
displayCn?: string | undefined;
|
|
35
44
|
name?: string | undefined;
|
|
36
45
|
nameEn?: string | undefined;
|
|
37
46
|
nameCn?: string | undefined;
|
|
@@ -41,6 +50,8 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
41
50
|
id?: string | number | undefined;
|
|
42
51
|
type: string;
|
|
43
52
|
display?: string | undefined;
|
|
53
|
+
displayEn?: string | undefined;
|
|
54
|
+
displayCn?: string | undefined;
|
|
44
55
|
name?: string | undefined;
|
|
45
56
|
nameEn?: string | undefined;
|
|
46
57
|
nameCn?: string | undefined;
|
|
@@ -50,10 +61,10 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
50
61
|
isFinished: import('vue').ComputedRef<boolean>;
|
|
51
62
|
currentPage: import('vue').Ref<number>;
|
|
52
63
|
floatingStyles: import('vue').Ref<import('vue').CSSProperties>;
|
|
53
|
-
saveToHistory: (item:
|
|
64
|
+
saveToHistory: (item: SearchItem) => void;
|
|
54
65
|
clearHistory: () => void;
|
|
55
66
|
fetchData: (page?: number, appendMode?: boolean) => Promise<void>;
|
|
56
|
-
filterByTypes: (data:
|
|
67
|
+
filterByTypes: (data: SearchItem[]) => SearchItem[];
|
|
57
68
|
startTrack: () => void;
|
|
58
69
|
stopTrack: () => void;
|
|
59
70
|
onFocus: () => Promise<void>;
|
|
@@ -61,13 +72,15 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
61
72
|
onInput: (e: any) => void;
|
|
62
73
|
handleDelete: () => void;
|
|
63
74
|
SearchIcon: string;
|
|
75
|
+
isEn: import('vue').ComputedRef<boolean>;
|
|
76
|
+
getItemType: (type: string) => any;
|
|
77
|
+
getItemLabel: (item: SearchItem) => string;
|
|
78
|
+
selectedItems: import('vue').ComputedRef<SearchItem[]>;
|
|
79
|
+
currentPlaceholder: import('vue').ComputedRef<string>;
|
|
80
|
+
displayedTags: import('vue').ComputedRef<SearchItem[]>;
|
|
81
|
+
inputWidth: import('vue').ComputedRef<string>;
|
|
64
82
|
}, {}, {
|
|
65
|
-
isEn(): boolean;
|
|
66
|
-
selectedItems(): any[];
|
|
67
|
-
displayedTags(): any[];
|
|
68
83
|
hasValue(): string | boolean;
|
|
69
|
-
inputWidth(): string;
|
|
70
|
-
currentPlaceholder(): string;
|
|
71
84
|
}, {
|
|
72
85
|
focusInput(): void;
|
|
73
86
|
getItemLabel(item: any): any;
|
|
@@ -96,8 +109,13 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
96
109
|
default: () => string[];
|
|
97
110
|
};
|
|
98
111
|
historyKey: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: undefined;
|
|
114
|
+
};
|
|
115
|
+
lang: {
|
|
99
116
|
type: StringConstructor;
|
|
100
117
|
default: string;
|
|
118
|
+
validator: (v: unknown) => boolean;
|
|
101
119
|
};
|
|
102
120
|
}>>, {
|
|
103
121
|
multiple: boolean;
|
|
@@ -105,5 +123,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
105
123
|
collapseTags: boolean;
|
|
106
124
|
searchTypeList: unknown[];
|
|
107
125
|
historyKey: string;
|
|
126
|
+
lang: string;
|
|
108
127
|
}>;
|
|
109
128
|
export default _default;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("vue"),R=require("@jctrans-materials/shared"),D=require("jctrans-ui");A.util.warn;function Wt(e){const t=A.ref([]),n="_search_history_cache",o=typeof window<"u"&&typeof localStorage<"u",s=A.computed(()=>(e.value||"")+n),i=A.computed(()=>e.value&&e.value!==""),l=a=>{if(!a||!o)return;const c=t.value.filter(d=>d.id&&d.id!==a.id||d.display!==a.display);c.unshift(a);const u=c.slice(0,4);if(t.value=u,i.value)try{localStorage.setItem(s.value,JSON.stringify(u))}catch(d){console.warn("LocalStorage save failed:",d)}},r=()=>{t.value=[],o&&localStorage.removeItem(s.value)};return A.onMounted(()=>{if(o&&i.value){const a=localStorage.getItem(s.value);if(a)try{t.value=JSON.parse(a)}catch{t.value=[]}}}),{searchHistory:t,saveToHistory:l,clearHistory:r,HasHistory:i}}async function Gt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return R.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const Jt=(e,t)=>R.locationSearchV2.searchByIdWithType(e,t);function Kt(e,t){const n=A.ref([]),o=A.ref(!1),s=A.ref(!1),i=A.ref(1),l=A.ref(0),r=A.ref(10),a=A.computed(()=>l.value===0?!1:n.value.length>=l.value),c=A.computed(()=>{const m=[...t.value];return m.includes("Country")&&!m.includes("Region")&&m.push("Region"),m}),u=m=>!m||!Array.isArray(m)?[]:m.filter(f=>c.value.includes(f.type));return{searchResults:n,loading:o,isFetchingMore:s,isFinished:a,currentPage:i,total:l,fetchData:async(m=1,f=!1)=>{if(!e.value.trim()&&!f){n.value=[],l.value=0;return}if(!(f&&(s.value||a.value))&&!(!f&&o.value)){f?s.value=!0:(o.value=!0,i.value=1);try{const p=await Gt(e.value,t.value,{current:m,size:r.value}),h=p.records||[],v=u(h);f?n.value=[...n.value,...v]:n.value=v,l.value=p.total||0,i.value=m}catch(p){console.error("Failed to fetch search results:",p)}finally{o.value=!1,s.value=!1}}},filterByTypes:u}}const Y=Math.min,O=Math.max,st=Math.round,ot=Math.floor,F=e=>({x:e,y:e}),Yt={left:"right",right:"left",bottom:"top",top:"bottom"},jt={start:"end",end:"start"};function bt(e,t,n){return O(e,Y(t,n))}function tt(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function et(e){return e.split("-")[1]}function Tt(e){return e==="x"?"y":"x"}function kt(e){return e==="y"?"height":"width"}const Xt=new Set(["top","bottom"]);function Q(e){return Xt.has(q(e))?"y":"x"}function It(e){return Tt(Q(e))}function zt(e,t,n){n===void 0&&(n=!1);const o=et(e),s=It(e),i=kt(s);let l=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=it(l)),[l,it(l)]}function $t(e){const t=it(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>jt[t])}const xt=["left","right"],Ct=["right","left"],Zt=["top","bottom"],te=["bottom","top"];function ee(e,t,n){switch(e){case"top":case"bottom":return n?t?Ct:xt:t?xt:Ct;case"left":case"right":return t?Zt:te;default:return[]}}function ne(e,t,n,o){const s=et(e);let i=ee(q(e),n==="start",o);return s&&(i=i.map(l=>l+"-"+s),t&&(i=i.concat(i.map(mt)))),i}function it(e){return e.replace(/left|right|bottom|top/g,t=>Yt[t])}function oe(e){return{top:0,right:0,bottom:0,left:0,...e}}function se(e){return typeof e!="number"?oe(e):{top:e,right:e,bottom:e,left:e}}function lt(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Rt(e,t,n){let{reference:o,floating:s}=e;const i=Q(t),l=It(t),r=kt(l),a=q(t),c=i==="y",u=o.x+o.width/2-s.width/2,d=o.y+o.height/2-s.height/2,m=o[r]/2-s[r]/2;let f;switch(a){case"top":f={x:u,y:o.y-s.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-s.width,y:d};break;default:f={x:o.x,y:o.y}}switch(et(t)){case"start":f[l]-=m*(n&&c?-1:1);break;case"end":f[l]+=m*(n&&c?-1:1);break}return f}const ie=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:l}=n,r=i.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=Rt(c,o,a),m=o,f={},p=0;for(let h=0;h<r.length;h++){const{name:v,fn:g}=r[h],{x:y,y:w,data:C,reset:b}=await g({x:u,y:d,initialPlacement:o,placement:m,strategy:s,middlewareData:f,rects:c,platform:l,elements:{reference:e,floating:t}});u=y??u,d=w??d,f={...f,[v]:{...f[v],...C}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(c=b.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):b.rects),{x:u,y:d}=Rt(c,m,a)),h=-1)}return{x:u,y:d,placement:m,strategy:s,middlewareData:f}};async function ht(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:i,rects:l,elements:r,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=tt(t,e),p=se(f),v=r[m?d==="floating"?"reference":"floating":d],g=lt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(r.floating)),boundary:c,rootBoundary:u,strategy:a})),y=d==="floating"?{x:o,y:s,width:l.floating.width,height:l.floating.height}:l.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(r.floating)),C=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},b=lt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:y,offsetParent:w,strategy:a}):y);return{top:(g.top-b.top+p.top)/C.y,bottom:(b.bottom-g.bottom+p.bottom)/C.y,left:(g.left-b.left+p.left)/C.x,right:(b.right-g.right+p.right)/C.x}}const le=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:i,rects:l,initialPlacement:r,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...v}=tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=q(s),y=Q(r),w=q(r)===r,C=await(a.isRTL==null?void 0:a.isRTL(c.floating)),b=m||(w||!h?[it(r)]:$t(r)),E=p!=="none";!m&&E&&b.push(...ne(r,h,p,C));const _=[r,...b],P=await ht(t,v),N=[];let T=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&N.push(P[g]),d){const W=zt(s,l,C);N.push(P[W[0]],P[W[1]])}if(T=[...T,{placement:s,overflows:N}],!N.every(W=>W<=0)){var x,V;const W=(((x=i.flip)==null?void 0:x.index)||0)+1,ft=_[W];if(ft&&(!(d==="alignment"?y!==Q(ft):!1)||T.every(k=>Q(k.placement)===y?k.overflows[0]>0:!0)))return{data:{index:W,overflows:T},reset:{placement:ft}};let $=(V=T.filter(G=>G.overflows[0]<=0).sort((G,k)=>G.overflows[1]-k.overflows[1])[0])==null?void 0:V.placement;if(!$)switch(f){case"bestFit":{var z;const G=(z=T.filter(k=>{if(E){const H=Q(k.placement);return H===y||H==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(H=>H>0).reduce((H,Ut)=>H+Ut,0)]).sort((k,H)=>k[1]-H[1])[0])==null?void 0:z[0];G&&($=G);break}case"initialPlacement":$=r;break}if(s!==$)return{reset:{placement:$}}}return{}}}},re=new Set(["left","top"]);async function ae(e,t){const{placement:n,platform:o,elements:s}=e,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),l=q(n),r=et(n),a=Q(n)==="y",c=re.has(l)?-1:1,u=i&&a?-1:1,d=tt(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return r&&typeof p=="number"&&(f=r==="end"?p*-1:p),a?{x:f*u,y:m*c}:{x:m*c,y:f*u}}const ce=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:i,placement:l,middlewareData:r}=t,a=await ae(t,e);return l===((n=r.offset)==null?void 0:n.placement)&&(o=r.arrow)!=null&&o.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:l}}}}},ue=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:r={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...a}=tt(e,t),c={x:n,y:o},u=await ht(t,a),d=Q(q(s)),m=Tt(d);let f=c[m],p=c[d];if(i){const v=m==="y"?"top":"left",g=m==="y"?"bottom":"right",y=f+u[v],w=f-u[g];f=bt(y,f,w)}if(l){const v=d==="y"?"top":"left",g=d==="y"?"bottom":"right",y=p+u[v],w=p-u[g];p=bt(y,p,w)}const h=r.fn({...t,[m]:f,[d]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:i,[d]:l}}}}}},fe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:i,platform:l,elements:r}=t,{apply:a=()=>{},...c}=tt(e,t),u=await ht(t,c),d=q(s),m=et(s),f=Q(s)==="y",{width:p,height:h}=i.floating;let v,g;d==="top"||d==="bottom"?(v=d,g=m===(await(l.isRTL==null?void 0:l.isRTL(r.floating))?"start":"end")?"left":"right"):(g=d,v=m==="end"?"top":"bottom");const y=h-u.top-u.bottom,w=p-u.left-u.right,C=Y(h-u[v],y),b=Y(p-u[g],w),E=!t.middlewareData.shift;let _=C,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(_=y),E&&!m){const T=O(u.left,0),x=O(u.right,0),V=O(u.top,0),z=O(u.bottom,0);f?P=p-2*(T!==0||x!==0?T+x:O(u.left,u.right)):_=h-2*(V!==0||z!==0?V+z:O(u.top,u.bottom))}await a({...t,availableWidth:P,availableHeight:_});const N=await l.getDimensions(r.floating);return p!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function rt(){return typeof window<"u"}function X(e){return Lt(e)?(e.nodeName||"").toLowerCase():"#document"}function S(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function B(e){var t;return(t=(Lt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lt(e){return rt()?e instanceof Node||e instanceof S(e).Node:!1}function I(e){return rt()?e instanceof Element||e instanceof S(e).Element:!1}function M(e){return rt()?e instanceof HTMLElement||e instanceof S(e).HTMLElement:!1}function Dt(e){return!rt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof S(e).ShadowRoot}const de=new Set(["inline","contents"]);function nt(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!de.has(s)}const me=new Set(["table","td","th"]);function pe(e){return me.has(X(e))}const he=[":popover-open",":modal"];function at(e){return he.some(t=>{try{return e.matches(t)}catch{return!1}})}const ge=["transform","translate","scale","rotate","perspective"],ve=["transform","translate","scale","rotate","perspective","filter"],ye=["paint","layout","strict","content"];function gt(e){const t=vt(),n=I(e)?L(e):e;return ge.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ve.some(o=>(n.willChange||"").includes(o))||ye.some(o=>(n.contain||"").includes(o))}function Ae(e){let t=U(e);for(;M(t)&&!j(t);){if(gt(t))return t;if(at(t))return null;t=U(t)}return null}function vt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const we=new Set(["html","body","#document"]);function j(e){return we.has(X(e))}function L(e){return S(e).getComputedStyle(e)}function ct(e){return I(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function U(e){if(X(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Dt(e)&&e.host||B(e);return Dt(t)?t.host:t}function Ft(e){const t=U(e);return j(t)?e.ownerDocument?e.ownerDocument.body:e.body:M(t)&&nt(t)?t:Ft(t)}function Z(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ft(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),l=S(s);if(i){const r=pt(l);return t.concat(l,l.visualViewport||[],nt(s)?s:[],r&&n?Z(r):[])}return t.concat(s,Z(s,[],n))}function pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=L(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=M(e),i=s?e.offsetWidth:n,l=s?e.offsetHeight:o,r=st(n)!==i||st(o)!==l;return r&&(n=i,o=l),{width:n,height:o,$:r}}function yt(e){return I(e)?e:e.contextElement}function K(e){const t=yt(e);if(!M(t))return F(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Mt(t);let l=(i?st(n.width):n.width)/o,r=(i?st(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!r||!Number.isFinite(r))&&(r=1),{x:l,y:r}}const be=F(0);function Bt(e){const t=S(e);return!vt()||!t.visualViewport?be:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==S(e)?!1:t}function J(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=yt(e);let l=F(1);t&&(o?I(o)&&(l=K(o)):l=K(e));const r=xe(i,n,o)?Bt(i):F(0);let a=(s.left+r.x)/l.x,c=(s.top+r.y)/l.y,u=s.width/l.x,d=s.height/l.y;if(i){const m=S(i),f=o&&I(o)?S(o):o;let p=m,h=pt(p);for(;h&&o&&f!==p;){const v=K(h),g=h.getBoundingClientRect(),y=L(h),w=g.left+(h.clientLeft+parseFloat(y.paddingLeft))*v.x,C=g.top+(h.clientTop+parseFloat(y.paddingTop))*v.y;a*=v.x,c*=v.y,u*=v.x,d*=v.y,a+=w,c+=C,p=S(h),h=pt(p)}}return lt({width:u,height:d,x:a,y:c})}function ut(e,t){const n=ct(e).scrollLeft;return t?t.left+n:J(B(e)).left+n}function Pt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ut(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function Ce(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",l=B(o),r=t?at(t.floating):!1;if(o===l||r&&i)return n;let a={scrollLeft:0,scrollTop:0},c=F(1);const u=F(0),d=M(o);if((d||!d&&!i)&&((X(o)!=="body"||nt(l))&&(a=ct(o)),M(o))){const f=J(o);c=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=l&&!d&&!i?Pt(l,a):F(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-a.scrollTop*c.y+u.y+m.y}}function Re(e){return Array.from(e.getClientRects())}function De(e){const t=B(e),n=ct(e),o=e.ownerDocument.body,s=O(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=O(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+ut(e);const r=-n.scrollTop;return L(o).direction==="rtl"&&(l+=O(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:l,y:r}}const Ot=25;function Oe(e,t){const n=S(e),o=B(e),s=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,r=0,a=0;if(s){i=s.width,l=s.height;const u=vt();(!u||u&&t==="fixed")&&(r=s.offsetLeft,a=s.offsetTop)}const c=ut(o);if(c<=0){const u=o.ownerDocument,d=u.body,m=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-d.clientWidth-f);p<=Ot&&(i-=p)}else c<=Ot&&(i+=c);return{width:i,height:l,x:r,y:a}}const Se=new Set(["absolute","fixed"]);function _e(e,t){const n=J(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,i=M(e)?K(e):F(1),l=e.clientWidth*i.x,r=e.clientHeight*i.y,a=s*i.x,c=o*i.y;return{width:l,height:r,x:a,y:c}}function St(e,t,n){let o;if(t==="viewport")o=Oe(e,n);else if(t==="document")o=De(B(e));else if(I(t))o=_e(t,n);else{const s=Bt(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lt(o)}function Nt(e,t){const n=U(e);return n===t||!I(n)||j(n)?!1:L(n).position==="fixed"||Nt(n,t)}function Ee(e,t){const n=t.get(e);if(n)return n;let o=Z(e,[],!1).filter(r=>I(r)&&X(r)!=="body"),s=null;const i=L(e).position==="fixed";let l=i?U(e):e;for(;I(l)&&!j(l);){const r=L(l),a=gt(l);!a&&r.position==="fixed"&&(s=null),(i?!a&&!s:!a&&r.position==="static"&&!!s&&Se.has(s.position)||nt(l)&&!a&&Nt(e,l))?o=o.filter(u=>u!==l):s=r,l=U(l)}return t.set(e,o),o}function Te(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const l=[...n==="clippingAncestors"?at(t)?[]:Ee(t,this._c):[].concat(n),o],r=l[0],a=l.reduce((c,u)=>{const d=St(t,u,s);return c.top=O(d.top,c.top),c.right=Y(d.right,c.right),c.bottom=Y(d.bottom,c.bottom),c.left=O(d.left,c.left),c},St(t,r,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function ke(e){const{width:t,height:n}=Mt(e);return{width:t,height:n}}function Ie(e,t,n){const o=M(t),s=B(t),i=n==="fixed",l=J(e,!0,i,t);let r={scrollLeft:0,scrollTop:0};const a=F(0);function c(){a.x=ut(s)}if(o||!o&&!i)if((X(t)!=="body"||nt(s))&&(r=ct(t)),o){const f=J(t,!0,i,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else s&&c();i&&!o&&s&&c();const u=s&&!o&&!i?Pt(s,r):F(0),d=l.left+r.scrollLeft-a.x-u.x,m=l.top+r.scrollTop-a.y-u.y;return{x:d,y:m,width:l.width,height:l.height}}function dt(e){return L(e).position==="static"}function _t(e,t){if(!M(e)||L(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return B(e)===n&&(n=n.ownerDocument.body),n}function Vt(e,t){const n=S(e);if(at(e))return n;if(!M(e)){let s=U(e);for(;s&&!j(s);){if(I(s)&&!dt(s))return s;s=U(s)}return n}let o=_t(e,t);for(;o&&pe(o)&&dt(o);)o=_t(o,t);return o&&j(o)&&dt(o)&&!gt(o)?n:o||Ae(e)||n}const Le=async function(e){const t=this.getOffsetParent||Vt,n=this.getDimensions,o=await n(e.floating);return{reference:Ie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Fe(e){return L(e).direction==="rtl"}const Me={convertOffsetParentRelativeRectToViewportRelativeRect:Ce,getDocumentElement:B,getClippingRect:Te,getOffsetParent:Vt,getElementRects:Le,getClientRects:Re,getDimensions:ke,getScale:K,isElement:I,isRTL:Fe};function Qt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Be(e,t){let n=null,o;const s=B(e);function i(){var r;clearTimeout(o),(r=n)==null||r.disconnect(),n=null}function l(r,a){r===void 0&&(r=!1),a===void 0&&(a=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=c;if(r||t(),!m||!f)return;const p=ot(d),h=ot(s.clientWidth-(u+m)),v=ot(s.clientHeight-(d+f)),g=ot(u),w={rootMargin:-p+"px "+-h+"px "+-v+"px "+-g+"px",threshold:O(0,Y(1,a))||1};let C=!0;function b(E){const _=E[0].intersectionRatio;if(_!==a){if(!C)return l();_?l(!1,_):o=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!Qt(c,e.getBoundingClientRect())&&l(),C=!1}try{n=new IntersectionObserver(b,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return l(!0),i}function Pe(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:r=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,c=yt(e),u=s||i?[...c?Z(c):[],...Z(t)]:[];u.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const d=c&&r?Be(c,n):null;let m=-1,f=null;l&&(f=new ResizeObserver(g=>{let[y]=g;y&&y.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!a&&f.observe(c),f.observe(t));let p,h=a?J(e):null;a&&v();function v(){const g=J(e);h&&!Qt(h,g)&&n(),h=g,p=requestAnimationFrame(v)}return n(),()=>{var g;u.forEach(y=>{s&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const Ne=ce,Ve=ue,Qe=le,He=fe,qe=(e,t,n)=>{const o=new Map,s={platform:Me,...n},i={...s.platform,_c:o};return ie(e,t,{...s,platform:i})};function Ue(e,t){const n=A.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let o=null;const s=()=>{!e.value||!t.value||qe(e.value,t.value,{placement:"bottom-start",strategy:"fixed",middleware:[Ne(6),Qe(),Ve({padding:10}),He({apply({rects:r,elements:a}){const c=`${r.reference.width}px`;Object.assign(a.floating.style,{width:c,minWidth:c,maxWidth:c})}})]}).then(({x:r,y:a})=>{Object.assign(n.value,{left:`${r}px`,top:`${a}px`})})},i=()=>{e.value&&t.value&&(o=Pe(e.value,t.value,s))},l=()=>{o&&(o(),o=null)};return A.onBeforeUnmount(l),{floatingStyles:n,startTrack:i,stopTrack:l}}const We="data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2534'%20width='200'%20height='200'%3e%3cpath%20d='M448%2085.333333a362.666667%20362.666667%200%201%200%20224.512%20647.509334l155.818667%20155.818666a42.666667%2042.666667%200%200%200%2060.330666-60.330666l-155.818666-155.818667A362.666667%20362.666667%200%200%200%20448%2085.333333zM170.666667%20448a277.333333%20277.333333%200%201%201%20554.666666%200%20277.333333%20277.333333%200%200%201-554.666666%200z'%20p-id='2535'%3e%3c/path%3e%3c/svg%3e",Ge="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOkVhOcZyepYndNpDpPvwAAAP//BVQJHAAAAAZJREFUAwDZW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AgQwqxNyc1NL7MCoeyH1xNWpuKsTcet7fv46QI0/zdoEtkmAwHGcHyFQj/Q57vuPzm7m+X5efB6HYj3kOCubuLVlApltfdbPX5uaetCmdeKVAqUN1mdy04XR3PTsqAHPWMztTb24myvEBBuRM+WlUnbzDEXeya2D4XC0zrJqnXwsO3pG3mCMGWMK6lQZk2A0hH2GMSxL9VlI6lVkd90RgGKkVFrrc+9REXubjLH9FxfbbVUVGG5v4i2p8LD8x9ax65C66KTfKGCSDc97fv6DJzuf9QtDtm+iqsM1ot70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",Xe=A.defineComponent({name:"GlobalSearch",model:{prop:"value",event:"input"},props:{value:{type:[Object,Array],default:null},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},searchTypeList:{type:Array,default:()=>["City","Seaport","Airport","Country"]},historyKey:{type:String,default:""}},setup(e,{emit:t}){const n=A.ref(""),o=A.ref(!1),s=A.ref(!1),i=A.ref(""),l=A.ref(null),r=A.ref(null),a=A.ref(null),c=A.ref(null),{searchHistory:u,saveToHistory:d,clearHistory:m}=Wt(A.toRef(e,"historyKey")),{searchResults:f,loading:p,isFetchingMore:h,isFinished:v,currentPage:g,fetchData:y,filterByTypes:w}=Kt(n,A.toRef(e,"searchTypeList")),{floatingStyles:C,startTrack:b,stopTrack:E}=Ue(a,c),_=async()=>{if(s.value=!0,console.log("🍉 ~ index.vue:210 ~ onFocus ~ searchResults.value:",f.value,o.value),!e.multiple&&o.value&&f.value.length===0){const x=e.value;if(console.log("🍉 ~ index.vue:221 ~ onFocus ~ val:",x),x?.id){p.value=!0;try{const V=await Jt(x.id,x.type);f.value=w(V.records)}finally{p.value=!1}}}},P=()=>{setTimeout(()=>{s.value=!1},200)},N=x=>{x.target.value===""&&!e.multiple&&(o.value=!1,t("input",null),t("update:value",null))},T=()=>{if(e.multiple&&!n.value&&e.value?.length>0){const x=[...e.value],V=x.pop();t("input",x),t("update:value",x),t("remove",V)}};return A.watch(s,x=>x?b():E()),A.watch(n,x=>{if(!x.trim()){f.value=[];return}l.value&&clearTimeout(l.value),l.value=setTimeout(()=>y(1,!1),300)}),A.onBeforeUnmount(E),{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:r,referenceRef:a,floatingRef:c,searchHistory:u,searchResults:f,loading:p,isFetchingMore:h,isFinished:v,currentPage:g,floatingStyles:C,saveToHistory:d,clearHistory:m,fetchData:y,filterByTypes:w,startTrack:b,stopTrack:E,onFocus:_,handleBlur:P,onInput:N,handleDelete:T,SearchIcon:We}},computed:{isEn(){let e="";try{if(typeof useCookie=="function"){const t=useCookie("jc-language").value;if(t)return/en/.test(t)||/en-US/.test(t)}}catch{}return process.client?e=document.cookie||"":process.server&&(e=useNuxtApp?.()?.ssrContext?.event.node.req.headers.cookie||""),/jc-language=en-US/.test(e)||/jc-language=en/.test(e)},selectedItems(){return this.value?Array.isArray(this.value)?this.value:[this.value]:[]},displayedTags(){return this.collapseTags?this.selectedItems.slice(0,1):this.selectedItems},hasValue(){return this.query||this.selectedItems.length>0},inputWidth(){return this.multiple?this.query?`${this.query.length*10+20}px`:"10px":"100%"},currentPlaceholder(){return this.multiple&&this.selectedItems.length>0?"":this.isSelected&&!this.multiple?this.selectedLabel:this.isEn?"Please enter...":"请输入..."}},methods:{focusInput(){this.$refs.inputRef?.focus()},getItemLabel(e){return e.display||e.nameEn||e.nameCn||""},isItemActive(e){return this.selectedItems.some(t=>t.id===e.id)},selectItem(e){this.saveToHistory(e),this.multiple?this.isItemActive(e)||(this.$emit("input",[...this.selectedItems,e]),this.$emit("update:value",[...this.selectedItems,e])):(this.isSelected=!0,this.selectedLabel=this.getItemLabel(e),this.$emit("input",e),this.$emit("update:value",e),this.isDropdownVisible=!1),this.query="",this.$emit("select",e)},removeItem(e){const t=this.selectedItems.filter(n=>n.id!==e.id);this.$emit("input",t),this.$emit("update:value",t),this.$emit("remove",e)},clearAll(){this.query="",this.isSelected=!1,this.selectedLabel="",this.$emit("input",this.multiple?[]:null),this.$emit("update:value",this.multiple?[]:null)},handleSearch(){const e=this.multiple?this.selectedItems:this.isSelected?this.value:{nameCn:this.query,type:"Manual"};this.$emit("submit-search",e),this.isDropdownVisible=!1},getIconUrl(e){return{City:Ge,Seaport:Je,Airport:Ke,Country:Ye}[e]||je},handleScroll(e){const{scrollTop:t,scrollHeight:n,clientHeight:o}=e.target;t+o>=n-20&&!this.loading&&!this.isFetchingMore&&!this.isFinished&&this.query&&this.fetchData(this.currentPage+1,!0)}}});function At(e,t,n,o,s,i,l,r){var a=typeof e=="function"?e.options:e;return t&&(a.render=t,a.staticRenderFns=n,a._compiled=!0),i&&(a._scopeId="data-v-"+i),{exports:e,options:a}}var ze=function(){var t=this,n=t._self._c;return t._self._setupProxy,n("div",{staticClass:"search-container"},[n("div",{ref:"referenceRef",staticClass:"search-input-wrapper",class:{"is-multiple":t.multiple},on:{click:t.focusInput}},[n("div",{staticClass:"selection-wrapper"},[t.multiple&&t.selectedItems.length>0?[t._l(t.displayedTags,function(o,s){return n("div",{key:o.id||s,staticClass:"search-tag"},[n("span",{staticClass:"tag-text"},[t._v(t._s(t.getItemLabel(o)))]),n("span",{staticClass:"tag-close",on:{click:function(i){return i.stopPropagation(),t.removeItem(o)}}},[t._v("×")])])}),t.collapseTags&&t.selectedItems.length>1?n("div",{staticClass:"search-tag collapse"},[t._v(" + "+t._s(t.selectedItems.length-1)+" ")]):t._e()]:t._e(),n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],ref:"inputRef",class:{"is-selected-state":t.isSelected&&!t.multiple},style:{width:t.inputWidth},attrs:{type:"text",placeholder:t.currentPlaceholder},domProps:{value:t.query},on:{focus:t.onFocus,blur:t.handleBlur,input:[function(o){o.target.composing||(t.query=o.target.value)},t.onInput],keydown:function(o){return!o.type.indexOf("key")&&t._k(o.keyCode,"delete",[8,46],o.key,["Backspace","Delete","Del"])?null:t.handleDelete.apply(null,arguments)}}})],2),n("div",{staticClass:"suffix-area"},[t.hasValue?n("span",{staticClass:"clear-icon",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearAll.apply(null,arguments)}}},[t._v("ⓧ")]):t._e(),t.loading&&!t.isFetchingMore?n("div",{staticClass:"loading-spinner"}):n("button",{staticClass:"search-btn",on:{click:t.handleSearch}},[n("span",{staticClass:"search-icon"},[n("img",{attrs:{src:t.SearchIcon,alt:"search"}})])])])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isDropdownVisible&&(t.searchResults.length>0||t.loading||t.query||t.searchHistory.length>0),expression:`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("vue"),D=require("@jctrans-materials/shared"),S=require("jctrans-ui");g.util.warn;function Wt(e){const t=g.ref([]),n="_search_history_cache",o=typeof window<"u"&&typeof localStorage<"u",s=g.computed(()=>(e.value||"")+n),i=g.computed(()=>!!e.value&&e.value!==""),r=a=>{if(!a||!o)return;const c=t.value.filter(d=>d.id&&d.id!==a.id||d.display!==a.display);c.unshift(a);const u=c.slice(0,4);if(i.value){t.value=u;try{localStorage.setItem(s.value,JSON.stringify(u))}catch(d){console.warn("LocalStorage save failed:",d)}}},l=()=>{t.value=[],o&&localStorage.removeItem(s.value)};return g.onMounted(()=>{if(o&&i.value){const a=localStorage.getItem(s.value);if(a)try{t.value=JSON.parse(a)}catch{t.value=[]}}}),{searchHistory:t,saveToHistory:r,clearHistory:l,HasHistory:i}}async function Gt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return D.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const Jt=(e,t)=>D.locationSearchV2.searchByIdWithType(e,t);function Kt(e,t){const n=g.ref([]),o=g.ref(!1),s=g.ref(!1),i=g.ref(1),r=g.ref(0),l=g.ref(10),a=g.computed(()=>r.value===0?!1:n.value.length>=r.value),c=g.computed(()=>{const m=[...t.value];return m.includes("Country")&&!m.includes("Region")&&m.push("Region"),m}),u=m=>!m||!Array.isArray(m)?[]:m.filter(f=>c.value.includes(f.type));return{searchResults:n,loading:o,isFetchingMore:s,isFinished:a,currentPage:i,total:r,fetchData:async(m=1,f=!1)=>{if(!e.value.trim()&&!f){n.value=[],r.value=0;return}if(!(f&&(s.value||a.value))&&!(!f&&o.value)){f?s.value=!0:(o.value=!0,i.value=1);try{const p=await Gt(e.value,t.value,{current:m,size:l.value}),v=p.records||[],A=u(v);f?n.value=[...n.value,...A]:n.value=A,r.value=p.total||0,i.value=m}catch(p){console.error("Failed to fetch search results:",p)}finally{o.value=!1,s.value=!1}}},filterByTypes:u}}const z=Math.min,O=Math.max,it=Math.round,st=Math.floor,B=e=>({x:e,y:e}),Yt={left:"right",right:"left",bottom:"top",top:"bottom"},jt={start:"end",end:"start"};function bt(e,t,n){return O(e,z(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function nt(e){return e.split("-")[1]}function Tt(e){return e==="x"?"y":"x"}function kt(e){return e==="y"?"height":"width"}const zt=new Set(["top","bottom"]);function U(e){return zt.has(q(e))?"y":"x"}function It(e){return Tt(U(e))}function Xt(e,t,n){n===void 0&&(n=!1);const o=nt(e),s=It(e),i=kt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(r=rt(r)),[r,rt(r)]}function $t(e){const t=rt(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>jt[t])}const xt=["left","right"],Ct=["right","left"],Zt=["top","bottom"],te=["bottom","top"];function ee(e,t,n){switch(e){case"top":case"bottom":return n?t?Ct:xt:t?xt:Ct;case"left":case"right":return t?Zt:te;default:return[]}}function ne(e,t,n,o){const s=nt(e);let i=ee(q(e),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),t&&(i=i.concat(i.map(mt)))),i}function rt(e){return e.replace(/left|right|bottom|top/g,t=>Yt[t])}function oe(e){return{top:0,right:0,bottom:0,left:0,...e}}function se(e){return typeof e!="number"?oe(e):{top:e,right:e,bottom:e,left:e}}function lt(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,x:t,y:n}}function Rt(e,t,n){let{reference:o,floating:s}=e;const i=U(t),r=It(t),l=kt(r),a=q(t),c=i==="y",u=o.x+o.width/2-s.width/2,d=o.y+o.height/2-s.height/2,m=o[l]/2-s[l]/2;let f;switch(a){case"top":f={x:u,y:o.y-s.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-s.width,y:d};break;default:f={x:o.x,y:o.y}}switch(nt(t)){case"start":f[r]-=m*(n&&c?-1:1);break;case"end":f[r]+=m*(n&&c?-1:1);break}return f}const ie=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,l=i.filter(Boolean),a=await(r.isRTL==null?void 0:r.isRTL(t));let c=await r.getElementRects({reference:e,floating:t,strategy:s}),{x:u,y:d}=Rt(c,o,a),m=o,f={},p=0;for(let v=0;v<l.length;v++){const{name:A,fn:y}=l[v],{x:w,y:b,data:R,reset:x}=await y({x:u,y:d,initialPlacement:o,placement:m,strategy:s,middlewareData:f,rects:c,platform:r,elements:{reference:e,floating:t}});u=w??u,d=b??d,f={...f,[A]:{...f[A],...R}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(c=x.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:s}):x.rects),{x:u,y:d}=Rt(c,m,a)),v=-1)}return{x:u,y:d,placement:m,strategy:s,middlewareData:f}};async function ht(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:i,rects:r,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=et(t,e),p=se(f),A=l[m?d==="floating"?"reference":"floating":d],y=lt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(A)))==null||n?A:A.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),w=d==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),R=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},x=lt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:b,strategy:a}):w);return{top:(y.top-x.top+p.top)/R.y,bottom:(x.bottom-y.bottom+p.bottom)/R.y,left:(y.left-x.left+p.left)/R.x,right:(x.right-y.right+p.right)/R.x}}const re=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:i,rects:r,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:v=!0,...A}=et(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=q(s),w=U(l),b=q(l)===l,R=await(a.isRTL==null?void 0:a.isRTL(c.floating)),x=m||(b||!v?[rt(l)]:$t(l)),k=p!=="none";!m&&k&&x.push(...ne(l,v,p,R));const E=[l,...x],N=await ht(t,A),Q=[];let I=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&Q.push(N[y]),d){const T=Xt(s,r,R);Q.push(N[T[0]],N[T[1]])}if(I=[...I,{placement:s,overflows:Q}],!Q.every(T=>T<=0)){var G,J;const T=(((G=i.flip)==null?void 0:G.index)||0)+1,Z=E[T];if(Z&&(!(d==="alignment"?w!==U(Z):!1)||I.every(h=>U(h.placement)===w?h.overflows[0]>0:!0)))return{data:{index:T,overflows:I},reset:{placement:Z}};let K=(J=I.filter(H=>H.overflows[0]<=0).sort((H,h)=>H.overflows[1]-h.overflows[1])[0])==null?void 0:J.placement;if(!K)switch(f){case"bestFit":{var L;const H=(L=I.filter(h=>{if(k){const C=U(h.placement);return C===w||C==="y"}return!0}).map(h=>[h.placement,h.overflows.filter(C=>C>0).reduce((C,qt)=>C+qt,0)]).sort((h,C)=>h[1]-C[1])[0])==null?void 0:L[0];H&&(K=H);break}case"initialPlacement":K=l;break}if(s!==K)return{reset:{placement:K}}}return{}}}},le=new Set(["left","top"]);async function ae(e,t){const{placement:n,platform:o,elements:s}=e,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=q(n),l=nt(n),a=U(n)==="y",c=le.has(r)?-1:1,u=i&&a?-1:1,d=et(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof p=="number"&&(f=l==="end"?p*-1:p),a?{x:f*u,y:m*c}:{x:m*c,y:f*u}}const ce=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:s,y:i,placement:r,middlewareData:l}=t,a=await ae(t,e);return r===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:s+a.x,y:i+a.y,data:{...a,placement:r}}}}},ue=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s}=t,{mainAxis:i=!0,crossAxis:r=!1,limiter:l={fn:A=>{let{x:y,y:w}=A;return{x:y,y:w}}},...a}=et(e,t),c={x:n,y:o},u=await ht(t,a),d=U(q(s)),m=Tt(d);let f=c[m],p=c[d];if(i){const A=m==="y"?"top":"left",y=m==="y"?"bottom":"right",w=f+u[A],b=f-u[y];f=bt(w,f,b)}if(r){const A=d==="y"?"top":"left",y=d==="y"?"bottom":"right",w=p+u[A],b=p-u[y];p=bt(w,p,b)}const v=l.fn({...t,[m]:f,[d]:p});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[m]:i,[d]:r}}}}}},fe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:i,platform:r,elements:l}=t,{apply:a=()=>{},...c}=et(e,t),u=await ht(t,c),d=q(s),m=nt(s),f=U(s)==="y",{width:p,height:v}=i.floating;let A,y;d==="top"||d==="bottom"?(A=d,y=m===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(y=d,A=m==="end"?"top":"bottom");const w=v-u.top-u.bottom,b=p-u.left-u.right,R=z(v-u[A],w),x=z(p-u[y],b),k=!t.middlewareData.shift;let E=R,N=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=b),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(E=w),k&&!m){const I=O(u.left,0),G=O(u.right,0),J=O(u.top,0),L=O(u.bottom,0);f?N=p-2*(I!==0||G!==0?I+G:O(u.left,u.right)):E=v-2*(J!==0||L!==0?J+L:O(u.top,u.bottom))}await a({...t,availableWidth:N,availableHeight:E});const Q=await r.getDimensions(l.floating);return p!==Q.width||v!==Q.height?{reset:{rects:!0}}:{}}}};function at(){return typeof window<"u"}function $(e){return Lt(e)?(e.nodeName||"").toLowerCase():"#document"}function _(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function V(e){var t;return(t=(Lt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Lt(e){return at()?e instanceof Node||e instanceof _(e).Node:!1}function F(e){return at()?e instanceof Element||e instanceof _(e).Element:!1}function P(e){return at()?e instanceof HTMLElement||e instanceof _(e).HTMLElement:!1}function Dt(e){return!at()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _(e).ShadowRoot}const de=new Set(["inline","contents"]);function ot(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=M(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!de.has(s)}const me=new Set(["table","td","th"]);function pe(e){return me.has($(e))}const he=[":popover-open",":modal"];function ct(e){return he.some(t=>{try{return e.matches(t)}catch{return!1}})}const ge=["transform","translate","scale","rotate","perspective"],ve=["transform","translate","scale","rotate","perspective","filter"],ye=["paint","layout","strict","content"];function gt(e){const t=vt(),n=F(e)?M(e):e;return ge.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ve.some(o=>(n.willChange||"").includes(o))||ye.some(o=>(n.contain||"").includes(o))}function Ae(e){let t=W(e);for(;P(t)&&!X(t);){if(gt(t))return t;if(ct(t))return null;t=W(t)}return null}function vt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const we=new Set(["html","body","#document"]);function X(e){return we.has($(e))}function M(e){return _(e).getComputedStyle(e)}function ut(e){return F(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function W(e){if($(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Dt(e)&&e.host||V(e);return Dt(t)?t.host:t}function Ft(e){const t=W(e);return X(t)?e.ownerDocument?e.ownerDocument.body:e.body:P(t)&&ot(t)?t:Ft(t)}function tt(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Ft(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),r=_(s);if(i){const l=pt(r);return t.concat(r,r.visualViewport||[],ot(s)?s:[],l&&n?tt(l):[])}return t.concat(s,tt(s,[],n))}function pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=M(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=P(e),i=s?e.offsetWidth:n,r=s?e.offsetHeight:o,l=it(n)!==i||it(o)!==r;return l&&(n=i,o=r),{width:n,height:o,$:l}}function yt(e){return F(e)?e:e.contextElement}function j(e){const t=yt(e);if(!P(t))return B(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Mt(t);let r=(i?it(n.width):n.width)/o,l=(i?it(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const be=B(0);function Bt(e){const t=_(e);return!vt()||!t.visualViewport?be:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_(e)?!1:t}function Y(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=yt(e);let r=B(1);t&&(o?F(o)&&(r=j(o)):r=j(e));const l=xe(i,n,o)?Bt(i):B(0);let a=(s.left+l.x)/r.x,c=(s.top+l.y)/r.y,u=s.width/r.x,d=s.height/r.y;if(i){const m=_(i),f=o&&F(o)?_(o):o;let p=m,v=pt(p);for(;v&&o&&f!==p;){const A=j(v),y=v.getBoundingClientRect(),w=M(v),b=y.left+(v.clientLeft+parseFloat(w.paddingLeft))*A.x,R=y.top+(v.clientTop+parseFloat(w.paddingTop))*A.y;a*=A.x,c*=A.y,u*=A.x,d*=A.y,a+=b,c+=R,p=_(v),v=pt(p)}}return lt({width:u,height:d,x:a,y:c})}function ft(e,t){const n=ut(e).scrollLeft;return t?t.left+n:Y(V(e)).left+n}function Pt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-ft(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function Ce(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",r=V(o),l=t?ct(t.floating):!1;if(o===r||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=B(1);const u=B(0),d=P(o);if((d||!d&&!i)&&(($(o)!=="body"||ot(r))&&(a=ut(o)),P(o))){const f=Y(o);c=j(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=r&&!d&&!i?Pt(r,a):B(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-a.scrollTop*c.y+u.y+m.y}}function Re(e){return Array.from(e.getClientRects())}function De(e){const t=V(e),n=ut(e),o=e.ownerDocument.body,s=O(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=O(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ft(e);const l=-n.scrollTop;return M(o).direction==="rtl"&&(r+=O(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:l}}const St=25;function Se(e,t){const n=_(e),o=V(e),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,l=0,a=0;if(s){i=s.width,r=s.height;const u=vt();(!u||u&&t==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const c=ft(o);if(c<=0){const u=o.ownerDocument,d=u.body,m=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-d.clientWidth-f);p<=St&&(i-=p)}else c<=St&&(i+=c);return{width:i,height:r,x:l,y:a}}const Oe=new Set(["absolute","fixed"]);function _e(e,t){const n=Y(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,i=P(e)?j(e):B(1),r=e.clientWidth*i.x,l=e.clientHeight*i.y,a=s*i.x,c=o*i.y;return{width:r,height:l,x:a,y:c}}function Ot(e,t,n){let o;if(t==="viewport")o=Se(e,n);else if(t==="document")o=De(V(e));else if(F(t))o=_e(t,n);else{const s=Bt(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return lt(o)}function Vt(e,t){const n=W(e);return n===t||!F(n)||X(n)?!1:M(n).position==="fixed"||Vt(n,t)}function Ee(e,t){const n=t.get(e);if(n)return n;let o=tt(e,[],!1).filter(l=>F(l)&&$(l)!=="body"),s=null;const i=M(e).position==="fixed";let r=i?W(e):e;for(;F(r)&&!X(r);){const l=M(r),a=gt(r);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&Oe.has(s.position)||ot(r)&&!a&&Vt(e,r))?o=o.filter(u=>u!==r):s=l,r=W(r)}return t.set(e,o),o}function Te(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const r=[...n==="clippingAncestors"?ct(t)?[]:Ee(t,this._c):[].concat(n),o],l=r[0],a=r.reduce((c,u)=>{const d=Ot(t,u,s);return c.top=O(d.top,c.top),c.right=z(d.right,c.right),c.bottom=z(d.bottom,c.bottom),c.left=O(d.left,c.left),c},Ot(t,l,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function ke(e){const{width:t,height:n}=Mt(e);return{width:t,height:n}}function Ie(e,t,n){const o=P(t),s=V(t),i=n==="fixed",r=Y(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=B(0);function c(){a.x=ft(s)}if(o||!o&&!i)if(($(t)!=="body"||ot(s))&&(l=ut(t)),o){const f=Y(t,!0,i,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else s&&c();i&&!o&&s&&c();const u=s&&!o&&!i?Pt(s,l):B(0),d=r.left+l.scrollLeft-a.x-u.x,m=r.top+l.scrollTop-a.y-u.y;return{x:d,y:m,width:r.width,height:r.height}}function dt(e){return M(e).position==="static"}function _t(e,t){if(!P(e)||M(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function Nt(e,t){const n=_(e);if(ct(e))return n;if(!P(e)){let s=W(e);for(;s&&!X(s);){if(F(s)&&!dt(s))return s;s=W(s)}return n}let o=_t(e,t);for(;o&&pe(o)&&dt(o);)o=_t(o,t);return o&&X(o)&&dt(o)&&!gt(o)?n:o||Ae(e)||n}const Le=async function(e){const t=this.getOffsetParent||Nt,n=this.getDimensions,o=await n(e.floating);return{reference:Ie(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Fe(e){return M(e).direction==="rtl"}const Me={convertOffsetParentRelativeRectToViewportRelativeRect:Ce,getDocumentElement:V,getClippingRect:Te,getOffsetParent:Nt,getElementRects:Le,getClientRects:Re,getDimensions:ke,getScale:j,isElement:F,isRTL:Fe};function Qt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Be(e,t){let n=null,o;const s=V(e);function i(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function r(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=c;if(l||t(),!m||!f)return;const p=st(d),v=st(s.clientWidth-(u+m)),A=st(s.clientHeight-(d+f)),y=st(u),b={rootMargin:-p+"px "+-v+"px "+-A+"px "+-y+"px",threshold:O(0,z(1,a))||1};let R=!0;function x(k){const E=k[0].intersectionRatio;if(E!==a){if(!R)return r();E?r(!1,E):o=setTimeout(()=>{r(!1,1e-7)},1e3)}E===1&&!Qt(c,e.getBoundingClientRect())&&r(),R=!1}try{n=new IntersectionObserver(x,{...b,root:s.ownerDocument})}catch{n=new IntersectionObserver(x,b)}n.observe(e)}return r(!0),i}function Pe(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,c=yt(e),u=s||i?[...c?tt(c):[],...tt(t)]:[];u.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=c&&l?Be(c,n):null;let m=-1,f=null;r&&(f=new ResizeObserver(y=>{let[w]=y;w&&w.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(t)})),n()}),c&&!a&&f.observe(c),f.observe(t));let p,v=a?Y(e):null;a&&A();function A(){const y=Y(e);v&&!Qt(v,y)&&n(),v=y,p=requestAnimationFrame(A)}return n(),()=>{var y;u.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d?.(),(y=f)==null||y.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const Ve=ce,Ne=ue,Qe=re,He=fe,Ue=(e,t,n)=>{const o=new Map,s={platform:Me,...n},i={...s.platform,_c:o};return ie(e,t,{...s,platform:i})};function qe(e,t){const n=g.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let o=null;const s=()=>{!e.value||!t.value||Ue(e.value,t.value,{placement:"bottom-start",strategy:"fixed",middleware:[Ve(6),Qe(),Ne({padding:10}),He({apply({rects:l,elements:a}){const c=`${l.reference.width}px`;Object.assign(a.floating.style,{width:c,minWidth:c,maxWidth:c})}})]}).then(({x:l,y:a})=>{Object.assign(n.value,{left:`${l}px`,top:`${a}px`})})},i=()=>{e.value&&t.value&&(o=Pe(e.value,t.value,s))},r=()=>{o&&(o(),o=null)};return g.onBeforeUnmount(r),{floatingStyles:n,startTrack:i,stopTrack:r}}const We="data:image/svg+xml,%3csvg%20t='1695277594902'%20fill='%23fff'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='2534'%20width='200'%20height='200'%3e%3cpath%20d='M448%2085.333333a362.666667%20362.666667%200%201%200%20224.512%20647.509334l155.818667%20155.818666a42.666667%2042.666667%200%200%200%2060.330666-60.330666l-155.818666-155.818667A362.666667%20362.666667%200%200%200%20448%2085.333333zM170.666667%20448a277.333333%20277.333333%200%201%201%20554.666666%200%20277.333333%20277.333333%200%200%201-554.666666%200z'%20p-id='2535'%3e%3c/path%3e%3c/svg%3e",Ge="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyD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nfNN+6mq9weMPM+818v2/mm1HYQXK5XH02mz9h1fo7pOE/gkwmU+v5+fuGot8phJdWmSLLnl+4I0RV/xIFCGxCdU3DUwaOkULX18Uve1ydrC4xdwLcwRR9bnO2kwQIoCIDEowpXjsZ4vBCSyx+w/Nnb1KElkkwG4OqGhG79QUImEkT0T2JrpZ4fV5sF0Ad6je9BrBKxLeZuVv8rS9IAG4qGf5oTPSolNxIXOyUNjqlpb0W4xI+Cd62dVqcAAGBVqSCVmPMIoPCttzm2MEBAoeLir4hRK2AWPyVIAHRHMH0Ly0tCBF3M5t+Aq6A0HPJSSyCeZAIz7BNAgQwqxNyc1NL7MCoeyH1xNWpuKsTcet7fv46QI0/zdoEtkmAwHGcHyFQj/Q57vuPzm7m+X5efB6HYj3kOCubuLVlApltfdbPX5uaetCmdeKVAqUN1mdy04XR3PTsqAHPWMztTb24myvEBBuRM+WlUnbzDEXeya2D4XC0zrJqnXwsO3pG3mCMGWMK6lQZk2A0hH2GMSxL9VlI6lVkd90RgGKkVFrrc+9REXubjLH9FxfbbVUVGG5v4i2p8LD8x9ax65C66KTfKGCSDc97fv6DJzuf9QtDtm+iqsM1ot70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",ze=g.defineComponent({name:"GlobalSearch",model:{prop:"value",event:"input"},props:{value:{type:[Object,Array],default:null},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},searchTypeList:{type:Array,default:()=>["City","Seaport","Airport","Country"]},historyKey:{type:String,default:void 0},lang:{type:String,default:"en",validator:e=>["","en","cn","en-US","zh-CN"].includes(e)}},setup(e,{emit:t}){const n=g.ref(""),o=g.ref(!1),s=g.ref(!1),i=g.ref(""),r=g.ref(null),l=g.ref(null),a=g.ref(null),c=g.ref(null),{searchHistory:u,saveToHistory:d,clearHistory:m}=Wt(g.toRef(e,"historyKey")),{searchResults:f,loading:p,isFetchingMore:v,isFinished:A,currentPage:y,fetchData:w,filterByTypes:b}=Kt(n,g.toRef(e,"searchTypeList")),{floatingStyles:R,startTrack:x,stopTrack:k}=qe(a,c),E=async()=>{if(s.value=!0,console.log("🍉 ~ index.vue:210 ~ onFocus ~ searchResults.value:",f.value,o.value),!e.multiple&&o.value&&f.value.length===0){const h=e.value;if(console.log("🍉 ~ index.vue:221 ~ onFocus ~ val:",h),h?.id){p.value=!0;try{const C=await Jt(h.id,h.type);f.value=b(C.records)}finally{p.value=!1}}}},N=()=>{setTimeout(()=>{s.value=!1},200)},Q=h=>{h.target.value===""&&!e.multiple&&(o.value=!1,t("input",null),t("update:value",null))},I=()=>{if(e.multiple&&!n.value&&e.value?.length>0){const h=[...e.value],C=h.pop();t("input",h),t("update:value",h),t("remove",C)}},G=h=>L.value?h.displayEn||h.display||"":h.displayCn||h.display||"",J=h=>{const C={City:{en:"City",cn:"城市"},Country:{en:"Country",cn:"国家"},Region:{en:"Region",cn:"区域"},Airport:{en:"Airport",cn:"机场"},Seaport:{en:"Seaport",cn:"港口"}};return console.log("🍉 ~ index.vue:434 ~ getItemType ~ isEn.value:",L.value),L.value?C[h].en:C[h].cn};g.watch(s,h=>h?x():k()),g.watch(n,h=>{if(!h.trim()){f.value=[];return}r.value&&clearTimeout(r.value),r.value=setTimeout(()=>w(1,!1),300)}),g.onBeforeUnmount(k);const L=g.computed(()=>{if(e.lang!=="")return e.lang==="en"||e.lang==="en-US";let h="";try{if(typeof useCookie=="function"){const C=useCookie("jc-language").value;if(C)return/en/.test(C)||/en-US/.test(C)}}catch{}return typeof process<"u"&&process.client?h=document.cookie||"":typeof process<"u"&&process.server&&(h=useNuxtApp?.()?.ssrContext?.event.node.req.headers.cookie||""),/jc-language=en-US/.test(h)||/jc-language=en/.test(h)}),T=g.computed(()=>e.modelValue?Array.isArray(e.modelValue)?e.modelValue:[e.modelValue]:[]),Z=g.computed(()=>e.multiple&&T.value.length>0?"":o.value&&!e.multiple?i.value:L.value?"Please enter...":"请输入..."),K=g.computed(()=>e.multiple?e.collapseTags?T.value.slice(0,1):T.value:[]),H=g.computed(()=>e.multiple?n.value?`${n.value.length*10+20}px`:"10px":"100%");return{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:l,referenceRef:a,floatingRef:c,searchHistory:u,searchResults:f,loading:p,isFetchingMore:v,isFinished:A,currentPage:y,floatingStyles:R,saveToHistory:d,clearHistory:m,fetchData:w,filterByTypes:b,startTrack:x,stopTrack:k,onFocus:E,handleBlur:N,onInput:Q,handleDelete:I,SearchIcon:We,isEn:L,getItemType:J,getItemLabel:G,selectedItems:T,currentPlaceholder:Z,displayedTags:K,inputWidth:H}},computed:{hasValue(){return this.query||this.selectedItems.length>0}},methods:{focusInput(){this.$refs.inputRef?.focus()},getItemLabel(e){return e.display||e.nameEn||e.nameCn||""},isItemActive(e){return this.selectedItems.some(t=>t.id===e.id)},selectItem(e){this.saveToHistory(e),this.multiple?this.isItemActive(e)||(this.$emit("input",[...this.selectedItems,e]),this.$emit("update:value",[...this.selectedItems,e])):(this.isSelected=!0,this.selectedLabel=this.getItemLabel(e),this.$emit("input",e),this.$emit("update:value",e),this.isDropdownVisible=!1),this.query="",this.$emit("select",e)},removeItem(e){const t=this.selectedItems.filter(n=>n.id!==e.id);this.$emit("input",t),this.$emit("update:value",t),this.$emit("remove",e)},clearAll(){this.query="",this.isSelected=!1,this.selectedLabel="",this.$emit("input",this.multiple?[]:null),this.$emit("update:value",this.multiple?[]:null)},handleSearch(){const e=this.multiple?this.selectedItems:this.isSelected?this.value:null;this.$emit("submit-search",e),this.isDropdownVisible=!1},getIconUrl(e){return{City:Ge,Seaport:Je,Airport:Ke,Country:Ye}[e]||je},handleScroll(e){const{scrollTop:t,scrollHeight:n,clientHeight:o}=e.target;t+o>=n-20&&!this.loading&&!this.isFetchingMore&&!this.isFinished&&this.query&&this.fetchData(this.currentPage+1,!0)}}});function At(e,t,n,o,s,i,r,l){var a=typeof e=="function"?e.options:e;return t&&(a.render=t,a.staticRenderFns=n,a._compiled=!0),i&&(a._scopeId="data-v-"+i),{exports:e,options:a}}var Xe=function(){var t=this,n=t._self._c;return t._self._setupProxy,n("div",{staticClass:"search-container"},[n("div",{ref:"referenceRef",staticClass:"search-input-wrapper",class:{"is-multiple":t.multiple},on:{click:t.focusInput}},[n("div",{staticClass:"selection-wrapper"},[t.multiple&&t.selectedItems.length>0?[t._l(t.displayedTags,function(o,s){return n("div",{key:o.id||s,staticClass:"search-tag"},[n("span",{staticClass:"tag-text"},[t._v(t._s(t.getItemLabel(o)))]),n("span",{staticClass:"tag-close",on:{click:function(i){return i.stopPropagation(),t.removeItem(o)}}},[t._v("×")])])}),t.collapseTags&&t.selectedItems.length>1?n("div",{staticClass:"search-tag collapse"},[t._v(" + "+t._s(t.selectedItems.length-1)+" ")]):t._e()]:t._e(),n("input",{directives:[{name:"model",rawName:"v-model",value:t.query,expression:"query"}],ref:"inputRef",class:{"is-selected-state":t.isSelected&&!t.multiple},style:{width:t.inputWidth},attrs:{type:"text",placeholder:t.currentPlaceholder},domProps:{value:t.query},on:{focus:t.onFocus,blur:t.handleBlur,input:[function(o){o.target.composing||(t.query=o.target.value)},t.onInput],keydown:function(o){return!o.type.indexOf("key")&&t._k(o.keyCode,"delete",[8,46],o.key,["Backspace","Delete","Del"])?null:t.handleDelete.apply(null,arguments)}}})],2),n("div",{staticClass:"suffix-area"},[t.hasValue?n("span",{staticClass:"clear-icon",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearAll.apply(null,arguments)}}},[t._v("ⓧ")]):t._e(),t.loading&&!t.isFetchingMore?n("div",{staticClass:"loading-spinner"}):n("button",{staticClass:"search-btn",on:{click:function(o){return o.stopPropagation(),t.handleSearch.apply(null,arguments)}}},[n("span",{staticClass:"search-icon"},[n("img",{attrs:{src:t.SearchIcon,alt:"search"}})])])])]),n("div",{directives:[{name:"show",rawName:"v-show",value:t.isDropdownVisible&&(t.searchResults.length>0||t.loading||t.query||t.searchHistory.length>0),expression:`
|
|
2
2
|
isDropdownVisible &&
|
|
3
3
|
(searchResults.length > 0 ||
|
|
4
4
|
loading ||
|
|
5
5
|
query ||
|
|
6
6
|
searchHistory.length > 0)
|
|
7
|
-
`}],ref:"floatingRef",staticClass:"dropdown-list",style:t.floatingStyles,on:{scroll:t.handleScroll}},[t._t("history",function(){return[t.searchHistory.length>0&&!t.query?n("div",{staticClass:"history-section"},[n("div",{staticClass:"history-header"},[n("span",[t._v(t._s(t.isEn?"Recent search":"最近搜索"))]),n("span",{staticClass:"clear-btn",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearHistory.apply(null,arguments)}}},[t._v(" "+t._s(t.isEn?"Clear":"清空")+" ")])]),t._l(t.searchHistory,function(o,s){return n("div",{key:"hist-"+s,staticClass:"dropdown-item",on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag"},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(o.type))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])}),n("hr",{staticClass:"divider"})],2):t._e()]},{searchHistory:t.searchHistory}),t.loading&&!t.isFetchingMore?n("div",{staticClass:"status-msg"},[t._v(" "+t._s(t.isEn?"Searching...":"正在搜索中...")+" ")]):t.searchResults.length>0?[t._t("results",function(){return t._l(t.searchResults,function(o,s){return n("div",{key:s,staticClass:"dropdown-item",class:{"is-active":t.isItemActive(o)},on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag"},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(o.type))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])})},{searchResults:t.searchResults}),t.isFetchingMore?n("div",{staticClass:"load-more-msg"},[t._v(" "+t._s(t.isEn?"Loading more...":"正在加载更多...")+" ")]):t.isFinished&&t.query?n("div",{staticClass:"load-more-msg no-more"},[t._v(" "+t._s(t.isEn?"All results have been loaded":"已加载全部结果")+" ")]):t._e()]:t.query&&!t.loading?n("div",{staticClass:"status-msg"},[t._t("noData",function(){return[t._v(" "+t._s(t.isEn?`No results found related to "${t.query}".`:`未找到与 "${t.query}" 相关的结果`)+" ")]})],2):t._e()],2)])},$e=[],Ze=At(Xe
|
|
7
|
+
`}],ref:"floatingRef",staticClass:"dropdown-list",style:t.floatingStyles,on:{scroll:t.handleScroll}},[t._t("history",function(){return[t.searchHistory.length>0&&!t.query?n("div",{staticClass:"history-section"},[n("div",{staticClass:"history-header"},[n("span",[t._v(t._s(t.isEn?"Recent search":"最近搜索"))]),n("span",{staticClass:"clear-btn",on:{mousedown:function(o){o.preventDefault()},click:function(o){return o.stopPropagation(),t.clearHistory.apply(null,arguments)}}},[t._v(" "+t._s(t.isEn?"Clear":"清空")+" ")])]),t._l(t.searchHistory,function(o,s){return n("div",{key:"hist-"+s,staticClass:"dropdown-item",on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag"},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(t.getItemType(o.type)))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])}),n("hr",{staticClass:"divider"})],2):t._e()]},{searchHistory:t.searchHistory}),t.loading&&!t.isFetchingMore?n("div",{staticClass:"status-msg"},[t._v(" "+t._s(t.isEn?"Searching...":"正在搜索中...")+" ")]):t.searchResults.length>0?[t._t("results",function(){return t._l(t.searchResults,function(o,s){return n("div",{key:s,staticClass:"dropdown-item",class:{"is-active":t.isItemActive(o)},on:{mousedown:function(i){return t.selectItem(o)}}},[n("div",{staticClass:"category-tag"},[n("img",{staticClass:"type-icon",attrs:{src:t.getIconUrl(o.type),alt:""}}),n("span",{staticClass:"type-text"},[t._v(t._s(t.getItemType(o.type)))])]),n("div",{staticClass:"result-text"},[t._v(t._s(t.getItemLabel(o)))])])})},{searchResults:t.searchResults}),t.isFetchingMore?n("div",{staticClass:"load-more-msg"},[t._v(" "+t._s(t.isEn?"Loading more...":"正在加载更多...")+" ")]):t.isFinished&&t.query?n("div",{staticClass:"load-more-msg no-more"},[t._v(" "+t._s(t.isEn?"All results have been loaded":"已加载全部结果")+" ")]):t._e()]:t.query&&!t.loading?n("div",{staticClass:"status-msg"},[t._t("noData",function(){return[t._v(" "+t._s(t.isEn?`No results found related to "${t.query}".`:`未找到与 "${t.query}" 相关的结果`)+" ")]})],2):t._e()],2)])},$e=[],Ze=At(ze,Xe,$e,!1,null,"cebbea71");const wt=Ze.exports,tn={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:e=>["en","cn"].includes(e)}},emits:["update:value","confirm"],setup(e,{emit:t}){const n=e,o=[{typeCn:"城市",typeEn:"City",type:"City"},{typeCn:"海运港口",typeEn:"Port",type:"Seaport"},{typeCn:"机场",typeEn:"Airport",type:"Airport"}],s=g.ref(null),i=g.reactive({name:"",country:""}),r=g.reactive({name:"",type:"City"}),l=g.computed(()=>n.lang==="en"||n.lang==="en-US");return{__sfc:!0,props:n,emit:t,typeOptions:o,displayQuery:s,errors:i,formData:r,isEn:l,handleClose:()=>{i.name="",i.country="",t("update:value",!1)},handleConfirm:()=>{i.name="",i.country="";let u=!0;r.name.trim()||(i.name="Data name is required",u=!1),s.value||(i.country="Please select a country",u=!1),u&&(console.log("🍉 ~ ApplyDataDialog.vue:115 ~ handleConfirm ~ data:",{...r,country:s.value}),t("confirm",{...r,country:s.value}))},Search:wt}}};var en=function(){var t=this,n=t._self._c,o=t._self._setupProxy;return t.value?n("div",{staticClass:"modal-mask",on:{click:function(s){return s.target!==s.currentTarget?null:o.handleClose.apply(null,arguments)}}},[n("div",{staticClass:"modal-container"},[n("div",{staticClass:"modal-header"},[n("span",{staticClass:"header-title"},[t._v(t._s(o.isEn?"Apply for data addition":"申请补充数据"))]),n("div",{staticClass:"close-btn",on:{click:o.handleClose}},[t._v("×")])]),n("div",{staticClass:"modal-body"},[n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v(t._s(o.isEn?"Data To Add":"需补充的数据"))]),n("div",{staticClass:"input-box"},[n("input",{directives:[{name:"model",rawName:"v-model",value:o.formData.name,expression:"formData.name"}],class:["custom-input",{"input-error":o.errors.name}],attrs:{type:"text",placeholder:"Please enter your data"},domProps:{value:o.formData.name},on:{input:[function(s){s.target.composing||t.$set(o.formData,"name",s.target.value)},function(s){o.errors.name=""}]}})]),o.errors.name?n("div",{staticClass:"error-message"},[t._v(t._s(o.errors.name))]):t._e()]),n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v(t._s(o.isEn?"Type":"所属类别"))]),n("div",{staticClass:"type-group"},t._l(o.typeOptions,function(s){return n("div",{key:s,class:["type-btn",{active:o.formData.type===s.type}],on:{click:function(i){o.formData.type=s.type}}},[t._v(" "+t._s(o.isEn?s.typeEn:s.typeCn)+" "),o.formData.type===s.type?n("div",{staticClass:"check-mark"}):t._e()])}),0)]),n("div",{staticClass:"form-item"},[n("label",{staticClass:"required"},[t._v(t._s(o.isEn?"Country":"国家"))]),n("div",{class:{"search-error-wrap":o.errors.country}},[n(o.Search,{style:{margin:"0 auto"},attrs:{"search-type-list":["Country"],lang:t.lang},on:{"update:model-value":function(s){o.errors.country=""}},model:{value:o.displayQuery,callback:function(s){o.displayQuery=s},expression:"displayQuery"}})],1),o.errors.country?n("div",{staticClass:"error-message"},[t._v(" "+t._s(o.errors.country)+" ")]):t._e()])]),n("div",{staticClass:"modal-footer"},[n("button",{staticClass:"confirm-btn",on:{click:o.handleConfirm}},[t._v(" "+t._s(o.isEn?"Submit":"申请补充")+" ")])])])]):t._e()},nn=[],on=At(tn,en,nn,!1,null,"e8983beb");const Ht=on.exports,sn={components:{[S.Dialog.name]:S.Dialog,[S.Form.name]:S.Form,[S.FormItem.name]:S.FormItem,[S.Input.name]:S.Input,[S.Button.name]:S.Button,[S.Checkbox.name]:S.Checkbox,[S.Row.name]:S.Row,[S.Col.name]:S.Col},data(){return{isVisible:!1,formData:{city:"",company:"",email:"",phone:"",name:"",agreement:!1},formRules:{city:[{required:!0,message:"请输入所在地城市",trigger:"blur"}],company:[{required:!0,message:"请输入公司名称",trigger:"blur"}],email:[{required:!0,message:"请输入邮箱",trigger:"blur"},{type:"email",message:"请输入有效的邮箱地址",trigger:"blur"}],agreement:[{validator:(e,t,n)=>{t?n():n(new Error("请同意隐私政策"))},trigger:"change"}]}}},mounted(){D.emitter.on(D.MODAL_ACTION.Open,this.handleOpen)},beforeDestroy(){D.emitter.off(D.MODAL_ACTION.Open,this.handleOpen)},methods:{handleOpen(){console.log("🍉 ~ GlobalModal.vue:150 ~ methods.handleOpen:",this.handleOpen),this.isVisible=!0},closeModal(){this.isVisible=!1,D.emitter.emit(D.MODAL_ACTION.Close),this.$refs.formRef.resetFields()},handleSubmit(){this.$refs.formRef.validate(e=>{e&&(D.emitter.emit(D.MODAL_ACTION.Submit,{...this.formData}),this.closeModal())})}}};var rn=function(){var t=this,n=t._self._c;return n("el-dialog",{attrs:{visible:t.isVisible,"before-close":t.closeModal,"show-close":!1,"close-on-click-modal":!0,width:"500px","custom-class":"global-modal-custom"},on:{"update:visible":function(o){t.isVisible=o}}},[n("div",{staticClass:"global-modal-header-custom",attrs:{slot:"title"},slot:"title"},[n("h2",[t._v("即刻链接全球货代")]),n("el-button",{staticClass:"close-button-custom",attrs:{type:"text"},on:{click:t.closeModal}},[n("span",{staticStyle:{"font-size":"2rem"}},[t._v("×")])])],1),n("div",{staticClass:"global-modal-body-custom"},[n("el-form",{ref:"formRef",attrs:{model:t.formData,rules:t.formRules,"label-position":"top"},nativeOn:{submit:function(o){o.preventDefault()}}},[n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"所在地(城市)",prop:"city"}},[n("el-input",{attrs:{placeholder:"请输入城市"},model:{value:t.formData.city,callback:function(o){t.$set(t.formData,"city",o)},expression:"formData.city"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"公司名称",prop:"company"}},[n("el-input",{attrs:{placeholder:"请输入公司名称"},model:{value:t.formData.company,callback:function(o){t.$set(t.formData,"company",o)},expression:"formData.company"}})],1)],1)],1),n("el-row",{attrs:{gutter:20}},[n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"邮箱",prop:"email"}},[n("el-input",{attrs:{placeholder:"请输入邮箱"},model:{value:t.formData.email,callback:function(o){t.$set(t.formData,"email",o)},expression:"formData.email"}})],1)],1),n("el-col",{attrs:{span:12}},[n("el-form-item",{attrs:{label:"电话",prop:"phone"}},[n("el-input",{attrs:{placeholder:"请输入电话"},model:{value:t.formData.phone,callback:function(o){t.$set(t.formData,"phone",o)},expression:"formData.phone"}})],1)],1)],1),n("el-row",[n("el-col",{attrs:{span:24}},[n("el-form-item",{attrs:{label:"姓名",prop:"name"}},[n("el-input",{attrs:{placeholder:"请输入您的全名"},model:{value:t.formData.name,callback:function(o){t.$set(t.formData,"name",o)},expression:"formData.name"}})],1)],1)],1),n("el-form-item",{staticClass:"agreement-item",attrs:{prop:"agreement"}},[n("el-checkbox",{model:{value:t.formData.agreement,callback:function(o){t.$set(t.formData,"agreement",o)},expression:"formData.agreement"}},[t._v("我同意")]),n("a",{staticClass:"privacy-link",attrs:{href:"#"}},[t._v("隐私政策")])],1)],1)],1),n("div",{staticClass:"global-modal-footer-custom",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{staticClass:"submit-button-custom",attrs:{type:"primary"},on:{click:t.handleSubmit}},[t._v(" 加入会员 ")])],1)])},ln=[],an=At(sn,rn,ln,!1,null,null);const Ut=an.exports;let cn={open(){D.emitter.emit(D.MODAL_ACTION.Open)},close(){D.emitter.emit(D.MODAL_ACTION.Close)},onSubmit(e){D.emitter.on(D.MODAL_ACTION.Submit,e)}};function un(){let e=!1;return{install(t){if(typeof window<"u"&&!e){const n=document.createElement("div");n.setAttribute("id","global-modal-root"),document.body.appendChild(n);const o=t.extend(Ut);new o().$mount(n),e=!0}t.prototype.$globalModal=cn}}}const Et={ApplyDataDialog:Ht,JcSearch:wt},fn={install(e){Object.keys(Et).forEach(t=>{e.component(t,Et[t])})}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>D.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>D.emitter});exports.ApplyDataDialog=Ht;exports.GlobalModal=Ut;exports.JcSearch=wt;exports.createGlobalModalPlugin=un;exports.default=fn;
|