@jctrans-materials/comps-vue3 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.
- package/dist/components/search/common.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +789 -764
- package/package.json +2 -2
|
@@ -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
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),R=require("@jctrans-materials/shared"),B=require("element-plus");function it(t){const n=e.ref([]),o="_search_history_cache",l=typeof window<"u"&&typeof localStorage<"u",r=e.computed(()=>(t.value||"")+o),a=e.computed(()=>!!t.value&&t.value!==""),s=u=>{if(!u||!l)return;const i=n.value.filter(m=>m.id&&m.id!==u.id||m.display!==u.display);i.unshift(u);const d=i.slice(0,4);if(a.value){n.value=d;try{localStorage.setItem(r.value,JSON.stringify(d))}catch(m){console.warn("LocalStorage save failed:",m)}}},c=()=>{n.value=[],l&&localStorage.removeItem(r.value)};return e.onMounted(()=>{if(l&&a.value){const u=localStorage.getItem(r.value);if(u)try{n.value=JSON.parse(u)}catch{n.value=[]}}}),{searchHistory:n,saveToHistory:s,clearHistory:c,HasHistory:a}}async function ct(t,n=["Continent","Country","City","Seaport","Airport"],o={}){return R.locationSearchV2.searchByName({keyword:t,displayInfo:n,...o})}const De=(t,n)=>R.locationSearchV2.searchByIdWithType(t,n);function ut(t,n){const o=e.ref([]),l=e.ref(!1),r=e.ref(!1),a=e.ref(1),s=e.ref(0),c=e.ref(10),u=e.computed(()=>s.value===0?!1:o.value.length>=s.value),i=e.computed(()=>{const f=[...n.value];return f.includes("Country")&&!f.includes("Region")&&f.push("Region"),f}),d=f=>!f||!Array.isArray(f)?[]:f.filter(p=>i.value.includes(p.type));return{searchResults:o,loading:l,isFetchingMore:r,isFinished:u,currentPage:a,total:s,fetchData:async(f=1,p=!1)=>{if(!t.value.trim()&&!p){o.value=[],s.value=0;return}if(!(p&&(r.value||u.value))&&!(!p&&l.value)){p?r.value=!0:(l.value=!0,a.value=1);try{const h=await ct(t.value,n.value,{current:f,size:c.value}),y=h.records||[],A=d(y);p?o.value=[...o.value,...A]:o.value=A,s.value=h.total||0,a.value=f}catch(h){console.error("Failed to fetch search results:",h)}finally{l.value=!1,r.value=!1}}},filterByTypes:d}}const ne=Math.min,M=Math.max,fe=Math.round,de=Math.floor,q=t=>({x:t,y:t}),dt={left:"right",right:"left",bottom:"top",top:"bottom"},ft={start:"end",end:"start"};function _e(t,n,o){return M(t,ne(n,o))}function ie(t,n){return typeof t=="function"?t(n):t}function Y(t){return t.split("-")[0]}function ce(t){return t.split("-")[1]}function Qe(t){return t==="x"?"y":"x"}function $e(t){return t==="y"?"height":"width"}const mt=new Set(["top","bottom"]);function z(t){return mt.has(Y(t))?"y":"x"}function Je(t){return Qe(z(t))}function pt(t,n,o){o===void 0&&(o=!1);const l=ce(t),r=Je(t),a=$e(r);let s=r==="x"?l===(o?"end":"start")?"right":"left":l==="start"?"bottom":"top";return n.reference[a]>n.floating[a]&&(s=me(s)),[s,me(s)]}function ht(t){const n=me(t);return[we(t),n,we(n)]}function we(t){return t.replace(/start|end/g,n=>ft[n])}const Oe=["left","right"],Te=["right","left"],vt=["top","bottom"],gt=["bottom","top"];function yt(t,n,o){switch(t){case"top":case"bottom":return o?n?Te:Oe:n?Oe:Te;case"left":case"right":return n?vt:gt;default:return[]}}function At(t,n,o,l){const r=ce(t);let a=yt(Y(t),o==="start",l);return r&&(a=a.map(s=>s+"-"+r),n&&(a=a.concat(a.map(we)))),a}function me(t){return t.replace(/left|right|bottom|top/g,n=>dt[n])}function wt(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ct(t){return typeof t!="number"?wt(t):{top:t,right:t,bottom:t,left:t}}function pe(t){const{x:n,y:o,width:l,height:r}=t;return{width:l,height:r,top:o,left:n,right:n+l,bottom:o+r,x:n,y:o}}function Le(t,n,o){let{reference:l,floating:r}=t;const a=z(n),s=Je(n),c=$e(s),u=Y(n),i=a==="y",d=l.x+l.width/2-r.width/2,m=l.y+l.height/2-r.height/2,f=l[c]/2-r[c]/2;let p;switch(u){case"top":p={x:d,y:l.y-r.height};break;case"bottom":p={x:d,y:l.y+l.height};break;case"right":p={x:l.x+l.width,y:m};break;case"left":p={x:l.x-r.width,y:m};break;default:p={x:l.x,y:l.y}}switch(ce(n)){case"start":p[s]-=f*(o&&i?-1:1);break;case"end":p[s]+=f*(o&&i?-1:1);break}return p}const xt=async(t,n,o)=>{const{placement:l="bottom",strategy:r="absolute",middleware:a=[],platform:s}=o,c=a.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(n));let i=await s.getElementRects({reference:t,floating:n,strategy:r}),{x:d,y:m}=Le(i,l,u),f=l,p={},h=0;for(let y=0;y<c.length;y++){const{name:A,fn:v}=c[y],{x:C,y:k,data:S,reset:b}=await v({x:d,y:m,initialPlacement:l,placement:f,strategy:r,middlewareData:p,rects:i,platform:s,elements:{reference:t,floating:n}});d=C??d,m=k??m,p={...p,[A]:{...p[A],...S}},b&&h<=50&&(h++,typeof b=="object"&&(b.placement&&(f=b.placement),b.rects&&(i=b.rects===!0?await s.getElementRects({reference:t,floating:n,strategy:r}):b.rects),{x:d,y:m}=Le(i,f,u)),y=-1)}return{x:d,y:m,placement:f,strategy:r,middlewareData:p}};async function ke(t,n){var o;n===void 0&&(n={});const{x:l,y:r,platform:a,rects:s,elements:c,strategy:u}=t,{boundary:i="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:f=!1,padding:p=0}=ie(n,t),h=Ct(p),A=c[f?m==="floating"?"reference":"floating":m],v=pe(await a.getClippingRect({element:(o=await(a.isElement==null?void 0:a.isElement(A)))==null||o?A:A.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:i,rootBoundary:d,strategy:u})),C=m==="floating"?{x:l,y:r,width:s.floating.width,height:s.floating.height}:s.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),S=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},b=pe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:C,offsetParent:k,strategy:u}):C);return{top:(v.top-b.top+h.top)/S.y,bottom:(b.bottom-v.bottom+h.bottom)/S.y,left:(v.left-b.left+h.left)/S.x,right:(b.right-v.right+h.right)/S.x}}const kt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var o,l;const{placement:r,middlewareData:a,rects:s,initialPlacement:c,platform:u,elements:i}=n,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:y=!0,...A}=ie(t,n);if((o=a.arrow)!=null&&o.alignmentOffset)return{};const v=Y(r),C=z(c),k=Y(c)===c,S=await(u.isRTL==null?void 0:u.isRTL(i.floating)),b=f||(k||!y?[me(c)]:ht(c)),F=h!=="none";!f&&F&&b.push(...At(c,y,h,S));const _=[c,...b],L=await ke(n,A),P=[];let O=((l=a.flip)==null?void 0:l.overflows)||[];if(d&&P.push(L[v]),m){const U=pt(r,s,S);P.push(L[U[0]],L[U[1]])}if(O=[...O,{placement:r,overflows:P}],!P.every(U=>U<=0)){var G,$;const U=(((G=a.flip)==null?void 0:G.index)||0)+1,X=_[U];if(X&&(!(m==="alignment"?C!==z(X):!1)||O.every(V=>z(V.placement)===C?V.overflows[0]>0:!0)))return{data:{index:U,overflows:O},reset:{placement:X}};let x=($=O.filter(E=>E.overflows[0]<=0).sort((E,V)=>E.overflows[1]-V.overflows[1])[0])==null?void 0:$.placement;if(!x)switch(p){case"bestFit":{var D;const E=(D=O.filter(V=>{if(F){const T=z(V.placement);return T===C||T==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(T=>T>0).reduce((T,re)=>T+re,0)]).sort((V,T)=>V[1]-T[1])[0])==null?void 0:D[0];E&&(x=E);break}case"initialPlacement":x=c;break}if(r!==x)return{reset:{placement:x}}}return{}}}},Et=new Set(["left","top"]);async function Vt(t,n){const{placement:o,platform:l,elements:r}=t,a=await(l.isRTL==null?void 0:l.isRTL(r.floating)),s=Y(o),c=ce(o),u=z(o)==="y",i=Et.has(s)?-1:1,d=a&&u?-1:1,m=ie(n,t);let{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),u?{x:p*d,y:f*i}:{x:f*i,y:p*d}}const St=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var o,l;const{x:r,y:a,placement:s,middlewareData:c}=n,u=await Vt(n,t);return s===((o=c.offset)==null?void 0:o.placement)&&(l=c.arrow)!=null&&l.alignmentOffset?{}:{x:r+u.x,y:a+u.y,data:{...u,placement:s}}}}},bt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:o,y:l,placement:r}=n,{mainAxis:a=!0,crossAxis:s=!1,limiter:c={fn:A=>{let{x:v,y:C}=A;return{x:v,y:C}}},...u}=ie(t,n),i={x:o,y:l},d=await ke(n,u),m=z(Y(r)),f=Qe(m);let p=i[f],h=i[m];if(a){const A=f==="y"?"top":"left",v=f==="y"?"bottom":"right",C=p+d[A],k=p-d[v];p=_e(C,p,k)}if(s){const A=m==="y"?"top":"left",v=m==="y"?"bottom":"right",C=h+d[A],k=h-d[v];h=_e(C,h,k)}const y=c.fn({...n,[f]:p,[m]:h});return{...y,data:{x:y.x-o,y:y.y-l,enabled:{[f]:a,[m]:s}}}}}},Nt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(n){var o,l;const{placement:r,rects:a,platform:s,elements:c}=n,{apply:u=()=>{},...i}=ie(t,n),d=await ke(n,i),m=Y(r),f=ce(r),p=z(r)==="y",{width:h,height:y}=a.floating;let A,v;m==="top"||m==="bottom"?(A=m,v=f===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(v=m,A=f==="end"?"top":"bottom");const C=y-d.top-d.bottom,k=h-d.left-d.right,S=ne(y-d[A],C),b=ne(h-d[v],k),F=!n.middlewareData.shift;let _=S,L=b;if((o=n.middlewareData.shift)!=null&&o.enabled.x&&(L=k),(l=n.middlewareData.shift)!=null&&l.enabled.y&&(_=C),F&&!f){const O=M(d.left,0),G=M(d.right,0),$=M(d.top,0),D=M(d.bottom,0);p?L=h-2*(O!==0||G!==0?O+G:M(d.left,d.right)):_=y-2*($!==0||D!==0?$+D:M(d.top,d.bottom))}await u({...n,availableWidth:L,availableHeight:_});const P=await s.getDimensions(c.floating);return h!==P.width||y!==P.height?{reset:{rects:!0}}:{}}}};function he(){return typeof window<"u"}function le(t){return qe(t)?(t.nodeName||"").toLowerCase():"#document"}function I(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function K(t){var n;return(n=(qe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function qe(t){return he()?t instanceof Node||t instanceof I(t).Node:!1}function H(t){return he()?t instanceof Element||t instanceof I(t).Element:!1}function W(t){return he()?t instanceof HTMLElement||t instanceof I(t).HTMLElement:!1}function Me(t){return!he()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof I(t).ShadowRoot}const Bt=new Set(["inline","contents"]);function ue(t){const{overflow:n,overflowX:o,overflowY:l,display:r}=Q(t);return/auto|scroll|overlay|hidden|clip/.test(n+l+o)&&!Bt.has(r)}const Rt=new Set(["table","td","th"]);function Dt(t){return Rt.has(le(t))}const _t=[":popover-open",":modal"];function ve(t){return _t.some(n=>{try{return t.matches(n)}catch{return!1}})}const Ot=["transform","translate","scale","rotate","perspective"],Tt=["transform","translate","scale","rotate","perspective","filter"],Lt=["paint","layout","strict","content"];function Ee(t){const n=Ve(),o=H(t)?Q(t):t;return Ot.some(l=>o[l]?o[l]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||Tt.some(l=>(o.willChange||"").includes(l))||Lt.some(l=>(o.contain||"").includes(l))}function Mt(t){let n=j(t);for(;W(n)&&!oe(n);){if(Ee(n))return n;if(ve(n))return null;n=j(n)}return null}function Ve(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const It=new Set(["html","body","#document"]);function oe(t){return It.has(le(t))}function Q(t){return I(t).getComputedStyle(t)}function ge(t){return H(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function j(t){if(le(t)==="html")return t;const n=t.assignedSlot||t.parentNode||Me(t)&&t.host||K(t);return Me(n)?n.host:n}function We(t){const n=j(t);return oe(n)?t.ownerDocument?t.ownerDocument.body:t.body:W(n)&&ue(n)?n:We(n)}function ae(t,n,o){var l;n===void 0&&(n=[]),o===void 0&&(o=!0);const r=We(t),a=r===((l=t.ownerDocument)==null?void 0:l.body),s=I(r);if(a){const c=Ce(s);return n.concat(s,s.visualViewport||[],ue(r)?r:[],c&&o?ae(c):[])}return n.concat(r,ae(r,[],o))}function Ce(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ke(t){const n=Q(t);let o=parseFloat(n.width)||0,l=parseFloat(n.height)||0;const r=W(t),a=r?t.offsetWidth:o,s=r?t.offsetHeight:l,c=fe(o)!==a||fe(l)!==s;return c&&(o=a,l=s),{width:o,height:l,$:c}}function Se(t){return H(t)?t:t.contextElement}function te(t){const n=Se(t);if(!W(n))return q(1);const o=n.getBoundingClientRect(),{width:l,height:r,$:a}=Ke(n);let s=(a?fe(o.width):o.width)/l,c=(a?fe(o.height):o.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Ft=q(0);function Ge(t){const n=I(t);return!Ve()||!n.visualViewport?Ft:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Pt(t,n,o){return n===void 0&&(n=!1),!o||n&&o!==I(t)?!1:n}function Z(t,n,o,l){n===void 0&&(n=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),a=Se(t);let s=q(1);n&&(l?H(l)&&(s=te(l)):s=te(t));const c=Pt(a,o,l)?Ge(a):q(0);let u=(r.left+c.x)/s.x,i=(r.top+c.y)/s.y,d=r.width/s.x,m=r.height/s.y;if(a){const f=I(a),p=l&&H(l)?I(l):l;let h=f,y=Ce(h);for(;y&&l&&p!==h;){const A=te(y),v=y.getBoundingClientRect(),C=Q(y),k=v.left+(y.clientLeft+parseFloat(C.paddingLeft))*A.x,S=v.top+(y.clientTop+parseFloat(C.paddingTop))*A.y;u*=A.x,i*=A.y,d*=A.x,m*=A.y,u+=k,i+=S,h=I(y),y=Ce(h)}}return pe({width:d,height:m,x:u,y:i})}function ye(t,n){const o=ge(t).scrollLeft;return n?n.left+o:Z(K(t)).left+o}function ze(t,n){const o=t.getBoundingClientRect(),l=o.left+n.scrollLeft-ye(t,o),r=o.top+n.scrollTop;return{x:l,y:r}}function Ut(t){let{elements:n,rect:o,offsetParent:l,strategy:r}=t;const a=r==="fixed",s=K(l),c=n?ve(n.floating):!1;if(l===s||c&&a)return o;let u={scrollLeft:0,scrollTop:0},i=q(1);const d=q(0),m=W(l);if((m||!m&&!a)&&((le(l)!=="body"||ue(s))&&(u=ge(l)),W(l))){const p=Z(l);i=te(l),d.x=p.x+l.clientLeft,d.y=p.y+l.clientTop}const f=s&&!m&&!a?ze(s,u):q(0);return{width:o.width*i.x,height:o.height*i.y,x:o.x*i.x-u.scrollLeft*i.x+d.x+f.x,y:o.y*i.y-u.scrollTop*i.y+d.y+f.y}}function Ht(t){return Array.from(t.getClientRects())}function Qt(t){const n=K(t),o=ge(t),l=t.ownerDocument.body,r=M(n.scrollWidth,n.clientWidth,l.scrollWidth,l.clientWidth),a=M(n.scrollHeight,n.clientHeight,l.scrollHeight,l.clientHeight);let s=-o.scrollLeft+ye(t);const c=-o.scrollTop;return Q(l).direction==="rtl"&&(s+=M(n.clientWidth,l.clientWidth)-r),{width:r,height:a,x:s,y:c}}const Ie=25;function $t(t,n){const o=I(t),l=K(t),r=o.visualViewport;let a=l.clientWidth,s=l.clientHeight,c=0,u=0;if(r){a=r.width,s=r.height;const d=Ve();(!d||d&&n==="fixed")&&(c=r.offsetLeft,u=r.offsetTop)}const i=ye(l);if(i<=0){const d=l.ownerDocument,m=d.body,f=getComputedStyle(m),p=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(l.clientWidth-m.clientWidth-p);h<=Ie&&(a-=h)}else i<=Ie&&(a+=i);return{width:a,height:s,x:c,y:u}}const Jt=new Set(["absolute","fixed"]);function qt(t,n){const o=Z(t,!0,n==="fixed"),l=o.top+t.clientTop,r=o.left+t.clientLeft,a=W(t)?te(t):q(1),s=t.clientWidth*a.x,c=t.clientHeight*a.y,u=r*a.x,i=l*a.y;return{width:s,height:c,x:u,y:i}}function Fe(t,n,o){let l;if(n==="viewport")l=$t(t,o);else if(n==="document")l=Qt(K(t));else if(H(n))l=qt(n,o);else{const r=Ge(t);l={x:n.x-r.x,y:n.y-r.y,width:n.width,height:n.height}}return pe(l)}function Ye(t,n){const o=j(t);return o===n||!H(o)||oe(o)?!1:Q(o).position==="fixed"||Ye(o,n)}function Wt(t,n){const o=n.get(t);if(o)return o;let l=ae(t,[],!1).filter(c=>H(c)&&le(c)!=="body"),r=null;const a=Q(t).position==="fixed";let s=a?j(t):t;for(;H(s)&&!oe(s);){const c=Q(s),u=Ee(s);!u&&c.position==="fixed"&&(r=null),(a?!u&&!r:!u&&c.position==="static"&&!!r&&Jt.has(r.position)||ue(s)&&!u&&Ye(t,s))?l=l.filter(d=>d!==s):r=c,s=j(s)}return n.set(t,l),l}function Kt(t){let{element:n,boundary:o,rootBoundary:l,strategy:r}=t;const s=[...o==="clippingAncestors"?ve(n)?[]:Wt(n,this._c):[].concat(o),l],c=s[0],u=s.reduce((i,d)=>{const m=Fe(n,d,r);return i.top=M(m.top,i.top),i.right=ne(m.right,i.right),i.bottom=ne(m.bottom,i.bottom),i.left=M(m.left,i.left),i},Fe(n,c,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Gt(t){const{width:n,height:o}=Ke(t);return{width:n,height:o}}function zt(t,n,o){const l=W(n),r=K(n),a=o==="fixed",s=Z(t,!0,a,n);let c={scrollLeft:0,scrollTop:0};const u=q(0);function i(){u.x=ye(r)}if(l||!l&&!a)if((le(n)!=="body"||ue(r))&&(c=ge(n)),l){const p=Z(n,!0,a,n);u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}else r&&i();a&&!l&&r&&i();const d=r&&!l&&!a?ze(r,c):q(0),m=s.left+c.scrollLeft-u.x-d.x,f=s.top+c.scrollTop-u.y-d.y;return{x:m,y:f,width:s.width,height:s.height}}function Ae(t){return Q(t).position==="static"}function Pe(t,n){if(!W(t)||Q(t).position==="fixed")return null;if(n)return n(t);let o=t.offsetParent;return K(t)===o&&(o=o.ownerDocument.body),o}function je(t,n){const o=I(t);if(ve(t))return o;if(!W(t)){let r=j(t);for(;r&&!oe(r);){if(H(r)&&!Ae(r))return r;r=j(r)}return o}let l=Pe(t,n);for(;l&&Dt(l)&&Ae(l);)l=Pe(l,n);return l&&oe(l)&&Ae(l)&&!Ee(l)?o:l||Mt(t)||o}const Yt=async function(t){const n=this.getOffsetParent||je,o=this.getDimensions,l=await o(t.floating);return{reference:zt(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function jt(t){return Q(t).direction==="rtl"}const Xt={convertOffsetParentRelativeRectToViewportRelativeRect:Ut,getDocumentElement:K,getClippingRect:Kt,getOffsetParent:je,getElementRects:Yt,getClientRects:Ht,getDimensions:Gt,getScale:te,isElement:H,isRTL:jt};function Xe(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function Zt(t,n){let o=null,l;const r=K(t);function a(){var c;clearTimeout(l),(c=o)==null||c.disconnect(),o=null}function s(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),a();const i=t.getBoundingClientRect(),{left:d,top:m,width:f,height:p}=i;if(c||n(),!f||!p)return;const h=de(m),y=de(r.clientWidth-(d+f)),A=de(r.clientHeight-(m+p)),v=de(d),k={rootMargin:-h+"px "+-y+"px "+-A+"px "+-v+"px",threshold:M(0,ne(1,u))||1};let S=!0;function b(F){const _=F[0].intersectionRatio;if(_!==u){if(!S)return s();_?s(!1,_):l=setTimeout(()=>{s(!1,1e-7)},1e3)}_===1&&!Xe(i,t.getBoundingClientRect())&&s(),S=!1}try{o=new IntersectionObserver(b,{...k,root:r.ownerDocument})}catch{o=new IntersectionObserver(b,k)}o.observe(t)}return s(!0),a}function en(t,n,o,l){l===void 0&&(l={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=l,i=Se(t),d=r||a?[...i?ae(i):[],...ae(n)]:[];d.forEach(v=>{r&&v.addEventListener("scroll",o,{passive:!0}),a&&v.addEventListener("resize",o)});const m=i&&c?Zt(i,o):null;let f=-1,p=null;s&&(p=new ResizeObserver(v=>{let[C]=v;C&&C.target===i&&p&&(p.unobserve(n),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(n)})),o()}),i&&!u&&p.observe(i),p.observe(n));let h,y=u?Z(t):null;u&&A();function A(){const v=Z(t);y&&!Xe(y,v)&&o(),y=v,h=requestAnimationFrame(A)}return o(),()=>{var v;d.forEach(C=>{r&&C.removeEventListener("scroll",o),a&&C.removeEventListener("resize",o)}),m?.(),(v=p)==null||v.disconnect(),p=null,u&&cancelAnimationFrame(h)}}const tn=St,nn=bt,on=kt,ln=Nt,rn=(t,n,o)=>{const l=new Map,r={platform:Xt,...o},a={...r.platform,_c:l};return xt(t,n,{...r,platform:a})};function sn(t,n){const o=e.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let l=null;const r=()=>{!t.value||!n.value||rn(t.value,n.value,{placement:"bottom-start",strategy:"fixed",middleware:[tn(6),on(),nn({padding:10}),ln({apply({rects:c,elements:u}){const i=`${c.reference.width}px`;Object.assign(u.floating.style,{width:i,minWidth:i,maxWidth:i})}})]}).then(({x:c,y:u})=>{Object.assign(o.value,{left:`${c}px`,top:`${u}px`})})},a=()=>{t.value&&n.value&&(l=en(t.value,n.value,r))},s=()=>{l&&(l(),l=null)};return e.onBeforeUnmount(s),{floatingStyles:o,startTrack:a,stopTrack:s}}const an="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACT0lEQVR4AaRSO2hTYRT+zn9v2g6CiktFJYoVHXQoOljM2EIEh0orbRKa5qUuDoIZAnXI4FBwcRDikMcNkoQMQjcVESo4OASsW2kLBi3oUKiD1OZx7/H811wJZFF6uOee85/H93/3nKtwQPkvgFKpdKRgVR+UrFrOsurX9N3/DJCvVPxMwx+lKcbgKzbstPhwAXSyWK7eLZZrc4VCNZDPPx/Tt+kCrTqvOrQqfuNrc2OcgW0CduQM9TfJyIB5mQy8UaaxKbftFq3qL9HP1KGGFDe+NDdC/jPnlwgcZEM9lRiU2VFjgngI4FGxa0I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r7+FwAA//8Pj6q2AAAABklEQVQDAJPeLlNn5TR8AAAAAElFTkSuQmCC",fn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABFUlEQVR4AaRQO07DQBCdWe8B4B5IFFyAK9ARkIVNhIQEEiVtJLgABRVRvIBCJBquwBVyDgoaSnuHeZY3MlYcNsnIb8fze6M3hra0XoKJm95N3Nv3EnyhFvb2EgjRJbOMKqmO2tDcvQ5fK+qvl4CJbOn9/CJPP9tArp5sHtP4lc652VXxPL1Z1hRFIOytF1NuTJCfnT4Ms8HjSgJctn1xIt6hxqIkdK+u8U8zT1ESmP5enUkWmqMkhG2FmxXOvR+EGD5KAhoDqsQvtiMXJQGNQJ4N8mF6PMd/wL8SxuOXPSG21pj9p+L1EOjGyAHoQQ0zWGDqx9pbPWIpwqOEkw+gGyMHoAc1ozOkVhOcZyepYndNpDpPvwAAAP//BVQJHAAAAAZJREFUAwDZWL4hub5xHQAAAABJRU5ErkJggg==",xe="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",mn={class:"search-container"},pn={class:"selection-wrapper"},hn={class:"tag-text"},vn=["onClick"],gn={key:0,class:"search-tag collapse"},yn=["placeholder"],An={class:"suffix-area"},wn={key:1,class:"loading-spinner"},Cn={class:"search-icon"},xn=["src"],kn={key:0,class:"history-section"},En={class:"history-header"},Vn=["onMousedown"],Sn=["src"],bn={class:"type-text"},Nn={class:"result-text"},Bn={key:0,class:"status-msg"},Rn=["onMousedown"],Dn=["src"],_n={class:"type-text"},On={class:"result-text"},Tn={key:0,class:"load-more-msg"},Ln={key:1,class:"load-more-msg no-more"},Mn={key:2,class:"status-msg"},In=e.defineComponent({__name:"index",props:{modelValue:{default:null},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},searchTypeList:{default:()=>["Continent","Country","Region","City","Seaport","Airport"]},historyKey:{default:void 0},lang:{default:""},placeholder:{},showSearchIcon:{type:Boolean,default:!0},showItemTag:{type:Boolean,default:!0}},emits:["update:modelValue","select","change","submit-search","remove"],setup(t,{emit:n}){const o=t,l=n,r=e.ref(null),a=e.ref(null),s=e.ref(null),c=e.ref(""),u=e.ref(""),i=e.ref(!1),d=e.ref(!1);let m=null;const f=e.computed(()=>o.modelValue?Array.isArray(o.modelValue)?o.modelValue:[o.modelValue]:[]),p=e.computed(()=>o.multiple?o.collapseTags?f.value.slice(0,1):f.value:[]),h=e.computed(()=>c.value||f.value.length>0),y=e.computed(()=>o.multiple?c.value?`${c.value.length*10+20}px`:"10px":"100%"),{searchHistory:A,saveToHistory:v,clearHistory:C}=it(e.toRef(o,"historyKey")),{searchResults:k,loading:S,isFetchingMore:b,isFinished:F,currentPage:_,fetchData:L,filterByTypes:P}=ut(c,e.toRef(o,"searchTypeList")),{floatingStyles:O,startTrack:G,stopTrack:$}=sn(a,s),D=e.computed(()=>{if(o.lang)return o.lang==="en"||o.lang==="en-US";try{if(typeof useCookie=="function"){const g=useCookie("jc-language")?.value;if(g)return/^en(-US)?$/.test(g)}}catch{}if(typeof document<"u"){const g=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(g)}try{if(typeof useNuxtApp=="function"){const N=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(N)}}catch{}return!1}),U=e.computed(()=>o.multiple&&f.value.length>0?"":i.value&&!o.multiple?u.value:o.placeholder||D.value?"Please enter...":"请输入..."),X=()=>r.value?.focus(),x=g=>{if(v(g),o.multiple){if(!f.value.some(w=>w.id===g.id)){const w=[...f.value,g];l("update:modelValue",w)}c.value=""}else u.value=ee(g),i.value=!0,c.value="",d.value=!1,l("update:modelValue",g);l("select",g)},E=g=>{const N=f.value.filter(w=>w.id!==g.id);l("update:modelValue",N),l("remove",g)},V=()=>{o.multiple&&!c.value&&f.value.length>0&&E(f.value[f.value.length-1])},T=()=>{c.value="",i.value=!1,u.value="",l("update:modelValue",o.multiple?[]:null)},re=async()=>{if(d.value=!0,!o.multiple&&i.value&&k.value.length===0){const g=o.modelValue;if(g?.id){S.value=!0;try{const N=await De(g.id,g.type);k.value=P(N.records)}finally{S.value=!1}}}},nt=()=>setTimeout(()=>d.value=!1,200),ot=g=>{g.target.value===""&&!o.multiple&&T()},lt=()=>{o.multiple?l("submit-search",f.value):i.value&&l("submit-search",o.modelValue),d.value=!1},rt=g=>{const{scrollTop:N,scrollHeight:w,clientHeight:J}=g.target;N+J>=w-20&&!S.value&&!b.value&&!F.value&&c.value&&L(_.value+1,!0)};e.watch(d,g=>{g?G():$()}),e.watch(c,g=>{if(!g.trim()){k.value=[];return}m&&clearTimeout(m),m=setTimeout(()=>L(1,!1),300)}),e.watch(()=>o.modelValue,async(g,N)=>{if(o.multiple||JSON.stringify(g)===JSON.stringify(N)&&i.value)return;const w=g;if(!w){u.value="",i.value=!1;return}if(typeof w=="object")if(w.id&&w.type&&!w.display)try{const se=(await De(w.id,w.type)).records.find(at=>at.id===w.id);se&&(u.value=ee(se),i.value=!0)}catch(J){console.error("Failed to fetch search item detail:",J)}else u.value=ee(w),i.value=!!u.value;else typeof w=="string"&&(u.value=w,i.value=!!w)},{immediate:!0,deep:!0});const Be=g=>({City:fn,Country:dn,Airport:an,Seaport:un})[g]||cn,ee=g=>D.value?g.displayEn||g.display||"":g.displayCn||g.display||"",Re=g=>{const N={City:{en:"City",cn:"城市"},Country:{en:"Country",cn:"国家"},Region:{en:"Region",cn:"区域"},Airport:{en:"Airport",cn:"机场"},Seaport:{en:"Seaport",cn:"港口"}};return D.value?N[g].en:N[g].cn},st=g=>f.value.some(N=>N.id===g.id);return e.onBeforeUnmount($),(g,N)=>(e.openBlock(),e.createElementBlock("div",mn,[e.createElementVNode("div",{class:e.normalizeClass(["search-input-wrapper",{"is-multiple":t.multiple}]),ref_key:"referenceRef",ref:a,onClick:X},[e.createElementVNode("div",pn,[t.multiple&&f.value.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(w,J)=>(e.openBlock(),e.createElementBlock("div",{key:w.id||J,class:"search-tag"},[e.createElementVNode("span",hn,e.toDisplayString(ee(w)),1),e.createElementVNode("span",{class:"tag-close",onClick:e.withModifiers(se=>E(w),["stop"])},"×",8,vn)]))),128)),t.collapseTags&&f.value.length>1?(e.openBlock(),e.createElementBlock("div",gn," + "+e.toDisplayString(f.value.length-1),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:r,class:e.normalizeClass({"is-selected-state":i.value&&!t.multiple}),"onUpdate:modelValue":N[0]||(N[0]=w=>c.value=w),type:"text",placeholder:U.value,style:e.normalizeStyle({width:y.value}),onFocus:re,onBlur:nt,onInput:ot,onKeydown:e.withKeys(V,["delete"])},null,46,yn),[[e.vModelText,c.value]])]),e.createElementVNode("div",An,[h.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-icon",onMousedown:N[1]||(N[1]=e.withModifiers(()=>{},["prevent"])),onClick:e.withModifiers(T,["stop"])},"ⓧ",32)):e.createCommentVNode("",!0),e.unref(S)&&!e.unref(b)?(e.openBlock(),e.createElementBlock("div",wn)):!e.unref(S)&&t.showSearchIcon?(e.openBlock(),e.createElementBlock("button",{key:2,class:"search-btn",onClick:e.withModifiers(lt,["stop"])},[e.createElementVNode("span",Cn,[e.createElementVNode("img",{src:e.unref(xe),alt:"search"},null,8,xn)])])):e.createCommentVNode("",!0)])],2),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingRef",ref:s,class:"dropdown-list",style:e.normalizeStyle(e.unref(O)),onScroll:rt},[e.renderSlot(g.$slots,"history",{searchHistory:e.unref(A)},()=>[e.unref(A).length>0&&!c.value?(e.openBlock(),e.createElementBlock("div",kn,[e.createElementVNode("div",En,[e.createElementVNode("span",null,e.toDisplayString(D.value?"Recent search":"最近搜索"),1),e.createElementVNode("span",{class:"clear-btn",onMousedown:N[2]||(N[2]=e.withModifiers(()=>{},["prevent"])),onClick:N[3]||(N[3]=e.withModifiers((...w)=>e.unref(C)&&e.unref(C)(...w),["stop"]))},e.toDisplayString(D.value?"Clear":"清空"),33)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(A),(w,J)=>(e.openBlock(),e.createElementBlock("div",{key:"hist-"+J,class:"dropdown-item",onMousedown:se=>x(w)},[e.createElementVNode("div",{class:"category-tag",style:e.normalizeStyle(t.showItemTag?{}:{display:"none"})},[e.createElementVNode("img",{class:"type-icon",src:Be(w.type),alt:""},null,8,Sn),e.createElementVNode("span",bn,e.toDisplayString(Re(w.type)),1)],4),e.createElementVNode("div",Nn,e.toDisplayString(ee(w)),1)],40,Vn))),128)),N[4]||(N[4]=e.createElementVNode("hr",{class:"divider"},null,-1))])):e.createCommentVNode("",!0)],!0),e.unref(S)&&!e.unref(b)?(e.openBlock(),e.createElementBlock("div",Bn,e.toDisplayString(D.value?"Searching...":"正在搜索中..."),1)):e.unref(k).length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(g.$slots,"results",{searchResults:e.unref(k)},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),(w,J)=>(e.openBlock(),e.createElementBlock("div",{key:J,class:e.normalizeClass(["dropdown-item",{"is-active":st(w)}]),onMousedown:se=>x(w)},[e.createElementVNode("div",{class:"category-tag",style:e.normalizeStyle(t.showItemTag?{}:{display:"none"})},[e.createElementVNode("img",{class:"type-icon",src:Be(w.type),alt:""},null,8,Dn),e.createElementVNode("span",_n,e.toDisplayString(Re(w.type)),1)],4),e.createElementVNode("div",On,e.toDisplayString(ee(w)),1)],42,Rn))),128))],!0),e.unref(b)?(e.openBlock(),e.createElementBlock("div",Tn,e.toDisplayString(D.value?"Loading more...":"正在加载更多..."),1)):e.unref(F)&&c.value?(e.openBlock(),e.createElementBlock("div",Ln,e.toDisplayString(D.value?"All results have been loaded":"已加载全部结果"),1)):e.createCommentVNode("",!0)],64)):c.value&&!e.unref(S)?(e.openBlock(),e.createElementBlock("div",Mn,[e.renderSlot(g.$slots,"noData",{},()=>[e.createTextVNode(e.toDisplayString(D.value?`No results found related to "${c.value}".`:`未找到与 "${c.value}" 相关的结果`),1)],!0)])):e.createCommentVNode("",!0)],36),[[e.vShow,d.value&&(e.unref(k).length>0||e.unref(S)||c.value||e.unref(A).length>0)]])]))]))}}),be=(t,n)=>{const o=t.__vccOpts||t;for(const[l,r]of n)o[l]=r;return o},Ne=be(In,[["__scopeId","data-v-da175b2e"]]),Fn={class:"modal-container"},Pn={class:"modal-header"},Un={class:"header-title"},Hn={class:"modal-body"},Qn={class:"form-item"},$n={class:"required"},Jn={class:"input-box"},qn=["placeholder"],Wn={key:0,class:"error-message"},Kn={class:"form-item"},Gn={class:"required"},zn={class:"type-group"},Yn=["onClick"],jn={key:0,class:"check-mark"},Xn={class:"form-item"},Zn={class:"required"},eo={key:0,class:"error-message"},to={class:"modal-footer"},no={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:t=>["en","en-US","zh-CN","cn"].includes(t)},placeholder:{type:String,default:""}},emits:["update:value","confirm"],setup(t,{emit:n}){const o=t,l=n,r=[{typeCn:"城市",typeEn:"City",type:"City"},{typeCn:"海运港口",typeEn:"Port",type:"Seaport"},{typeCn:"机场",typeEn:"Airport",type:"Airport"}],a=e.ref(null),s=e.reactive({name:"",country:""}),c=e.reactive({name:"",type:"City"}),u=e.computed(()=>{if(o.lang)return o.lang==="en"||o.lang==="en-US";try{if(typeof useCookie=="function"){const m=useCookie("jc-language")?.value;if(m)return/^en(-US)?$/.test(m)}}catch{}if(typeof document<"u"){const m=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(m)}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}),i=()=>{s.name="",s.country="",l("update:value",!1)},d=()=>{s.name="",s.country="";let m=!0;c.name.trim()||(s.name="Data name is required",m=!1),a.value||(s.country="Please select a country",m=!1),m&&l("confirm",{...c,country:a.value})};return(m,f)=>t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-mask",onClick:e.withModifiers(i,["self"])},[e.createElementVNode("div",Fn,[e.createElementVNode("div",Pn,[e.createElementVNode("span",Un,e.toDisplayString(u.value?"Apply for data addition":"申请补充数据"),1),e.createElementVNode("div",{class:"close-btn",onClick:i},"×")]),e.createElementVNode("div",Hn,[e.createElementVNode("div",Qn,[e.createElementVNode("label",$n,e.toDisplayString(u.value?"Data To Add":"需补充的数据"),1),e.createElementVNode("div",Jn,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=p=>c.name=p),type:"text",placeholder:t.placeholder??(u.value?" Please enter":"请输入"),class:e.normalizeClass(["custom-input",{"input-error":s.name}]),onInput:f[1]||(f[1]=p=>s.name="")},null,42,qn),[[e.vModelText,c.name]])]),s.name?(e.openBlock(),e.createElementBlock("div",Wn,e.toDisplayString(s.name),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Kn,[e.createElementVNode("label",Gn,e.toDisplayString(u.value?"Type":"所属类别"),1),e.createElementVNode("div",zn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(r,p=>e.createElementVNode("div",{key:p.type,class:e.normalizeClass(["type-btn",{active:c.type===p.type}]),onClick:h=>c.type=p.type},[e.createTextVNode(e.toDisplayString(u.value?p.typeEn:p.typeCn)+" ",1),c.type===p.type?(e.openBlock(),e.createElementBlock("div",jn)):e.createCommentVNode("",!0)],10,Yn)),64))])]),e.createElementVNode("div",Xn,[e.createElementVNode("label",Zn,e.toDisplayString(u.value?"Country":"国家"),1),e.createElementVNode("div",{class:e.normalizeClass({"search-error-wrap":s.country})},[e.createVNode(Ne,{"search-type-list":["Country"],"model-value":a.value,"onUpdate:modelValue":[f[2]||(f[2]=p=>a.value=p),f[3]||(f[3]=p=>s.country="")],style:{margin:"0 auto"},lang:t.lang,placeholder:t.placeholder??(u.value?" Please enter":"请输入")},null,8,["model-value","lang","placeholder"])],2),s.country?(e.openBlock(),e.createElementBlock("div",eo,e.toDisplayString(s.country),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",to,[e.createElementVNode("button",{class:"confirm-btn",onClick:d},e.toDisplayString(u.value?"Submit":"申请补充"),1)])])])):e.createCommentVNode("",!0)}},Ze=be(no,[["__scopeId","data-v-9c778fb9"]]),oo={class:"global-modal-header-custom"},lo={class:"global-modal-body-custom"},ro={class:"global-modal-footer-custom"},et=e.defineComponent({__name:"GlobalModal",setup(t){const n=e.ref(),o=e.ref(!1),l=e.ref({city:"",company:"",email:"",phone:"",name:"",agreement:!1}),r=e.reactive({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:(u,i,d)=>{i?d():d(new Error("请同意隐私政策"))},trigger:"change"}]}),a=()=>{o.value=!1,R.emitter.emit(R.MODAL_ACTION.Close,void 0),n.value?.resetFields()},s=async()=>{n.value&&await n.value.validate(u=>{u&&(R.emitter.emit(R.MODAL_ACTION.Submit,l.value),a(),l.value={city:"",company:"",email:"",phone:"",name:"",agreement:!1})})},c=u=>{o.value=!0};return e.onMounted(()=>{R.emitter.on(R.MODAL_ACTION.Open,c)}),e.onUnmounted(()=>{R.emitter.off(R.MODAL_ACTION.Open,c)}),(u,i)=>(e.openBlock(),e.createBlock(e.unref(B.ElDialog),{modelValue:o.value,"onUpdate:modelValue":i[7]||(i[7]=d=>o.value=d),"before-close":a,"show-close":!1,"close-on-click-modal":!0,width:500,class:"global-modal-custom"},{header:e.withCtx(()=>[e.createElementVNode("div",oo,[i[9]||(i[9]=e.createElementVNode("h2",null,"即刻链接全球货代",-1)),e.createVNode(e.unref(B.ElButton),{link:"",onClick:a,class:"close-button-custom","aria-label":"Close"},{default:e.withCtx(()=>[...i[8]||(i[8]=[e.createElementVNode("span",{style:{"font-size":"2rem"}},"×",-1)])]),_:1})])]),footer:e.withCtx(()=>[e.createElementVNode("div",ro,[e.createVNode(e.unref(B.ElButton),{type:"primary",class:"submit-button-custom",onClick:s},{default:e.withCtx(()=>[...i[11]||(i[11]=[e.createTextVNode(" 加入会员 ",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",lo,[e.createVNode(e.unref(B.ElForm),{model:l.value,rules:r,ref_key:"formRef",ref:n,"label-position":"top",onSubmit:i[6]||(i[6]=e.withModifiers(()=>{},["prevent"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElRow),{gutter:20},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"所在地(城市)",prop:"city"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.city,"onUpdate:modelValue":i[0]||(i[0]=d=>l.value.city=d),placeholder:"请输入城市"},null,8,["modelValue"])]),_:1})]),_:1}),e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"公司名称",prop:"company"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.company,"onUpdate:modelValue":i[1]||(i[1]=d=>l.value.company=d),placeholder:"请输入公司名称"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(B.ElRow),{gutter:20},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"邮箱",prop:"email"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.email,"onUpdate:modelValue":i[2]||(i[2]=d=>l.value.email=d),placeholder:"请输入邮箱"},null,8,["modelValue"])]),_:1})]),_:1}),e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"电话",prop:"phone"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.phone,"onUpdate:modelValue":i[3]||(i[3]=d=>l.value.phone=d),placeholder:"请输入电话"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(B.ElRow),null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCol),{span:24},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"姓名",prop:"name"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.name,"onUpdate:modelValue":i[4]||(i[4]=d=>l.value.name=d),placeholder:"请输入您的全名"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(B.ElFormItem),{prop:"agreement",class:"agreement-item"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCheckbox),{modelValue:l.value.agreement,"onUpdate:modelValue":i[5]||(i[5]=d=>l.value.agreement=d),label:"我同意"},null,8,["modelValue"]),i[10]||(i[10]=e.createElementVNode("a",{href:"#",class:"privacy-link"},"隐私政策",-1))]),_:1})]),_:1},8,["model","rules"])])]),_:1},8,["modelValue"]))}});function so(t){const n=e.ref([]),o="_search_history_cache",l=typeof window<"u"&&typeof localStorage<"u",r=e.computed(()=>(t.value||"")+o),a=e.computed(()=>!!t.value&&t.value!==""),s=u=>{if(!u||!l)return;const i=n.value.filter(m=>m.id&&m.id!==u.id||m.display!==u.display);i.unshift(u);const d=i.slice(0,4);if(a.value){n.value=d;try{localStorage.setItem(r.value,JSON.stringify(d))}catch(m){console.warn("LocalStorage save failed:",m)}}},c=()=>{n.value=[],l&&localStorage.removeItem(r.value)};return e.onMounted(()=>{if(l&&a.value){const u=localStorage.getItem(r.value);if(u)try{n.value=JSON.parse(u)}catch{n.value=[]}}}),{searchHistory:n,saveToHistory:s,clearHistory:c,HasHistory:a}}async function ao(t,n=["Continent","Country","City","Seaport","Airport"],o={}){return R.locationSearchV2.searchByName({keyword:t,displayInfo:n,...o})}function io(t,n){const o=e.ref([]),l=e.ref(!1),r=e.ref(!1),a=e.ref(!1),s=e.ref(1),c=10,u=e.ref(0),i=e.computed(()=>{const f=[...n.value];return f.includes("Country")&&!f.includes("Region")&&f.push("Region"),f}),d=f=>Array.isArray(f)?f.filter(p=>i.value.includes(p.type)):[];return{searchResults:o,loading:l,isFetchingMore:r,isFinished:a,fetchData:async(f=!1)=>{const p=t.value.trim();if(!p){o.value=[],u.value=0,a.value=!1;return}if(f){if(r.value||a.value)return;r.value=!0,s.value+=1}else{if(l.value)return;l.value=!0,s.value=1,a.value=!1}try{const h=await ao(p,n.value,{current:s.value,size:c}),y=d(h.records||[]);f?o.value.push(...y):o.value=y,u.value=h.total||0,(o.value.length>=u.value||y.length<c)&&(a.value=!0)}catch(h){console.error("Search request failed:",h),f&&(s.value-=1)}finally{l.value=!1,r.value=!1}}}}const co={class:"h5-search-container"},uo={class:"trigger-content"},fo=["src"],mo={class:"placeholder-text"},po={key:0,class:"selected-count"},ho={key:1,class:"selected-val"},vo={key:2,class:"placeholder-gray"},go={key:0,class:"h5-modal-root"},yo={class:"h5-drawer-card"},Ao={class:"h5-header"},wo={class:"h5-input-wrapper"},Co=["src"],xo=["placeholder"],ko={key:0,class:"h5-spinner-box"},Eo={key:1,class:"h5-section"},Vo={class:"h5-section-hd"},So={class:"h5-history-grid"},bo=["onClick"],No={key:2,class:"h5-result-list"},Bo=["onClick"],Ro={class:"item-info"},Do={class:"item-name"},_o={key:0,class:"item-sub"},Oo={class:"h5-load-status"},To={key:1,class:"no-more"},Lo={key:3,class:"h5-empty"},Mo=e.defineComponent({__name:"index",props:{modelValue:{},multiple:{type:Boolean,default:!1},lang:{default:"zh-CN"},placeholder:{},historyKey:{}},emits:["update:modelValue","select"],setup(t,{emit:n}){const o=t,l=n,r=e.ref(!1),a=e.ref(""),s=e.ref(null),c=e.ref(null);let u=null;const{searchHistory:i,saveToHistory:d,clearHistory:m}=so(e.toRef(o,"historyKey")),{searchResults:f,loading:p,isFetchingMore:h,isFinished:y,fetchData:A}=io(a,e.ref(["City","Seaport","Airport"])),v=e.computed(()=>{if(o.lang)return o.lang==="en"||o.lang==="en-US";try{if(typeof useCookie=="function"){const x=useCookie("jc-language")?.value;if(x)return/^en(-US)?$/.test(x)}}catch{}if(typeof document<"u"){const x=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(x)}try{if(typeof useNuxtApp=="function"){const E=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(E)}}catch{}return!1}),C=e.computed(()=>Array.isArray(o.modelValue)?o.modelValue:o.modelValue?[o.modelValue]:[]),k=e.computed(()=>!o.multiple&&!!o.modelValue),S=e.computed(()=>k.value?D(o.modelValue):""),b=e.computed(()=>C.value.length>0),F=()=>{r.value=!0,e.nextTick(()=>{s.value?.focus()})},_=()=>{r.value=!1,a.value=""},L=x=>{d(x),o.multiple?C.value.some(V=>V.id===x.id)||l("update:modelValue",[...C.value,x]):(l("update:modelValue",x),_()),l("select",x)},P=()=>{l("update:modelValue",o.multiple?[]:null)},O=e.ref(!1),G=x=>{const E=x.target;if(!E)return;E.scrollTop+E.clientHeight>=E.scrollHeight-80&&a.value&&!p.value&&!h.value&&!y.value&&!O.value&&(O.value=!0,A(!0))};e.watch(h,x=>{x||(O.value=!1)});const $=()=>{u&&clearTimeout(u),u=setTimeout(()=>{O.value=!1,c.value?.scrollTo({top:0}),console.log("🍉 ~ index.vue:279 ~ onInput ~ fetchData:",A),A(!1)},300)},D=x=>v.value?x.displayEn||x.display:x.displayCn||x.display,U=x=>{const E={City:"城市",Seaport:"港口",Airport:"机场"};return v.value?x:E[x]||x},X=x=>C.value.some(E=>E.id===x.id);return(x,E)=>(e.openBlock(),e.createElementBlock("div",co,[e.createElementVNode("div",{class:"search-trigger",onClick:F},[e.createElementVNode("div",uo,[e.createElementVNode("img",{src:e.unref(xe),class:"search-icon-m"},null,8,fo),e.createElementVNode("div",mo,[t.multiple&&C.value.length>0?(e.openBlock(),e.createElementBlock("span",po,e.toDisplayString(v.value?"Selected":"已选")+" ("+e.toDisplayString(C.value.length)+")",1)):!t.multiple&&k.value?(e.openBlock(),e.createElementBlock("span",ho,e.toDisplayString(S.value),1)):(e.openBlock(),e.createElementBlock("span",vo,e.toDisplayString(t.placeholder||(v.value?"Search":"搜索")),1))])]),b.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-trigger",onClick:e.withModifiers(P,["stop"])},"ⓧ")):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[r.value?(e.openBlock(),e.createElementBlock("div",go,[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"h5-mask",onClick:_})]),_:1}),e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.createElementVNode("div",yo,[e.createElementVNode("div",{class:"drawer-handle",onClick:_}),e.createElementVNode("div",Ao,[e.createElementVNode("div",wo,[e.createElementVNode("img",{src:e.unref(xe),class:"inner-icon"},null,8,Co),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:s,"onUpdate:modelValue":E[0]||(E[0]=V=>a.value=V),placeholder:v.value?"City/Port/Airport":"搜索城市/港口/机场",onInput:$},null,40,xo),[[e.vModelText,a.value]]),a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"h5-clear-btn",onClick:E[1]||(E[1]=V=>a.value="")}," ✕ ")):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"h5-cancel-btn",onClick:_},e.toDisplayString(v.value?"Cancel":"取消"),1)]),e.createElementVNode("div",{class:"h5-main-content",ref_key:"scrollContainer",ref:c,onScroll:G},[e.unref(p)&&!e.unref(h)?(e.openBlock(),e.createElementBlock("div",ko,[...E[3]||(E[3]=[e.createElementVNode("div",{class:"h5-spinner"},null,-1)])])):e.createCommentVNode("",!0),!a.value&&e.unref(i).length>0?(e.openBlock(),e.createElementBlock("div",Eo,[e.createElementVNode("div",Vo,[e.createElementVNode("span",null,e.toDisplayString(v.value?"Recent":"最近搜索"),1),e.createElementVNode("span",{class:"h5-clear-history",onClick:E[2]||(E[2]=(...V)=>e.unref(m)&&e.unref(m)(...V))},e.toDisplayString(v.value?"Clear":"清空"),1)]),e.createElementVNode("div",So,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i),(V,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:"h5-history-tag",onClick:re=>L(V)},e.toDisplayString(D(V)),9,bo))),128))])])):e.createCommentVNode("",!0),e.unref(f).length>0?(e.openBlock(),e.createElementBlock("div",No,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f),(V,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:e.normalizeClass(["h5-result-item",{"is-active":X(V)}]),onClick:re=>L(V)},[e.createElementVNode("div",{class:e.normalizeClass(["item-type",V.type.toLowerCase()])},e.toDisplayString(U(V.type)),3),e.createElementVNode("div",Ro,[e.createElementVNode("div",Do,e.toDisplayString(D(V)),1),V.parentName?(e.openBlock(),e.createElementBlock("div",_o,e.toDisplayString(V.parentName),1)):e.createCommentVNode("",!0)])],10,Bo))),128)),e.createElementVNode("div",Oo,[e.unref(h)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[E[4]||(E[4]=e.createElementVNode("div",{class:"mini-spinner"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(v.value?"Loading...":"加载中..."),1)],64)):e.unref(y)&&a.value?(e.openBlock(),e.createElementBlock("span",To,e.toDisplayString(v.value?"No more results":"没有更多结果了"),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),a.value&&!e.unref(p)&&e.unref(f).length===0?(e.openBlock(),e.createElementBlock("div",Lo,e.toDisplayString(v.value?"No Results Found":"未找到相关结果"),1)):e.createCommentVNode("",!0)],544)])]),_:1})])):e.createCommentVNode("",!0)]))]))}}),tt=be(Mo,[["__scopeId","data-v-c1314e9c"]]);let Io={open(){R.emitter.emit(R.MODAL_ACTION.Open)},close(){R.emitter.emit(R.MODAL_ACTION.Close)},onSubmit(t){R.emitter.on(R.MODAL_ACTION.Submit,t)}};function Fo(){let t=!1;return{install(n){if(typeof window<"u"&&!t){const o=document.createElement("div");o.setAttribute("id","global-modal-root"),document.body.appendChild(o),e.createApp(et).mount(o),t=!0}n.config.globalProperties.$globalModal=Io}}}const Ue={ApplyDataDialog:Ze,JcSearch:Ne,JCMSearch:tt};let He=!1;const Po={install(t,n){if(!He){He=!0,n?.sharedConfig&&R.initSharedConfig(n.sharedConfig);for(const o in Ue)t.component(o,Ue[o])}}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>R.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>R.emitter});Object.defineProperty(exports,"initSharedConfig",{enumerable:!0,get:()=>R.initSharedConfig});exports.ApplyDataDialog=Ze;exports.GlobalModal=et;exports.JCMSearch=tt;exports.JcSearch=Ne;exports.createGlobalModalPlugin=Fo;exports.default=Po;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),R=require("@jctrans-materials/shared"),B=require("element-plus");function pt(t){const n=e.ref([]),o="_search_history_cache",l=typeof window<"u"&&typeof localStorage<"u",r=e.computed(()=>(t.value||"")+o),a=e.computed(()=>!!t.value&&t.value!==""),s=u=>{if(!u||!l)return;const c=n.value.filter(m=>m.id&&m.id!==u.id||m.display!==u.display);c.unshift(u);const d=c.slice(0,4);if(a.value){n.value=d;try{localStorage.setItem(r.value,JSON.stringify(d))}catch(m){console.warn("LocalStorage save failed:",m)}}},i=()=>{n.value=[],l&&localStorage.removeItem(r.value)};return e.onMounted(()=>{if(l&&a.value){const u=localStorage.getItem(r.value);if(u)try{n.value=JSON.parse(u)}catch{n.value=[]}}}),{searchHistory:n,saveToHistory:s,clearHistory:i,HasHistory:a}}async function ht(t,n=["Continent","Country","City","Seaport","Airport"],o={}){return R.locationSearchV2.searchByName({keyword:t,displayInfo:n,...o})}const ke=(t,n)=>R.locationSearchV2.searchByIdWithType(t,n);function gt(t,n){const o=e.ref([]),l=e.ref(!1),r=e.ref(!1),a=e.ref(1),s=e.ref(0),i=e.ref(10),u=e.computed(()=>s.value===0?!1:o.value.length>=s.value),c=e.computed(()=>{const f=[...n.value];return f.includes("Country")&&!f.includes("Region")&&f.push("Region"),f}),d=f=>!f||!Array.isArray(f)?[]:f.filter(p=>c.value.includes(p.type));return{searchResults:o,loading:l,isFetchingMore:r,isFinished:u,currentPage:a,total:s,fetchData:async(f=1,p=!1)=>{if(!t.value.trim()&&!p){o.value=[],s.value=0;return}if(!(p&&(r.value||u.value))&&!(!p&&l.value)){p?r.value=!0:(l.value=!0,a.value=1);try{const h=await ht(t.value,n.value,{current:f,size:i.value}),y=h.records||[],A=d(y);p?o.value=[...o.value,...A]:o.value=A,s.value=h.total||0,a.value=f}catch(h){console.error("Failed to fetch search results:",h)}finally{l.value=!1,r.value=!1}}},filterByTypes:d}}const re=Math.min,I=Math.max,he=Math.round,pe=Math.floor,W=t=>({x:t,y:t}),vt={left:"right",right:"left",bottom:"top",top:"bottom"},yt={start:"end",end:"start"};function Ie(t,n,o){return I(t,re(n,o))}function ue(t,n){return typeof t=="function"?t(n):t}function X(t){return t.split("-")[0]}function de(t){return t.split("-")[1]}function Ke(t){return t==="x"?"y":"x"}function Ge(t){return t==="y"?"height":"width"}const At=new Set(["top","bottom"]);function j(t){return At.has(X(t))?"y":"x"}function ze(t){return Ke(j(t))}function wt(t,n,o){o===void 0&&(o=!1);const l=de(t),r=ze(t),a=Ge(r);let s=r==="x"?l===(o?"end":"start")?"right":"left":l==="start"?"bottom":"top";return n.reference[a]>n.floating[a]&&(s=ge(s)),[s,ge(s)]}function Ct(t){const n=ge(t);return[Ve(t),n,Ve(n)]}function Ve(t){return t.replace(/start|end/g,n=>yt[n])}const Fe=["left","right"],Pe=["right","left"],xt=["top","bottom"],kt=["bottom","top"];function Et(t,n,o){switch(t){case"top":case"bottom":return o?n?Pe:Fe:n?Fe:Pe;case"left":case"right":return n?xt:kt;default:return[]}}function Vt(t,n,o,l){const r=de(t);let a=Et(X(t),o==="start",l);return r&&(a=a.map(s=>s+"-"+r),n&&(a=a.concat(a.map(Ve)))),a}function ge(t){return t.replace(/left|right|bottom|top/g,n=>vt[n])}function St(t){return{top:0,right:0,bottom:0,left:0,...t}}function bt(t){return typeof t!="number"?St(t):{top:t,right:t,bottom:t,left:t}}function ve(t){const{x:n,y:o,width:l,height:r}=t;return{width:l,height:r,top:o,left:n,right:n+l,bottom:o+r,x:n,y:o}}function Ue(t,n,o){let{reference:l,floating:r}=t;const a=j(n),s=ze(n),i=Ge(s),u=X(n),c=a==="y",d=l.x+l.width/2-r.width/2,m=l.y+l.height/2-r.height/2,f=l[i]/2-r[i]/2;let p;switch(u){case"top":p={x:d,y:l.y-r.height};break;case"bottom":p={x:d,y:l.y+l.height};break;case"right":p={x:l.x+l.width,y:m};break;case"left":p={x:l.x-r.width,y:m};break;default:p={x:l.x,y:l.y}}switch(de(n)){case"start":p[s]-=f*(o&&c?-1:1);break;case"end":p[s]+=f*(o&&c?-1:1);break}return p}const Nt=async(t,n,o)=>{const{placement:l="bottom",strategy:r="absolute",middleware:a=[],platform:s}=o,i=a.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(n));let c=await s.getElementRects({reference:t,floating:n,strategy:r}),{x:d,y:m}=Ue(c,l,u),f=l,p={},h=0;for(let y=0;y<i.length;y++){const{name:A,fn:v}=i[y],{x:w,y:k,data:S,reset:b}=await v({x:d,y:m,initialPlacement:l,placement:f,strategy:r,middlewareData:p,rects:c,platform:s,elements:{reference:t,floating:n}});d=w??d,m=k??m,p={...p,[A]:{...p[A],...S}},b&&h<=50&&(h++,typeof b=="object"&&(b.placement&&(f=b.placement),b.rects&&(c=b.rects===!0?await s.getElementRects({reference:t,floating:n,strategy:r}):b.rects),{x:d,y:m}=Ue(c,f,u)),y=-1)}return{x:d,y:m,placement:f,strategy:r,middlewareData:p}};async function Ne(t,n){var o;n===void 0&&(n={});const{x:l,y:r,platform:a,rects:s,elements:i,strategy:u}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:m="floating",altBoundary:f=!1,padding:p=0}=ue(n,t),h=bt(p),A=i[f?m==="floating"?"reference":"floating":m],v=ve(await a.getClippingRect({element:(o=await(a.isElement==null?void 0:a.isElement(A)))==null||o?A:A.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:c,rootBoundary:d,strategy:u})),w=m==="floating"?{x:l,y:r,width:s.floating.width,height:s.floating.height}:s.reference,k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),S=await(a.isElement==null?void 0:a.isElement(k))?await(a.getScale==null?void 0:a.getScale(k))||{x:1,y:1}:{x:1,y:1},b=ve(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:w,offsetParent:k,strategy:u}):w);return{top:(v.top-b.top+h.top)/S.y,bottom:(b.bottom-v.bottom+h.bottom)/S.y,left:(v.left-b.left+h.left)/S.x,right:(b.right-v.right+h.right)/S.x}}const Bt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var o,l;const{placement:r,middlewareData:a,rects:s,initialPlacement:i,platform:u,elements:c}=n,{mainAxis:d=!0,crossAxis:m=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:y=!0,...A}=ue(t,n);if((o=a.arrow)!=null&&o.alignmentOffset)return{};const v=X(r),w=j(i),k=X(i)===i,S=await(u.isRTL==null?void 0:u.isRTL(c.floating)),b=f||(k||!y?[ge(i)]:Ct(i)),P=h!=="none";!f&&P&&b.push(...Vt(i,y,h,S));const _=[i,...b],L=await Ne(n,A),U=[];let O=((l=a.flip)==null?void 0:l.overflows)||[];if(d&&U.push(L[v]),m){const H=wt(r,s,S);U.push(L[H[0]],L[H[1]])}if(O=[...O,{placement:r,overflows:U}],!U.every(H=>H<=0)){var z,J;const H=(((z=a.flip)==null?void 0:z.index)||0)+1,ee=_[H];if(ee&&(!(m==="alignment"?w!==j(ee):!1)||O.every(V=>j(V.placement)===w?V.overflows[0]>0:!0)))return{data:{index:H,overflows:O},reset:{placement:ee}};let C=(J=O.filter(E=>E.overflows[0]<=0).sort((E,V)=>E.overflows[1]-V.overflows[1])[0])==null?void 0:J.placement;if(!C)switch(p){case"bestFit":{var D;const E=(D=O.filter(V=>{if(P){const T=j(V.placement);return T===w||T==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(T=>T>0).reduce((T,ie)=>T+ie,0)]).sort((V,T)=>V[1]-T[1])[0])==null?void 0:D[0];E&&(C=E);break}case"initialPlacement":C=i;break}if(r!==C)return{reset:{placement:C}}}return{}}}},Rt=new Set(["left","top"]);async function Dt(t,n){const{placement:o,platform:l,elements:r}=t,a=await(l.isRTL==null?void 0:l.isRTL(r.floating)),s=X(o),i=de(o),u=j(o)==="y",c=Rt.has(s)?-1:1,d=a&&u?-1:1,m=ue(n,t);let{mainAxis:f,crossAxis:p,alignmentAxis:h}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return i&&typeof h=="number"&&(p=i==="end"?h*-1:h),u?{x:p*d,y:f*c}:{x:f*c,y:p*d}}const _t=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var o,l;const{x:r,y:a,placement:s,middlewareData:i}=n,u=await Dt(n,t);return s===((o=i.offset)==null?void 0:o.placement)&&(l=i.arrow)!=null&&l.alignmentOffset?{}:{x:r+u.x,y:a+u.y,data:{...u,placement:s}}}}},Ot=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:o,y:l,placement:r}=n,{mainAxis:a=!0,crossAxis:s=!1,limiter:i={fn:A=>{let{x:v,y:w}=A;return{x:v,y:w}}},...u}=ue(t,n),c={x:o,y:l},d=await Ne(n,u),m=j(X(r)),f=Ke(m);let p=c[f],h=c[m];if(a){const A=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=p+d[A],k=p-d[v];p=Ie(w,p,k)}if(s){const A=m==="y"?"top":"left",v=m==="y"?"bottom":"right",w=h+d[A],k=h-d[v];h=Ie(w,h,k)}const y=i.fn({...n,[f]:p,[m]:h});return{...y,data:{x:y.x-o,y:y.y-l,enabled:{[f]:a,[m]:s}}}}}},Tt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(n){var o,l;const{placement:r,rects:a,platform:s,elements:i}=n,{apply:u=()=>{},...c}=ue(t,n),d=await Ne(n,c),m=X(r),f=de(r),p=j(r)==="y",{width:h,height:y}=a.floating;let A,v;m==="top"||m==="bottom"?(A=m,v=f===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(v=m,A=f==="end"?"top":"bottom");const w=y-d.top-d.bottom,k=h-d.left-d.right,S=re(y-d[A],w),b=re(h-d[v],k),P=!n.middlewareData.shift;let _=S,L=b;if((o=n.middlewareData.shift)!=null&&o.enabled.x&&(L=k),(l=n.middlewareData.shift)!=null&&l.enabled.y&&(_=w),P&&!f){const O=I(d.left,0),z=I(d.right,0),J=I(d.top,0),D=I(d.bottom,0);p?L=h-2*(O!==0||z!==0?O+z:I(d.left,d.right)):_=y-2*(J!==0||D!==0?J+D:I(d.top,d.bottom))}await u({...n,availableWidth:L,availableHeight:_});const U=await s.getDimensions(i.floating);return h!==U.width||y!==U.height?{reset:{rects:!0}}:{}}}};function ye(){return typeof window<"u"}function ae(t){return Ye(t)?(t.nodeName||"").toLowerCase():"#document"}function F(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function G(t){var n;return(n=(Ye(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function Ye(t){return ye()?t instanceof Node||t instanceof F(t).Node:!1}function Q(t){return ye()?t instanceof Element||t instanceof F(t).Element:!1}function K(t){return ye()?t instanceof HTMLElement||t instanceof F(t).HTMLElement:!1}function He(t){return!ye()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof F(t).ShadowRoot}const Lt=new Set(["inline","contents"]);function fe(t){const{overflow:n,overflowX:o,overflowY:l,display:r}=$(t);return/auto|scroll|overlay|hidden|clip/.test(n+l+o)&&!Lt.has(r)}const Mt=new Set(["table","td","th"]);function It(t){return Mt.has(ae(t))}const Ft=[":popover-open",":modal"];function Ae(t){return Ft.some(n=>{try{return t.matches(n)}catch{return!1}})}const Pt=["transform","translate","scale","rotate","perspective"],Ut=["transform","translate","scale","rotate","perspective","filter"],Ht=["paint","layout","strict","content"];function Be(t){const n=Re(),o=Q(t)?$(t):t;return Pt.some(l=>o[l]?o[l]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||Ut.some(l=>(o.willChange||"").includes(l))||Ht.some(l=>(o.contain||"").includes(l))}function Qt(t){let n=Z(t);for(;K(n)&&!se(n);){if(Be(n))return n;if(Ae(n))return null;n=Z(n)}return null}function Re(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const $t=new Set(["html","body","#document"]);function se(t){return $t.has(ae(t))}function $(t){return F(t).getComputedStyle(t)}function we(t){return Q(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Z(t){if(ae(t)==="html")return t;const n=t.assignedSlot||t.parentNode||He(t)&&t.host||G(t);return He(n)?n.host:n}function je(t){const n=Z(t);return se(n)?t.ownerDocument?t.ownerDocument.body:t.body:K(n)&&fe(n)?n:je(n)}function ce(t,n,o){var l;n===void 0&&(n=[]),o===void 0&&(o=!0);const r=je(t),a=r===((l=t.ownerDocument)==null?void 0:l.body),s=F(r);if(a){const i=Se(s);return n.concat(s,s.visualViewport||[],fe(r)?r:[],i&&o?ce(i):[])}return n.concat(r,ce(r,[],o))}function Se(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Xe(t){const n=$(t);let o=parseFloat(n.width)||0,l=parseFloat(n.height)||0;const r=K(t),a=r?t.offsetWidth:o,s=r?t.offsetHeight:l,i=he(o)!==a||he(l)!==s;return i&&(o=a,l=s),{width:o,height:l,$:i}}function De(t){return Q(t)?t:t.contextElement}function le(t){const n=De(t);if(!K(n))return W(1);const o=n.getBoundingClientRect(),{width:l,height:r,$:a}=Xe(n);let s=(a?he(o.width):o.width)/l,i=(a?he(o.height):o.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!i||!Number.isFinite(i))&&(i=1),{x:s,y:i}}const Jt=W(0);function Ze(t){const n=F(t);return!Re()||!n.visualViewport?Jt:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function qt(t,n,o){return n===void 0&&(n=!1),!o||n&&o!==F(t)?!1:n}function ne(t,n,o,l){n===void 0&&(n=!1),o===void 0&&(o=!1);const r=t.getBoundingClientRect(),a=De(t);let s=W(1);n&&(l?Q(l)&&(s=le(l)):s=le(t));const i=qt(a,o,l)?Ze(a):W(0);let u=(r.left+i.x)/s.x,c=(r.top+i.y)/s.y,d=r.width/s.x,m=r.height/s.y;if(a){const f=F(a),p=l&&Q(l)?F(l):l;let h=f,y=Se(h);for(;y&&l&&p!==h;){const A=le(y),v=y.getBoundingClientRect(),w=$(y),k=v.left+(y.clientLeft+parseFloat(w.paddingLeft))*A.x,S=v.top+(y.clientTop+parseFloat(w.paddingTop))*A.y;u*=A.x,c*=A.y,d*=A.x,m*=A.y,u+=k,c+=S,h=F(y),y=Se(h)}}return ve({width:d,height:m,x:u,y:c})}function Ce(t,n){const o=we(t).scrollLeft;return n?n.left+o:ne(G(t)).left+o}function et(t,n){const o=t.getBoundingClientRect(),l=o.left+n.scrollLeft-Ce(t,o),r=o.top+n.scrollTop;return{x:l,y:r}}function Wt(t){let{elements:n,rect:o,offsetParent:l,strategy:r}=t;const a=r==="fixed",s=G(l),i=n?Ae(n.floating):!1;if(l===s||i&&a)return o;let u={scrollLeft:0,scrollTop:0},c=W(1);const d=W(0),m=K(l);if((m||!m&&!a)&&((ae(l)!=="body"||fe(s))&&(u=we(l)),K(l))){const p=ne(l);c=le(l),d.x=p.x+l.clientLeft,d.y=p.y+l.clientTop}const f=s&&!m&&!a?et(s,u):W(0);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-u.scrollLeft*c.x+d.x+f.x,y:o.y*c.y-u.scrollTop*c.y+d.y+f.y}}function Kt(t){return Array.from(t.getClientRects())}function Gt(t){const n=G(t),o=we(t),l=t.ownerDocument.body,r=I(n.scrollWidth,n.clientWidth,l.scrollWidth,l.clientWidth),a=I(n.scrollHeight,n.clientHeight,l.scrollHeight,l.clientHeight);let s=-o.scrollLeft+Ce(t);const i=-o.scrollTop;return $(l).direction==="rtl"&&(s+=I(n.clientWidth,l.clientWidth)-r),{width:r,height:a,x:s,y:i}}const Qe=25;function zt(t,n){const o=F(t),l=G(t),r=o.visualViewport;let a=l.clientWidth,s=l.clientHeight,i=0,u=0;if(r){a=r.width,s=r.height;const d=Re();(!d||d&&n==="fixed")&&(i=r.offsetLeft,u=r.offsetTop)}const c=Ce(l);if(c<=0){const d=l.ownerDocument,m=d.body,f=getComputedStyle(m),p=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(l.clientWidth-m.clientWidth-p);h<=Qe&&(a-=h)}else c<=Qe&&(a+=c);return{width:a,height:s,x:i,y:u}}const Yt=new Set(["absolute","fixed"]);function jt(t,n){const o=ne(t,!0,n==="fixed"),l=o.top+t.clientTop,r=o.left+t.clientLeft,a=K(t)?le(t):W(1),s=t.clientWidth*a.x,i=t.clientHeight*a.y,u=r*a.x,c=l*a.y;return{width:s,height:i,x:u,y:c}}function $e(t,n,o){let l;if(n==="viewport")l=zt(t,o);else if(n==="document")l=Gt(G(t));else if(Q(n))l=jt(n,o);else{const r=Ze(t);l={x:n.x-r.x,y:n.y-r.y,width:n.width,height:n.height}}return ve(l)}function tt(t,n){const o=Z(t);return o===n||!Q(o)||se(o)?!1:$(o).position==="fixed"||tt(o,n)}function Xt(t,n){const o=n.get(t);if(o)return o;let l=ce(t,[],!1).filter(i=>Q(i)&&ae(i)!=="body"),r=null;const a=$(t).position==="fixed";let s=a?Z(t):t;for(;Q(s)&&!se(s);){const i=$(s),u=Be(s);!u&&i.position==="fixed"&&(r=null),(a?!u&&!r:!u&&i.position==="static"&&!!r&&Yt.has(r.position)||fe(s)&&!u&&tt(t,s))?l=l.filter(d=>d!==s):r=i,s=Z(s)}return n.set(t,l),l}function Zt(t){let{element:n,boundary:o,rootBoundary:l,strategy:r}=t;const s=[...o==="clippingAncestors"?Ae(n)?[]:Xt(n,this._c):[].concat(o),l],i=s[0],u=s.reduce((c,d)=>{const m=$e(n,d,r);return c.top=I(m.top,c.top),c.right=re(m.right,c.right),c.bottom=re(m.bottom,c.bottom),c.left=I(m.left,c.left),c},$e(n,i,r));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function en(t){const{width:n,height:o}=Xe(t);return{width:n,height:o}}function tn(t,n,o){const l=K(n),r=G(n),a=o==="fixed",s=ne(t,!0,a,n);let i={scrollLeft:0,scrollTop:0};const u=W(0);function c(){u.x=Ce(r)}if(l||!l&&!a)if((ae(n)!=="body"||fe(r))&&(i=we(n)),l){const p=ne(n,!0,a,n);u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}else r&&c();a&&!l&&r&&c();const d=r&&!l&&!a?et(r,i):W(0),m=s.left+i.scrollLeft-u.x-d.x,f=s.top+i.scrollTop-u.y-d.y;return{x:m,y:f,width:s.width,height:s.height}}function Ee(t){return $(t).position==="static"}function Je(t,n){if(!K(t)||$(t).position==="fixed")return null;if(n)return n(t);let o=t.offsetParent;return G(t)===o&&(o=o.ownerDocument.body),o}function nt(t,n){const o=F(t);if(Ae(t))return o;if(!K(t)){let r=Z(t);for(;r&&!se(r);){if(Q(r)&&!Ee(r))return r;r=Z(r)}return o}let l=Je(t,n);for(;l&&It(l)&&Ee(l);)l=Je(l,n);return l&&se(l)&&Ee(l)&&!Be(l)?o:l||Qt(t)||o}const nn=async function(t){const n=this.getOffsetParent||nt,o=this.getDimensions,l=await o(t.floating);return{reference:tn(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function on(t){return $(t).direction==="rtl"}const ln={convertOffsetParentRelativeRectToViewportRelativeRect:Wt,getDocumentElement:G,getClippingRect:Zt,getOffsetParent:nt,getElementRects:nn,getClientRects:Kt,getDimensions:en,getScale:le,isElement:Q,isRTL:on};function ot(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function rn(t,n){let o=null,l;const r=G(t);function a(){var i;clearTimeout(l),(i=o)==null||i.disconnect(),o=null}function s(i,u){i===void 0&&(i=!1),u===void 0&&(u=1),a();const c=t.getBoundingClientRect(),{left:d,top:m,width:f,height:p}=c;if(i||n(),!f||!p)return;const h=pe(m),y=pe(r.clientWidth-(d+f)),A=pe(r.clientHeight-(m+p)),v=pe(d),k={rootMargin:-h+"px "+-y+"px "+-A+"px "+-v+"px",threshold:I(0,re(1,u))||1};let S=!0;function b(P){const _=P[0].intersectionRatio;if(_!==u){if(!S)return s();_?s(!1,_):l=setTimeout(()=>{s(!1,1e-7)},1e3)}_===1&&!ot(c,t.getBoundingClientRect())&&s(),S=!1}try{o=new IntersectionObserver(b,{...k,root:r.ownerDocument})}catch{o=new IntersectionObserver(b,k)}o.observe(t)}return s(!0),a}function sn(t,n,o,l){l===void 0&&(l={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:u=!1}=l,c=De(t),d=r||a?[...c?ce(c):[],...ce(n)]:[];d.forEach(v=>{r&&v.addEventListener("scroll",o,{passive:!0}),a&&v.addEventListener("resize",o)});const m=c&&i?rn(c,o):null;let f=-1,p=null;s&&(p=new ResizeObserver(v=>{let[w]=v;w&&w.target===c&&p&&(p.unobserve(n),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(n)})),o()}),c&&!u&&p.observe(c),p.observe(n));let h,y=u?ne(t):null;u&&A();function A(){const v=ne(t);y&&!ot(y,v)&&o(),y=v,h=requestAnimationFrame(A)}return o(),()=>{var v;d.forEach(w=>{r&&w.removeEventListener("scroll",o),a&&w.removeEventListener("resize",o)}),m?.(),(v=p)==null||v.disconnect(),p=null,u&&cancelAnimationFrame(h)}}const an=_t,cn=Ot,un=Bt,dn=Tt,fn=(t,n,o)=>{const l=new Map,r={platform:ln,...o},a={...r.platform,_c:l};return Nt(t,n,{...r,platform:a})};function mn(t,n){const o=e.ref({position:"fixed",left:"0",top:"0",zIndex:3e3});let l=null;const r=()=>{!t.value||!n.value||fn(t.value,n.value,{placement:"bottom-start",strategy:"fixed",middleware:[an(6),un(),cn({padding:10}),dn({apply({rects:i,elements:u}){const c=`${i.reference.width}px`;Object.assign(u.floating.style,{width:c,minWidth:c,maxWidth:c})}})]}).then(({x:i,y:u})=>{Object.assign(o.value,{left:`${i}px`,top:`${u}px`})})},a=()=>{t.value&&n.value&&(l=sn(t.value,n.value,r))},s=()=>{l&&(l(),l=null)};return e.onBeforeUnmount(s),{floatingStyles:o,startTrack:a,stopTrack:s}}const pn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACT0lEQVR4AaRSO2hTYRT+zn9v2g6CiktFJYoVHXQoOljM2EIEh0orbRKa5qUuDoIZAnXI4FBwcRDikMcNkoQMQjcVESo4OASsW2kLBi3oUKiD1OZx7/H811wJZFF6uOee85/H93/3nKtwQPkvgFKpdKRgVR+UrFrOsurX9N3/DJCvVPxMwx+lKcbgKzbstPhwAXSyWK7eLZZrc4VCNZDPPx/Tt+kCrTqvOrQqfuNrc2OcgW0CduQM9TfJyIB5mQy8UaaxKbftFq3qL9HP1KGGFDe+NDdC/jPnlwgcZEM9lRiU2VFjgngI4FGxa0IvZXecU07XPsc2pkCUIULaa2Z2MsJ7Orkw/8kFiMVCb4XWcQV14w8temL4aJNM47Fh0OHEYqieWAyXT/jPBhzmh7o5EY28Rk/cGWSz2a4GSsTCt3tgs5qmDc726sTQvsS6/c0SFDz97lO/329K4z2Amm1u3ZK11SyrOmNC/ZDYSElWiT5R2resymUZ1pIUv2Qa+iafcrrFretDNJwTf94GUnt7u9u6to3hUW09dQEcIC+BR0LxqgztPnFrotd8wWHclNykaR4dYeCngj0IQNyekOQshLas8hmzLyA3B2UTU6l4eEX8Ld8IZsTu+Mg4hj5xGcTj8f1kLPxChjgO0AdWlAOwnkotbImFrHGFGdOy6u82aJAB+kUZywQ6KaH3ou7TcbguziRApiLWOXjiMvAO2iaic3rH6wxe1Wetd+KRNQKEDV9kwisd83QAQCfkr7uUjEUq2vdUgdJQFExEw++8mLa/AQAA//9h0VsEAAAABklEQVQDAKhs6Pxd3K8TAAAAAElFTkSuQmCC",hn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAA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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",An={class:"search-container"},wn={class:"selection-wrapper"},Cn={class:"tag-text"},xn=["onClick"],kn={key:0,class:"search-tag collapse"},En=["placeholder"],Vn={class:"suffix-area"},Sn={key:1,class:"loading-spinner"},bn={class:"search-icon"},Nn=["src"],Bn={key:0,class:"history-section"},Rn={class:"history-header"},Dn=["onMousedown"],_n=["src"],On={class:"type-text"},Tn={class:"result-text"},Ln={key:0,class:"status-msg"},Mn=["onMousedown"],In=["src"],Fn={class:"type-text"},Pn={class:"result-text"},Un={key:0,class:"load-more-msg"},Hn={key:1,class:"load-more-msg no-more"},Qn={key:2,class:"status-msg"},$n=e.defineComponent({__name:"index",props:{modelValue:{default:null},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},searchTypeList:{default:()=>["Continent","Country","Region","City","Seaport","Airport"]},historyKey:{default:void 0},lang:{default:""},placeholder:{},showSearchIcon:{type:Boolean,default:!0},showItemTag:{type:Boolean,default:!0}},emits:["update:modelValue","select","change","submit-search","remove"],setup(t,{emit:n}){const o=t,l=n,r=e.ref(null),a=e.ref(null),s=e.ref(null),i=e.ref(""),u=e.ref(""),c=e.ref(!1),d=e.ref(!1);let m=null;const f=e.computed(()=>o.modelValue?Array.isArray(o.modelValue)?o.modelValue:[o.modelValue]:[]),p=e.computed(()=>o.multiple?o.collapseTags?f.value.slice(0,1):f.value:[]),h=e.computed(()=>i.value||f.value.length>0),y=e.computed(()=>o.multiple?i.value?`${i.value.length*10+20}px`:"10px":"100%"),{searchHistory:A,saveToHistory:v,clearHistory:w}=pt(e.toRef(o,"historyKey")),{searchResults:k,loading:S,isFetchingMore:b,isFinished:P,currentPage:_,fetchData:L,filterByTypes:U}=gt(i,e.toRef(o,"searchTypeList")),{floatingStyles:O,startTrack:z,stopTrack:J}=mn(a,s),D=e.computed(()=>{if(o.lang)return o.lang==="en"||o.lang==="en-US";try{if(typeof useCookie=="function"){const g=useCookie("jc-language")?.value;if(g)return/^en(-US)?$/.test(g)}}catch{}if(typeof document<"u"){const g=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(g)}try{if(typeof useNuxtApp=="function"){const N=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(N)}}catch{}return!1}),H=e.computed(()=>o.multiple&&f.value.length>0?"":c.value&&!o.multiple?u.value:o.placeholder?o.placeholder:D.value?"Please enter...":"请输入..."),ee=()=>r.value?.focus(),C=g=>{if(v(g),o.multiple){if(!f.value.some(x=>x.id===g.id)){const x=[...f.value,g];l("update:modelValue",x)}i.value=""}else u.value=oe(g),c.value=!0,i.value="",d.value=!1,l("update:modelValue",g);l("select",g),l("change",g)},E=g=>{const N=f.value.filter(x=>x.id!==g.id);l("update:modelValue",N),l("remove",g)},V=()=>{o.multiple&&!i.value&&f.value.length>0&&E(f.value[f.value.length-1])},T=()=>{i.value="",c.value=!1,u.value="",l("update:modelValue",o.multiple?[]:null)},ie=async()=>{if(d.value=!0,!o.multiple&&c.value&&k.value.length===0){const g=o.modelValue;if(g?.id){S.value=!0;try{const N=await ke(g.id,g.type);k.value=U(N.records)}finally{S.value=!1}}}},at=()=>setTimeout(()=>d.value=!1,200),it=g=>{g.target.value===""&&!o.multiple&&T()},ct=()=>{l("submit-search",f.value),d.value=!1},ut=g=>{const{scrollTop:N,scrollHeight:x,clientHeight:M}=g.target;N+M>=x-20&&!S.value&&!b.value&&!P.value&&i.value&&L(_.value+1,!0)};e.watch(d,g=>{g?z():J()}),e.watch(i,g=>{if(!g.trim()){k.value=[];return}m&&clearTimeout(m),m=setTimeout(()=>L(1,!1),300)}),e.watch(()=>o.modelValue,async(g,N)=>{if(JSON.stringify(g)===JSON.stringify(N))return;if(o.multiple&&Array.isArray(g)){const M=[...g],Y=M.filter(q=>q&&q.id&&q.type&&!q.display);if(Y.length>0)try{const q=Y.map(te=>te.id).filter(te=>te!=null),xe=await ke(q,Y[0].type);if(xe&&xe.records){let te=!1;const ft=M.map(me=>{const Me=xe.records.find(mt=>mt.id===me.id);return Me&&!me.display?(te=!0,{...me,...Me}):me});te&&l("update:modelValue",ft)}}catch(q){console.error("Batch fetch detail failed:",q)}return}const x=g;if(!x){c.value=!1,u.value="";return}if(typeof x=="object")if(x.id&&x.type&&!x.display)try{const Y=(await ke(x.id,x.type)).records.find(q=>q.id===x.id);Y&&(u.value=oe(Y),c.value=!0)}catch(M){console.error("Single fetch detail failed:",M)}else u.value=oe(x),c.value=!!u.value;else u.value=String(x),c.value=!!x},{immediate:!0,deep:!0});const Te=g=>({City:yn,Country:vn,Airport:pn,Seaport:gn})[g]||hn,oe=g=>D.value?g.displayEn||g.display||"":g.displayCn||g.display||"",Le=g=>{const N={City:{en:"City",cn:"城市"},Country:{en:"Country",cn:"国家"},Region:{en:"Region",cn:"区域"},Airport:{en:"Airport",cn:"机场"},Seaport:{en:"Seaport",cn:"港口"}};return D.value?N[g].en:N[g].cn},dt=g=>f.value.some(N=>N.id===g.id);return e.onBeforeUnmount(J),(g,N)=>(e.openBlock(),e.createElementBlock("div",An,[e.createElementVNode("div",{class:e.normalizeClass(["search-input-wrapper",{"is-multiple":t.multiple}]),ref_key:"referenceRef",ref:a,onClick:ee},[e.createElementVNode("div",wn,[t.multiple&&f.value.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(x,M)=>(e.openBlock(),e.createElementBlock("div",{key:x.id||M,class:"search-tag"},[e.createElementVNode("span",Cn,e.toDisplayString(oe(x)),1),e.createElementVNode("span",{class:"tag-close",onClick:e.withModifiers(Y=>E(x),["stop"])},"×",8,xn)]))),128)),t.collapseTags&&f.value.length>1?(e.openBlock(),e.createElementBlock("div",kn," + "+e.toDisplayString(f.value.length-1),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:r,class:e.normalizeClass({"is-selected-state":c.value&&!t.multiple}),"onUpdate:modelValue":N[0]||(N[0]=x=>i.value=x),type:"text",placeholder:H.value,style:e.normalizeStyle({width:y.value}),onFocus:ie,onBlur:at,onInput:it,onKeydown:e.withKeys(V,["delete"])},null,46,En),[[e.vModelText,i.value]])]),e.createElementVNode("div",Vn,[h.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-icon",onMousedown:N[1]||(N[1]=e.withModifiers(()=>{},["prevent"])),onClick:e.withModifiers(T,["stop"])},"ⓧ",32)):e.createCommentVNode("",!0),e.unref(S)&&!e.unref(b)?(e.openBlock(),e.createElementBlock("div",Sn)):!e.unref(S)&&t.showSearchIcon?(e.openBlock(),e.createElementBlock("button",{key:2,class:"search-btn",onClick:e.withModifiers(ct,["stop"])},[e.createElementVNode("span",bn,[e.createElementVNode("img",{src:e.unref(be),alt:"search"},null,8,Nn)])])):e.createCommentVNode("",!0)])],2),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingRef",ref:s,class:"dropdown-list",style:e.normalizeStyle(e.unref(O)),onScroll:ut},[e.renderSlot(g.$slots,"history",{searchHistory:e.unref(A)},()=>[e.unref(A).length>0&&!i.value?(e.openBlock(),e.createElementBlock("div",Bn,[e.createElementVNode("div",Rn,[e.createElementVNode("span",null,e.toDisplayString(D.value?"Recent search":"最近搜索"),1),e.createElementVNode("span",{class:"clear-btn",onMousedown:N[2]||(N[2]=e.withModifiers(()=>{},["prevent"])),onClick:N[3]||(N[3]=e.withModifiers((...x)=>e.unref(w)&&e.unref(w)(...x),["stop"]))},e.toDisplayString(D.value?"Clear":"清空"),33)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(A),(x,M)=>(e.openBlock(),e.createElementBlock("div",{key:"hist-"+M,class:"dropdown-item",onMousedown:Y=>C(x)},[e.createElementVNode("div",{class:"category-tag",style:e.normalizeStyle(t.showItemTag?{}:{display:"none"})},[e.createElementVNode("img",{class:"type-icon",src:Te(x.type),alt:""},null,8,_n),e.createElementVNode("span",On,e.toDisplayString(Le(x.type)),1)],4),e.createElementVNode("div",Tn,e.toDisplayString(oe(x)),1)],40,Dn))),128)),N[4]||(N[4]=e.createElementVNode("hr",{class:"divider"},null,-1))])):e.createCommentVNode("",!0)],!0),e.unref(S)&&!e.unref(b)?(e.openBlock(),e.createElementBlock("div",Ln,e.toDisplayString(D.value?"Searching...":"正在搜索中..."),1)):e.unref(k).length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(g.$slots,"results",{searchResults:e.unref(k)},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),(x,M)=>(e.openBlock(),e.createElementBlock("div",{key:M,class:e.normalizeClass(["dropdown-item",{"is-active":dt(x)}]),onMousedown:Y=>C(x)},[e.createElementVNode("div",{class:"category-tag",style:e.normalizeStyle(t.showItemTag?{}:{display:"none"})},[e.createElementVNode("img",{class:"type-icon",src:Te(x.type),alt:""},null,8,In),e.createElementVNode("span",Fn,e.toDisplayString(Le(x.type)),1)],4),e.createElementVNode("div",Pn,e.toDisplayString(oe(x)),1)],42,Mn))),128))],!0),e.unref(b)?(e.openBlock(),e.createElementBlock("div",Un,e.toDisplayString(D.value?"Loading more...":"正在加载更多..."),1)):e.unref(P)&&i.value?(e.openBlock(),e.createElementBlock("div",Hn,e.toDisplayString(D.value?"All results have been loaded":"已加载全部结果"),1)):e.createCommentVNode("",!0)],64)):i.value&&!e.unref(S)?(e.openBlock(),e.createElementBlock("div",Qn,[e.renderSlot(g.$slots,"noData",{},()=>[e.createTextVNode(e.toDisplayString(D.value?`No results found related to "${i.value}".`:`未找到与 "${i.value}" 相关的结果`),1)],!0)])):e.createCommentVNode("",!0)],36),[[e.vShow,d.value&&(e.unref(k).length>0||e.unref(S)||i.value||e.unref(A).length>0)]])]))]))}}),_e=(t,n)=>{const o=t.__vccOpts||t;for(const[l,r]of n)o[l]=r;return o},Oe=_e($n,[["__scopeId","data-v-af778256"]]),Jn={class:"modal-container"},qn={class:"modal-header"},Wn={class:"header-title"},Kn={class:"modal-body"},Gn={class:"form-item"},zn={class:"required"},Yn={class:"input-box"},jn=["placeholder"],Xn={key:0,class:"error-message"},Zn={class:"form-item"},eo={class:"required"},to={class:"type-group"},no=["onClick"],oo={key:0,class:"check-mark"},lo={class:"form-item"},ro={class:"required"},so={key:0,class:"error-message"},ao={class:"modal-footer"},io={__name:"ApplyDataDialog",props:{value:{type:Boolean,default:!1},lang:{type:String,default:"en",validator:t=>["en","en-US","zh-CN","cn"].includes(t)},placeholder:{type:String,default:""}},emits:["update:value","confirm"],setup(t,{emit:n}){const o=t,l=n,r=[{typeCn:"城市",typeEn:"City",type:"City"},{typeCn:"海运港口",typeEn:"Port",type:"Seaport"},{typeCn:"机场",typeEn:"Airport",type:"Airport"}],a=e.ref(null),s=e.reactive({name:"",country:""}),i=e.reactive({name:"",type:"City"}),u=e.computed(()=>{if(o.lang)return o.lang==="en"||o.lang==="en-US";try{if(typeof useCookie=="function"){const m=useCookie("jc-language")?.value;if(m)return/^en(-US)?$/.test(m)}}catch{}if(typeof document<"u"){const m=document.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(m)}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}),c=()=>{s.name="",s.country="",l("update:value",!1)},d=()=>{s.name="",s.country="";let m=!0;i.name.trim()||(s.name="Data name is required",m=!1),a.value||(s.country="Please select a country",m=!1),m&&l("confirm",{...i,country:a.value})};return(m,f)=>t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-mask",onClick:e.withModifiers(c,["self"])},[e.createElementVNode("div",Jn,[e.createElementVNode("div",qn,[e.createElementVNode("span",Wn,e.toDisplayString(u.value?"Apply for data addition":"申请补充数据"),1),e.createElementVNode("div",{class:"close-btn",onClick:c},"×")]),e.createElementVNode("div",Kn,[e.createElementVNode("div",Gn,[e.createElementVNode("label",zn,e.toDisplayString(u.value?"Data To Add":"需补充的数据"),1),e.createElementVNode("div",Yn,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[0]||(f[0]=p=>i.name=p),type:"text",placeholder:t.placeholder??(u.value?" Please enter":"请输入"),class:e.normalizeClass(["custom-input",{"input-error":s.name}]),onInput:f[1]||(f[1]=p=>s.name="")},null,42,jn),[[e.vModelText,i.name]])]),s.name?(e.openBlock(),e.createElementBlock("div",Xn,e.toDisplayString(s.name),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Zn,[e.createElementVNode("label",eo,e.toDisplayString(u.value?"Type":"所属类别"),1),e.createElementVNode("div",to,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(r,p=>e.createElementVNode("div",{key:p.type,class:e.normalizeClass(["type-btn",{active:i.type===p.type}]),onClick:h=>i.type=p.type},[e.createTextVNode(e.toDisplayString(u.value?p.typeEn:p.typeCn)+" ",1),i.type===p.type?(e.openBlock(),e.createElementBlock("div",oo)):e.createCommentVNode("",!0)],10,no)),64))])]),e.createElementVNode("div",lo,[e.createElementVNode("label",ro,e.toDisplayString(u.value?"Country":"国家"),1),e.createElementVNode("div",{class:e.normalizeClass({"search-error-wrap":s.country})},[e.createVNode(Oe,{"search-type-list":["Country"],"model-value":a.value,"onUpdate:modelValue":[f[2]||(f[2]=p=>a.value=p),f[3]||(f[3]=p=>s.country="")],style:{margin:"0 auto"},lang:t.lang,placeholder:t.placeholder??(u.value?" Please enter":"请输入")},null,8,["model-value","lang","placeholder"])],2),s.country?(e.openBlock(),e.createElementBlock("div",so,e.toDisplayString(s.country),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ao,[e.createElementVNode("button",{class:"confirm-btn",onClick:d},e.toDisplayString(u.value?"Submit":"申请补充"),1)])])])):e.createCommentVNode("",!0)}},lt=_e(io,[["__scopeId","data-v-9c778fb9"]]),co={class:"global-modal-header-custom"},uo={class:"global-modal-body-custom"},fo={class:"global-modal-footer-custom"},rt=e.defineComponent({__name:"GlobalModal",setup(t){const n=e.ref(),o=e.ref(!1),l=e.ref({city:"",company:"",email:"",phone:"",name:"",agreement:!1}),r=e.reactive({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:(u,c,d)=>{c?d():d(new Error("请同意隐私政策"))},trigger:"change"}]}),a=()=>{o.value=!1,R.emitter.emit(R.MODAL_ACTION.Close,void 0),n.value?.resetFields()},s=async()=>{n.value&&await n.value.validate(u=>{u&&(R.emitter.emit(R.MODAL_ACTION.Submit,l.value),a(),l.value={city:"",company:"",email:"",phone:"",name:"",agreement:!1})})},i=u=>{o.value=!0};return e.onMounted(()=>{R.emitter.on(R.MODAL_ACTION.Open,i)}),e.onUnmounted(()=>{R.emitter.off(R.MODAL_ACTION.Open,i)}),(u,c)=>(e.openBlock(),e.createBlock(e.unref(B.ElDialog),{modelValue:o.value,"onUpdate:modelValue":c[7]||(c[7]=d=>o.value=d),"before-close":a,"show-close":!1,"close-on-click-modal":!0,width:500,class:"global-modal-custom"},{header:e.withCtx(()=>[e.createElementVNode("div",co,[c[9]||(c[9]=e.createElementVNode("h2",null,"即刻链接全球货代",-1)),e.createVNode(e.unref(B.ElButton),{link:"",onClick:a,class:"close-button-custom","aria-label":"Close"},{default:e.withCtx(()=>[...c[8]||(c[8]=[e.createElementVNode("span",{style:{"font-size":"2rem"}},"×",-1)])]),_:1})])]),footer:e.withCtx(()=>[e.createElementVNode("div",fo,[e.createVNode(e.unref(B.ElButton),{type:"primary",class:"submit-button-custom",onClick:s},{default:e.withCtx(()=>[...c[11]||(c[11]=[e.createTextVNode(" 加入会员 ",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",uo,[e.createVNode(e.unref(B.ElForm),{model:l.value,rules:r,ref_key:"formRef",ref:n,"label-position":"top",onSubmit:c[6]||(c[6]=e.withModifiers(()=>{},["prevent"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElRow),{gutter:20},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"所在地(城市)",prop:"city"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.city,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value.city=d),placeholder:"请输入城市"},null,8,["modelValue"])]),_:1})]),_:1}),e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"公司名称",prop:"company"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.company,"onUpdate:modelValue":c[1]||(c[1]=d=>l.value.company=d),placeholder:"请输入公司名称"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(B.ElRow),{gutter:20},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"邮箱",prop:"email"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.email,"onUpdate:modelValue":c[2]||(c[2]=d=>l.value.email=d),placeholder:"请输入邮箱"},null,8,["modelValue"])]),_:1})]),_:1}),e.createVNode(e.unref(B.ElCol),{span:12},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"电话",prop:"phone"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.phone,"onUpdate:modelValue":c[3]||(c[3]=d=>l.value.phone=d),placeholder:"请输入电话"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(B.ElRow),null,{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCol),{span:24},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElFormItem),{label:"姓名",prop:"name"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElInput),{modelValue:l.value.name,"onUpdate:modelValue":c[4]||(c[4]=d=>l.value.name=d),placeholder:"请输入您的全名"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(B.ElFormItem),{prop:"agreement",class:"agreement-item"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.ElCheckbox),{modelValue:l.value.agreement,"onUpdate:modelValue":c[5]||(c[5]=d=>l.value.agreement=d),label:"我同意"},null,8,["modelValue"]),c[10]||(c[10]=e.createElementVNode("a",{href:"#",class:"privacy-link"},"隐私政策",-1))]),_:1})]),_:1},8,["model","rules"])])]),_:1},8,["modelValue"]))}});function mo(t){const n=e.ref([]),o="_search_history_cache",l=typeof window<"u"&&typeof localStorage<"u",r=e.computed(()=>(t.value||"")+o),a=e.computed(()=>!!t.value&&t.value!==""),s=u=>{if(!u||!l)return;const c=n.value.filter(m=>m.id&&m.id!==u.id||m.display!==u.display);c.unshift(u);const d=c.slice(0,4);if(a.value){n.value=d;try{localStorage.setItem(r.value,JSON.stringify(d))}catch(m){console.warn("LocalStorage save failed:",m)}}},i=()=>{n.value=[],l&&localStorage.removeItem(r.value)};return e.onMounted(()=>{if(l&&a.value){const u=localStorage.getItem(r.value);if(u)try{n.value=JSON.parse(u)}catch{n.value=[]}}}),{searchHistory:n,saveToHistory:s,clearHistory:i,HasHistory:a}}async function po(t,n=["Continent","Country","City","Seaport","Airport"],o={}){return R.locationSearchV2.searchByName({keyword:t,displayInfo:n,...o})}function ho(t,n){const o=e.ref([]),l=e.ref(!1),r=e.ref(!1),a=e.ref(!1),s=e.ref(1),i=10,u=e.ref(0),c=e.computed(()=>{const f=[...n.value];return f.includes("Country")&&!f.includes("Region")&&f.push("Region"),f}),d=f=>Array.isArray(f)?f.filter(p=>c.value.includes(p.type)):[];return{searchResults:o,loading:l,isFetchingMore:r,isFinished:a,fetchData:async(f=!1)=>{const p=t.value.trim();if(!p){o.value=[],u.value=0,a.value=!1;return}if(f){if(r.value||a.value)return;r.value=!0,s.value+=1}else{if(l.value)return;l.value=!0,s.value=1,a.value=!1}try{const h=await po(p,n.value,{current:s.value,size:i}),y=d(h.records||[]);f?o.value.push(...y):o.value=y,u.value=h.total||0,(o.value.length>=u.value||y.length<i)&&(a.value=!0)}catch(h){console.error("Search request failed:",h),f&&(s.value-=1)}finally{l.value=!1,r.value=!1}}}}const go={class:"h5-search-container"},vo={class:"trigger-content"},yo=["src"],Ao={class:"placeholder-text"},wo={key:0,class:"selected-count"},Co={key:1,class:"selected-val"},xo={key:2,class:"placeholder-gray"},ko={key:0,class:"h5-modal-root"},Eo={class:"h5-drawer-card"},Vo={class:"h5-header"},So={class:"h5-input-wrapper"},bo=["src"],No=["placeholder"],Bo={key:0,class:"h5-spinner-box"},Ro={key:1,class:"h5-section"},Do={class:"h5-section-hd"},_o={class:"h5-history-grid"},Oo=["onClick"],To={key:2,class:"h5-result-list"},Lo=["onClick"],Mo={class:"item-info"},Io={class:"item-name"},Fo={key:0,class:"item-sub"},Po={class:"h5-load-status"},Uo={key:1,class:"no-more"},Ho={key:3,class:"h5-empty"},Qo=e.defineComponent({__name:"index",props:{modelValue:{},multiple:{type:Boolean,default:!1},lang:{default:"zh-CN"},placeholder:{},historyKey:{}},emits:["update:modelValue","select"],setup(t,{emit:n}){const o=t,l=n,r=e.ref(!1),a=e.ref(""),s=e.ref(null),i=e.ref(null);let u=null;const{searchHistory:c,saveToHistory:d,clearHistory:m}=mo(e.toRef(o,"historyKey")),{searchResults:f,loading:p,isFetchingMore:h,isFinished:y,fetchData:A}=ho(a,e.ref(["City","Seaport","Airport"])),v=e.computed(()=>{if(o.lang)return o.lang==="en"||o.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 E=useNuxtApp()?.ssrContext?.event?.node?.req?.headers?.cookie||"";return/(^|;\s*)jc-language=en(-US)?(;|$)/.test(E)}}catch{}return!1}),w=e.computed(()=>Array.isArray(o.modelValue)?o.modelValue:o.modelValue?[o.modelValue]:[]),k=e.computed(()=>!o.multiple&&!!o.modelValue),S=e.computed(()=>k.value?D(o.modelValue):""),b=e.computed(()=>w.value.length>0),P=()=>{r.value=!0,e.nextTick(()=>{s.value?.focus()})},_=()=>{r.value=!1,a.value=""},L=C=>{d(C),o.multiple?w.value.some(V=>V.id===C.id)||l("update:modelValue",[...w.value,C]):(l("update:modelValue",C),_()),l("select",C)},U=()=>{l("update:modelValue",o.multiple?[]:null)},O=e.ref(!1),z=C=>{const E=C.target;if(!E)return;E.scrollTop+E.clientHeight>=E.scrollHeight-80&&a.value&&!p.value&&!h.value&&!y.value&&!O.value&&(O.value=!0,A(!0))};e.watch(h,C=>{C||(O.value=!1)});const J=()=>{u&&clearTimeout(u),u=setTimeout(()=>{O.value=!1,i.value?.scrollTo({top:0}),console.log("🍉 ~ index.vue:279 ~ onInput ~ fetchData:",A),A(!1)},300)},D=C=>v.value?C.displayEn||C.display:C.displayCn||C.display,H=C=>{const E={City:"城市",Seaport:"港口",Airport:"机场"};return v.value?C:E[C]||C},ee=C=>w.value.some(E=>E.id===C.id);return(C,E)=>(e.openBlock(),e.createElementBlock("div",go,[e.createElementVNode("div",{class:"search-trigger",onClick:P},[e.createElementVNode("div",vo,[e.createElementVNode("img",{src:e.unref(be),class:"search-icon-m"},null,8,yo),e.createElementVNode("div",Ao,[t.multiple&&w.value.length>0?(e.openBlock(),e.createElementBlock("span",wo,e.toDisplayString(v.value?"Selected":"已选")+" ("+e.toDisplayString(w.value.length)+")",1)):!t.multiple&&k.value?(e.openBlock(),e.createElementBlock("span",Co,e.toDisplayString(S.value),1)):(e.openBlock(),e.createElementBlock("span",xo,e.toDisplayString(t.placeholder||(v.value?"Search":"搜索")),1))])]),b.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"clear-trigger",onClick:e.withModifiers(U,["stop"])},"ⓧ")):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[r.value?(e.openBlock(),e.createElementBlock("div",ko,[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"h5-mask",onClick:_})]),_:1}),e.createVNode(e.Transition,{name:"slide-up"},{default:e.withCtx(()=>[e.createElementVNode("div",Eo,[e.createElementVNode("div",{class:"drawer-handle",onClick:_}),e.createElementVNode("div",Vo,[e.createElementVNode("div",So,[e.createElementVNode("img",{src:e.unref(be),class:"inner-icon"},null,8,bo),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:s,"onUpdate:modelValue":E[0]||(E[0]=V=>a.value=V),placeholder:v.value?"City/Port/Airport":"搜索城市/港口/机场",onInput:J},null,40,No),[[e.vModelText,a.value]]),a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"h5-clear-btn",onClick:E[1]||(E[1]=V=>a.value="")}," ✕ ")):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"h5-cancel-btn",onClick:_},e.toDisplayString(v.value?"Cancel":"取消"),1)]),e.createElementVNode("div",{class:"h5-main-content",ref_key:"scrollContainer",ref:i,onScroll:z},[e.unref(p)&&!e.unref(h)?(e.openBlock(),e.createElementBlock("div",Bo,[...E[3]||(E[3]=[e.createElementVNode("div",{class:"h5-spinner"},null,-1)])])):e.createCommentVNode("",!0),!a.value&&e.unref(c).length>0?(e.openBlock(),e.createElementBlock("div",Ro,[e.createElementVNode("div",Do,[e.createElementVNode("span",null,e.toDisplayString(v.value?"Recent":"最近搜索"),1),e.createElementVNode("span",{class:"h5-clear-history",onClick:E[2]||(E[2]=(...V)=>e.unref(m)&&e.unref(m)(...V))},e.toDisplayString(v.value?"Clear":"清空"),1)]),e.createElementVNode("div",_o,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),(V,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:"h5-history-tag",onClick:ie=>L(V)},e.toDisplayString(D(V)),9,Oo))),128))])])):e.createCommentVNode("",!0),e.unref(f).length>0?(e.openBlock(),e.createElementBlock("div",To,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f),(V,T)=>(e.openBlock(),e.createElementBlock("div",{key:T,class:e.normalizeClass(["h5-result-item",{"is-active":ee(V)}]),onClick:ie=>L(V)},[e.createElementVNode("div",{class:e.normalizeClass(["item-type",V.type.toLowerCase()])},e.toDisplayString(H(V.type)),3),e.createElementVNode("div",Mo,[e.createElementVNode("div",Io,e.toDisplayString(D(V)),1),V.parentName?(e.openBlock(),e.createElementBlock("div",Fo,e.toDisplayString(V.parentName),1)):e.createCommentVNode("",!0)])],10,Lo))),128)),e.createElementVNode("div",Po,[e.unref(h)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[E[4]||(E[4]=e.createElementVNode("div",{class:"mini-spinner"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(v.value?"Loading...":"加载中..."),1)],64)):e.unref(y)&&a.value?(e.openBlock(),e.createElementBlock("span",Uo,e.toDisplayString(v.value?"No more results":"没有更多结果了"),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),a.value&&!e.unref(p)&&e.unref(f).length===0?(e.openBlock(),e.createElementBlock("div",Ho,e.toDisplayString(v.value?"No Results Found":"未找到相关结果"),1)):e.createCommentVNode("",!0)],544)])]),_:1})])):e.createCommentVNode("",!0)]))]))}}),st=_e(Qo,[["__scopeId","data-v-c1314e9c"]]);let $o={open(){R.emitter.emit(R.MODAL_ACTION.Open)},close(){R.emitter.emit(R.MODAL_ACTION.Close)},onSubmit(t){R.emitter.on(R.MODAL_ACTION.Submit,t)}};function Jo(){let t=!1;return{install(n){if(typeof window<"u"&&!t){const o=document.createElement("div");o.setAttribute("id","global-modal-root"),document.body.appendChild(o),e.createApp(rt).mount(o),t=!0}n.config.globalProperties.$globalModal=$o}}}const qe={ApplyDataDialog:lt,JcSearch:Oe,JCMSearch:st};let We=!1;const qo={install(t,n){if(!We){We=!0,n?.sharedConfig&&R.initSharedConfig(n.sharedConfig);for(const o in qe)t.component(o,qe[o])}}};Object.defineProperty(exports,"MODAL_ACTION",{enumerable:!0,get:()=>R.MODAL_ACTION});Object.defineProperty(exports,"emitter",{enumerable:!0,get:()=>R.emitter});Object.defineProperty(exports,"initSharedConfig",{enumerable:!0,get:()=>R.initSharedConfig});exports.ApplyDataDialog=lt;exports.GlobalModal=rt;exports.JCMSearch=st;exports.JcSearch=Oe;exports.createGlobalModalPlugin=Jo;exports.default=qo;
|