@jctrans-materials/comps-vue2 1.0.5 → 1.0.7

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.
@@ -8,7 +8,7 @@ export declare function searchByNameApi(key: string, types?: LocationType[], oth
8
8
  current: number;
9
9
  size: number;
10
10
  }>;
11
- export declare const searchByIdWithTypeApi: (id: string | number, type: LocationType) => Promise<{
11
+ export declare const searchByIdWithTypeApi: (id: string | number | Array<number | string>, type: LocationType) => Promise<{
12
12
  records: import('@jctrans-materials/shared').LocationUnifiedItem[];
13
13
  total: number;
14
14
  current: number;
package/dist/index.cjs.js CHANGED
@@ -1,7 +1,7 @@
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=l=>{if(!l||!o)return;const u=t.value.filter(f=>f.id&&f.id!==l.id||f.display!==l.display);u.unshift(l);const c=u.slice(0,4);if(i.value){t.value=c;try{localStorage.setItem(s.value,JSON.stringify(c))}catch(f){console.warn("LocalStorage save failed:",f)}}},a=()=>{t.value=[],o&&localStorage.removeItem(s.value)};return v.onMounted(()=>{if(o&&i.value){const l=localStorage.getItem(s.value);if(l)try{t.value=JSON.parse(l)}catch{t.value=[]}}}),{searchHistory:t,saveToHistory:r,clearHistory:a,HasHistory:i}}async function Kt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return C.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const bt=(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),a=v.ref(10),l=v.computed(()=>r.value===0?!1:n.value.length>=r.value),u=v.computed(()=>{const m=[...t.value];return m.includes("Country")&&!m.includes("Region")&&m.push("Region"),m}),c=m=>!m||!Array.isArray(m)?[]:m.filter(d=>u.value.includes(d.type));return{searchResults:n,loading:o,isFetchingMore:s,isFinished:l,currentPage:i,total:r,fetchData:async(m=1,d=!1)=>{if(!e.value.trim()&&!d){n.value=[],r.value=0;return}if(!(d&&(s.value||l.value))&&!(!d&&o.value)){d?s.value=!0:(o.value=!0,i.value=1);try{const p=await Kt(e.value,t.value,{current:m,size:a.value}),h=p.records||[],y=c(h);d?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:c}}const X=Math.min,E=Math.max,it=Math.round,st=Math.floor,N=e=>({x:e,y:e}),jt={left:"right",right:"left",bottom:"top",top:"bottom"},zt={start:"end",end:"start"};function xt(e,t,n){return E(e,X(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function G(e){return e.split("-")[0]}function nt(e){return e.split("-")[1]}function It(e){return e==="x"?"y":"x"}function Lt(e){return e==="y"?"height":"width"}const Xt=new Set(["top","bottom"]);function H(e){return Xt.has(G(e))?"y":"x"}function Ft(e){return It(H(e))}function $t(e,t,n){n===void 0&&(n=!1);const o=nt(e),s=Ft(e),i=Lt(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 Zt(e){const t=rt(e);return[mt(e),t,mt(t)]}function mt(e){return e.replace(/start|end/g,t=>zt[t])}const Ct=["left","right"],St=["right","left"],te=["top","bottom"],ee=["bottom","top"];function ne(e,t,n){switch(e){case"top":case"bottom":return n?t?St:Ct:t?Ct:St;case"left":case"right":return t?te:ee;default:return[]}}function oe(e,t,n,o){const s=nt(e);let i=ne(G(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=>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 at(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 Dt(e,t,n){let{reference:o,floating:s}=e;const i=H(t),r=Ft(t),a=Lt(r),l=G(t),u=i==="y",c=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,m=o[a]/2-s[a]/2;let d;switch(l){case"top":d={x:c,y:o.y-s.height};break;case"bottom":d={x:c,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-s.width,y:f};break;default:d={x:o.x,y:o.y}}switch(nt(t)){case"start":d[r]-=m*(n&&u?-1:1);break;case"end":d[r]+=m*(n&&u?-1:1);break}return d}const re=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,a=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(t));let u=await r.getElementRects({reference:e,floating:t,strategy:s}),{x:c,y:f}=Dt(u,o,l),m=o,d={},p=0;for(let h=0;h<a.length;h++){const{name:y,fn:g}=a[h],{x:A,y:b,data:S,reset:x}=await g({x:c,y:f,initialPlacement:o,placement:m,strategy:s,middlewareData:d,rects:u,platform:r,elements:{reference:e,floating:t}});c=A??c,f=b??f,d={...d,[y]:{...d[y],...S}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(u=x.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:s}):x.rects),{x:c,y:f}=Dt(u,m,l)),h=-1)}return{x:c,y:f,placement:m,strategy:s,middlewareData:d}};async function ht(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:i,rects:r,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:m=!1,padding:d=0}=et(t,e),p=ie(d),y=a[m?f==="floating"?"reference":"floating":f],g=at(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(a.floating)),boundary:u,rootBoundary:c,strategy:l})),A=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=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=at(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:A,offsetParent:b,strategy:l}):A);return{top:(g.top-x.top+p.top)/S.y,bottom:(x.bottom-g.bottom+p.bottom)/S.y,left:(g.left-x.left+p.left)/S.x,right:(x.right-g.right+p.right)/S.x}}const ae=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:a,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...y}=et(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=G(s),A=H(a),b=G(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=m||(b||!h?[rt(a)]:Zt(a)),I=p!=="none";!m&&I&&x.push(...oe(a,h,p,S));const k=[a,...x],Q=await ht(t,y),U=[];let L=((o=i.flip)==null?void 0:o.overflows)||[];if(c&&U.push(Q[g]),f){const O=$t(s,r,S);U.push(Q[O[0]],Q[O[1]])}if(L=[...L,{placement:s,overflows:U}],!U.every(O=>O<=0)){var Y,q;const O=(((Y=i.flip)==null?void 0:Y.index)||0)+1,D=k[O];if(D&&(!(f==="alignment"?A!==H(D):!1)||L.every(_=>H(_.placement)===A?_.overflows[0]>0:!0)))return{data:{index:O,overflows:L},reset:{placement:D}};let J=(q=L.filter(M=>M.overflows[0]<=0).sort((M,_)=>M.overflows[1]-_.overflows[1])[0])==null?void 0:q.placement;if(!J)switch(d){case"bestFit":{var w;const M=(w=L.filter(_=>{if(I){const W=H(_.placement);return W===A||W==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(W=>W>0).reduce((W,Wt)=>W+Wt,0)]).sort((_,W)=>_[1]-W[1])[0])==null?void 0:w[0];M&&(J=M);break}case"initialPlacement":J=a;break}if(s!==J)return{reset:{placement:J}}}return{}}}},le=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=G(n),a=nt(n),l=H(n)==="y",u=le.has(r)?-1:1,c=i&&l?-1:1,f=et(t,e);let{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(d=a==="end"?p*-1:p),l?{x:d*c,y:m*u}:{x:m*u,y:d*c}}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:a}=t,l=await ce(t,e);return r===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,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:a={fn:y=>{let{x:g,y:A}=y;return{x:g,y:A}}},...l}=et(e,t),u={x:n,y:o},c=await ht(t,l),f=H(G(s)),m=It(f);let d=u[m],p=u[f];if(i){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",A=d+c[y],b=d-c[g];d=xt(A,d,b)}if(r){const y=f==="y"?"top":"left",g=f==="y"?"bottom":"right",A=p+c[y],b=p-c[g];p=xt(A,p,b)}const h=a.fn({...t,[m]:d,[f]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:i,[f]: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:a}=t,{apply:l=()=>{},...u}=et(e,t),c=await ht(t,u),f=G(s),m=nt(s),d=H(s)==="y",{width:p,height:h}=i.floating;let y,g;f==="top"||f==="bottom"?(y=f,g=m===(await(r.isRTL==null?void 0:r.isRTL(a.floating))?"start":"end")?"left":"right"):(g=f,y=m==="end"?"top":"bottom");const A=h-c.top-c.bottom,b=p-c.left-c.right,S=X(h-c[y],A),x=X(p-c[g],b),I=!t.middlewareData.shift;let k=S,Q=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(Q=b),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(k=A),I&&!m){const L=E(c.left,0),Y=E(c.right,0),q=E(c.top,0),w=E(c.bottom,0);d?Q=p-2*(L!==0||Y!==0?L+Y:E(c.left,c.right)):k=h-2*(q!==0||w!==0?q+w:E(c.top,c.bottom))}await l({...t,availableWidth:Q,availableHeight:k});const U=await r.getDimensions(a.floating);return p!==U.width||h!==U.height?{reset:{rects:!0}}:{}}}};function lt(){return typeof window<"u"}function Z(e){return Bt(e)?(e.nodeName||"").toLowerCase():"#document"}function T(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function V(e){var t;return(t=(Bt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Bt(e){return lt()?e instanceof Node||e instanceof T(e).Node:!1}function F(e){return lt()?e instanceof Element||e instanceof T(e).Element:!1}function P(e){return lt()?e instanceof HTMLElement||e instanceof T(e).HTMLElement:!1}function Rt(e){return!lt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof T(e).ShadowRoot}const me=new Set(["inline","contents"]);function ot(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=B(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(Z(e))}const ge=[":popover-open",":modal"];function ct(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=F(e)?B(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=K(e);for(;P(t)&&!$(t);){if(gt(t))return t;if(ct(t))return null;t=K(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 $(e){return be.has(Z(e))}function B(e){return T(e).getComputedStyle(e)}function ut(e){return F(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function K(e){if(Z(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Rt(e)&&e.host||V(e);return Rt(t)?t.host:t}function Mt(e){const t=K(e);return $(t)?e.ownerDocument?e.ownerDocument.body:e.body:P(t)&&ot(t)?t:Mt(t)}function tt(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Mt(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),r=T(s);if(i){const a=pt(r);return t.concat(r,r.visualViewport||[],ot(s)?s:[],a&&n?tt(a):[])}return t.concat(s,tt(s,[],n))}function pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Nt(e){const t=B(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,a=it(n)!==i||it(o)!==r;return a&&(n=i,o=r),{width:n,height:o,$:a}}function vt(e){return F(e)?e:e.contextElement}function z(e){const t=vt(e);if(!P(t))return N(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Nt(t);let r=(i?it(n.width):n.width)/o,a=(i?it(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const xe=N(0);function Pt(e){const t=T(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!==T(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=N(1);t&&(o?F(o)&&(r=z(o)):r=z(e));const a=Ce(i,n,o)?Pt(i):N(0);let l=(s.left+a.x)/r.x,u=(s.top+a.y)/r.y,c=s.width/r.x,f=s.height/r.y;if(i){const m=T(i),d=o&&F(o)?T(o):o;let p=m,h=pt(p);for(;h&&o&&d!==p;){const y=z(h),g=h.getBoundingClientRect(),A=B(h),b=g.left+(h.clientLeft+parseFloat(A.paddingLeft))*y.x,S=g.top+(h.clientTop+parseFloat(A.paddingTop))*y.y;l*=y.x,u*=y.y,c*=y.x,f*=y.y,l+=b,u+=S,p=T(h),h=pt(p)}}return at({width:c,height:f,x:l,y:u})}function ft(e,t){const n=ut(e).scrollLeft;return t?t.left+n:j(V(e)).left+n}function Vt(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 Se(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",r=V(o),a=t?ct(t.floating):!1;if(o===r||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=N(1);const c=N(0),f=P(o);if((f||!f&&!i)&&((Z(o)!=="body"||ot(r))&&(l=ut(o)),P(o))){const d=j(o);u=z(o),c.x=d.x+o.clientLeft,c.y=d.y+o.clientTop}const m=r&&!f&&!i?Vt(r,l):N(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+m.x,y:n.y*u.y-l.scrollTop*u.y+c.y+m.y}}function De(e){return Array.from(e.getClientRects())}function Re(e){const t=V(e),n=ut(e),o=e.ownerDocument.body,s=E(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=E(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+ft(e);const a=-n.scrollTop;return B(o).direction==="rtl"&&(r+=E(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:a}}const Ot=25;function Oe(e,t){const n=T(e),o=V(e),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,a=0,l=0;if(s){i=s.width,r=s.height;const c=yt();(!c||c&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const u=ft(o);if(u<=0){const c=o.ownerDocument,f=c.body,m=getComputedStyle(f),d=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-f.clientWidth-d);p<=Ot&&(i-=p)}else u<=Ot&&(i+=u);return{width:i,height:r,x:a,y:l}}const _e=new Set(["absolute","fixed"]);function Ee(e,t){const n=j(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,i=P(e)?z(e):N(1),r=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:a,x:l,y:u}}function _t(e,t,n){let o;if(t==="viewport")o=Oe(e,n);else if(t==="document")o=Re(V(e));else if(F(t))o=Ee(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 at(o)}function Qt(e,t){const n=K(e);return n===t||!F(n)||$(n)?!1:B(n).position==="fixed"||Qt(n,t)}function Te(e,t){const n=t.get(e);if(n)return n;let o=tt(e,[],!1).filter(a=>F(a)&&Z(a)!=="body"),s=null;const i=B(e).position==="fixed";let r=i?K(e):e;for(;F(r)&&!$(r);){const a=B(r),l=gt(r);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&_e.has(s.position)||ot(r)&&!l&&Qt(e,r))?o=o.filter(c=>c!==r):s=a,r=K(r)}return t.set(e,o),o}function ke(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const r=[...n==="clippingAncestors"?ct(t)?[]:Te(t,this._c):[].concat(n),o],a=r[0],l=r.reduce((u,c)=>{const f=_t(t,c,s);return u.top=E(f.top,u.top),u.right=X(f.right,u.right),u.bottom=X(f.bottom,u.bottom),u.left=E(f.left,u.left),u},_t(t,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ie(e){const{width:t,height:n}=Nt(e);return{width:t,height:n}}function Le(e,t,n){const o=P(t),s=V(t),i=n==="fixed",r=j(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=N(0);function u(){l.x=ft(s)}if(o||!o&&!i)if((Z(t)!=="body"||ot(s))&&(a=ut(t)),o){const d=j(t,!0,i,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else s&&u();i&&!o&&s&&u();const c=s&&!o&&!i?Vt(s,a):N(0),f=r.left+a.scrollLeft-l.x-c.x,m=r.top+a.scrollTop-l.y-c.y;return{x:f,y:m,width:r.width,height:r.height}}function dt(e){return B(e).position==="static"}function Et(e,t){if(!P(e)||B(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function Ut(e,t){const n=T(e);if(ct(e))return n;if(!P(e)){let s=K(e);for(;s&&!$(s);){if(F(s)&&!dt(s))return s;s=K(s)}return n}let o=Et(e,t);for(;o&&he(o)&&dt(o);)o=Et(o,t);return o&&$(o)&&dt(o)&&!gt(o)?n:o||we(e)||n}const Fe=async function(e){const t=this.getOffsetParent||Ut,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 B(e).direction==="rtl"}const Me={convertOffsetParentRelativeRectToViewportRelativeRect:Se,getDocumentElement:V,getClippingRect:ke,getOffsetParent:Ut,getElementRects:Fe,getClientRects:De,getDimensions:Ie,getScale:z,isElement:F,isRTL:Be};function Ht(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ne(e,t){let n=null,o;const s=V(e);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function r(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const u=e.getBoundingClientRect(),{left:c,top:f,width:m,height:d}=u;if(a||t(),!m||!d)return;const p=st(f),h=st(s.clientWidth-(c+m)),y=st(s.clientHeight-(f+d)),g=st(c),b={rootMargin:-p+"px "+-h+"px "+-y+"px "+-g+"px",threshold:E(0,X(1,l))||1};let S=!0;function x(I){const k=I[0].intersectionRatio;if(k!==l){if(!S)return r();k?r(!1,k):o=setTimeout(()=>{r(!1,1e-7)},1e3)}k===1&&!Ht(u,e.getBoundingClientRect())&&r(),S=!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:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=vt(e),c=s||i?[...u?tt(u):[],...tt(t)]:[];c.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&a?Ne(u,n):null;let m=-1,d=null;r&&(d=new ResizeObserver(g=>{let[A]=g;A&&A.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(t)})),n()}),u&&!l&&d.observe(u),d.observe(t));let p,h=l?j(e):null;l&&y();function y(){const g=j(e);h&&!Ht(h,g)&&n(),h=g,p=requestAnimationFrame(y)}return n(),()=>{var g;c.forEach(A=>{s&&A.removeEventListener("scroll",n),i&&A.removeEventListener("resize",n)}),f?.(),(g=d)==null||g.disconnect(),d=null,l&&cancelAnimationFrame(p)}}const Ve=ue,Qe=fe,Ue=ae,He=de,qe=(e,t,n)=>{const o=new Map,s={platform:Me,...n},i={...s.platform,_c:o};return re(e,t,{...s,platform:i})};function Je(e,t){const n=v.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:[Ve(6),Ue(),Qe({padding:10}),He({apply({rects:a,elements:l}){const u=`${a.reference.width}px`;Object.assign(l.floating.style,{width:u,minWidth:u,maxWidth:u})}})]}).then(({x:a,y:l})=>{Object.assign(n.value,{left:`${a}px`,top:`${l}px`})})},i=()=>{e.value&&t.value&&(o=Pe(e.value,t.value,s))},r=()=>{o&&(o(),o=null)};return v.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/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ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4I0RV/xIFCGxCdU3DUwaOkULX18Uve1ydrC4xdwLcwRR9bnO2kwQIoCIDEowpXjsZ4vBCSyx+w/Nnb1KElkkwG4OqGhG79QUImEkT0T2JrpZ4fV5sF0Ad6je9BrBKxLeZuVv8rS9IAG4qGf5oTPSolNxIXOyUNjqlpb0W4xI+Cd62dVqcAAGBVqSCVmPMIoPCttzm2MEBAoeLir4hRK2AWPyVIAHRHMH0Ly0tCBF3M5t+Aq6A0HPJSSyCeZAIz7BNAgQwqxNyc1NL7MCoeyH1xNWpuKsTcet7fv46QI0/zdoEtkmAwHGcHyFQj/Q57vuPzm7m+X5efB6HYj3kOCubuLVlApltfdbPX5uaetCmdeKVAqUN1mdy04XR3PTsqAHPWMztTb24myvEBBuRM+WlUnbzDEXeya2D4XC0zrJqnXwsO3pG3mCMGWMK6lQZk2A0hH2GMSxL9VlI6lVkd90RgGKkVFrrc+9REXubjLH9FxfbbVUVGG5v4i2p8LD8x9ax65C66KTfKGCSDc97fv6DJzuf9QtDtm+iqsM1ot70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",Xe=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),a=v.ref(null),l=v.ref(null),u=v.ref(null),{searchHistory:c,saveToHistory:f,clearHistory:m}=Gt(v.toRef(e,"historyKey")),{searchResults:d,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,fetchData:A,filterByTypes:b}=Yt(n,v.toRef(e,"searchTypeList")),{floatingStyles:S,startTrack:x,stopTrack:I}=Je(l,u),k=async()=>{if(s.value=!0,!e.multiple&&o.value&&d.value.length===0){const w=e.value;if(w?.id){p.value=!0;try{const O=await bt(w.id,w.type);d.value=b(O.records)}finally{p.value=!1}}}},Q=()=>{setTimeout(()=>{s.value=!1},200)},U=w=>{w.target.value===""&&!e.multiple&&(o.value=!1,t("input",null),t("update:value",null))},L=()=>{if(e.multiple&&!n.value&&e.value?.length>0){const w=[...e.value],O=w.pop();t("input",w),t("update:value",w),t("remove",O)}};v.watch(s,w=>w?x():I()),v.watch(n,w=>{if(!w.trim()){d.value=[];return}r.value&&clearTimeout(r.value),r.value=setTimeout(()=>A(1,!1),300)});const Y=v.computed(()=>e.lang?e.lang==="en"||e.lang==="en-US":typeof document<"u"?/(^|;\s*)jc-language=en(-US)?(;|$)/.test(document.cookie||""):!1),q=w=>Y.value?w.displayEn||w.display||w.nameEn||"":w.displayCn||w.display||w.nameCn||w.name||"";return v.watch(()=>e.value,async(w,O)=>{if(e.multiple||JSON.stringify(w)===JSON.stringify(O)&&o.value)return;const D=w;if(!D){i.value="",o.value=!1;return}if(typeof D=="object")if(D.id&&D.type&&!D.display)try{const M=(await bt(D.id,D.type)).records.find(_=>_.id===D.id);M&&(i.value=q(M),o.value=!0)}catch(J){console.error("Failed to fetch search item detail:",J)}else i.value=q(D),o.value=!!i.value;else typeof D=="string"&&(i.value=D,o.value=!!D)},{immediate:!0,deep:!0}),v.onBeforeUnmount(I),{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:a,referenceRef:l,floatingRef:u,searchHistory:c,searchResults:d,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,floatingStyles:S,saveToHistory:f,clearHistory:m,fetchData:A,filterByTypes:b,startTrack:x,stopTrack:I,onFocus:k,handleBlur:Q,onInput:U,handleDelete:L,SearchIcon:We}},computed:{isEn(){if(this.lang&&this.lang!=="")return this.lang==="en"||this.lang==="en-US";try{if(typeof useCookie=="function"){const e=useCookie("jc-language")?.value;if(e)return/^en(-US)?$/.test(e)}}catch{}if(typeof document<"u"){const e=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(e)}try{if(typeof useNuxtApp=="function"){const t=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(t)}}catch{}return!1},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:Ge,Seaport:Ke,Airport:Ye,Country:je}[e]||ze},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,a){var l=typeof e=="function"?e.options:e;return t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),i&&(l._scopeId="data-v-"+i),{exports:e,options:l}}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:`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("vue"),S=require("@jctrans-materials/shared"),R=require("jctrans-ui");v.util.warn;function $t(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=l=>{if(!l||!o)return;const u=t.value.filter(f=>f.id&&f.id!==l.id||f.display!==l.display);u.unshift(l);const c=u.slice(0,4);if(i.value){t.value=c;try{localStorage.setItem(s.value,JSON.stringify(c))}catch(f){console.warn("LocalStorage save failed:",f)}}},a=()=>{t.value=[],o&&localStorage.removeItem(s.value)};return v.onMounted(()=>{if(o&&i.value){const l=localStorage.getItem(s.value);if(l)try{t.value=JSON.parse(l)}catch{t.value=[]}}}),{searchHistory:t,saveToHistory:r,clearHistory:a,HasHistory:i}}async function zt(e,t=["Continent","Country","City","Seaport","Airport"],n={}){return S.locationSearchV2.searchByName({keyword:e,displayInfo:t,...n})}const pt=(e,t)=>S.locationSearchV2.searchByIdWithType(e,t);function Xt(e,t){const n=v.ref([]),o=v.ref(!1),s=v.ref(!1),i=v.ref(1),r=v.ref(0),a=v.ref(10),l=v.computed(()=>r.value===0?!1:n.value.length>=r.value),u=v.computed(()=>{const m=[...t.value];return m.includes("Country")&&!m.includes("Region")&&m.push("Region"),m}),c=m=>!m||!Array.isArray(m)?[]:m.filter(d=>u.value.includes(d.type));return{searchResults:n,loading:o,isFetchingMore:s,isFinished:l,currentPage:i,total:r,fetchData:async(m=1,d=!1)=>{if(!e.value.trim()&&!d){n.value=[],r.value=0;return}if(!(d&&(s.value||l.value))&&!(!d&&o.value)){d?s.value=!0:(o.value=!0,i.value=1);try{const p=await zt(e.value,t.value,{current:m,size:a.value}),h=p.records||[],y=c(h);d?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:c}}const X=Math.min,T=Math.max,at=Math.round,rt=Math.floor,Q=e=>({x:e,y:e}),Zt={left:"right",right:"left",bottom:"top",top:"bottom"},te={start:"end",end:"start"};function Rt(e,t,n){return T(e,X(t,n))}function nt(e,t){return typeof e=="function"?e(t):e}function G(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function Mt(e){return e==="x"?"y":"x"}function Nt(e){return e==="y"?"height":"width"}const ee=new Set(["top","bottom"]);function J(e){return ee.has(G(e))?"y":"x"}function Pt(e){return Mt(J(e))}function ne(e,t,n){n===void 0&&(n=!1);const o=ot(e),s=Pt(e),i=Nt(s);let r=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(r=lt(r)),[r,lt(r)]}function oe(e){const t=lt(e);return[gt(e),t,gt(t)]}function gt(e){return e.replace(/start|end/g,t=>te[t])}const Ot=["left","right"],_t=["right","left"],se=["top","bottom"],ie=["bottom","top"];function re(e,t,n){switch(e){case"top":case"bottom":return n?t?_t:Ot:t?Ot:_t;case"left":case"right":return t?se:ie;default:return[]}}function ae(e,t,n,o){const s=ot(e);let i=re(G(e),n==="start",o);return s&&(i=i.map(r=>r+"-"+s),t&&(i=i.concat(i.map(gt)))),i}function lt(e){return e.replace(/left|right|bottom|top/g,t=>Zt[t])}function le(e){return{top:0,right:0,bottom:0,left:0,...e}}function ce(e){return typeof e!="number"?le(e):{top:e,right:e,bottom:e,left:e}}function ct(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 Et(e,t,n){let{reference:o,floating:s}=e;const i=J(t),r=Pt(t),a=Nt(r),l=G(t),u=i==="y",c=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,m=o[a]/2-s[a]/2;let d;switch(l){case"top":d={x:c,y:o.y-s.height};break;case"bottom":d={x:c,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:f};break;case"left":d={x:o.x-s.width,y:f};break;default:d={x:o.x,y:o.y}}switch(ot(t)){case"start":d[r]-=m*(n&&u?-1:1);break;case"end":d[r]+=m*(n&&u?-1:1);break}return d}const ue=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:i=[],platform:r}=n,a=i.filter(Boolean),l=await(r.isRTL==null?void 0:r.isRTL(t));let u=await r.getElementRects({reference:e,floating:t,strategy:s}),{x:c,y:f}=Et(u,o,l),m=o,d={},p=0;for(let h=0;h<a.length;h++){const{name:y,fn:g}=a[h],{x:w,y:b,data:D,reset:x}=await g({x:c,y:f,initialPlacement:o,placement:m,strategy:s,middlewareData:d,rects:u,platform:r,elements:{reference:e,floating:t}});c=w??c,f=b??f,d={...d,[y]:{...d[y],...D}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(u=x.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:s}):x.rects),{x:c,y:f}=Et(u,m,l)),h=-1)}return{x:c,y:f,placement:m,strategy:s,middlewareData:d}};async function vt(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:i,rects:r,elements:a,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:m=!1,padding:d=0}=nt(t,e),p=ce(d),y=a[m?f==="floating"?"reference":"floating":f],g=ct(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(a.floating)),boundary:u,rootBoundary:c,strategy:l})),w=f==="floating"?{x:o,y:s,width:r.floating.width,height:r.floating.height}:r.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),D=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=ct(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:b,strategy:l}):w);return{top:(g.top-x.top+p.top)/D.y,bottom:(x.bottom-g.bottom+p.bottom)/D.y,left:(g.left-x.left+p.left)/D.x,right:(x.right-g.right+p.right)/D.x}}const fe=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:a,platform:l,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...y}=nt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=G(s),w=J(a),b=G(a)===a,D=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=m||(b||!h?[lt(a)]:oe(a)),F=p!=="none";!m&&F&&x.push(...ae(a,h,p,D));const I=[a,...x],H=await vt(t,y),q=[];let B=((o=i.flip)==null?void 0:o.overflows)||[];if(c&&q.push(H[g]),f){const E=ne(s,r,D);q.push(H[E[0]],H[E[1]])}if(B=[...B,{placement:s,overflows:q}],!q.every(E=>E<=0)){var Y,W;const E=(((Y=i.flip)==null?void 0:Y.index)||0)+1,O=I[E];if(O&&(!(f==="alignment"?w!==J(O):!1)||B.every(C=>J(C.placement)===w?C.overflows[0]>0:!0)))return{data:{index:E,overflows:B},reset:{placement:O}};let M=(W=B.filter(_=>_.overflows[0]<=0).sort((_,C)=>_.overflows[1]-C.overflows[1])[0])==null?void 0:W.placement;if(!M)switch(d){case"bestFit":{var A;const _=(A=B.filter(C=>{if(F){const L=J(C.placement);return L===w||L==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(L=>L>0).reduce((L,$)=>L+$,0)]).sort((C,L)=>C[1]-L[1])[0])==null?void 0:A[0];_&&(M=_);break}case"initialPlacement":M=a;break}if(s!==M)return{reset:{placement:M}}}return{}}}},de=new Set(["left","top"]);async function me(e,t){const{placement:n,platform:o,elements:s}=e,i=await(o.isRTL==null?void 0:o.isRTL(s.floating)),r=G(n),a=ot(n),l=J(n)==="y",u=de.has(r)?-1:1,c=i&&l?-1:1,f=nt(t,e);let{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(d=a==="end"?p*-1:p),l?{x:d*c,y:m*u}:{x:m*u,y:d*c}}const pe=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:a}=t,l=await me(t,e);return r===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:r}}}}},he=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:a={fn:y=>{let{x:g,y:w}=y;return{x:g,y:w}}},...l}=nt(e,t),u={x:n,y:o},c=await vt(t,l),f=J(G(s)),m=Mt(f);let d=u[m],p=u[f];if(i){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",w=d+c[y],b=d-c[g];d=Rt(w,d,b)}if(r){const y=f==="y"?"top":"left",g=f==="y"?"bottom":"right",w=p+c[y],b=p-c[g];p=Rt(w,p,b)}const h=a.fn({...t,[m]:d,[f]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:i,[f]:r}}}}}},ge=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:a}=t,{apply:l=()=>{},...u}=nt(e,t),c=await vt(t,u),f=G(s),m=ot(s),d=J(s)==="y",{width:p,height:h}=i.floating;let y,g;f==="top"||f==="bottom"?(y=f,g=m===(await(r.isRTL==null?void 0:r.isRTL(a.floating))?"start":"end")?"left":"right"):(g=f,y=m==="end"?"top":"bottom");const w=h-c.top-c.bottom,b=p-c.left-c.right,D=X(h-c[y],w),x=X(p-c[g],b),F=!t.middlewareData.shift;let I=D,H=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(H=b),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(I=w),F&&!m){const B=T(c.left,0),Y=T(c.right,0),W=T(c.top,0),A=T(c.bottom,0);d?H=p-2*(B!==0||Y!==0?B+Y:T(c.left,c.right)):I=h-2*(W!==0||A!==0?W+A:T(c.top,c.bottom))}await l({...t,availableWidth:H,availableHeight:I});const q=await r.getDimensions(a.floating);return p!==q.width||h!==q.height?{reset:{rects:!0}}:{}}}};function ut(){return typeof window<"u"}function tt(e){return Qt(e)?(e.nodeName||"").toLowerCase():"#document"}function k(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){var t;return(t=(Qt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Qt(e){return ut()?e instanceof Node||e instanceof k(e).Node:!1}function N(e){return ut()?e instanceof Element||e instanceof k(e).Element:!1}function V(e){return ut()?e instanceof HTMLElement||e instanceof k(e).HTMLElement:!1}function Tt(e){return!ut()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof k(e).ShadowRoot}const ye=new Set(["inline","contents"]);function st(e){const{overflow:t,overflowX:n,overflowY:o,display:s}=P(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!ye.has(s)}const ve=new Set(["table","td","th"]);function Ae(e){return ve.has(tt(e))}const we=[":popover-open",":modal"];function ft(e){return we.some(t=>{try{return e.matches(t)}catch{return!1}})}const be=["transform","translate","scale","rotate","perspective"],xe=["transform","translate","scale","rotate","perspective","filter"],Ce=["paint","layout","strict","content"];function At(e){const t=wt(),n=N(e)?P(e):e;return be.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)||xe.some(o=>(n.willChange||"").includes(o))||Ce.some(o=>(n.contain||"").includes(o))}function Se(e){let t=K(e);for(;V(t)&&!Z(t);){if(At(t))return t;if(ft(t))return null;t=K(t)}return null}function wt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const De=new Set(["html","body","#document"]);function Z(e){return De.has(tt(e))}function P(e){return k(e).getComputedStyle(e)}function dt(e){return N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function K(e){if(tt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tt(e)&&e.host||U(e);return Tt(t)?t.host:t}function Vt(e){const t=K(e);return Z(t)?e.ownerDocument?e.ownerDocument.body:e.body:V(t)&&st(t)?t:Vt(t)}function et(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=Vt(e),i=s===((o=e.ownerDocument)==null?void 0:o.body),r=k(s);if(i){const a=yt(r);return t.concat(r,r.visualViewport||[],st(s)?s:[],a&&n?et(a):[])}return t.concat(s,et(s,[],n))}function yt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ut(e){const t=P(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=V(e),i=s?e.offsetWidth:n,r=s?e.offsetHeight:o,a=at(n)!==i||at(o)!==r;return a&&(n=i,o=r),{width:n,height:o,$:a}}function bt(e){return N(e)?e:e.contextElement}function z(e){const t=bt(e);if(!V(t))return Q(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:i}=Ut(t);let r=(i?at(n.width):n.width)/o,a=(i?at(n.height):n.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}const Re=Q(0);function Ht(e){const t=k(e);return!wt()||!t.visualViewport?Re:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Oe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==k(e)?!1:t}function j(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=bt(e);let r=Q(1);t&&(o?N(o)&&(r=z(o)):r=z(e));const a=Oe(i,n,o)?Ht(i):Q(0);let l=(s.left+a.x)/r.x,u=(s.top+a.y)/r.y,c=s.width/r.x,f=s.height/r.y;if(i){const m=k(i),d=o&&N(o)?k(o):o;let p=m,h=yt(p);for(;h&&o&&d!==p;){const y=z(h),g=h.getBoundingClientRect(),w=P(h),b=g.left+(h.clientLeft+parseFloat(w.paddingLeft))*y.x,D=g.top+(h.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,u*=y.y,c*=y.x,f*=y.y,l+=b,u+=D,p=k(h),h=yt(p)}}return ct({width:c,height:f,x:l,y:u})}function mt(e,t){const n=dt(e).scrollLeft;return t?t.left+n:j(U(e)).left+n}function qt(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-mt(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function _e(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const i=s==="fixed",r=U(o),a=t?ft(t.floating):!1;if(o===r||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Q(1);const c=Q(0),f=V(o);if((f||!f&&!i)&&((tt(o)!=="body"||st(r))&&(l=dt(o)),V(o))){const d=j(o);u=z(o),c.x=d.x+o.clientLeft,c.y=d.y+o.clientTop}const m=r&&!f&&!i?qt(r,l):Q(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+m.x,y:n.y*u.y-l.scrollTop*u.y+c.y+m.y}}function Ee(e){return Array.from(e.getClientRects())}function Te(e){const t=U(e),n=dt(e),o=e.ownerDocument.body,s=T(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=T(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+mt(e);const a=-n.scrollTop;return P(o).direction==="rtl"&&(r+=T(t.clientWidth,o.clientWidth)-s),{width:s,height:i,x:r,y:a}}const kt=25;function ke(e,t){const n=k(e),o=U(e),s=n.visualViewport;let i=o.clientWidth,r=o.clientHeight,a=0,l=0;if(s){i=s.width,r=s.height;const c=wt();(!c||c&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}const u=mt(o);if(u<=0){const c=o.ownerDocument,f=c.body,m=getComputedStyle(f),d=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(o.clientWidth-f.clientWidth-d);p<=kt&&(i-=p)}else u<=kt&&(i+=u);return{width:i,height:r,x:a,y:l}}const Ie=new Set(["absolute","fixed"]);function Le(e,t){const n=j(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,i=V(e)?z(e):Q(1),r=e.clientWidth*i.x,a=e.clientHeight*i.y,l=s*i.x,u=o*i.y;return{width:r,height:a,x:l,y:u}}function It(e,t,n){let o;if(t==="viewport")o=ke(e,n);else if(t==="document")o=Te(U(e));else if(N(t))o=Le(t,n);else{const s=Ht(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ct(o)}function Jt(e,t){const n=K(e);return n===t||!N(n)||Z(n)?!1:P(n).position==="fixed"||Jt(n,t)}function Fe(e,t){const n=t.get(e);if(n)return n;let o=et(e,[],!1).filter(a=>N(a)&&tt(a)!=="body"),s=null;const i=P(e).position==="fixed";let r=i?K(e):e;for(;N(r)&&!Z(r);){const a=P(r),l=At(r);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&Ie.has(s.position)||st(r)&&!l&&Jt(e,r))?o=o.filter(c=>c!==r):s=a,r=K(r)}return t.set(e,o),o}function Be(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const r=[...n==="clippingAncestors"?ft(t)?[]:Fe(t,this._c):[].concat(n),o],a=r[0],l=r.reduce((u,c)=>{const f=It(t,c,s);return u.top=T(f.top,u.top),u.right=X(f.right,u.right),u.bottom=X(f.bottom,u.bottom),u.left=T(f.left,u.left),u},It(t,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Me(e){const{width:t,height:n}=Ut(e);return{width:t,height:n}}function Ne(e,t,n){const o=V(t),s=U(t),i=n==="fixed",r=j(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=Q(0);function u(){l.x=mt(s)}if(o||!o&&!i)if((tt(t)!=="body"||st(s))&&(a=dt(t)),o){const d=j(t,!0,i,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else s&&u();i&&!o&&s&&u();const c=s&&!o&&!i?qt(s,a):Q(0),f=r.left+a.scrollLeft-l.x-c.x,m=r.top+a.scrollTop-l.y-c.y;return{x:f,y:m,width:r.width,height:r.height}}function ht(e){return P(e).position==="static"}function Lt(e,t){if(!V(e)||P(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function Wt(e,t){const n=k(e);if(ft(e))return n;if(!V(e)){let s=K(e);for(;s&&!Z(s);){if(N(s)&&!ht(s))return s;s=K(s)}return n}let o=Lt(e,t);for(;o&&Ae(o)&&ht(o);)o=Lt(o,t);return o&&Z(o)&&ht(o)&&!At(o)?n:o||Se(e)||n}const Pe=async function(e){const t=this.getOffsetParent||Wt,n=this.getDimensions,o=await n(e.floating);return{reference:Ne(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Qe(e){return P(e).direction==="rtl"}const Ve={convertOffsetParentRelativeRectToViewportRelativeRect:_e,getDocumentElement:U,getClippingRect:Be,getOffsetParent:Wt,getElementRects:Pe,getClientRects:Ee,getDimensions:Me,getScale:z,isElement:N,isRTL:Qe};function Gt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ue(e,t){let n=null,o;const s=U(e);function i(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function r(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const u=e.getBoundingClientRect(),{left:c,top:f,width:m,height:d}=u;if(a||t(),!m||!d)return;const p=rt(f),h=rt(s.clientWidth-(c+m)),y=rt(s.clientHeight-(f+d)),g=rt(c),b={rootMargin:-p+"px "+-h+"px "+-y+"px "+-g+"px",threshold:T(0,X(1,l))||1};let D=!0;function x(F){const I=F[0].intersectionRatio;if(I!==l){if(!D)return r();I?r(!1,I):o=setTimeout(()=>{r(!1,1e-7)},1e3)}I===1&&!Gt(u,e.getBoundingClientRect())&&r(),D=!1}try{n=new IntersectionObserver(x,{...b,root:s.ownerDocument})}catch{n=new IntersectionObserver(x,b)}n.observe(e)}return r(!0),i}function He(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=o,u=bt(e),c=s||i?[...u?et(u):[],...et(t)]:[];c.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&a?Ue(u,n):null;let m=-1,d=null;r&&(d=new ResizeObserver(g=>{let[w]=g;w&&w.target===u&&d&&(d.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(t)})),n()}),u&&!l&&d.observe(u),d.observe(t));let p,h=l?j(e):null;l&&y();function y(){const g=j(e);h&&!Gt(h,g)&&n(),h=g,p=requestAnimationFrame(y)}return n(),()=>{var g;c.forEach(w=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(g=d)==null||g.disconnect(),d=null,l&&cancelAnimationFrame(p)}}const qe=pe,Je=he,We=fe,Ge=ge,Ke=(e,t,n)=>{const o=new Map,s={platform:Ve,...n},i={...s.platform,_c:o};return ue(e,t,{...s,platform:i})};function Ye(e,t){const n=v.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let o=null;const s=()=>{!e.value||!t.value||Ke(e.value,t.value,{placement:"bottom-start",strategy:"fixed",middleware:[qe(6),We(),Je({padding:10}),Ge({apply({rects:a,elements:l}){const u=`${a.reference.width}px`;Object.assign(l.floating.style,{width:u,minWidth:u,maxWidth:u})}})]}).then(({x:a,y:l})=>{Object.assign(n.value,{left:`${a}px`,top:`${l}px`})})},i=()=>{e.value&&t.value&&(o=He(e.value,t.value,s))},r=()=>{o&&(o(),o=null)};return v.onBeforeUnmount(r),{floatingStyles:n,startTrack:i,stopTrack:r}}const je="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",$e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOyt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kwQIoCIDEowpXjsZ4vBCSyx+w/Nnb1KElkkwG4OqGhG79QUImEkT0T2JrpZ4fV5sF0Ad6je9BrBKxLeZuVv8rS9IAG4qGf5oTPSolNxIXOyUNjqlpb0W4xI+Cd62dVqcAAGBVqSCVmPMIoPCttzm2MEBAoeLir4hRK2AWPyVIAHRHMH0Ly0tCBF3M5t+Aq6A0HPJSSyCeZAIz7BNAgQwqxNyc1NL7MCoeyH1xNWpuKsTcet7fv46QI0/zdoEtkmAwHGcHyFQj/Q57vuPzm7m+X5efB6HYj3kOCubuLVlApltfdbPX5uaetCmdeKVAqUN1mdy04XR3PTsqAHPWMztTb24myvEBBuRM+WlUnbzDEXeya2D4XC0zrJqnXwsO3pG3mCMGWMK6lQZk2A0hH2GMSxL9VlI6lVkd90RgGKkVFrrc+9REXubjLH9FxfbbVUVGG5v4i2p8LD8x9ax65C66KTfKGCSDc97fv6DJzuf9QtDtm+iqsM1ot70w9O+YDbmSQ6bkkyCJitnAUcnryqmuExgSsZYKypvgFvS+5xVsJk0MGlps97mFCVXpnNZqoBcbo2QyJz7dCLj6JTj6tRxVyf3izZUtNndwM73SU55JzaO4Q8AAAD//54At5MAAAAGSURBVAMAh2IbMAJQAZQAAAAASUVORK5CYII=",en=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),a=v.ref(null),l=v.ref(null),u=v.ref(null),{searchHistory:c,saveToHistory:f,clearHistory:m}=$t(v.toRef(e,"historyKey")),{searchResults:d,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,fetchData:w,filterByTypes:b}=Xt(n,v.toRef(e,"searchTypeList")),{floatingStyles:D,startTrack:x,stopTrack:F}=Ye(l,u),I=async()=>{if(s.value=!0,!e.multiple&&o.value&&d.value.length===0){const A=e.value;if(A?.id){p.value=!0;try{const E=await pt(A.id,A.type);d.value=b(E.records)}finally{p.value=!1}}}},H=()=>{setTimeout(()=>{s.value=!1},200)},q=A=>{A.target.value===""&&!e.multiple&&(o.value=!1,t("input",null),t("update:value",null))},B=()=>{if(e.multiple&&!n.value&&e.value?.length>0){const A=[...e.value],E=A.pop();t("input",A),t("update:value",A),t("remove",E)}};v.watch(s,A=>A?x():F()),v.watch(n,A=>{if(!A.trim()){d.value=[];return}r.value&&clearTimeout(r.value),r.value=setTimeout(()=>w(1,!1),300)});const Y=v.computed(()=>e.lang?e.lang==="en"||e.lang==="en-US":typeof document<"u"?/(^|;\s*)jc-language=en(-US)?(;|$)/.test(document.cookie||""):!1),W=A=>Y.value?A.displayEn||A.display||A.nameEn||"":A.displayCn||A.display||A.nameCn||A.name||"";return v.watch(()=>e.value,async(A,E)=>{if(console.log("🍉 ~ index.vue:304 ~ newVal:",A),JSON.stringify(A)===JSON.stringify(E))return;if(e.multiple&&Array.isArray(A)){const M=[...A],_=M.filter(C=>C&&C.id&&C.type);if(_.length>0)try{const C=_.map($=>$.id),L=await pt(C,_[0].type);if(L&&L.records){let $=!1;const St=M.map(it=>{const Dt=L.records.find(jt=>jt.id===it.id);return Dt&&!it.display?($=!0,{...it,...Dt}):it});$&&(t("input",St),t("update:value",St))}}catch(C){console.error("Batch fetch detail failed:",C)}return}const O=A;if(!O){o.value=!1,i.value="";return}if(typeof O=="object")if(O.id&&O.type&&!O.display)try{const _=(await pt(O.id,O.type)).records.find(C=>C.id===O.id);_&&(i.value=W(_),o.value=!0)}catch(M){console.error("Single fetch detail failed:",M)}else i.value=W(O),o.value=!!i.value;else i.value=String(O),o.value=!!O},{immediate:!0,deep:!0}),v.onBeforeUnmount(F),{query:n,isSelected:o,isDropdownVisible:s,selectedLabel:i,inputRef:a,referenceRef:l,floatingRef:u,searchHistory:c,searchResults:d,loading:p,isFetchingMore:h,isFinished:y,currentPage:g,floatingStyles:D,saveToHistory:f,clearHistory:m,fetchData:w,filterByTypes:b,startTrack:x,stopTrack:F,onFocus:I,handleBlur:H,onInput:q,handleDelete:B,SearchIcon:je}},computed:{isEn(){if(this.lang&&this.lang!=="")return this.lang==="en"||this.lang==="en-US";try{if(typeof useCookie=="function"){const e=useCookie("jc-language")?.value;if(e)return/^en(-US)?$/.test(e)}}catch{}if(typeof document<"u"){const e=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(e)}try{if(typeof useNuxtApp=="function"){const t=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(t)}}catch{}return!1},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.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),this.$emit("change",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:$e,Seaport:ze,Airport:Xe,Country:Ze}[e]||tn},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 xt(e,t,n,o,s,i,r,a){var l=typeof e=="function"?e.options:e;return t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),i&&(l._scopeId="data-v-"+i),{exports:e,options:l}}var nn=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",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(Xe,$e,Ze,!1,null,"9028fb16");const wt=tn.exports,en={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:e=>["en","en-US","zh-CN","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"}),a=v.computed(()=>{if(n.lang&&n.lang!=="")return n.lang==="en"||n.lang==="en-US";try{if(typeof useCookie=="function"){const c=useCookie("jc-language")?.value;if(c)return/^en(-US)?$/.test(c)}}catch{}if(typeof document<"u"){const c=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(c)}try{if(typeof useNuxtApp=="function"){const f=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(f)}}catch{}return!1});return{__sfc:!0,props:n,emit:t,typeOptions:o,displayQuery:s,errors:i,formData:r,isEn:a,handleClose:()=>{i.name="",i.country="",t("update:value",!1)},handleConfirm:()=>{i.name="",i.country="";let c=!0;r.name.trim()||(i.name="Data name is required",c=!1),s.value||(i.country="Please select a country",c=!1),c&&(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,"77035ea3");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 an=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=[],cn=At(rn,an,ln,!1,null,null);const Jt=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(Jt);new o().$mount(n),e=!0}t.prototype.$globalModal=un}}}const Tt={ApplyDataDialog:qt,JcSearch:wt};let kt=!1;const dn={install(e,t){kt||(kt=!0,t?.sharedConfig&&C.initSharedConfig(t.sharedConfig),Object.keys(Tt).forEach(n=>{e.component(n,Tt[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=Jt;exports.JcSearch=wt;exports.createGlobalModalPlugin=fn;exports.default=dn;
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)])},on=[],sn=xt(en,nn,on,!1,null,"74864ae1");const Ct=sn.exports,rn={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:e=>["en","en-US","zh-CN","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"}),a=v.computed(()=>{if(n.lang&&n.lang!=="")return n.lang==="en"||n.lang==="en-US";try{if(typeof useCookie=="function"){const c=useCookie("jc-language")?.value;if(c)return/^en(-US)?$/.test(c)}}catch{}if(typeof document<"u"){const c=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(c)}try{if(typeof useNuxtApp=="function"){const f=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(f)}}catch{}return!1});return{__sfc:!0,props:n,emit:t,typeOptions:o,displayQuery:s,errors:i,formData:r,isEn:a,handleClose:()=>{i.name="",i.country="",t("update:value",!1)},handleConfirm:()=>{i.name="",i.country="";let c=!0;r.name.trim()||(i.name="Data name is required",c=!1),s.value||(i.country="Please select a country",c=!1),c&&(console.log("🍉 ~ ApplyDataDialog.vue:115 ~ handleConfirm ~ data:",{...r,country:s.value}),t("confirm",{...r,country:s.value}))},Search:Ct}}};var an=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()},ln=[],cn=xt(rn,an,ln,!1,null,"77035ea3");const Kt=cn.exports,un={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(){S.emitter.on(S.MODAL_ACTION.Open,this.handleOpen)},beforeDestroy(){S.emitter.off(S.MODAL_ACTION.Open,this.handleOpen)},methods:{handleOpen(){console.log("🍉 ~ GlobalModal.vue:150 ~ methods.handleOpen:",this.handleOpen),this.isVisible=!0},closeModal(){this.isVisible=!1,S.emitter.emit(S.MODAL_ACTION.Close),this.$refs.formRef.resetFields()},handleSubmit(){this.$refs.formRef.validate(e=>{e&&(S.emitter.emit(S.MODAL_ACTION.Submit,{...this.formData}),this.closeModal())})}}};var fn=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)])},dn=[],mn=xt(un,fn,dn,!1,null,null);const Yt=mn.exports;let pn={open(){S.emitter.emit(S.MODAL_ACTION.Open)},close(){S.emitter.emit(S.MODAL_ACTION.Close)},onSubmit(e){S.emitter.on(S.MODAL_ACTION.Submit,e)}};function hn(){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(Yt);new o().$mount(n),e=!0}t.prototype.$globalModal=pn}}}const Ft={ApplyDataDialog:Kt,JcSearch:Ct};let Bt=!1;const gn={install(e,t){Bt||(Bt=!0,t?.sharedConfig&&S.initSharedConfig(t.sharedConfig),Object.keys(Ft).forEach(n=>{e.component(n,Ft[n])}))}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>S.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>S.emitter});exports.ApplyDataDialog=Kt;exports.GlobalModal=Yt;exports.JcSearch=Ct;exports.createGlobalModalPlugin=hn;exports.default=gn;