PageSourceSearch

https://civ.quest/assets/ChatMiniMap-DgePOAHP.js

js civ.quest collected 2026-10-04 05:51:34 UTC 8,046 bytes, 1 lines download raw bytes

1import{R as ee,r as n,j as p}from"./react-vendor-BW9Nu_5l.js";import{d8 as te,vV as O,_ as V,lc as re,lb as A,la as W,cR as P,wb as de,wc as pe,v_ as fe,vX as me,v5 as B,vY as we,wl as ye}from"./arcgis-BRIaWsrf.js";import{dG as ge,eQ as ne,L as xe}from"./SSOProviderLogo-Cf_Gn5rN.js";import{c as Re}from"./basemapFactory-ChZjnVCq.js";import{Z as ve}from"./zoom-out-BXABbPko.js";import{Z as je}from"./zoom-in-DF-B6Alt.js";import"./firebase-C4P3A27n.js";import"./vite-helpers-mg6Z-sIv.js";import"./calcite-lWgj3pT7.js";import"./single-org-5b_TQwao.js";const Me={"human-geography":"arcgis-human-geography","human-geography-dark":"arcgis-human-geography-dark","charted-territory":"arcgis-charted-territory","colored-pencil":"arcgis-colored-pencil",newspaper:"arcgis-newspaper",nova:"arcgis-nova",midcentury:"arcgis-midcentury",community:"arcgis-community"};function Le(s){var f;if(!s)return null;if(s.x!==void 0&&s.y!==void 0)return{x:s.x,y:s.y};if(s.rings&&s.rings.length>0){try{const m=ye(s);if(m)return{x:m.x,y:m.y}}catch{}return s.centroid?{x:s.centroid.x,y:s.centroid.y}:(f=s.extent)!=null&&f.center?{x:s.extent.center.x,y:s.extent.center.y}:null}if(s.paths&&s.paths.length>0){const m=s.paths[0],z=Math.floor(m.length/2);return{x:m[z][0],y:m[z][1]}}return null}const Fe=ee.forwardRef(function({features:f,nearbyContext:m=null,themeColor:z="sky",buttonColor:se,height:Z=250,basemapId:$="streets-navigation-vector",basemapConfig:c=null,onFeatureClick:S=null,selectionHighlightColor:ie="#ffc800"},ce){const H=n.useRef(null),o=n.useRef(null),X=n.useRef(null),N=n.useRef(null),G=n.useRef(null),b=n.useRef(null),T=n.useRef(null),[q,Y]=n.useState(!0),[D,J]=n.useState(null),F=n.useRef(S),K=n.useRef(f);n.useEffect(()=>{F.current=S},[S]),n.useEffect(()=>{K.current=f},[f]);const Q=ge(z,se);n.useEffect(()=>H.current?((async()=>{Y(!0),J(null);try{if(!de())try{await pe()}catch(t){console.warn("[ChatMiniMap] Failed to load projection engine:",t)}let e=null;if(c&&(e=Re(c)),!e){const t=Me[$]||$;e=t.startsWith("arcgis-")?new fe({style:{id:t}}):t}const R=new me({basemap:e});X.current=R;const w=new B({id:"chat-mini-map-buffer"});T.current=w,R.add(w);const y=new B({id:"chat-mini-map-results"});N.current=y,R.add(y);const h=new B({id:"chat-mini-map-pushpins"});G.current=h,R.add(h);const j=new B({id:"chat-mini-map-highlight"});b.current=j,R.add(j);const l=new we({container:H.current,map:R,ui:{components:[]},constraints:{rotationEnabled:!1},popup:{autoOpenEnabled:!1}});o.current=l,await l.when(),Y(!1),l.on("click",async t=>{var _,g,a;if(!F.current)return;const L=await l.hitTest(t);if(L.results&&L.results.length>0){const k=L.results.find(x=>{var r,i,d,u;return((i=(r=x.graphic)==null?void 0:r.layer)==null?void 0:i.id)==="chat-mini-map-results"||((u=(d=x.graphic)==null?void 0:d.layer)==null?void 0:u.id)==="chat-mini-map-pushpins"});if(k&&((g=(_=k.graphic)==null?void 0:_.attributes)==null?void 0:g._index)!==void 0){const x=k.graphic.attributes._index,r=(a=K.current)==null?void 0:a[x];r&&F.current(r)}}}),l.on("pointer-move",async t=>{var g;if(!F.current)return;const _=(g=(await l.hitTest(t)).results)==null?void 0:g.some(a=>{var k,x,r,i;return((x=(k=a.graphic)==null?void 0:k.layer)==null?void 0:x.id)==="chat-mini-map-results"||((i=(r=a.graphic)==null?void 0:r.layer)==null?void 0:i.id)==="chat-mini-map-pushpins"});l.container.style.cursor=_?"pointer":"default"}),f&&f.length>0&&U(f,m)}catch(e){console.error("[ChatMiniMap] Initialization error:",e),J("Failed to load map"),Y(!1)}})(),()=>{o.current&&(o.current.destroy(),o.current=null),X.current=null,N.current=null,G.current=null,b.current=null,T.current=null}):void 0,[$,c==null?void 0:c.id,c==null?void 0:c.type,c==null?void 0:c.basemapId,c==null?void 0:c.url,c==null?void 0:c.portalItemId]),n.useEffect(()=>{o.current&&N.current&&f&&U(f,m)},[f,m]);const U=n.useCallback((v,e=null)=>{if(!N.current||!o.current||(N.current.removeAll(),G.current&&G.current.removeAll(),T.current&&T.current.removeAll(),!v||v.length===0))return;const w=(ne[z]||ne.sky)[500],y=r=>{const i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return i?[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16)]:[14,165,233]},[h,j,l]=y(w),t=[],L=[],_=v.length>1;v.forEach((r,i)=>{if(!r.geometry)return;let d;const u=r.geometry,M=u.spatialReference||{wkid:4326};if(u.rings?d=new te({rings:u.rings,spatialReference:M}):u.paths?d=new O({paths:u.paths,spatialReference:M}):u.x!==void 0&&(d=new V({x:u.x,y:u.y,spatialReference:M})),!d)return;let E;if(u.rings?E=new re({color:[h,j,l,.25],outline:new A({color:[h,j,l],width:2})}):u.paths?E=new A({color:[h,j,l],width:3}):E=new W({color:[h,j,l],size:12,outline:{color:[255,255,255],width:2}}),t.push(new P({geometry:d,symbol:E,attributes:{_index:i}})),_){const I=Le(d);if(I){const ue=new V({x:I.x,y:I.y,spatialReference:M}),he=new W({style:"circle",color:[h,j,l],size:14,outline:{color:[255,255,255],width:2}});L.push(new P({geometry:ue,symbol:he,attributes:{_index:i}}))}}});const g=e==null?void 0:e.bufferGeometry,a=e==null?void 0:e.searchInfo,k=(a==null?void 0:a.searchMode)!=="buffer";let x=null;if(T.current&&g&&!k){const r=(a==null?void 0:a.sourceType)==="markup-popup"||(a==null?void 0:a.sourceType)==="feature-info",[i,d,u]=y(ie||"#ffc800");let M;const E=g.spatialReference||{wkid:4326};if(g.rings?M=new O({paths:g.rings,spatialReference:E}):g.paths&&(M=new O({paths:g.paths,spatialReference:E})),M){const I=new A({color:[i,d,u,1],width:r?3:2,style:"dash"});x=new P({geometry:M,symbol:I}),T.current.add(x)}}if(N.current.addMany(t),G.current&&L.length>0&&G.current.addMany(L),t.length>0&&o.current){const r=o.current,i=()=>{try{if(x){r.goTo([...t,x],{padding:40,duration:300}).catch(()=>{});return}t.length===1&&t[0].geometry.type==="point"?r.goTo({target:t[0].geometry,zoom:17},{duration:300}).catch(()=>{}):r.goTo(t,{padding:40,duration:300}).catch(()=>{})}catch{}};r.ready?i():r.when(()=>i())}},[z]),oe=n.useCallback(()=>{o.current&&o.current.goTo({zoom:o.current.zoom+1},{duration:200})},[]),le=n.useCallback(()=>{o.current&&o.current.goTo({zoom:o.current.zoom-1},{duration:200})},[]),C=n.useCallback(v=>{var t;if(!o.current||!(v!=null&&v.geometry))return;const e=v.geometry,R=e.spatialReference||{wkid:4326};let w;if(e.rings?w=new te({rings:e.rings,spatialReference:R}):e.paths?w=new O({paths:e.paths,spatialReference:R}):e.x!==void 0&&(w=new V({x:e.x,y:e.y,spatialReference:R})),!w)return;b.current&&b.current.removeAll();const y=[255,100,0];let h;e.rings?h=new re({color:[y[0],y[1],y[2],.4],outline:new A({color:y,width:3})}):e.paths?h=new A({color:y,width:4}):h=new W({color:y,size:16,outline:{color:[255,255,255],width:3}});const j=new P({geometry:w,symbol:h});(t=b.current)==null||t.addMany([j]);const l=e.x!==void 0?{target:w,zoom:18}:{target:w};o.current.goTo(l,{duration:300})},[]);ee.useImperativeHandle(ce,()=>({zoomToFeature:C}),[C]);const ae=typeof Z=="number"?{height:Z}:{height:Z,minHeight:200};return p.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-slate-200",style:ae,"data-tour-tag":"chat-mini-map-container",children:[p.jsx("div",{ref:H,className:"w-full h-full"}),q&&p.jsx("div",{className:"absolute inset-0 bg-slate-100 flex items-center justify-center",children:p.jsxs("div",{className:"text-center",children:[p.jsx(xe,{className:"w-6 h-6 animate-spin mx-auto mb-1",style:{color:Q.text600}}),p.jsx("span",{className:"text-xs text-slate-500",children:"Loading map..."})]})}),D&&p.jsx("div",{className:"absolute inset-0 bg-slate-100 flex items-center justify-center",children:p.jsx("span",{className:"text-xs text-red-500",children:D})}),!q&&!D&&p.jsxs("div",{className:"absolute bottom-2 right-2 flex flex-col bg-white rounded-lg shadow-md overflow-hidden",children:[p.jsx("button",{onClick:le,className:"p-1.5 hover:bg-slate-100 border-b border-slate-200",title:"Zoom Out",children:p.jsx(ve,{className:"w-4 h-4",style:{color:Q.bg600}})}),p.jsx("button",{onClick:oe,className:"p-1.5 hover:bg-slate-100",title:"Zoom In",children:p.jsx(je,{className:"w-4 h-4",style:{color:Q.bg600}})})]})]})});export{Fe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.