@jctrans-materials/comps-vue2 1.0.1 → 1.0.3

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.
@@ -1,5 +1,3 @@
1
- import { SearchItem } from './type';
2
-
3
1
  declare const _default: import('vue').DefineComponent<{
4
2
  value: {
5
3
  type: (ArrayConstructor | ObjectConstructor)[];
@@ -19,12 +17,23 @@ declare const _default: import('vue').DefineComponent<{
19
17
  };
20
18
  historyKey: {
21
19
  type: StringConstructor;
22
- default: undefined;
20
+ default: string;
23
21
  };
24
22
  lang: {
25
23
  type: StringConstructor;
26
24
  default: string;
27
- validator: (v: unknown) => boolean;
25
+ };
26
+ placeholder: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ showSearchIcon: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ showItemTag: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
28
37
  };
29
38
  }, {
30
39
  query: import('vue').Ref<string>;
@@ -61,10 +70,10 @@ declare const _default: import('vue').DefineComponent<{
61
70
  isFinished: import('vue').ComputedRef<boolean>;
62
71
  currentPage: import('vue').Ref<number>;
63
72
  floatingStyles: import('vue').Ref<import('vue').CSSProperties>;
64
- saveToHistory: (item: SearchItem) => void;
73
+ saveToHistory: (item: import('./type').SearchItem) => void;
65
74
  clearHistory: () => void;
66
75
  fetchData: (page?: number, appendMode?: boolean) => Promise<void>;
67
- filterByTypes: (data: SearchItem[]) => SearchItem[];
76
+ filterByTypes: (data: import('./type').SearchItem[]) => import('./type').SearchItem[];
68
77
  startTrack: () => void;
69
78
  stopTrack: () => void;
70
79
  onFocus: () => Promise<void>;
@@ -72,18 +81,17 @@ declare const _default: import('vue').DefineComponent<{
72
81
  onInput: (e: any) => void;
73
82
  handleDelete: () => void;
74
83
  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>;
82
84
  }, {}, {
85
+ isEn(): boolean;
86
+ selectedItems(): any[];
87
+ displayedTags(): any[];
83
88
  hasValue(): string | boolean;
89
+ inputWidth(): string;
90
+ currentPlaceholder(): string;
84
91
  }, {
85
92
  focusInput(): void;
86
93
  getItemLabel(item: any): any;
94
+ getItemType(type: any): any;
87
95
  isItemActive(item: any): boolean;
88
96
  selectItem(item: any): void;
89
97
  removeItem(item: any): void;
@@ -110,12 +118,23 @@ declare const _default: import('vue').DefineComponent<{
110
118
  };
111
119
  historyKey: {
112
120
  type: StringConstructor;
113
- default: undefined;
121
+ default: string;
114
122
  };
115
123
  lang: {
116
124
  type: StringConstructor;
117
125
  default: string;
118
- validator: (v: unknown) => boolean;
126
+ };
127
+ placeholder: {
128
+ type: StringConstructor;
129
+ default: string;
130
+ };
131
+ showSearchIcon: {
132
+ type: BooleanConstructor;
133
+ default: boolean;
134
+ };
135
+ showItemTag: {
136
+ type: BooleanConstructor;
137
+ default: boolean;
119
138
  };
120
139
  }>>, {
121
140
  multiple: boolean;
@@ -124,5 +143,8 @@ declare const _default: import('vue').DefineComponent<{
124
143
  searchTypeList: unknown[];
125
144
  historyKey: string;
126
145
  lang: string;
146
+ placeholder: string;
147
+ showSearchIcon: boolean;
148
+ showItemTag: boolean;
127
149
  }>;
128
150
  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 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/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOkVhOcZyepYndNpDpPvwAAAP//BVQJHAAAAAZJREFUAwDZWL4hub5xHQAAAABJRU5ErkJggg==",Je="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACC0lEQVR4AXxRv2tTURT+zk1iIjgoOMShkIJVNwf/gQYULOjQwaGvGl8TBMEMDg4ODgF17likvL4HIYm4OLg61K2CooWKDoKCDoJDHASb9N17POf5Enwk6eN+9/z+3nfvNZjxbYS9ymbYXlQ8CbvnZrRhKoEOFMl9zFHuuaJA/E4Jp5FMJTCwZWner/veCYX6ecQVsRNrKsFE1yGJDMFW1Hm4FXX7hnIvADquvkJ9zYn/U3vw35chYOA2Eb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S+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:`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("vue"),C=require("@jctrans-materials/shared"),R=require("jctrans-ui");v.util.warn;function Gt(e){const t=v.ref([]),n="_search_history_cache",o=typeof window<"u"&&typeof localStorage<"u",s=v.computed(()=>(e.value||"")+n),i=v.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 v.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 Jt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return C.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const Kt=(e,t)=>C.locationSearchV2.searchByIdWithType(e,t);function Yt(e,t){const n=v.ref([]),o=v.ref(!1),s=v.ref(!1),i=v.ref(1),r=v.ref(0),l=v.ref(10),a=v.computed(()=>r.value===0?!1:n.value.length>=r.value),c=v.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 Jt(e.value,t.value,{current:m,size:l.value}),h=p.records||[],y=u(h);f?n.value=[...n.value,...y]:n.value=y,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 Y=Math.min,D=Math.max,st=Math.round,ot=Math.floor,F=e=>({x:e,y:e}),jt={left:"right",right:"left",bottom:"top",top:"bottom"},Xt={start:"end",end:"start"};function bt(e,t,n){return D(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 kt(e){return e==="x"?"y":"x"}function It(e){return e==="y"?"height":"width"}const zt=new Set(["top","bottom"]);function Q(e){return zt.has(q(e))?"y":"x"}function Lt(e){return kt(Q(e))}function $t(e,t,n){n===void 0&&(n=!1);const o=et(e),s=Lt(e),i=It(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(r=it(r)),[r,it(r)]}function Zt(e){const t=it(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>Xt[t])}const xt=["left","right"],Ct=["right","left"],te=["top","bottom"],ee=["bottom","top"];function ne(e,t,n){switch(e){case"top":case"bottom":return n?t?Ct:xt:t?xt:Ct;case"left":case"right":return t?te:ee;default:return[]}}function oe(e,t,n,o){const s=et(e);let i=ne(q(e),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),t&&(i=i.concat(i.map(mt)))),i}function it(e){return e.replace(/left|right|bottom|top/g,t=>jt[t])}function se(e){return{top:0,right:0,bottom:0,left:0,...e}}function ie(e){return typeof e!="number"?se(e):{top:e,right:e,bottom:e,left:e}}function rt(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 St(e,t,n){let{reference:o,floating:s}=e;const i=Q(t),r=Lt(t),l=It(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(et(t)){case"start":f[r]-=m*(n&&c?-1:1);break;case"end":f[r]+=m*(n&&c?-1:1);break}return f}const re=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}=St(c,o,a),m=o,f={},p=0;for(let h=0;h<l.length;h++){const{name:y,fn:g}=l[h],{x:A,y:w,data:S,reset:b}=await g({x:u,y:d,initialPlacement:o,placement:m,strategy:s,middlewareData:f,rects:c,platform:r,elements:{reference:e,floating:t}});u=A??u,d=w??d,f={...f,[y]:{...f[y],...S}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(m=b.placement),b.rects&&(c=b.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:s}):b.rects),{x:u,y:d}=St(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:r,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=tt(t,e),p=ie(f),y=l[m?d==="floating"?"reference":"floating":d],g=rt(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),A=d==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=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=rt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:A,offsetParent:w,strategy:a}):A);return{top:(g.top-b.top+p.top)/S.y,bottom:(b.bottom-g.bottom+p.bottom)/S.y,left:(g.left-b.left+p.left)/S.x,right:(b.right-g.right+p.right)/S.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:r,initialPlacement:l,platform:a,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...y}=tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=q(s),A=Q(l),w=q(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(c.floating)),b=m||(w||!h?[it(l)]:Zt(l)),_=p!=="none";!m&&_&&b.push(...oe(l,h,p,S));const E=[l,...b],P=await ht(t,y),N=[];let T=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&N.push(P[g]),d){const W=$t(s,r,S);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=E[W];if(ft&&(!(d==="alignment"?A!==Q(ft):!1)||T.every(k=>Q(k.placement)===A?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(_){const H=Q(k.placement);return H===A||H==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(H=>H>0).reduce((H,Wt)=>H+Wt,0)]).sort((k,H)=>k[1]-H[1])[0])==null?void 0:z[0];G&&($=G);break}case"initialPlacement":$=l;break}if(s!==$)return{reset:{placement:$}}}return{}}}},ae=new Set(["left","top"]);async function ce(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=et(n),a=Q(n)==="y",c=ae.has(r)?-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 l&&typeof p=="number"&&(f=l==="end"?p*-1:p),a?{x:f*u,y:m*c}:{x:m*c,y:f*u}}const ue=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 ce(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}}}}},fe=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:y=>{let{x:g,y:A}=y;return{x:g,y:A}}},...a}=tt(e,t),c={x:n,y:o},u=await ht(t,a),d=Q(q(s)),m=kt(d);let f=c[m],p=c[d];if(i){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",A=f+u[y],w=f-u[g];f=bt(A,f,w)}if(r){const y=d==="y"?"top":"left",g=d==="y"?"bottom":"right",A=p+u[y],w=p-u[g];p=bt(A,p,w)}const h=l.fn({...t,[m]:f,[d]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:i,[d]:r}}}}}},de=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}=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 y,g;d==="top"||d==="bottom"?(y=d,g=m===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(g=d,y=m==="end"?"top":"bottom");const A=h-u.top-u.bottom,w=p-u.left-u.right,S=Y(h-u[y],A),b=Y(p-u[g],w),_=!t.middlewareData.shift;let E=S,P=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(E=A),_&&!m){const T=D(u.left,0),x=D(u.right,0),V=D(u.top,0),z=D(u.bottom,0);f?P=p-2*(T!==0||x!==0?T+x:D(u.left,u.right)):E=h-2*(V!==0||z!==0?V+z:D(u.top,u.bottom))}await a({...t,availableWidth:P,availableHeight:E});const N=await r.getDimensions(l.floating);return p!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function lt(){return typeof window<"u"}function X(e){return Ft(e)?(e.nodeName||"").toLowerCase():"#document"}function O(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function M(e){var t;return(t=(Ft(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ft(e){return lt()?e instanceof Node||e instanceof O(e).Node:!1}function I(e){return lt()?e instanceof Element||e instanceof O(e).Element:!1}function B(e){return lt()?e instanceof HTMLElement||e instanceof O(e).HTMLElement:!1}function Rt(e){return!lt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof O(e).ShadowRoot}const me=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)&&!me.has(s)}const pe=new Set(["table","td","th"]);function he(e){return pe.has(X(e))}const ge=[":popover-open",":modal"];function at(e){return ge.some(t=>{try{return e.matches(t)}catch{return!1}})}const ye=["transform","translate","scale","rotate","perspective"],ve=["transform","translate","scale","rotate","perspective","filter"],Ae=["paint","layout","strict","content"];function gt(e){const t=yt(),n=I(e)?L(e):e;return ye.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))||Ae.some(o=>(n.contain||"").includes(o))}function we(e){let t=U(e);for(;B(t)&&!j(t);){if(gt(t))return t;if(at(t))return null;t=U(t)}return null}function yt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const be=new Set(["html","body","#document"]);function j(e){return be.has(X(e))}function L(e){return O(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||Rt(e)&&e.host||M(e);return Rt(t)?t.host:t}function Bt(e){const t=U(e);return j(t)?e.ownerDocument?e.ownerDocument.body:e.body:B(t)&&nt(t)?t:Bt(t)}function Z(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Bt(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),r=O(s);if(i){const l=pt(r);return t.concat(r,r.visualViewport||[],nt(s)?s:[],l&&n?Z(l):[])}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=B(e),i=s?e.offsetWidth:n,r=s?e.offsetHeight:o,l=st(n)!==i||st(o)!==r;return l&&(n=i,o=r),{width:n,height:o,$:l}}function vt(e){return I(e)?e:e.contextElement}function K(e){const t=vt(e);if(!B(t))return F(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Mt(t);let r=(i?st(n.width):n.width)/o,l=(i?st(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const xe=F(0);function Pt(e){const t=O(e);return!yt()||!t.visualViewport?xe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ce(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==O(e)?!1:t}function J(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=vt(e);let r=F(1);t&&(o?I(o)&&(r=K(o)):r=K(e));const l=Ce(i,n,o)?Pt(i):F(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=O(i),f=o&&I(o)?O(o):o;let p=m,h=pt(p);for(;h&&o&&f!==p;){const y=K(h),g=h.getBoundingClientRect(),A=L(h),w=g.left+(h.clientLeft+parseFloat(A.paddingLeft))*y.x,S=g.top+(h.clientTop+parseFloat(A.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,d*=y.y,a+=w,c+=S,p=O(h),h=pt(p)}}return rt({width:u,height:d,x:a,y:c})}function ut(e,t){const n=ct(e).scrollLeft;return t?t.left+n:J(M(e)).left+n}function Nt(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 Se(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",r=M(o),l=t?at(t.floating):!1;if(o===r||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=F(1);const u=F(0),d=B(o);if((d||!d&&!i)&&((X(o)!=="body"||nt(r))&&(a=ct(o)),B(o))){const f=J(o);c=K(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=r&&!d&&!i?Nt(r,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=M(e),n=ct(e),o=e.ownerDocument.body,s=D(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=D(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ut(e);const l=-n.scrollTop;return L(o).direction==="rtl"&&(r+=D(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:l}}const Dt=25;function Oe(e,t){const n=O(e),o=M(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=yt();(!u||u&&t==="fixed")&&(l=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<=Dt&&(i-=p)}else c<=Dt&&(i+=c);return{width:i,height:r,x:l,y:a}}const Ee=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=B(e)?K(e):F(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=Oe(e,n);else if(t==="document")o=De(M(e));else if(I(t))o=_e(t,n);else{const s=Pt(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return rt(o)}function Vt(e,t){const n=U(e);return n===t||!I(n)||j(n)?!1:L(n).position==="fixed"||Vt(n,t)}function Te(e,t){const n=t.get(e);if(n)return n;let o=Z(e,[],!1).filter(l=>I(l)&&X(l)!=="body"),s=null;const i=L(e).position==="fixed";let r=i?U(e):e;for(;I(r)&&!j(r);){const l=L(r),a=gt(r);!a&&l.position==="fixed"&&(s=null),(i?!a&&!s:!a&&l.position==="static"&&!!s&&Ee.has(s.position)||nt(r)&&!a&&Vt(e,r))?o=o.filter(u=>u!==r):s=l,r=U(r)}return t.set(e,o),o}function ke(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const r=[...n==="clippingAncestors"?at(t)?[]:Te(t,this._c):[].concat(n),o],l=r[0],a=r.reduce((c,u)=>{const d=Ot(t,u,s);return c.top=D(d.top,c.top),c.right=Y(d.right,c.right),c.bottom=Y(d.bottom,c.bottom),c.left=D(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 Ie(e){const{width:t,height:n}=Mt(e);return{width:t,height:n}}function Le(e,t,n){const o=B(t),s=M(t),i=n==="fixed",r=J(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const a=F(0);function c(){a.x=ut(s)}if(o||!o&&!i)if((X(t)!=="body"||nt(s))&&(l=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?Nt(s,l):F(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 L(e).position==="static"}function Et(e,t){if(!B(e)||L(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return M(e)===n&&(n=n.ownerDocument.body),n}function Qt(e,t){const n=O(e);if(at(e))return n;if(!B(e)){let s=U(e);for(;s&&!j(s);){if(I(s)&&!dt(s))return s;s=U(s)}return n}let o=Et(e,t);for(;o&&he(o)&&dt(o);)o=Et(o,t);return o&&j(o)&&dt(o)&&!gt(o)?n:o||we(e)||n}const Fe=async function(e){const t=this.getOffsetParent||Qt,n=this.getDimensions,o=await n(e.floating);return{reference:Le(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Be(e){return L(e).direction==="rtl"}const Me={convertOffsetParentRelativeRectToViewportRelativeRect:Se,getDocumentElement:M,getClippingRect:ke,getOffsetParent:Qt,getElementRects:Fe,getClientRects:Re,getDimensions:Ie,getScale:K,isElement:I,isRTL:Be};function Ht(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Pe(e,t){let n=null,o;const s=M(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=ot(d),h=ot(s.clientWidth-(u+m)),y=ot(s.clientHeight-(d+f)),g=ot(u),w={rootMargin:-p+"px "+-h+"px "+-y+"px "+-g+"px",threshold:D(0,Y(1,a))||1};let S=!0;function b(_){const E=_[0].intersectionRatio;if(E!==a){if(!S)return r();E?r(!1,E):o=setTimeout(()=>{r(!1,1e-7)},1e3)}E===1&&!Ht(c,e.getBoundingClientRect())&&r(),S=!1}try{n=new IntersectionObserver(b,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return r(!0),i}function Ne(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=vt(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&&l?Pe(c,n):null;let m=-1,f=null;r&&(f=new ResizeObserver(g=>{let[A]=g;A&&A.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&&y();function y(){const g=J(e);h&&!Ht(h,g)&&n(),h=g,p=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(A=>{s&&A.removeEventListener("scroll",n),i&&A.removeEventListener("resize",n)}),d?.(),(g=f)==null||g.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const Ve=ue,Qe=fe,He=le,qe=de,Ue=(e,t,n)=>{const o=new Map,s={platform:Me,...n},i={...s.platform,_c:o};return re(e,t,{...s,platform:i})};function We(e,t){const n=v.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),He(),Qe({padding:10}),qe({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=Ne(e.value,t.value,s))},r=()=>{o&&(o(),o=null)};return v.onBeforeUnmount(r),{floatingStyles:n,startTrack:i,stopTrack:r}}const Ge="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",Je="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07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T7J/ve09DQsOigkNCha4ckl4Lct0/S3QI7REFEBB08FBHRIYLwIJEodOlUurnfNN+6mq9weMPM+818v2/mm1HYQXK5XH02mz9h1fo7pOE/gkwmU+v5+fuGot8phJdWmSLLnl+4I0RV/xIFCGxCdU3DUwaOkULX18Uve1ydrC4xdwLcwRR9bnO2kwQIoCIDEowpXjsZ4vBCSyx+w/Nnb1KElkkwG4OqGhG79QUImEkT0T2JrpZ4fV5sF0Ad6je9BrBKxLeZuVv8rS9IAG4qGf5oTPSolNxIXOyUNjqlpb0W4xI+Cd62dVqcAAGBVqSCVmPMIoPCttzm2MEBAoeLir4hRK2AWPyVIAHRHMH0Ly0tCBF3M5t+Aq6A0HPJSSyCeZAIz7BNAgQwqxNyc1NL7MCoeyH1xNWpuKsTcet7fv46QI0/zdoEtkmAwHGcHyFQj/Q57vuPzm7m+X5efB6HYj3kOCubuLVlApltfdbPX5uaetCmdeKVAqUN1mdy04XR3PTsqAHPWMztTb24myvEBBuRM+WlUnbzDEXeya2D4XC0zrJqnXwsO3pG3mCMGWMK6lQZk2A0hH2GMSxL9VlI6lVkd90RgGKkVFrrc+9REXubjLH9FxfbbVUVGG5v4i2p8LD8x9ax65C66KTfKGCSDc97fv6DJzuf9QtDtm+iqsM1ot70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",ze=v.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:""},lang:{type:String,default:""},placeholder:{type:String,default:""},showSearchIcon:{type:Boolean,default:!0},showItemTag:{type:Boolean,default:!0}},setup(e,{emit:t}){const n=v.ref(""),o=v.ref(!1),s=v.ref(!1),i=v.ref(""),r=v.ref(null),l=v.ref(null),a=v.ref(null),c=v.ref(null),{searchHistory:u,saveToHistory:d,clearHistory:m}=Gt(v.toRef(e,"historyKey")),{searchResults:f,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,fetchData:A,filterByTypes:w}=Yt(n,v.toRef(e,"searchTypeList")),{floatingStyles:S,startTrack:b,stopTrack:_}=We(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 x=e.value;if(console.log("🍉 ~ index.vue:221 ~ onFocus ~ val:",x),x?.id){p.value=!0;try{const V=await Kt(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 v.watch(s,x=>x?b():_()),v.watch(n,x=>{if(!x.trim()){f.value=[];return}r.value&&clearTimeout(r.value),r.value=setTimeout(()=>A(1,!1),300)}),v.onBeforeUnmount(_),{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:l,referenceRef:a,floatingRef:c,searchHistory:u,searchResults:f,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,floatingStyles:S,saveToHistory:d,clearHistory:m,fetchData:A,filterByTypes:w,startTrack:b,stopTrack:_,onFocus:E,handleBlur:P,onInput:N,handleDelete:T,SearchIcon:Ge}},computed:{isEn(){if(this.lang!=="")return this.lang==="en"||this.lang==="en-US";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 typeof process<"u"&&process.client?e=document.cookie||"":typeof process<"u"&&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.placeholder||this.isEn?"Please enter...":"请输入..."}},methods:{focusInput(){this.$refs.inputRef?.focus()},getItemLabel(e){return this.isEn?e.displayEn||e.display||"":e.displayCn||e.display||""},getItemType(e){const t={City:{en:"City",cn:"城市"},Country:{en:"Country",cn:"国家"},Region:{en:"Region",cn:"区域"},Airport:{en:"Airport",cn:"机场"},Seaport:{en:"Seaport",cn:"港口"}};return this.isEn?t[e].en:t[e].cn},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:Je,Seaport:Ke,Airport:Ye,Country:je}[e]||Xe},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 $e=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"}):!t.loading&&t.showSearchIcon?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"}})])]):t._e()])]),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(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;
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",style:t.showItemTag?{}:{display:"none"}},[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",style:t.showItemTag?{}:{display:"none"}},[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)])},Ze=[],tn=At(ze,$e,Ze,!1,null,"fbdd60f5");const wt=tn.exports,en={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:e=>["en","cn"].includes(e)},placeholder:{type:String,default:""}},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=v.ref(null),i=v.reactive({name:"",country:""}),r=v.reactive({name:"",type:"City"}),l=v.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 nn=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:t.placeholder??(o.isEn?" Please enter":"请输入")},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.type,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,placeholder:t.placeholder??(o.isEn?" Please enter":"请输入")},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()},on=[],sn=At(en,nn,on,!1,null,"3ca839c7");const qt=sn.exports,rn={components:{[R.Dialog.name]:R.Dialog,[R.Form.name]:R.Form,[R.FormItem.name]:R.FormItem,[R.Input.name]:R.Input,[R.Button.name]:R.Button,[R.Checkbox.name]:R.Checkbox,[R.Row.name]:R.Row,[R.Col.name]:R.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(){C.emitter.on(C.MODAL_ACTION.Open,this.handleOpen)},beforeDestroy(){C.emitter.off(C.MODAL_ACTION.Open,this.handleOpen)},methods:{handleOpen(){console.log("🍉 ~ GlobalModal.vue:150 ~ methods.handleOpen:",this.handleOpen),this.isVisible=!0},closeModal(){this.isVisible=!1,C.emitter.emit(C.MODAL_ACTION.Close),this.$refs.formRef.resetFields()},handleSubmit(){this.$refs.formRef.validate(e=>{e&&(C.emitter.emit(C.MODAL_ACTION.Submit,{...this.formData}),this.closeModal())})}}};var ln=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)])},an=[],cn=At(rn,ln,an,!1,null,null);const Ut=cn.exports;let un={open(){C.emitter.emit(C.MODAL_ACTION.Open)},close(){C.emitter.emit(C.MODAL_ACTION.Close)},onSubmit(e){C.emitter.on(C.MODAL_ACTION.Submit,e)}};function fn(){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=un}}}const _t={ApplyDataDialog:qt,JcSearch:wt};let Tt=!1;const dn={install(e,t){Tt||(Tt=!0,t?.sharedConfig&&C.initSharedConfig(t.sharedConfig),Object.keys(_t).forEach(n=>{e.component(n,_t[n])}))}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>C.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>C.emitter});exports.ApplyDataDialog=qt;exports.GlobalModal=Ut;exports.JcSearch=wt;exports.createGlobalModalPlugin=fn;exports.default=dn;