You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
hy-screen-2.0/docs/assets/index-4ef8d3f3-178654178154...

115 lines
254 KiB

var Ko=Object.defineProperty,Zo=Object.defineProperties;var Xo=Object.getOwnPropertyDescriptors;var ps=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable;var Sa=Math.pow,fs=(g,e,t)=>e in g?Ko(g,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):g[e]=t,A=(g,e)=>{for(var t in e||(e={}))Jo.call(e,t)&&fs(g,t,e[t]);if(ps)for(var t of ps(e))Qo.call(e,t)&&fs(g,t,e[t]);return g},O=(g,e)=>Zo(g,Xo(e));var re=(g,e,t)=>new Promise((a,i)=>{var r=d=>{try{u(t.next(d))}catch(c){i(c)}},o=d=>{try{u(t.throw(d))}catch(c){i(c)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(r,o);u((t=t.apply(g,e)).next())});import{q as qs,h as Us,w as qt,o as b,c as L,a as h,d as I,L as el,A as jt,g as P,M as rt,s as et,v as tl,C as pe,u as W,j as fe,n as ze,t as S,F as K,y as le,b as J,x as te,K as bt,B as Wt,e as Xa,H as ta,f as Ja,O as Ma}from"./index-1786541781548.js";import{H as ke}from"./index.esm.min-8cdcc8d4-1786541781548.js";import{_ as ie}from"./index-6fc47545-1786541781548.js";import{t as Hi,S as la,u as oi,v as _a,w as al,V as Q,F as il,C as wt,G as ge,c as nl,d as sl,f as rl,g as Vi,L as aa,D as Ne,a as me,h as Qa,R as ot,A as xe,N as ms,b as We,P as _t,o as ia,n as na,x as ol,T as ll,B as ul,i as cl,j as dl,k as hl,l as pl,m as fl,y as ml,z as Pa,E as ys,H as gs,I as yl,J as vs,q as bs,r as gl,s as ws,K as Fa,U as Di,W as Ls,M as vl}from"./screen2Standard-54c0337d-1786541781548.js";import{g as Ht,M as bl,h as wl,L as Ll,B as Ca,a as sa,E as Ts,G as ei,D as Tl,b as kl,l as Sl,P as ks,c as Ss}from"./three.interactive-b20ac8b1-1786541781548.js";import{g as ra}from"./index-e9f36657-1786541781548.js";import{h as li,S as Ml,W as Rt,H as Y,j as Oi,k as Pl,l as Fl,m as Cl}from"./townshipBoundaries-cb449981-1786541781548.js";import{b as Nl,g as Ms,a as Ps,c as xl}from"./geoserver-a49d147b-1786541781548.js";import{_ as _l}from"./TopicSwitcher-dccf4985-1786541781548.js";import{_ as Rl}from"./LayerPanel-3f19d00c-1786541781548.js";import{A as Il}from"./assets-4ee2b5a6-1786541781548.js";import{M as Gl}from"./index-af4e3bce-1786541781548.js";import{g as Al,a as Bl,b as El,c as Fs,d as $l,e as zi,f as Vl}from"./yakApi-ed83694d-1786541781548.js";import"./index-25a05535-1786541781548.js";const Dl=li.map(g=>A({},g)),Cs=li.map(({name:g,code:e,fullCode:t,center:a,centroid:i})=>({name:g,code:e,fullCode:t,center:a,centroid:i})),Ol=li.map(g=>{var e,t;return{name:g.name,lng:(e=g.center)==null?void 0:e[0],lat:(t=g.center)==null?void 0:t[1]}}),zl=li.map(g=>({name:g.name,lng:g.center[0],lat:g.center[1]})),ua=256,qi="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",Wl=900,Yl=10,Ut=new Map,ca={west:101.852492,south:31.851389,east:103.347518,north:33.319796};function Wi(g,e,t){const a=Sa(2,t),i=Math.sin(e*Math.PI/180);return{x:(g+180)/360*a,y:(.5-Math.log((1+i)/(1-i))/(4*Math.PI))*a}}function Ns(g,e,t){const a=Sa(2,t),i=g/a*360-180,r=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r)));return[i,o]}function ti(g,e,t){return Math.max(e,Math.min(t,g))}function Ks(g,e,{centerLngLat:t,maxCols:a,maxRows:i}={}){const r=Wi(g.west,g.north,e),o=Wi(g.east,g.south,e),u=Math.floor(r.x),d=Math.floor(o.x),c=Math.floor(r.y),f=Math.floor(o.y);let m=u,T=d,M=c,F=f,x=Math.floor((u+d)/2),G=Math.floor((c+f)/2);if(t&&Number.isFinite(a)&&Number.isFinite(i)){const j=ti(Number(t[0]),g.west,g.east),X=ti(Number(t[1]),g.south,g.north),se=Wi(j,X,e);x=Math.floor(se.x),G=Math.floor(se.y);const q=Math.max(1,Math.min(Math.floor(a),d-u+1)),R=Math.max(1,Math.min(Math.floor(i),f-c+1));m=ti(x-Math.floor(q/2),u,d-q+1),M=ti(G-Math.floor(R/2),c,f-R+1),T=m+q-1,F=M+R-1}return{zoom:e,minX:m,maxX:T,minY:M,maxY:F,centerX:x,centerY:G,cols:T-m+1,rows:F-M+1}}function jl({zoom:g=11,centerLngLat:e,maxCols:t,maxRows:a,bounds:i=ca}={}){return Ks(i,g,{centerLngLat:e,maxCols:t,maxRows:a})}function Hl(g,e){const[t,a]=Ns(g.minX,g.minY,g.zoom),[i,r]=Ns(g.maxX+1,g.maxY+1,g.zoom),[o]=e([t,ca.south]),[u]=e([i,ca.south]),[,d]=e([ca.west,a]),[,c]=e([ca.west,r]);return{left:o,right:u,bottom:-c,top:-d}}function ql(g,e){const{width:t,height:a}=e;g.save(),g.globalCompositeOperation="multiply",g.fillStyle="rgba(5, 24, 34, 0.22)",g.fillRect(0,0,t,a),g.globalCompositeOperation="screen";const i=g.createRadialGradient(t*.5,a*.48,t*.1,t*.5,a*.5,t*.72);i.addColorStop(0,"rgba(80, 230, 255, 0.16)"),i.addColorStop(1,"rgba(0, 18, 36, 0.03)"),g.fillStyle=i,g.fillRect(0,0,t,a),g.restore()}function Ul(g,e){const t=g.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,"#061927"),t.addColorStop(.5,"#0b2c3c"),t.addColorStop(1,"#07131f"),g.fillStyle=t,g.fillRect(0,0,e.width,e.height)}function Kl(g){const e=Ut.get(g);return e||new Promise(t=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t(a),a.onerror=()=>{Ut.delete(g),t(null)},a.src=g})}function Zl(g){const e=Ut.get(g);if(e)return e;const t=Kl(g);for(Ut.set(g,t);Ut.size>Wl;){const a=Ut.keys().next().value;if(!a)break;Ut.delete(a)}return t}function Xl(g,e,t,a=qi){return String(a||qi).replace(/\{x\}/g,g).replace(/\{y\}/g,e).replace(/\{z\}/g,t)}function Jl(u,d,c,f){return re(this,arguments,function*(g,e,t,a,{tileUrlTemplate:i,onTileStatus:r,applyTone:o=!0}={}){const m=[],T=a.cols*a.rows;let M=0,F=0;r==null||r({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:M,failed:F,total:T,zoom:a.zoom,tileRange:a,tileUrlTemplate:i}),g.save(),g.filter="brightness(0.92) contrast(1.22) saturate(1.06)";for(let q=a.minX;q<=a.maxX;q+=1)for(let R=a.minY;R<=a.maxY;R+=1)m.push({x:q,y:R});m.sort((q,R)=>Math.abs(q.x-a.centerX)+Math.abs(q.y-a.centerY)-(Math.abs(R.x-a.centerX)+Math.abs(R.y-a.centerY)));let x=0;function G(){return re(this,null,function*(){for(;x<m.length;){const q=m[x];x+=1;const R=yield Zl(Xl(q.x,q.y,a.zoom,i));R?(M+=1,g.drawImage(R,(q.x-a.minX)*ua,(q.y-a.minY)*ua,ua,ua),t.needsUpdate=!0):F+=1,r==null||r({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:M,failed:F,total:T,zoom:a.zoom,tileRange:a,tileUrlTemplate:i})}})}yield Promise.all(Array.from({length:Math.min(Yl,m.length)},G)),g.restore(),o&&ql(g,e),t.needsUpdate=!0;const j=T>0?M/T:0,X=M===0?"error":j>=.75?"success":"warning",se=M===T?`${a.zoom}级影像底图已加载`:M>0?`${a.zoom}级影像底图已加载(${M}/${T}张有效瓦片)`:`${a.zoom}级影像底图加载失败`;r==null||r({type:X,text:se,loaded:M,failed:F,total:T,zoom:a.zoom,tileRange:a,tileUrlTemplate:i})})}function xs({geoProjectionCenter:g,geoProjectionScale:e,zoom:t=11,tileUrlTemplate:a=qi,onTileStatus:i,centerLngLat:r,maxCols:o,maxRows:u,transparentBackground:d=!1,applyTone:c=!0}={}){const f=Ks(ca,t,{centerLngLat:r,maxCols:o,maxRows:u}),m=document.createElement("canvas");m.width=f.cols*ua,m.height=f.rows*ua;const T=m.getContext("2d");d?T.clearRect(0,0,m.width,m.height):Ul(T,m);const M=new Hi(m);M.colorSpace=la,M.wrapS=oi,M.wrapT=oi,M.minFilter=_a,M.magFilter=_a,M.needsUpdate=!0;const F=Ht().center(g).scale(e).translate([0,0]),x=Hl(f,F);return Jl(T,m,M,f,{tileUrlTemplate:a,onTileStatus:i,applyTone:c}).catch(G=>{console.warn("load satellite tiles failed:",G),i==null||i({type:"error",text:`${f.zoom}级影像底图加载失败`,loaded:0,failed:f.cols*f.rows,total:f.cols*f.rows,zoom:f.zoom,tileRange:f,tileUrlTemplate:a})}),{texture:M,uvBounds:x,tileRange:f}}function _s(g,e){const t=e.right-e.left,a=e.top-e.bottom;g.mapGroup.traverse(i=>{var u,d;const r=(d=(u=i.geometry)==null?void 0:u.attributes)==null?void 0:d.position;if(!i.isMesh||!r)return;const o=new Float32Array(r.count*2);for(let c=0;c<r.count;c+=1){const f=r.getX(c),m=r.getY(c);o[c*2]=(f-e.left)/t,o[c*2+1]=(m-e.bottom)/a}i.geometry.setAttribute("uv",new al(o,2)),i.geometry.attributes.uv.needsUpdate=!0})}const Ql=new Q(-.17427287762525134,13.678992786206543,20.688611202093714),eu=new Q(0,0,0),tu=new Q(-13.767695123014105,12.990152163077308,39.28228164159694),ai=21,au=9,iu=260,nu=12,su=700,oa=new Map,Rs="#30DCFF",ru="#F2FFFF",ou="#8BF7FF",Is=3202303,lu=15925247,Gs=9172991,As={"family-pasture":"pasture","artificial-grassland":"grass","scale-breeding":"breeding","forage-storage":"storage","slaughter-processing":"processing","farm-equipment":"equipment","social-service":"service"};function lt(g){return String(g||"").replace(/\s+/g,"").trim()}function Yi(g=[],e=[]){return g.reduce((t,a,i)=>{var o;const r=Number((o=a==null?void 0:a.userData)==null?void 0:o.rank);return(a==null?void 0:a.visible)===!0&&e[i]&&Number.isFinite(r)&&r>0&&t.push(i),t},[])}function ne(g,e=0){const t=Number(g);return Number.isFinite(t)?t:e}function Yt(g,e,t){const a=Number(g);return Number.isFinite(a)?Math.max(e,Math.min(t,a)):e}function ve(g){return String(g!=null?g:"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function Bs(g){return(g==null?void 0:g.scope)==="village"||(g==null?void 0:g.labelMode)==="village"}function Es(g){return(g==null?void 0:g.scope)==="trade-flow"||(g==null?void 0:g.labelMode)==="trade-flow"}function uu(g){return(g==null?void 0:g.showFlowLines)!==!1}function $s(g){return!!(g!=null&&g.hideTownNames||(g==null?void 0:g.showTownNames)===!1)}function Na(g){return!!(g!=null&&g.hideMapLabels||(g==null?void 0:g.showMapLabels)===!1)}function cu(g){return(g==null?void 0:g.displayMode)==="callout"||(g==null?void 0:g.labelMode)==="callout"}function ii(g){return["wkt-api","geojson","wfs"].includes(String((g==null?void 0:g.sourceType)||"").toLowerCase())}function du(g){return(g==null?void 0:g.interactive)===!1||(g==null?void 0:g.key)==="yak-recognition-layer"}function Vs(g){return String((g==null?void 0:g.sourceType)||"").toLowerCase()==="wmts"}function Ds(g,e,t){const a=Sa(2,t),i=Math.sin(e*Math.PI/180);return{x:(g+180)/360*a,y:(.5-Math.log((1+i)/(1-i))/(4*Math.PI))*a}}function Os(g,e,t){const a=Sa(2,t),i=g/a*360-180,r=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(r)-Math.exp(-r)));return[i,o]}function hu(g,e){const t=Ds(g.west,g.north,e),a=Ds(g.east,g.south,e);return{minX:Math.floor(t.x),maxX:Math.floor(a.x),minY:Math.floor(t.y),maxY:Math.floor(a.y)}}function pu(g,e,t,a){const[i,r]=Os(g,e,t),[o,u]=Os(g+1,e+1,t),d=Y.east-Y.west,c=Y.north-Y.south;return{x:(i-Y.west)/d*a.width,y:(Y.north-r)/c*a.height,width:(o-i)/d*a.width,height:(r-u)/c*a.height}}function fu(g){const e=oa.get(g);if(e)return e;const t=new Promise(a=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>a(i),i.onerror=()=>{oa.delete(g),a(null)},i.src=g});for(oa.set(g,t);oa.size>su;){const a=oa.keys().next().value;if(!a)break;oa.delete(a)}return t}function zs(g){return g?/^https?:\/\//.test(g)||g.startsWith("/")?g:`./${g}`:""}function mu(g){if(!g)return null;if(typeof g=="string")try{return JSON.parse(g)}catch(e){return console.warn("地图 GeoJSON 解析失败",e),null}return g}function xa(g){const e=mu(g);return e!=null&&e.features&&e.features.forEach(t=>{var a;((a=t.geometry)==null?void 0:a.type)==="Polygon"&&(t.geometry.coordinates=[t.geometry.coordinates])}),e}function Ws(g){var e,t,a;return g!=null&&g.coordinates?g.type==="Polygon"?Array.isArray((a=(t=(e=g.coordinates)==null?void 0:e[0])==null?void 0:t[0])==null?void 0:a[0])?g.coordinates:[g.coordinates]:g.type==="MultiPolygon"?g.coordinates:[]:[]}class yu extends bl{constructor(e,t,a={}){var u,d,c,f;super(e),this.geoProjectionCenter=[102.6305459723107,32.72169252326339],this.geoProjectionScale=650,this.tradeGeoProjectionCenter=[104,36],this.tradeGeoProjectionScale=11.4,this.tradeNationalDepth=.24,this.depth=.5,this.clicked=!1,this.scene.fog=new il(466735,1,50),this.scene.background=new wt(466735),this.camera.instance.position.copy(tu),this.camera.instance.near=1,this.camera.instance.far=1e4,this.camera.instance.updateProjectionMatrix(),this.defaultMapCameraPosition=Ql.clone(),this.defaultMapTarget=eu.clone(),this.camera.controls.target.copy(this.defaultMapTarget),this.camera.controls.update(),this.activeMapViewTweens=[],this.sceneTweens=[],this.sceneTimers=[],this.interactionManager=new wl(this.renderer.instance,this.camera.instance,this.canvas),this.assets=t,this.callbacks=a,this.useSatelliteBase=a.useSatelliteBase!==!1,this.showNationalBackdrop=a.showNationalBackdrop===!0,this.topicLayerPresentation=a.topicLayerPresentation||"default",this.hideTownLabelStatsByDefault=a.hideTownLabelStats===!0,this.tileUrlTemplate=a.tileUrlTemplate||"",this.usesCustomSatelliteTiles=this.useSatelliteBase&&!!this.tileUrlTemplate;const i=Math.round(Number(a.satelliteTextureZoom));this.satelliteTextureZoom=Number.isFinite(i)&&i>0?Math.min(ai,i):Ml;const r=Math.round(Number(a.satelliteMaxZoom)),o=Number.isFinite(r)&&r>0?Math.min(ai,Math.max(this.satelliteTextureZoom,r)):ai;this.adminBoundaryLineScale=this.normalizeAdminBoundaryLineScale(a.adminBoundaryLineScale),this.mapBoundaryEmphasisMaterial=null,this.dynamicSatelliteMaxZoom=o,this.dynamicSatelliteTileWindow=au,this.dynamicSatelliteOverlay=null,this.dynamicSatelliteMaterial=null,this.dynamicSatelliteTexture=null,this.dynamicSatelliteCurrentKey="",this.dynamicSatelliteLoadingKey="",this.dynamicSatelliteRequestId=0,this.dynamicSatelliteLastCheck=0,this.topicLayerLoadId=0,this.visibleTopicLayers=[],this.mapAnimationComplete=!1,this.showTownRankingBars=!1,this.showTownRankingPointMarkers=!1,this.currentTownRanking=null,this.villageRankingGroup=null,this.villageRankingLabels=[],this.tradeFlowGroup=null,this.tradeFlowMeshGroup=null,this.tradeFlowLabelGroup=null,this.tradeFlowLabels=[],this.tradeFlowMaterials=[],this.tradeFlowPulseSprites=[],this.isTradeNationalMapActive=!1,this.selectedFeatureGroup=null,this.selectedVectorFeatures=[],this.analysisBoundaryFeature=null,this.analysisMatchedFeatures=[],this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.currentVectorFeatures=[],this.yakIndustryPointLabelGroup=null,this.yakIndustryPointLabels=[],this.yakIndustryPointMarkerGroup=null,this.yakIndustryPointMarkers=[],this.yakIndustryMarkerMaterialCache=new Map,this.hongyuanBoundaryPolygons=[],this.townMetaByName=new Map(Cs.map(m=>[lt(m.name),m])),this.staticMapData={china:xa(this.assets.instance.getResource("china")),mapJson:xa(this.assets.instance.getResource("mapJson")),mapStroke:xa(this.assets.instance.getResource("mapStroke"))},this.handleCanvasBoundaryPointerDown=this.handleCanvasBoundaryPointerDown.bind(this),this.handleCanvasBoundaryDoubleClick=this.handleCanvasBoundaryDoubleClick.bind(this),(d=(u=this.canvas)==null?void 0:u.addEventListener)==null||d.call(u,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(f=(c=this.canvas)==null?void 0:c.addEventListener)==null||f.call(c,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.initEnvironment(),this.init()}init(){this.labelGroup=new ge,this.label3d=new Ll(this),this.labelGroup.rotation.x=-Math.PI/2,this.scene.add(this.labelGroup),this.flyLineFocusGroup=new ge,this.flyLineFocusGroup.visible=!1,this.flyLineFocusGroup.rotation.x=-Math.PI/2,this.scene.add(this.flyLineFocusGroup),this.eventElement=[],this.defaultMaterial=null,this.defaultLightMaterial=null,this.createBottomBg(),this.createChinaBlurLine(),this.createGrid(),this.createRotateBorder(),this.createLabel(),this.createMap(),this.createEvent(),this.createFlyLine(),this.createFocus(),this.createParticles(),this.createScatter(),this.createInfoPoint(),this.createStorke();let e=ra.timeline({onComplete:()=>{if(this.mapAnimationComplete=!0,this.applyLayerMapView(this.currentTopicLayer,{force:!0}),this.setTradeNationalMapVisible(!1),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),Na(this.currentTownRanking)){this.hideAllMapStatisticLabels();return}this.updateVillageRankingLabels(this.currentTownRanking),this.updateTradeFlowLayer(this.currentTownRanking),this.updateInfoPointStats()}});e.pause(),this.animateTl=e,e.addLabel("focusMap",1.5),e.addLabel("focusMapOpacity",2),e.addLabel("bar",3),e.to(this.camera.instance.position,{duration:2,x:this.defaultMapCameraPosition.x,y:this.defaultMapCameraPosition.y,z:this.defaultMapCameraPosition.z,ease:"circ.out",onStart:()=>{this.flyLineFocusGroup.visible=!1}}),e.to(this.focusMapGroup.position,{duration:1,x:0,y:0,z:0},"focusMap"),e.to(this.focusMapGroup.scale,{duration:1,x:1,y:1,z:1,ease:"circ.out",onComplete:()=>{if(this.flyLineGroup.visible=!0,this.scatterGroup.visible=!0,this.InfoPointGroup.visible=!Na(this.currentTownRanking)&&this.showTownRankingPointMarkers&&this.hasTownRankingRows(),this.setTradeNationalMapVisible(!1),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),Na(this.currentTownRanking)){this.hideAllMapStatisticLabels();return}this.updateVillageRankingLabels(this.currentTownRanking),this.updateTradeFlowLayer(this.currentTownRanking),this.updateInfoPointStats()}},"focusMap"),e.to(this.focusMapTopMaterial,{duration:1,opacity:this.getFocusMapTopOpacity(),ease:"circ.out"},"focusMapOpacity"),e.to(this.focusMapSideMaterial,{duration:1,opacity:1,ease:"circ.out",onComplete:()=>{this.focusMapSideMaterial.transparent=!1}},"focusMapOpacity"),this.otherLabel.map((a,i)=>{let r=a.element.querySelector(".other-label");e.to(r,{duration:1,delay:.1*i,translateY:0,opacity:1,ease:"circ.out"},"focusMapOpacity")}),e.to(this.mapLineMaterial,{duration:.5,delay:.3,opacity:1},"focusMapOpacity"),this.mapBoundaryEmphasisMaterial&&e.to(this.mapBoundaryEmphasisMaterial,{duration:.5,delay:.3,opacity:this.getAdminBoundaryEmphasisOpacity()},"focusMapOpacity"),e.to(this.rotateBorder1.scale,{delay:.3,duration:1,x:1,y:1,z:1,ease:"circ.out"},"focusMapOpacity"),e.to(this.rotateBorder2.scale,{duration:1,delay:.5,x:1,y:1,z:1,ease:"circ.out",onComplete:()=>{var a,i;this.flyLineFocusGroup.visible=!0,(i=(a=this.callbacks).onPlayComplete)==null||i.call(a)}},"focusMapOpacity"),this.showTownRankingBars&&(this.allBar.map((a,i)=>{e.to(a.scale,{duration:1,delay:.1*i,x:1,y:1,z:1,ease:"circ.out"},"bar")}),this.allBarMaterial.map((a,i)=>{e.to(a,{duration:1,delay:.1*i,opacity:1,ease:"circ.out"},"bar")}));const t=this;this.allProvinceLabel.map((a,i)=>{let r=a.element.querySelector(".provinces-label-wrap"),o=a.element.querySelector(".number .value"),u={progress:0};e.to(r,{duration:1,delay:.2*i,translateY:0,opacity:1,ease:"circ.out"},"bar"),e.to(u,{duration:1,delay:.2*i,progress:1,onStart:()=>{u.progress=0},onUpdate:d},"bar");function d(){var f,m;const c=ne((m=(f=a.userData)==null?void 0:f.targetValue)!=null?m:o.dataset.targetValue);o.innerText=t.formatMapRankingValue(c*u.progress)}}),this.showTownRankingBars&&this.allGuangquan.map((a,i)=>{e.to(a.children[0].scale,{duration:1,delay:.1*i,x:1,y:1,z:1,ease:"circ.out"},"bar"),e.to(a.children[1].scale,{duration:1,delay:.1*i,x:1,y:1,z:1,ease:"circ.out"},"bar")})}initEnvironment(){let e=new nl(13171711,4.2);this.scene.add(e);let t=new sl(14679295,5.8);t.position.set(-30,6,-8),t.castShadow=!0,t.shadow.radius=20,t.shadow.mapSize.width=1024,t.shadow.mapSize.height=1024,this.scene.add(t),this.createPointLight({color:"#1fd6df",intensity:680,distance:1e4,x:-9,y:3,z:-3}),this.createPointLight({color:"#2af0c6",intensity:260,distance:1e4,x:0,y:2,z:5})}createPointLight(e){const t=new rl(1924702,e.intensity,e.distance);t.position.set(e.x,e.y,e.z),this.scene.add(t)}createMap(){let e=new ge,t=new ge;this.mapGroup=e,this.focusMapGroup=t;let{china:a,chinaTopLine:i}=this.createChina(),{map:r,mapTop:o,mapLine:u,mapBoundaryEmphasis:d}=this.createProvince();this.createNationalBackdrop(),a.setParent(e),i.setParent(e),this.createDiffuse(),r.setParent(t),o.setParent(t),u.setParent(t),d==null||d.setParent(t),t.position.set(0,0,-.01),t.scale.set(1,1,0),e.add(t),this.createTopicLayer(),e.rotation.x=-Math.PI/2,e.position.set(0,.2,0),this.scene.add(e),this.createBar()}createChina(){let e={chinaBgMaterialColor:"#0d3349",lineColor:"#39c7ef"},t=this.staticMapData.china,a=new Vi({color:new wt(e.chinaBgMaterialColor),transparent:!0,opacity:.72}),i=new Ca(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,merge:!0,material:a,renderOrder:2}),r=new aa({color:e.lineColor,transparent:!0,opacity:.58}),o=new sa(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,material:r,renderOrder:3});return o.lineGroup.position.z+=.01,{china:i,chinaTopLine:o}}createNationalBackdrop(){var c;if(!this.showNationalBackdrop||this.nationalBackdropGroup)return!1;let e=null;try{e=xa(this.assets.instance.getResource("chinaMap"))}catch(f){return console.warn("首页全国底图资源未加载",f),!1}if(!((c=e==null?void 0:e.features)!=null&&c.length))return!1;const t=this.geoProjectionCenter,a=120,i=new Q(0,0,-.08),r=new Vi({color:new wt("#152c47"),transparent:!0,opacity:.72,depthWrite:!1,fog:!1,side:Ne}),o=new Ca(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,merge:!0,position:i,material:r,renderOrder:0});o.mapGroup.name="home-national-backdrop-fill",o.setParent(this.mapGroup);const u=new aa({color:new wt("#3f82cd"),transparent:!0,opacity:.46,depthWrite:!1,fog:!1}),d=new sa(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,position:new Q(i.x,i.y,i.z+.01),material:u,renderOrder:1});return d.lineGroup.name="home-national-backdrop-line",d.setParent(this.mapGroup),this.nationalBackdropGroup=o.mapGroup,this.nationalBackdropLineGroup=d.lineGroup,!0}createTradeNationalMap(){var m;if(this.tradeNationalMapGroup)return!0;let e=null;try{e=xa(this.assets.instance.getResource("chinaMap"))}catch(T){return console.warn("牦牛交易全国地图资源未加载",T),!1}const t=e;if(!e||!((m=t==null?void 0:t.features)!=null&&m.length))return!1;const a=new ge;a.name="trade-national-map",a.visible=!1,a.rotation.x=-Math.PI/2,a.position.set(0,.04,0);const i=new me({color:403001,transparent:!0,opacity:.14,side:Ne,depthWrite:!1,fog:!1});new Ca(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new Q(.05,-.05,-.03),material:i,renderOrder:17}).setParent(a);const{topMaterial:o,sideMaterial:u}=this.createTradeNationalMaterials(),d=new Ts(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new Q(0,0,0),depth:this.tradeNationalDepth,topFaceMaterial:o,sideMaterial:u,renderOrder:20,bevelThickness:.024,bevelSegments:1});d.mapGroup.traverse(T=>{T.isMesh&&(T.renderOrder=20)}),d.setParent(a);const c=new aa({color:4777983,transparent:!0,opacity:.52,fog:!1,depthTest:!1}),f=new sa(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,material:c,renderOrder:21});return f.lineGroup.position.z+=this.tradeNationalDepth+.055,f.setParent(a),this.scene.add(a),this.tradeNationalMapGroup=a,this.createTradeNationalLabels(t),!0}createTradeNationalMaterials(){const e=new Qa({color:16777215,transparent:!0,opacity:.54,roughness:.84,metalness:.08,side:Ne,fog:!1});new ei(e,{uColor1:827317,uColor2:403515,size:6.8,dir:"x"});const t=this.assets.instance.getResource("side").clone();t.wrapS=ot,t.wrapT=ot,t.repeat.set(1,1.2),t.needsUpdate=!0;const a=new Qa({color:1485501,map:t,transparent:!0,opacity:.58,roughness:.78,metalness:.04,side:Ne,fog:!1});return new ei(a,{uColor1:1354174,uColor2:134940,size:Math.max(this.tradeNationalDepth,.1),dir:"y"}),this.time.on("tick",()=>{t.offset.y+=.004}),{topMaterial:e,sideMaterial:a}}createTradeNationalLabels(e){this.tradeNationalLabelGroup=new ge,this.tradeNationalLabelGroup.name="trade-national-label",this.tradeNationalLabelGroup.rotation.x=-Math.PI/2,this.tradeNationalLabelGroup.visible=!1,this.scene.add(this.tradeNationalLabelGroup),this.tradeNationalLabels=[];const t=new Set(["四川","青海","甘肃","陕西","重庆","云南","西藏","新疆"]);(e.features||[]).forEach(a=>{var d;const i=((d=a.properties)==null?void 0:d.name)||"",r=this.normalizeTradeProvinceName(i);if(!t.has(r))return;const o=this.getFeatureCenterLngLat(a);if(!o)return;const u=this.label3d.create("","trade-national-label",!0);u.init(`<div class="trade-national-name">${ve(r)}</div>`,this.getTradeLocalPoint(o.lng,o.lat,.82)),this.label3d.setLabelStyle(u,.012,"x"),u.setParent(this.tradeNationalLabelGroup),u.visible=!0,this.tradeNationalLabels.push(u)})}normalizeTradeProvinceName(e=""){return String(e).replace(/省|市|自治区|壮族|回族|维吾尔|特别行政区/g,"").trim()}getFeatureCenterLngLat(e){var r,o,u;const t=((r=e==null?void 0:e.properties)==null?void 0:r.cp)||((o=e==null?void 0:e.properties)==null?void 0:o.centroid)||((u=e==null?void 0:e.properties)==null?void 0:u.center);if(Array.isArray(t)&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])))return{lng:Number(t[0]),lat:Number(t[1])};const a=this.getGeometryCoordinateList(e==null?void 0:e.geometry);if(!a.length)return null;const i=a.reduce((d,c)=>({minLng:Math.min(d.minLng,Number(c[0])),maxLng:Math.max(d.maxLng,Number(c[0])),minLat:Math.min(d.minLat,Number(c[1])),maxLat:Math.max(d.maxLat,Number(c[1]))}),{minLng:1/0,maxLng:-1/0,minLat:1/0,maxLat:-1/0});return{lng:(i.minLng+i.maxLng)/2,lat:(i.minLat+i.maxLat)/2}}isHomeTopicPresentation(){return this.topicLayerPresentation==="home"}createProvince(){let e=this.staticMapData.mapJson;this.mapJsonData=e;const t=this.useSatelliteBase?xs({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:this.satelliteTextureZoom,tileUrlTemplate:this.tileUrlTemplate,onTileStatus:m=>{var T,M;return(M=(T=this.callbacks).onTileStatus)==null?void 0:M.call(T,m)}}):null;t!=null&&t.texture&&this.enhanceTexture(t.texture);let[a,i]=this.createProvinceMaterial();this.focusMapTopMaterial=a,this.focusMapSideMaterial=i;let r=new Ts(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new Q(0,0,.11),data:e,depth:this.depth,topFaceMaterial:a,sideMaterial:i,renderOrder:9}),o=new Qa({color:this.useSatelliteBase?16777215:13172735,map:(t==null?void 0:t.texture)||null,transparent:!0,opacity:this.useSatelliteBase?this.usesCustomSatelliteTiles?1:.94:this.isHomeTopicPresentation()?.58:.88,roughness:this.useSatelliteBase?this.usesCustomSatelliteTiles?.7:.82:.66,metalness:this.useSatelliteBase?0:.08});this.usesCustomSatelliteTiles||new ei(o,{uColor1:this.useSatelliteBase?1629410:this.isHomeTopicPresentation()?683906:1227744,uColor2:this.useSatelliteBase?757673:this.isHomeTopicPresentation()?406090:38069,size:this.useSatelliteBase?15:8.6}),this.defaultMaterial=o,this.defaultLightMaterial=this.defaultMaterial.clone(),this.defaultLightMaterial.color=new wt("rgba(128,244,255,1)"),this.defaultLightMaterial.opacity=.9;let u=new Ca(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new Q(0,0,this.depth+.22),data:e,material:o,renderOrder:this.usesCustomSatelliteTiles?14:8});this.satelliteMapTop=u,this.satelliteMaterial=o,t!=null&&t.uvBounds&&_s(u,t.uvBounds),u.mapGroup.children.map(m=>{m.children.map(T=>{T.type==="Mesh"&&this.eventElement.push(T)})}),this.mapLineMaterial=new aa({color:12254463,opacity:0,transparent:!0,linewidth:this.adminBoundaryLineScale,fog:!1});let d=new sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapLineMaterial,renderOrder:this.isHomeTopicPresentation()?34:26});d.lineGroup.position.z+=this.depth+(this.isHomeTopicPresentation()?.315:.285);let c=null;const f=this.getAdminBoundaryEmphasisRadius();return f>0&&(this.mapBoundaryEmphasisMaterial=new me({color:9632767,transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1,blending:xe}),c=new sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapBoundaryEmphasisMaterial,renderOrder:this.usesCustomSatelliteTiles?24:18,type:"Line3",tubeRadius:f}),c.lineGroup.position.z+=this.depth+.255),{map:r,mapTop:u,mapLine:d,mapBoundaryEmphasis:c}}normalizeAdminBoundaryLineScale(e){const t=Number(e);return Number.isFinite(t)?Math.min(4,Math.max(1,t)):1}getAdminBoundaryEmphasisRadius(){return this.adminBoundaryLineScale<=1?0:Math.min(.04,.011*this.adminBoundaryLineScale)}getAdminBoundaryEmphasisOpacity(){return this.adminBoundaryLineScale<=1?0:Math.min(.5,.2+this.adminBoundaryLineScale*.08)}createTopicLayer(){if(!this.mapJsonData)return;this.initHongyuanBoundaryPolygons();const e=document.createElement("canvas");e.width=Rt.width,e.height=Rt.height;const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height);const a=new Hi(e);a.colorSpace=la,a.wrapS=oi,a.wrapT=oi,a.minFilter=_a,a.magFilter=_a,this.enhanceTexture(a),a.needsUpdate=!0;const i=new me({map:a,transparent:!0,opacity:0,depthWrite:!1,depthTest:!this.isHomeTopicPresentation(),side:Ne,fog:!1}),r=this.createLayerUvBounds(),o=new Ca(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new Q(0,0,this.depth+(this.isHomeTopicPresentation()?.272:.255)),data:this.mapJsonData,material:i,renderOrder:this.isHomeTopicPresentation()?24:18});_s(o,r),o.setParent(this.focusMapGroup),this.topicLayerUvBounds=r,this.topicLayerCanvas=e,this.topicLayerContext=t,this.topicLayerTexture=a,this.topicLayerMaterial=i,this.topicLayerMap=o}initHongyuanBoundaryPolygons(){var t,a,i;if((t=this.hongyuanBoundaryPolygons)!=null&&t.length)return;const e=this.staticMapData.mapStroke;this.hongyuanBoundaryPolygons=Ws((i=(a=e==null?void 0:e.features)==null?void 0:a[0])==null?void 0:i.geometry)}createSelectedFeatureGroup(){var e;this.selectedFeatureGroup||(this.selectedFeatureGroup=new ge,this.selectedFeatureGroup.name="selected-feature-highlight",this.selectedFeatureGroup.position.z=this.depth+.31,(e=this.focusMapGroup)==null||e.add(this.selectedFeatureGroup))}createLayerUvBounds(){const e=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),[t]=e([Y.west,Y.south]),[a]=e([Y.east,Y.south]),[,i]=e([Y.west,Y.north]),[,r]=e([Y.west,Y.south]);return{left:t,right:a,bottom:-r,top:-i}}setTopicLayer(e){var a,i;if(!e||!this.topicLayerContext||!this.topicLayerTexture)return;this.currentTopicLayer=e,this.visibleTopicLayers=[e],this.clearSelectedFeature(),this.applyLayerMapView(e);const t=++this.topicLayerLoadId;if(this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(i=(a=this.callbacks).onLayerStatus)==null||i.call(a,{type:"loading",text:`正在加载 ${e.name}`}),ii(e)){this.loadVectorTopicLayer(e,t);return}this.loadTopicLayerImage(e).then(r=>{var o,u,d,c;if(t===this.topicLayerLoadId){if(!(r!=null&&r.image)){this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(u=(o=this.callbacks).onLayerStatus)==null||u.call(o,{type:"error",text:"GeoServer 图层加载失败"});return}this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.drawTopicRasterImage(r.image,r.layer||e),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(e),this.topicLayerMaterial.opacity=this.getTopicLayerMaterialOpacity(e,.84),(c=(d=this.callbacks).onLayerStatus)==null||c.call(d,{type:"success",text:"GeoServer 图层已加载"})}}).catch(()=>{var r,o;t===this.topicLayerLoadId&&(this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"error",text:"GeoServer 图层加载失败"}))})}setTopicLayers(e=[],t=e[0]){var r,o,u,d;if(!this.topicLayerContext||!this.topicLayerTexture)return;const a=e.filter(Boolean);if(!a.length){this.topicLayerLoadId+=1,this.visibleTopicLayers=[],this.currentTopicLayer=null,this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.clearSelectedFeature(),this.applyLayerMapView(null),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"success",text:"图层已关闭"});return}if(a.length===1){this.setTopicLayer(A(A({},a[0]),(t==null?void 0:t.key)===a[0].key?t:{}));return}this.currentTopicLayer=t||a[a.length-1],this.visibleTopicLayers=a,this.clearSelectedFeature(),this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.applyLayerMapView(this.currentTopicLayer);const i=++this.topicLayerLoadId;this.currentVectorFeatures=[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"loading",text:`正在加载 ${a.length} 个地图图层`}),Promise.all(a.map(c=>this.loadCompositeTopicLayerItem(c))).then(c=>{var T,M,F;if(i!==this.topicLayerLoadId)return;const f=c.filter(Boolean),m=f.find(x=>{var G,j;return x.type==="vector"&&((G=x.layer)==null?void 0:G.key)===((j=this.currentTopicLayer)==null?void 0:j.key)});this.currentVectorFeatures=((T=m==null?void 0:m.geojson)==null?void 0:T.features)||[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),f.forEach((x,G)=>{var j,X;if(x.type==="image"){this.topicLayerContext.save();const se=G===f.length-1?Math.max(.78,(j=x.layer.opacity)!=null?j:.9):Math.min(.52,(X=x.layer.opacity)!=null?X:.52);this.topicLayerContext.globalAlpha=Math.min(1,Math.max(.28,se)),this.drawTopicRasterImage(x.image,x.layer),this.topicLayerContext.restore();return}this.drawVectorTopicLayer(x.layer,x.geojson.features||[],{clear:!1})}),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(this.currentTopicLayer),this.topicLayerMaterial.opacity=f.length?this.getTopicLayerMaterialOpacity(this.currentTopicLayer,1):0,(F=(M=this.callbacks).onLayerStatus)==null||F.call(M,{type:f.length?"success":"error",text:f.length?`已加载 ${f.length} 个地图图层`:"地图图层加载失败"})})}loadCompositeTopicLayerItem(e){return re(this,null,function*(){if(ii(e))try{const t=yield this.fetchVectorLayerGeojson(e);return{type:"vector",layer:e,geojson:t}}catch(t){return null}return this.loadTopicLayerImage(e).then(t=>t?A({type:"image"},t):null)})}loadTopicLayerImage(e){return Vs(e)?this.loadWmtsTopicLayerImage(e):new Promise(t=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t({image:a,layer:e}),a.onerror=()=>t(null),a.src=Nl(e)})}loadWmtsTopicLayerImage(e){return re(this,null,function*(){const t=document.createElement("canvas");t.width=Rt.width,t.height=Rt.height;const a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,t.width,t.height);const i=this.getWmtsTopicZoom(e),r=hu(Y,i),o=[];for(let f=r.minX;f<=r.maxX;f+=1)for(let m=r.minY;m<=r.maxY;m+=1)o.push({x:f,y:m});let u=0,d=0;const c=()=>re(this,null,function*(){for(;d<o.length;){const f=o[d];d+=1;const m=yield fu(xl(e,{x:f.x,y:f.y,z:i}));if(!m)continue;const T=pu(f.x,f.y,i,t);a.drawImage(m,T.x,T.y,T.width,T.height),u+=1}});return yield Promise.all(Array.from({length:Math.min(nu,o.length)},c)),u?(this.enhanceWmtsTopicCanvas(t,e),{image:t,layer:e,loaded:u}):null})}enhanceWmtsTopicCanvas(e,t={}){var d,c;if(t.homeWmtsEnhance===!1)return;const a=e.getContext("2d");if(!a)return;const i=document.createElement("canvas");i.width=e.width,i.height=e.height;const r=i.getContext("2d");if(!r)return;r.drawImage(e,0,0);const o=Yt((d=t.homeWmtsPointSpread)!=null?d:0,0,4),u=Yt((c=t.homeWmtsGlowRadius)!=null?c:0,0,6);if(a.clearRect(0,0,e.width,e.height),u>0&&(a.save(),a.globalAlpha=.58,a.filter=`blur(${u}px)`,a.drawImage(i,0,0),a.restore()),o>0){const f=[[-o,0],[o,0],[0,-o],[0,o],[-o,-o],[o,-o],[-o,o],[o,o]];a.save(),a.globalAlpha=.72,f.forEach(([m,T])=>a.drawImage(i,m,T)),a.restore()}a.drawImage(i,0,0)}getWmtsTopicZoom(e={}){var o,u,d;const t=Math.round(Number(e.maximumLevel)),a=Number.isFinite(t)&&t>0?t:21,i=Number((d=(u=(o=e.homeWmtsZoom)!=null?o:e.wmtsZoom)!=null?u:e.tileZoom)!=null?d:this.satelliteTextureZoom),r=Number.isFinite(i)&&i>0?Math.round(i):11;return Yt(r,3,Math.min(a,ai))}updateTopicLayerTextureSampling(e={}){if(!this.topicLayerTexture)return;const t=Vs(e)?ms:_a;this.topicLayerTexture.minFilter=t,this.topicLayerTexture.magFilter=t,this.topicLayerTexture.needsUpdate=!0}drawTopicRasterImage(e,t={}){const a=this.topicLayerCanvas,i=this.topicLayerContext;if(!a||!i)return;if(!t.softMask){this.drawHomeTopicRasterGlow(e,t),i.drawImage(e,0,0,a.width,a.height);return}const r=Math.min(1,Math.max(.08,Number(t.softMaskScale)||.18)),o=document.createElement("canvas");o.width=Math.max(96,Math.round(a.width*r)),o.height=Math.max(96,Math.round(a.height*r));const u=o.getContext("2d");if(!u){i.drawImage(e,0,0,a.width,a.height);return}u.clearRect(0,0,o.width,o.height),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(e,0,0,o.width,o.height),i.save(),i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high",i.drawImage(o,0,0,a.width,a.height),i.restore()}drawHomeTopicRasterGlow(e,t={}){var d,c;if(!this.isHomeTopicPresentation())return;const a=this.topicLayerCanvas,i=this.topicLayerContext;if(!a||!i)return;const r=Yt((d=t.homeGlowOpacity)!=null?d:0,0,.8),o=Yt((c=t.homeGlowBlur)!=null?c:0,0,32);if(!r||!o)return;const u=t.homeGlowColor||"#E5FCFF";i.save(),i.globalAlpha=r,i.filter=`drop-shadow(0 0 ${o}px ${u})`,i.drawImage(e,0,0,a.width,a.height),i.restore()}applyLayerMapView(e,t={}){var d,c;if(!((d=this.camera)!=null&&d.instance)||!((c=this.camera)!=null&&c.controls)||!this.mapAnimationComplete&&!t.force)return;const a=e?null:this.currentTownRanking,i=(e==null?void 0:e.mapView)||(e!=null&&e.cameraPosition?{cameraPosition:e.cameraPosition}:null)||(a==null?void 0:a.mapView)||(a!=null&&a.cameraPosition?{cameraPosition:a.cameraPosition}:null),r=i?this.getLayerMapViewTarget(i):this.defaultMapTarget.clone(),o=i?this.getLayerMapViewCameraPosition(i,r):this.defaultMapCameraPosition.clone(),u=i&&Number.isFinite(i.duration)?i.duration:.75;this.animateMapCamera(o,r,u)}getFocusMapTopOpacity(){return this.useSatelliteBase?this.usesCustomSatelliteTiles?.16:1:.78}getTopicLayerMaterialOpacity(e,t=.84){const a=Number(e==null?void 0:e.opacity),i=Number.isFinite(a)?a:t;if(!this.isHomeTopicPresentation())return i;const r=Number(e==null?void 0:e.homePresentationMaxOpacity),o=Number.isFinite(r)?r:.56;return Yt(i,0,o)}getDynamicSatelliteZoom(e){return this.usesCustomSatelliteTiles?e<=4.2?Math.min(this.dynamicSatelliteMaxZoom,21):e<=6.4?Math.min(this.dynamicSatelliteMaxZoom,19):e<=8.4?Math.min(this.dynamicSatelliteMaxZoom,17):e<=11?Math.min(this.dynamicSatelliteMaxZoom,15):e<=14.5?Math.min(this.dynamicSatelliteMaxZoom,13):e<=18?Math.min(this.dynamicSatelliteMaxZoom,11):this.satelliteTextureZoom:this.satelliteTextureZoom}getCameraTargetLngLat(){var r,o,u,d,c,f,m;const e=(d=(u=(o=(r=this.camera)==null?void 0:r.controls)==null?void 0:o.target)==null?void 0:u.clone)==null?void 0:d.call(u);if(!e)return[102.58,32.72];(f=(c=this.focusMapGroup)==null?void 0:c.updateWorldMatrix)==null||f.call(c,!0,!1);const t=this.focusMapGroup?this.focusMapGroup.worldToLocal(e):e,a=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),i=((m=a.invert)==null?void 0:m.call(a,[t.x,-t.y]))||[102.58,32.72];return[Math.max(Y.west,Math.min(Y.east,Number(i[0])||102.58)),Math.max(Y.south,Math.min(Y.north,Number(i[1])||32.72))]}getDynamicSatelliteTileWindow(e){return e>=21?3:e>=19?5:e>=17?7:e>=15?this.dynamicSatelliteTileWindow:e>=13?Math.min(11,this.dynamicSatelliteTileWindow+2):Math.min(11,this.dynamicSatelliteTileWindow+2)}getDynamicSatelliteKey(e,t){return t?`${e}:${t.minX}-${t.maxX}:${t.minY}-${t.maxY}`:""}updateDynamicSatelliteTiles(e=!1){if(!this.usesCustomSatelliteTiles||!this.mapAnimationComplete)return;const t=Date.now();if(!e&&t-this.dynamicSatelliteLastCheck<iu)return;this.dynamicSatelliteLastCheck=t;const a=this.camera.instance.position.distanceTo(this.camera.controls.target),i=this.getDynamicSatelliteZoom(a);if(i<=this.satelliteTextureZoom){this.hideDynamicSatelliteOverlay();return}const r=this.getCameraTargetLngLat(),o=this.getDynamicSatelliteTileWindow(i),u=jl({zoom:i,centerLngLat:r,maxCols:o,maxRows:o}),d=this.getDynamicSatelliteKey(i,u);!d||d===this.dynamicSatelliteCurrentKey||d===this.dynamicSatelliteLoadingKey||this.loadDynamicSatelliteOverlay({zoom:i,centerLngLat:r,maxTiles:o,key:d})}loadDynamicSatelliteOverlay({zoom:e,centerLngLat:t,maxTiles:a,key:i}){const r=++this.dynamicSatelliteRequestId;this.dynamicSatelliteLoadingKey=i;let o;o=xs({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:e,centerLngLat:t,maxCols:a,maxRows:a,tileUrlTemplate:this.tileUrlTemplate,transparentBackground:!0,applyTone:!1,onTileStatus:u=>{var d,c,f,m,T;if((f=(c=this.callbacks).onTileStatus)==null||f.call(c,O(A({},u),{text:((d=u.text)==null?void 0:d.replace("影像底图","高清影像底图"))||u.text})),u.type!=="loading"){if(r!==this.dynamicSatelliteRequestId){(T=(m=o==null?void 0:o.texture)==null?void 0:m.dispose)==null||T.call(m);return}if(this.dynamicSatelliteLoadingKey="",Number(u.loaded||0)<=0){this.dynamicSatelliteCurrentKey===i&&this.hideDynamicSatelliteOverlay();return}this.applyDynamicSatelliteOverlay(o,i)}}}),this.applyDynamicSatelliteOverlay(o,i)}ensureDynamicSatelliteOverlay(){var a;if(this.dynamicSatelliteOverlay)return;const e=new me({transparent:!0,opacity:0,depthWrite:!1,depthTest:!0,side:Ne,fog:!1}),t=new We(new _t(1,1),e);t.name="dynamic-satellite-overlay",t.renderOrder=15,t.visible=!1,t.position.z=this.depth+.248,(a=this.focusMapGroup)==null||a.add(t),this.dynamicSatelliteOverlay=t,this.dynamicSatelliteMaterial=e}applyDynamicSatelliteOverlay(e,t){var o,u;if(!(e!=null&&e.texture)||!(e!=null&&e.uvBounds))return;this.ensureDynamicSatelliteOverlay();const a=e.uvBounds,i=Math.max(1e-4,a.right-a.left),r=Math.max(1e-4,a.top-a.bottom);this.dynamicSatelliteOverlay.position.set((a.left+a.right)/2,(a.bottom+a.top)/2,this.depth+.248),this.dynamicSatelliteOverlay.scale.set(i,r,1),this.dynamicSatelliteOverlay.visible=!0,this.dynamicSatelliteTexture&&this.dynamicSatelliteTexture!==e.texture&&((u=(o=this.dynamicSatelliteTexture).dispose)==null||u.call(o)),this.dynamicSatelliteTexture=e.texture,this.dynamicSatelliteMaterial.map=e.texture,this.dynamicSatelliteMaterial.opacity=1,this.dynamicSatelliteMaterial.needsUpdate=!0,this.dynamicSatelliteCurrentKey=t}hideDynamicSatelliteOverlay(){this.dynamicSatelliteOverlay&&(this.dynamicSatelliteOverlay.visible=!1),this.dynamicSatelliteLoadingKey&&(this.dynamicSatelliteRequestId+=1,this.dynamicSatelliteLoadingKey=""),this.dynamicSatelliteCurrentKey=""}ensureMapRevealed(){var e,t,a,i;if(!this.mapAnimationComplete){if((t=(e=this.animateTl)==null?void 0:e.progress)==null||t.call(e,1,!1),(i=(a=this.animateTl)==null?void 0:a.pause)==null||i.call(a),this.mapAnimationComplete=!0,this.focusMapGroup&&(this.focusMapGroup.position.set(0,0,0),this.focusMapGroup.scale.set(1,1,1)),this.focusMapTopMaterial&&(this.focusMapTopMaterial.opacity=this.getFocusMapTopOpacity()),this.focusMapSideMaterial&&(this.focusMapSideMaterial.opacity=1,this.focusMapSideMaterial.transparent=!1),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=!0),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=!0),this.scatterGroup&&(this.scatterGroup.visible=!0),this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.hasTownRankingRows()),this.applyLayerMapView(this.currentTopicLayer,{force:!0}),this.updateDynamicSatelliteTiles(!0),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),Na(this.currentTownRanking)){this.hideAllMapStatisticLabels();return}this.updateVillageRankingLabels(this.currentTownRanking),this.updateTradeFlowLayer(this.currentTownRanking),this.updateInfoPointStats()}}getLayerMapViewTarget(e){var t;return e!=null&&e.targetLngLat?this.lngLatToWorldPoint(e.targetLngLat,(t=e.targetLocalZ)!=null?t:.72):e!=null&&e.target?this.toVector3(e.target,this.defaultMapTarget):this.defaultMapTarget.clone()}getLayerMapViewCameraPosition(e,t){if(e!=null&&e.cameraPosition)return this.toVector3(e.cameraPosition,this.defaultMapCameraPosition);const a=Number.isFinite(e==null?void 0:e.distanceScale)?e.distanceScale:1,i=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(a),r=t.clone().add(i);return e!=null&&e.cameraOffset&&r.add(this.toVector3(e.cameraOffset,new Q(0,0,0))),r}lngLatToWorldPoint(e,t=0){const a=Array.isArray(e)?e:[e==null?void 0:e.lng,e==null?void 0:e.lat],i=Number(a==null?void 0:a[0]),r=Number(a==null?void 0:a[1]);if(!Number.isFinite(i)||!Number.isFinite(r))return this.defaultMapTarget.clone();const[o,u]=this.geoProjection([i,r]),d=new Q(o,-u,Number(t)||0);return this.focusMapGroup?this.focusMapGroup.localToWorld(d):d}toVector3(e,t){if(Array.isArray(e)){const[o,u,d]=e.map(Number);return[o,u,d].every(Number.isFinite)?new Q(o,u,d):t.clone()}const a=Number(e==null?void 0:e.x),i=Number(e==null?void 0:e.y),r=Number(e==null?void 0:e.z);return[a,i,r].every(Number.isFinite)?new Q(a,i,r):t.clone()}animateMapCamera(e,t,a=.75){this.activeMapViewTweens.forEach(o=>{var u;return(u=o==null?void 0:o.kill)==null?void 0:u.call(o)}),this.activeMapViewTweens=[];const i=this.camera.controls,r=()=>i.update();this.activeMapViewTweens.push(ra.to(this.camera.instance.position,{duration:a,x:e.x,y:e.y,z:e.z,ease:"power2.out",onUpdate:r}),ra.to(i.target,{duration:a,x:t.x,y:t.y,z:t.z,ease:"power2.out",onUpdate:r}))}addSceneTween(e){var t;return e&&(this.sceneTweens.push(e),this.scenePaused&&((t=e.pause)==null||t.call(e)),e)}addSceneTimer(e){return e&&this.sceneTimers.push(e),e}focusTownByName(e,t={}){var u,d,c;const a=this.townMetaByName.get(lt(e)),i=t.select?this.selectTownFeatureByName(e,t):!1;if(t.preserveCamera)return i||!!(a!=null&&a.center);if(!(a!=null&&a.center))return i;const r=this.lngLatToWorldPoint(a.center,(u=t.targetLocalZ)!=null?u:.82),o=this.getLayerMapViewCameraPosition({distanceScale:(d=t.distanceScale)!=null?d:.82,cameraOffset:t.cameraOffset||{x:0,y:1.2,z:0}},r);return this.animateMapCamera(o,r,(c=t.duration)!=null?c:.75),!0}isNationalParkTownSelectionActive(){var e;return((e=this.currentTopicLayer)==null?void 0:e.key)==="national-park-zoning"&&this.getTownRankingMeta().onlyRankedTownLabels}getTownNameFromMapEvent(e){var a,i,r,o,u,d,c,f,m,T;return[(r=(i=(a=e==null?void 0:e.target)==null?void 0:a.parent)==null?void 0:i.userData)==null?void 0:r.name,(u=(o=e==null?void 0:e.target)==null?void 0:o.userData)==null?void 0:u.name,(f=(c=(d=e==null?void 0:e.target)==null?void 0:d.parent)==null?void 0:c.userData)==null?void 0:f.townName,(T=(m=e==null?void 0:e.target)==null?void 0:m.userData)==null?void 0:T.townName].find(M=>String(M||"").trim())||""}findTownFeatureByName(e){var i,r,o,u;const t=lt(e);if(!t)return null;const a=(((i=this.mapJsonData)==null?void 0:i.features)||((o=(r=this.staticMapData)==null?void 0:r.mapJson)==null?void 0:o.features)||[]).find(d=>{const c=(d==null?void 0:d.properties)||{};return[c.name,c.fullName,c.full_name,c.townName].some(m=>lt(m)===t)});return a!=null&&a.geometry?{type:"Feature",properties:O(A({},a.properties||{}),{name:((u=a.properties)==null?void 0:u.name)||e,feature_role:"乡镇范围"}),geometry:a.geometry}:null}selectTownFeatureByName(e,t={}){var i,r,o,u,d;const a=this.findTownFeatureByName(e);return a?(this.showSelectedFeature(a,{mode:"town"}),t.silentStatus!==!0&&((d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"success",text:t.statusText||`已选中${((o=a.properties)==null?void 0:o.name)||e}`})),!0):(t.showMissingStatus!==!1&&((r=(i=this.callbacks).onLayerStatus)==null||r.call(i,{type:"warning",text:"未找到对应乡镇边界"})),!1)}handleTownRankingSelect(e,t={}){var u,d;if(!this.isNationalParkTownSelectionActive())return!1;const a=lt(e);if(!a||!this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1).some(c=>lt(c.name)===a))return!1;const o=this.focusTownByName(e,A({select:!0,preserveCamera:!0,statusText:`已选中${e}`},t));return o&&((d=(u=this.callbacks).onFeatureInfo)==null||d.call(u,{feature:null})),o}focusYakIndustryPoint(e={}){var r,o;const t=this.getYakIndustryPayloadCoordinate(e);if(!t)return(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"warning",text:"当前主体暂无可定位坐标"}),{focused:!1,screen:null};const a=this.findYakIndustryPointFeature(e,t);return a?this.setSelectedVectorFeatures([a]):this.clearSelectedFeature(),{focused:this.flyToLngLat(t,{span:.035,duration:.72,statusText:"已定位产业主体"}),screen:this.getYakIndustryPointScreen(e),feature:a}}focusVectorFeature(e={}){var c,f;const t=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),a=String(e.id||e.key||""),i=String(e.fullName||e.name||"").trim(),r=t.find(m=>{const T=(m==null?void 0:m.properties)||{};return a&&String(T.id||"")===a||i&&String(T.name||T.plot_name||"").trim()===i});if(!r)return(f=(c=this.callbacks).onLayerStatus)==null||f.call(c,{type:"warning",text:"当前图斑尚未加载"}),{focused:!1,screen:null,feature:null};this.setSelectedVectorFeatures([r]);const o=this.getGeometryLngLatBounds(r.geometry);if(!o)return{focused:!1,screen:null,feature:r};const u=[(o.minLng+o.maxLng)/2,(o.minLat+o.maxLat)/2];return{focused:this.flyToLngLat(u,{span:Math.max(o.maxLng-o.minLng,o.maxLat-o.minLat),duration:.75,statusText:"已定位种草图斑"}),screen:this.getVectorFeatureScreen(r),feature:r}}getVectorFeatureScreen(e={}){let t=(e==null?void 0:e.feature)||e;if(!(t!=null&&t.geometry)){const r=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),o=String((e==null?void 0:e.id)||(e==null?void 0:e.key)||"");t=r.find(u=>{var d;return String(((d=u==null?void 0:u.properties)==null?void 0:d.id)||"")===o})||null}const a=this.getGeometryLngLatBounds(t==null?void 0:t.geometry);if(!a)return null;const i=[(a.minLng+a.maxLng)/2,(a.minLat+a.maxLat)/2];return this.lngLatToLayerScreenPoint(i,this.depth+.34)||this.lngLatToScreenPoint(i,this.depth+.32)}getYakIndustryPointScreen(e={}){const t=this.getYakIndustryPayloadCoordinate(e);return t?this.lngLatToLayerScreenPoint(t,this.depth+.36)||this.lngLatToScreenPoint(t,this.depth+.32):null}getYakIndustryPayloadCoordinate(e={}){var r,o,u,d,c;const t=((r=e.geometry)==null?void 0:r.coordinates)||e.coordinates,a=Number((u=(o=e.longitude)!=null?o:e.lng)!=null?u:t==null?void 0:t[0]),i=Number((c=(d=e.latitude)!=null?d:e.lat)!=null?c:t==null?void 0:t[1]);return!Number.isFinite(a)||!Number.isFinite(i)?null:[a,i]}findYakIndustryPointFeature(e={},t=this.getYakIndustryPayloadCoordinate(e)){const a=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),i=String(e.id||e.key||""),r=String(e.fullName||e.name||"").trim(),o=String(e.stageKey||""),u=t&&a.find(c=>{var m;if(((m=c==null?void 0:c.geometry)==null?void 0:m.type)!=="Point")return!1;const f=c.properties||{};return o&&String(f.stageKey||"")!==o?!1:this.getCoordinateDistance(c.geometry.coordinates,t)<=8e-4})||null;if(e.preferCoordinateMatch)return u;const d=a.find(c=>{const f=(c==null?void 0:c.properties)||{};return!!(i&&String(f.id||"")===i||r&&String(f.name||f.fullName||"").trim()===r)});return d||u}loadVectorTopicLayer(e,t){return re(this,null,function*(){var a,i,r,o;try{const u=yield this.fetchVectorLayerGeojson(e);if(t!==this.topicLayerLoadId)return;this.currentVectorFeatures=u.features||[],this.drawVectorTopicLayer(e,this.currentVectorFeatures),this.updateYakIndustryPointMarkers(e,this.currentVectorFeatures),this.updateYakIndustryPointLabels(e,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=this.getTopicLayerMaterialOpacity(e,.9),(i=(a=this.callbacks).onLayerStatus)==null||i.call(a,{type:"success",text:"真实矢量图层已加载"})}catch(u){if(t!==this.topicLayerLoadId)return;this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(r=this.callbacks).onLayerStatus)==null||o.call(r,{type:"error",text:"真实矢量图层加载失败"})}})}fetchVectorLayerGeojson(e){return re(this,null,function*(){var r,o,u,d;if(e.sourceType==="geojson-api"){const c=yield fetch(e.apiUrl,{credentials:"include"});if(!c.ok)throw new Error(`HTTP ${c.status}`);const f=yield c.json();let m=(r=f==null?void 0:f.data)!=null?r:f;if(m=(o=m==null?void 0:m.geojson)!=null?o:m,m&&typeof m.value=="string"&&(m=m.value),typeof m=="string"&&(m=JSON.parse(m)),(m==null?void 0:m.type)!=="FeatureCollection"||!Array.isArray(m.features))throw new Error("Invalid GeoJSON API payload");return m}if(e.sourceType==="geojson"){if(((u=e.geojsonData)==null?void 0:u.type)==="FeatureCollection")return e.geojsonData;const c=yield fetch(zs(e.dataPath),{credentials:"include"});if(!c.ok)throw new Error(`HTTP ${c.status}`);return yield c.json()}if(e.sourceType==="wfs"){const c=yield Ms(e.layerName,{cqlFilter:e.cqlFilter,maxFeatures:e.maxFeatures||1200,timeout:e.timeout||18e3});return(c==null?void 0:c.type)==="FeatureCollection"?c:{type:"FeatureCollection",features:(c==null?void 0:c.features)||[]}}let t=[],a=null;try{const c=yield fetch(e.apiUrl,{credentials:"include"});if(!c.ok)throw new Error(`HTTP ${c.status}`);const f=yield c.json();t=Array.isArray(f==null?void 0:f.data)?f.data:Array.isArray((d=f==null?void 0:f.data)==null?void 0:d.rows)?f.data.rows:[]}catch(c){a=c}let i=this.buildWktLayerFeatures(t);if((!t.length||!i.length)&&e.fallbackPath){const c=yield fetch(zs(e.fallbackPath),{credentials:"include"});if(!c.ok)throw a||new Error(`HTTP ${c.status}`);const f=yield c.json();t=Array.isArray(f==null?void 0:f.rows)?f.rows:[],i=this.buildWktLayerFeatures(t)}return{type:"FeatureCollection",features:i}})}buildWktLayerFeatures(e=[]){return(e||[]).map(t=>({type:"Feature",properties:{id:t.id,type:t.type,totalAcreage:t.totalAcreage,cdAcreage:t.cdAcreage,sdAcreage:t.sdAcreage,cdScl:t.cdScl,sdScl:t.sdScl},geometry:this.parseWktGeometry(this.pickWktValue(t))})).filter(t=>t.geometry)}pickWktValue(e={}){return e.wkt||e.WKT||e.geom||e.geometry||e.the_geom||e.theGeom||e.shape||e.Shape}drawVectorTopicLayer(e,t,a={}){const i=this.topicLayerContext;a.clear!==!1&&i.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),i.save(),i.lineJoin="round",i.lineCap="round",this.clipVectorLayerContext(i,e);const o=this.getVisibleVectorFeatures(e,t).filter(u=>{var d;return!(e!=null&&e.hidePointFeatures)||((d=u==null?void 0:u.geometry)==null?void 0:d.type)!=="Point"}).sort((u,d)=>{var m,T;const c=this.getGeometryDrawRank((m=u.geometry)==null?void 0:m.type),f=this.getGeometryDrawRank((T=d.geometry)==null?void 0:T.type);return c-f});o.forEach(u=>{const d=this.getVectorFeatureStyle(e,u);this.drawVectorFeature(i,u.geometry,d)}),this.drawNationalParkBoundaryOverlay(i,e,o),this.drawSelectedVectorOverlay(i),i.restore()}drawNationalParkBoundaryOverlay(e,t,a=[]){(t==null?void 0:t.key)!=="national-park-zoning"||!a.length||a.forEach(i=>{const r=this.getVectorFeatureStyle(t,i);this.drawVectorFeature(e,i.geometry,O(A({},r),{fill:"#071A20",stroke:"#071A20",polygonAlpha:0,lineAlpha:.34,lineWidth:7,glow:!0})),this.drawVectorFeature(e,i.geometry,O(A({},r),{fill:"#E7FFF6",stroke:"#E7FFF6",polygonAlpha:0,lineAlpha:.68,lineWidth:2.1,glow:!1})),this.drawVectorFeature(e,i.geometry,O(A({},r),{fill:r.stroke,stroke:r.stroke,polygonAlpha:0,lineAlpha:.86,lineWidth:1.2,glow:!1}))})}drawSelectedVectorOverlay(e){const t=this.selectedVectorFeatures||[],a=this.analysisMatchedFeatures||[],i=this.analysisBoundaryFeature,r=this.boundaryDrawPoints||[];if(!t.length&&!a.length&&!i&&!r.length)return;const o=this.isEcologicalProjectLayer(this.currentTopicLayer),u={fill:Rs,stroke:ou,polygonAlpha:o?.2:.28,lineAlpha:o?.78:.98,lineWidth:o?6:12,pointRadius:11,glow:!o,halo:!o},d={fill:Rs,stroke:ru,polygonAlpha:o?.34:.52,lineAlpha:o?.94:1,lineWidth:o?3.2:5,pointRadius:6.5,glow:!1,halo:!1};if(e.save(),t.forEach(c=>{var m;const f=(c==null?void 0:c.geometry)||((m=c==null?void 0:c.feature)==null?void 0:m.geometry);this.drawVectorFeature(e,f,u),this.drawVectorFeature(e,f,d)}),a.forEach(c=>{var m;const f=(c==null?void 0:c.geometry)||((m=c==null?void 0:c.feature)==null?void 0:m.geometry);this.drawVectorFeature(e,f,{fill:"#30DCFF",stroke:"#C9FBFF",polygonAlpha:o?.22:.28,lineAlpha:o?.88:.98,lineWidth:o?2.8:5,pointRadius:6,glow:!o})}),i!=null&&i.geometry&&this.drawVectorFeature(e,i.geometry,{fill:"#24F6C4",stroke:"#FFFFFF",polygonAlpha:o?.12:.18,lineAlpha:o?.92:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),r.length){const c=r.map(m=>[m.lng,m.lat]),f={type:"LineString",coordinates:this.boundaryDrawingEnabled?c:[...c,c[0]].filter(Boolean)};this.drawVectorFeature(e,f,{fill:"#24F6C4",stroke:"#24F6C4",polygonAlpha:o?.08:.12,lineAlpha:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),c.forEach(m=>{this.drawVectorFeature(e,{type:"Point",coordinates:m},{fill:"#FFFFFF",stroke:"#24F6C4",polygonAlpha:.2,lineAlpha:1,lineWidth:o?2.4:3,pointRadius:5.5,glow:!o})})}e.restore()}redrawVectorTopicLayer(){!this.topicLayerContext||!this.topicLayerTexture||!this.currentTopicLayer||!ii(this.currentTopicLayer)||(this.drawVectorTopicLayer(this.currentTopicLayer,this.currentVectorFeatures||[]),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0)}featureMatchesLegend(e={},t={}){var r;const a=Array.isArray(t==null?void 0:t.matches)?t.matches.filter(o=>o==null?void 0:o.field):[];if(a.length)return a.some(o=>{var u;return String((u=e[o.field])!=null?u:"")===String(o.value)});const i=t==null?void 0:t.match;return i!=null&&i.field?String((r=e[i.field])!=null?r:"")===String(i.value):!0}getVisibleVectorFeatures(e,t){var u,d;const a=Array.isArray(e==null?void 0:e.activeLegends)?e.activeLegends.filter(c=>{var f,m;return((f=c==null?void 0:c.matches)==null?void 0:f.length)||((m=c==null?void 0:c.match)==null?void 0:m.field)}):[];if(a.length)return(t||[]).filter(c=>a.some(f=>this.featureMatchesLegend((c==null?void 0:c.properties)||{},f)));const i=e==null?void 0:e.activeLegend;if((u=i==null?void 0:i.matches)!=null&&u.length||(d=i==null?void 0:i.match)!=null&&d.field)return(t||[]).filter(c=>this.featureMatchesLegend((c==null?void 0:c.properties)||{},i));const o=String((e==null?void 0:e.cqlFilter)||"").trim().match(/^([a-zA-Z0-9_]+)\s*=\s*'((?:''|[^'])*)'$/);if(o){const[,c,f]=o,m=f.replace(/''/g,"'");return(t||[]).filter(T=>{var M,F;return String((F=(M=T==null?void 0:T.properties)==null?void 0:M[c])!=null?F:"")===m})}return[...t||[]]}updateYakIndustryPointLabels(e=this.currentTopicLayer,t=this.currentVectorFeatures){if(this.clearYakIndustryPointLabels(),(e==null?void 0:e.showPointLabels)===!1||e!=null&&e.hidePointFeatures||(e==null?void 0:e.key)!=="yak-industry-points"||!this.label3d)return;const a=this.getYakIndustryLabelFeatures(e,t);a.length&&(this.ensureYakIndustryPointLabelGroup(),a.forEach((i,r)=>{var u;let o=this.yakIndustryPointLabels[r];o||(o=this.label3d.create("","yak-industry-point-label",!0),this.label3d.setLabelStyle(o,.012,"x"),o.setParent(this.yakIndustryPointLabelGroup),this.yakIndustryPointLabels.push(o)),o.element.className="yak-industry-point-label",o.init(this.getYakIndustryPointLabelHtml(i),this.getYakIndustryPointLabelPosition(i,r)),o.visible=!0,(u=o.show)==null||u.call(o),o.userData={feature:i}}),this.yakIndustryPointLabels.slice(a.length).forEach(i=>{var r;i.visible=!1,(r=i.hide)==null||r.call(i),i.userData=null}),this.yakIndustryPointLabelGroup.visible=!!this.mapAnimationComplete)}updateYakIndustryPointMarkers(e=this.currentTopicLayer,t=this.currentVectorFeatures){if(this.clearYakIndustryPointMarkers(),(e==null?void 0:e.key)!=="yak-industry-points"||e!=null&&e.hidePointMarkers)return;const a=this.getVisibleVectorFeatures(e,t).filter(i=>{var r;return((r=i==null?void 0:i.geometry)==null?void 0:r.type)==="Point"});a.length&&(this.ensureYakIndustryPointMarkerGroup(),a.forEach((i,r)=>{let o=this.yakIndustryPointMarkers[r];const u=this.getVectorFeatureStyle(e,i),d=this.getYakIndustryMarkerMaterial(u,i),c=this.lngLatToLayerLocalPoint(i.geometry.coordinates,this.depth+.36),f=Number(e==null?void 0:e.pointSpriteScale)||.34,m=this.getYakIndustryMarkerType(i);o||(o=new ia(d),o.name="yak-industry-point-marker",o.renderOrder=42,this.bindYakIndustryPointMarkerEvents(o),this.interactionManager.add(o),this.yakIndustryPointMarkerGroup.add(o),this.yakIndustryPointMarkers.push(o)),o.material=d,o.center.set(.5,.5),o.position.copy(c),o.scale.set(f*.88,f*.88,1),o.visible=!0,o.userData={feature:i,layer:e,index:r,markerType:m}}),this.yakIndustryPointMarkers.slice(a.length).forEach(i=>{i.visible=!1,i.userData=null}),this.yakIndustryPointMarkerGroup.visible=!!this.mapAnimationComplete)}ensureYakIndustryPointMarkerGroup(){var e;this.yakIndustryPointMarkerGroup||(this.yakIndustryPointMarkerGroup=new ge,this.yakIndustryPointMarkerGroup.name="yak-industry-point-markers",this.yakIndustryPointMarkerGroup.visible=!1,(e=this.focusMapGroup)==null||e.add(this.yakIndustryPointMarkerGroup))}clearYakIndustryPointMarkers(){var e;this.yakIndustryPointMarkerGroup&&(this.yakIndustryPointMarkerGroup.visible=!1),(e=this.yakIndustryPointMarkers)==null||e.forEach(t=>{t.visible=!1})}bindYakIndustryPointMarkerEvents(e){e.addEventListener("mousedown",t=>{var r,o,u,d,c,f,m,T,M;if(this.clicked||!((r=this.yakIndustryPointMarkerGroup)!=null&&r.visible))return!1;const a=(u=(o=t.target)==null?void 0:o.userData)==null?void 0:u.feature;if(!a)return!1;this.clicked=!0;const i=((d=a.geometry)==null?void 0:d.coordinates)||[];this.setSelectedVectorFeatures([a]),(M=(T=this.callbacks).onFeatureInfo)==null||M.call(T,{feature:{id:((c=a.properties)==null?void 0:c.id)||((f=a.properties)==null?void 0:f.feature_id)||((m=a.properties)==null?void 0:m.project_name),properties:a.properties||{},feature:a,layer:this.currentTopicLayer,lngLat:{lng:Number(i[0]),lat:Number(i[1])}},screen:this.getPointFeatureScreenPoint(a)})}),e.addEventListener("mouseup",()=>{this.clicked=!1}),e.addEventListener("mouseover",()=>{e.visible&&(document.body.style.cursor="pointer")}),e.addEventListener("mouseout",()=>{document.body.style.cursor="default"})}getYakIndustryMarkerMaterial(e,t){const a=e.markerType||this.getYakIndustryMarkerType(t),i=`${e.fill||"#24F6C4"}-${e.stroke||"#B7FFF2"}-${a}`,r=this.yakIndustryMarkerMaterialCache.get(i);if(r)return r;const o=this.createYakIndustryMarkerTexture(e.fill,e.stroke,a),u=new na({map:o,transparent:!0,depthTest:!1,depthWrite:!1,fog:!1});return this.yakIndustryMarkerMaterialCache.set(i,u),u}getYakIndustryMarkerType(e={}){var a;const t=String(((a=e==null?void 0:e.properties)==null?void 0:a.stageKey)||"");return As[t]||"point"}createYakIndustryMarkerTexture(e="#24F6C4",t="#B7FFF2",a="point"){const i=document.createElement("canvas");i.width=112,i.height=112;const r=i.getContext("2d"),o=56,u=56;r.clearRect(0,0,i.width,i.height),r.beginPath(),r.arc(o,u,42,0,Math.PI*2),r.fillStyle=this.hexToRgba(e,.18),r.shadowColor=e,r.shadowBlur=20,r.fill(),this.drawYakIndustryMarkerFrame(r,a,o,u,e,t||e),r.save(),r.shadowBlur=0,r.beginPath(),r.arc(o,u,19,0,Math.PI*2),r.fillStyle="rgba(3, 23, 34, 0.64)",r.fill(),r.strokeStyle=this.hexToRgba("#FFFFFF",.32),r.lineWidth=2,r.stroke(),r.restore(),this.drawYakIndustryMarkerGlyph(r,a,o,u,"#FFFFFF");const d=new Hi(i);return d.colorSpace=la,d.needsUpdate=!0,d}drawYakIndustryMarkerFrame(e,t,a,i,r="#24F6C4",o="#B7FFF2"){if(e.save(),e.translate(a,i),e.fillStyle=this.hexToRgba(r,.92),e.strokeStyle=this.hexToRgba(o||r,.98),e.lineWidth=4,e.shadowColor=o||r,e.shadowBlur=14,t==="pasture")e.beginPath(),e.moveTo(-34,-9),e.lineTo(0,-38),e.lineTo(34,-9),e.lineTo(28,-9),e.lineTo(28,24),e.quadraticCurveTo(28,31,21,31),e.lineTo(-21,31),e.quadraticCurveTo(-28,31,-28,24),e.lineTo(-28,-9),e.closePath();else if(t==="grass")e.beginPath(),e.moveTo(0,-38),e.bezierCurveTo(31,-22,34,18,0,38),e.bezierCurveTo(-34,18,-31,-22,0,-38),e.closePath();else if(t==="breeding"){e.beginPath();for(let u=0;u<6;u+=1){const d=-Math.PI/2+Math.PI*2*u/6,c=Math.cos(d)*35,f=Math.sin(d)*35;u===0?e.moveTo(c,f):e.lineTo(c,f)}e.closePath()}else if(t==="storage")e.beginPath(),e.moveTo(-34,-25),e.lineTo(25,-25),e.lineTo(35,-13),e.lineTo(35,27),e.lineTo(-25,27),e.lineTo(-35,15),e.lineTo(-35,-25),e.closePath();else if(t==="processing"){e.beginPath();for(let u=0;u<10;u+=1){const d=-Math.PI/2+Math.PI*2*u/10,c=u%2===0?38:30,f=Math.cos(d)*c,m=Math.sin(d)*c;u===0?e.moveTo(f,m):e.lineTo(f,m)}e.closePath()}else if(t==="equipment"){e.beginPath();for(let u=0;u<16;u+=1){const d=-Math.PI/2+Math.PI*2*u/16,c=u%2===0?38:30,f=Math.cos(d)*c,m=Math.sin(d)*c;u===0?e.moveTo(f,m):e.lineTo(f,m)}e.closePath()}else t==="service"?(e.beginPath(),e.moveTo(0,-39),e.lineTo(31,-24),e.lineTo(25,14),e.quadraticCurveTo(0,39,-25,14),e.lineTo(-31,-24),e.closePath()):(e.beginPath(),e.arc(0,0,34,0,Math.PI*2));e.fill(),e.stroke(),e.restore()}drawYakIndustryMarkerGlyph(e,t,a,i,r="#24F6C4"){if(e.save(),e.translate(a,i),e.lineCap="round",e.lineJoin="round",e.shadowBlur=0,e.fillStyle=this.hexToRgba(r,.98),e.strokeStyle=this.hexToRgba(r,.98),e.lineWidth=3,t==="pasture")e.beginPath(),e.moveTo(-12,-2),e.lineTo(0,-11),e.lineTo(12,-2),e.stroke(),e.fillRect(-9,-2,18,12),e.clearRect(-3,2,6,8);else if(t==="grass")e.beginPath(),e.moveTo(0,10),e.quadraticCurveTo(-10,1,-7,-10),e.moveTo(0,10),e.quadraticCurveTo(10,1,7,-10),e.moveTo(0,10),e.quadraticCurveTo(0,0,1,-12),e.stroke();else if(t==="breeding")e.beginPath(),e.moveTo(-8,-5),e.quadraticCurveTo(-15,-12,-18,-4),e.moveTo(8,-5),e.quadraticCurveTo(15,-12,18,-4),e.stroke(),e.beginPath(),e.ellipse(0,1,11,12,0,0,Math.PI*2),e.fill(),e.fillStyle=this.hexToRgba("#08202D",.85),e.fillRect(-5,-2,3,3),e.fillRect(2,-2,3,3);else if(t==="storage")e.beginPath(),e.moveTo(-13,-3),e.lineTo(0,-11),e.lineTo(13,-3),e.lineTo(13,9),e.lineTo(-13,9),e.closePath(),e.fill(),e.strokeStyle=this.hexToRgba("#08202D",.72),e.lineWidth=2,e.beginPath(),e.moveTo(-8,0),e.lineTo(8,0),e.moveTo(-8,5),e.lineTo(8,5),e.stroke();else if(t==="processing")e.beginPath(),e.moveTo(-13,8),e.lineTo(-13,-1),e.lineTo(-5,-6),e.lineTo(-5,-1),e.lineTo(3,-6),e.lineTo(3,-1),e.lineTo(12,-6),e.lineTo(12,8),e.closePath(),e.fill(),e.fillRect(-13,-11,5,7),e.fillStyle=this.hexToRgba("#08202D",.72),e.fillRect(-8,2,4,3),e.fillRect(0,2,4,3),e.fillRect(7,2,4,3);else if(t==="equipment"){for(let o=0;o<8;o+=1)e.save(),e.rotate(Math.PI*2*o/8),e.fillRect(8,-2,5,4),e.restore();e.beginPath(),e.arc(0,0,9,0,Math.PI*2),e.fill(),e.fillStyle=this.hexToRgba("#FFFFFF",.98),e.beginPath(),e.arc(0,0,4,0,Math.PI*2),e.fill()}else t==="service"?(e.beginPath(),e.moveTo(0,-13),e.lineTo(12,-7),e.lineTo(9,6),e.quadraticCurveTo(0,14,-9,6),e.lineTo(-12,-7),e.closePath(),e.fill(),e.strokeStyle=this.hexToRgba("#FFFFFF",.94),e.lineWidth=2.4,e.beginPath(),e.moveTo(0,-7),e.lineTo(0,6),e.moveTo(-6,-1),e.lineTo(6,-1),e.stroke()):(e.beginPath(),e.arc(0,0,7,0,Math.PI*2),e.fill());e.restore()}ensureYakIndustryPointLabelGroup(){this.yakIndustryPointLabelGroup||(this.yakIndustryPointLabelGroup=new ge,this.yakIndustryPointLabelGroup.name="yak-industry-point-labels",this.yakIndustryPointLabelGroup.rotation.x=-Math.PI/2,this.yakIndustryPointLabelGroup.visible=!1,this.scene.add(this.yakIndustryPointLabelGroup))}clearYakIndustryPointLabels(){var e;this.yakIndustryPointLabelGroup&&(this.yakIndustryPointLabelGroup.visible=!1),(e=this.yakIndustryPointLabels)==null||e.forEach(t=>{var a;t.visible=!1,(a=t.hide)==null||a.call(t)})}getYakIndustryLabelFeatures(e,t){const a=this.getVisibleVectorFeatures(e,t).filter(d=>{var c;return((c=d==null?void 0:d.geometry)==null?void 0:c.type)==="Point"}),i=Number(e==null?void 0:e.pointLabelLimit)||(a.length>36?12:Math.min(a.length,16)),r=a.map(d=>{var c;return{feature:d,score:this.getYakIndustryFeatureScore(d),town:lt((c=d.properties)==null?void 0:c.town)}}).sort((d,c)=>{var f,m;return c.score-d.score||String(((f=d.feature.properties)==null?void 0:f.name)||"").localeCompare(String(((m=c.feature.properties)==null?void 0:m.name)||""),"zh-CN")}),o=[],u=new Set;return r.forEach(d=>{o.length>=i||!d.town||u.has(d.town)||(o.push(d.feature),u.add(d.town))}),r.forEach(d=>{o.length>=i||o.includes(d.feature)||o.push(d.feature)}),o}getYakIndustryFeatureScore(e){const t=(e==null?void 0:e.properties)||{},a=[t.outputValue,t.capacity,t.value,t.count,t["年产值 (万元)"],t["年总产值 (万元)"],t["设计存栏量 (头)"],t["总库容 (吨)"]].map(i=>this.parseMapMetricNumber(i));return Math.max(...a,0)}parseMapMetricNumber(e){if(typeof e=="number")return Number.isFinite(e)?e:0;const t=String(e!=null?e:"").replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);return t&&Number(t[0])||0}getYakIndustryPointLabelPosition(e,t=0){var i;const a=this.lngLatToLayerLocalPoint((i=e==null?void 0:e.geometry)==null?void 0:i.coordinates,this.depth+.42+Math.min(t,5)*.01);return a.x+=(t%3-1)*.08,a.y+=t%2===0?.07:-.06,a}getYakIndustryPointLabelHtml(e){const t=(e==null?void 0:e.properties)||{},a=this.compactYakIndustryLabelName(t.name||t.fullName||"产业主体"),i=this.formatYakIndustryLabelText(t.categoryName||t.stageName||"产业主体"),r=t.town||t.village||"红原县",o=this.getYakIndustryPointMetricText(t),u=this.getYakIndustryLabelColor(t);return`<div class="yak-industry-point-label-wrap" style="--yak-point-color:${ve(u)}">
<div class="yak-industry-point-label-head"><i></i><span>${ve(i)}</span></div>
<div class="yak-industry-point-label-name">${ve(a)}</div>
<div class="yak-industry-point-label-meta">
<span>${ve(r)}</span>
${o?`<strong>${ve(o)}</strong>`:""}
</div>
</div>`}compactYakIndustryLabelName(e=""){const t=String(e).replace(/^四川红原/,"").replace(/^红原县/,"").replace(/有限责任公司$/,"").replace(/农民专业合作社$/,"合作社").replace(/\s+/g," ").trim();return t.length>16?`${t.slice(0,15)}…`:t}formatYakIndustryLabelText(e=""){return String(e).replace(/\bcxpt[-_./\s]*/gi,"").replace(/^cxpt/i,"").replace(/\s+/g," ").trim()}getYakIndustryPointMetricText(e={}){return e.capacity!==void 0&&e.capacity!==null&&e.capacity!==""&&this.parseMapMetricNumber(e.capacity)>0?this.formatYakIndustryMetricText(e.capacity,e.capacityUnit):this.parseMapMetricNumber(e.outputValue)>0?`${this.formatMapRankingValue(e.outputValue)}万元`:this.isMeaningfulMapText(e.locationType)?e.locationType:this.isMeaningfulMapText(e.status)?e.status:""}isMeaningfulMapText(e){const t=String(e!=null?e:"").trim();return!!(t&&t!=="0"&&t!=="无"&&t!=="待完善")}formatYakIndustryMetricText(e,t=""){const a=String(e!=null?e:"").trim();return!a||a==="0"?"":typeof e=="string"&&/[^\d.,\s-]/.test(a)?a:`${this.formatMapRankingValue(e)}${t||""}`}getYakIndustryLabelColor(e={}){var i,r,o,u,d,c;const t=String(e.stageKey||""),a=(((i=this.currentTopicLayer)==null?void 0:i.legends)||[]).find(f=>{var m;return String(((m=f.match)==null?void 0:m.value)||"")===t})||(String(((u=(o=(r=this.currentTopicLayer)==null?void 0:r.activeLegend)==null?void 0:o.match)==null?void 0:u.value)||"")===t?this.currentTopicLayer.activeLegend:null);return(a==null?void 0:a.fillColor)||((c=(d=this.currentTopicLayer)==null?void 0:d.activeLegend)==null?void 0:c.fillColor)||"#24F6C4"}clipVectorLayerContext(e,t){if(this.shouldClipLayerToHongyuanBoundary(t)&&this.clipContextToHongyuanBoundary(e),!this.shouldClipLayerToLayerBounds(t))return;const a=this.getLayerClipBounds(t);if(!a)return;const i=this.lngLatToLayerCanvasPoint([a.west,a.north]),r=this.lngLatToLayerCanvasPoint([a.east,a.south]),o=Math.min(i.x,r.x),u=Math.min(i.y,r.y),d=Math.abs(r.x-i.x),c=Math.abs(r.y-i.y);!d||!c||(e.beginPath(),e.rect(o,u,d,c),e.clip())}clipContextToHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];t.length&&(e.beginPath(),t.forEach(a=>{a.forEach(i=>{i.forEach((r,o)=>{const u=this.lngLatToLayerCanvasPoint(r);o===0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}),e.closePath()})}),e.clip("evenodd"))}shouldClipLayerToHongyuanBoundary(e=this.currentTopicLayer){if(!e||e.clipToHongyuanBoundary===!1)return!1;if(e.clipToHongyuanBoundary===!0)return!0;const t=String((e==null?void 0:e.key)||"");return!!(t==="national-park-zoning"||t.startsWith("yak-"))}shouldClipLayerToLayerBounds(e=this.currentTopicLayer){return!!(e!=null&&e.clipBounds&&(e==null?void 0:e.clipToLayerBounds)!==!1)}isLngLatInHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];return t.length?t.some(a=>this.isLngLatInPolygon(e,a)):!0}isLngLatInLayerClipBounds(e,t=this.currentTopicLayer){const a=this.getLayerClipBounds(t);return a?e.lng>=a.west&&e.lng<=a.east&&e.lat>=a.south&&e.lat<=a.north:!0}getLayerClipBounds(e){const t=e==null?void 0:e.clipBounds;if(!t)return null;const a=Math.max(Number(t.west),Y.west),i=Math.max(Number(t.south),Y.south),r=Math.min(Number(t.east),Y.east),o=Math.min(Number(t.north),Y.north);return![a,i,r,o].every(Number.isFinite)||a>=r||i>=o?null:{west:a,south:i,east:r,north:o}}getGeometryDrawRank(e){return String(e).includes("Polygon")?1:String(e).includes("LineString")?2:3}isEcologicalProjectLayer(e=this.currentTopicLayer){return["restoration-projects","engineering-analysis-projects"].includes(e==null?void 0:e.key)}getVectorFeatureStyle(e,t){var d,c,f;const a=t.properties||{},r=(e.legends||[]).find(m=>{var T,M;return(((T=m==null?void 0:m.matches)==null?void 0:T.length)||((M=m==null?void 0:m.match)==null?void 0:M.field))&&this.featureMatchesLegend(a,m)})||e.activeLegend||((d=e.legends)==null?void 0:d[0])||{},o=String(((c=t.geometry)==null?void 0:c.type)||"").includes("LineString"),u=((f=t.geometry)==null?void 0:f.type)==="Point";if(this.isEcologicalProjectLayer(e)){const m=o||String(a.feature_role||"")==="线性设施";return{fill:m||u?r.strokeColor||r.fillColor||"#D2EA78":r.fillColor||"#75AD49",stroke:r.strokeColor||r.fillColor||"#D2EA78",polygonAlpha:m?.08:.22,lineAlpha:m?.9:.82,lineWidth:m?3:1.85,pointRadius:u?3.8:4,glow:!1}}return(e==null?void 0:e.key)==="yak-epidemic-village-boundary"?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||"#C9FBFF",polygonAlpha:.16,lineAlpha:1,lineWidth:3.2,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="artificial-grassland-plots"?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||"#A7F8FF",polygonAlpha:.2,lineAlpha:.94,lineWidth:1.6,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="yak-industry-points"?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||r.fillColor||"#B7FFF2",polygonAlpha:.36,lineAlpha:.82,lineWidth:1.6,pointRadius:this.getVectorPointRadius(e,t),glow:!0,halo:!0,marker:!0,markerType:As[String(a.stageKey||"")]||"point"}:(e==null?void 0:e.key)==="national-park-zoning"?{fill:r.fillColor||"#30DCFF",stroke:r.strokeColor||"#F2FFFF",polygonAlpha:.38,lineAlpha:.96,lineWidth:2.7,pointRadius:4.5,glow:!1}:e!=null&&e.boundaryOnly?{fill:r.fillColor||"#24F6C4",stroke:r.strokeColor||r.fillColor||"#18F8FF",polygonAlpha:.04,lineAlpha:.96,lineWidth:10,pointRadius:4.5,glow:!0}:{fill:o||u?r.strokeColor||r.fillColor||"#30DCFF":r.fillColor||"#30DCFF",stroke:r.strokeColor||r.fillColor||"#30DCFF",polygonAlpha:.36,lineAlpha:o?.92:.9,lineWidth:o?5:2.4,pointRadius:u?this.getVectorPointRadius(e,t):4.5,glow:!0}}getVectorPointRadius(e,t){var i,r;const a=Number(((i=t==null?void 0:t.properties)==null?void 0:i.count)||((r=t==null?void 0:t.properties)==null?void 0:r.value)||0);return(e==null?void 0:e.key)==="yak-recognition-layer"?Math.max(3.8,Math.min(8.6,3.6+Math.sqrt(a)/68)):(e==null?void 0:e.key)==="yak-industry-points"?10.4:4.5}drawVectorFeature(e,t,a){if(t!=null&&t.coordinates){if(t.type==="Polygon"){this.drawPolygonPath(e,t.coordinates,a);return}if(t.type==="MultiPolygon"){t.coordinates.forEach(i=>this.drawPolygonPath(e,i,a));return}if(t.type==="LineString"){this.drawLinePath(e,t.coordinates,a);return}if(t.type==="MultiLineString"){t.coordinates.forEach(i=>this.drawLinePath(e,i,a));return}t.type==="Point"&&this.drawPointPath(e,t.coordinates,a)}}drawPolygonPath(e,t,a){Array.isArray(t==null?void 0:t[0])&&(e.save(),e.beginPath(),t.forEach(i=>{i.forEach((r,o)=>{const u=this.lngLatToLayerCanvasPoint(r);o===0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}),e.closePath()}),e.fillStyle=this.hexToRgba(a.fill,a.polygonAlpha),e.strokeStyle=this.hexToRgba(a.stroke,a.lineAlpha),e.lineWidth=a.lineWidth,a.glow&&(e.shadowColor=a.stroke,e.shadowBlur=14),e.fill("evenodd"),e.stroke(),e.restore())}drawLinePath(e,t,a){!Array.isArray(t)||t.length<2||(e.save(),e.beginPath(),t.forEach((i,r)=>{const o=this.lngLatToLayerCanvasPoint(i);r===0?e.moveTo(o.x,o.y):e.lineTo(o.x,o.y)}),e.strokeStyle=this.hexToRgba(a.stroke,a.lineAlpha),e.lineWidth=a.lineWidth,e.shadowColor=a.stroke,e.shadowBlur=12,e.stroke(),e.restore())}drawPointPath(e,t,a){var r;if(a.marker){this.drawMarkerPointPath(e,t,a);return}const i=this.lngLatToLayerCanvasPoint(t);e.save(),a.halo&&(e.beginPath(),e.arc(i.x,i.y,a.pointRadius*2.35,0,Math.PI*2),e.fillStyle=this.hexToRgba(a.fill,.18),e.shadowColor=a.fill,e.shadowBlur=18,e.fill()),e.beginPath(),e.arc(i.x,i.y,a.pointRadius,0,Math.PI*2),e.fillStyle=this.hexToRgba(a.fill,.96),e.shadowColor=a.stroke,e.shadowBlur=a.halo?8:12,e.fill(),a.lineWidth&&(e.lineWidth=a.lineWidth,e.strokeStyle=this.hexToRgba(a.stroke,(r=a.lineAlpha)!=null?r:.9),e.stroke()),e.restore()}drawMarkerPointPath(e,t,a){const i=this.lngLatToLayerCanvasPoint(t),r=a.pointRadius||6;e.save(),e.beginPath(),e.arc(i.x,i.y+r*.22,r*2.55,0,Math.PI*2),e.fillStyle=this.hexToRgba(a.fill,.16),e.shadowColor=a.fill,e.shadowBlur=24,e.fill(),e.beginPath(),e.moveTo(i.x,i.y+r*2.05),e.bezierCurveTo(i.x+r*1.46,i.y+r*.62,i.x+r*1.34,i.y-r*1.34,i.x,i.y-r*1.62),e.bezierCurveTo(i.x-r*1.34,i.y-r*1.34,i.x-r*1.46,i.y+r*.62,i.x,i.y+r*2.05),e.closePath(),e.fillStyle=this.hexToRgba(a.fill,.94),e.strokeStyle=this.hexToRgba(a.stroke,.98),e.lineWidth=Math.max(2,a.lineWidth||2),e.shadowColor=a.stroke,e.shadowBlur=14,e.fill(),e.stroke(),e.beginPath(),e.arc(i.x,i.y-r*.34,r*.52,0,Math.PI*2),e.fillStyle=this.hexToRgba("#FFFFFF",.96),e.shadowBlur=0,e.fill(),e.beginPath(),e.arc(i.x,i.y-r*.34,r*.82,0,Math.PI*2),e.lineWidth=Math.max(1.2,r*.14),e.strokeStyle=this.hexToRgba("#FFFFFF",.42),e.stroke(),e.restore()}lngLatToLayerCanvasPoint(e){const t=Number(e==null?void 0:e[0]),a=Number(e==null?void 0:e[1]);return{x:(t-Y.west)/(Y.east-Y.west)*this.topicLayerCanvas.width,y:(Y.north-a)/(Y.north-Y.south)*this.topicLayerCanvas.height}}hexToRgba(e,t=1){const a=String(e||"#30DCFF").replace("#",""),i=a.length===3?a.split("").map(c=>c+c).join(""):a,r=Number.parseInt(i,16);if(!Number.isFinite(r))return`rgba(48, 220, 255, ${t})`;const o=r>>16&255,u=r>>8&255,d=r&255;return`rgba(${o}, ${u}, ${d}, ${t})`}parseWktGeometry(e){var o;const t=String(e||"").trim();if(!t)return null;const a=t.match(/^([A-Z]+)(?:\s+[A-Z]+)?\s*\(/i),i=(o=a==null?void 0:a[1])==null?void 0:o.toUpperCase();if(!i)return null;const r=t.slice(t.indexOf("("));return i==="POLYGON"?{type:"Polygon",coordinates:this.parseWktPolygonBody(r)}:i==="MULTIPOLYGON"?{type:"MultiPolygon",coordinates:this.parseWktMultiPolygonBody(r)}:i==="POINT"?{type:"Point",coordinates:this.parseWktPoint(r)}:i==="MULTIPOINT"?{type:"MultiPoint",coordinates:this.getWktChildGroups(r).map(u=>this.parseWktPoint(u)).filter(Boolean)}:i==="LINESTRING"?{type:"LineString",coordinates:this.parseWktRing(r)}:i==="MULTILINESTRING"?{type:"MultiLineString",coordinates:this.getWktChildGroups(r).map(u=>this.parseWktRing(u)).filter(u=>u.length)}:null}parseWktMultiPolygonBody(e){return this.getWktChildGroups(e).map(t=>this.parseWktPolygonBody(t)).filter(t=>t.length)}parseWktPolygonBody(e){return this.getWktChildGroups(e).map(t=>this.parseWktRing(t)).filter(t=>t.length>=3)}getWktChildGroups(e){const t=String(e||"").trim(),a=t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1):t,i=[];let r=0,o=-1;for(let u=0;u<a.length;u+=1){const d=a[u];d==="("?(r===0&&(o=u),r+=1):d===")"&&(r-=1,r===0&&o>=0&&(i.push(a.slice(o,u+1)),o=-1))}return i.length?i:[a]}parseWktRing(e){return String(e||"").replace(/^\(+|\)+$/g,"").split(",").map(a=>a.trim().split(/\s+/).slice(0,2).map(Number)).filter(([a,i])=>Number.isFinite(a)&&Number.isFinite(i))}parseWktPoint(e){const t=String(e||"").replace(/^\(+|\)+$/g,"").trim().split(/\s+/).slice(0,2).map(Number);return t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1])?[t[0],t[1]]:null}createProvinceMaterial(){const e=!this.useSatelliteBase;let t=new Vi({color:16777215,transparent:!0,opacity:0,depthWrite:!this.usesCustomSatelliteTiles,fog:!1,side:Ne});t.onBeforeCompile=r=>{r.uniforms=O(A({},r.uniforms),{uColor1:{value:new wt(e?2780818:2152676)},uColor2:{value:new wt(e?1058614:475482)}}),r.vertexShader=r.vertexShader.replace("void main() {",`
attribute float alpha;
varying vec3 vPosition;
varying float vAlpha;
void main() {
vAlpha = alpha;
vPosition = position;
`),r.fragmentShader=r.fragmentShader.replace("void main() {",`
varying vec3 vPosition;
varying float vAlpha;
uniform vec3 uColor1;
uniform vec3 uColor2;
void main() {
`),r.fragmentShader=r.fragmentShader.replace("#include <opaque_fragment>",`
#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= transmissionAlpha + 0.1;
#endif
vec3 gradient = mix(uColor1, uColor2, vPosition.x/15.78);
${e?`outgoingLight = outgoingLight * gradient;
float topAlpha = 0.56;`:`outgoingLight = mix(outgoingLight * vec3(1.18), outgoingLight * gradient, 0.32);
float topAlpha = 0.92;`}
if(vPosition.z>0.3){
diffuseColor.a *= topAlpha;
}
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
`)};let a=this.assets.instance.getResource("side");a.wrapS=ot,a.wrapT=ot,a.repeat.set(1,1.8),a.offset.y+=.065;let i=new Qa({color:2148829,map:a,fog:!1,opacity:0,side:Ne,roughness:.58,metalness:.08});return this.time.on("tick",()=>{a.offset.y+=.005}),i.onBeforeCompile=r=>{r.uniforms=O(A({},r.uniforms),{uColor1:{value:new wt(1629410)},uColor2:{value:new wt(205365)}}),r.vertexShader=r.vertexShader.replace("void main() {",`
attribute float alpha;
varying vec3 vPosition;
varying float vAlpha;
void main() {
vAlpha = alpha;
vPosition = position;
`),r.fragmentShader=r.fragmentShader.replace("void main() {",`
varying vec3 vPosition;
varying float vAlpha;
uniform vec3 uColor1;
uniform vec3 uColor2;
void main() {
`),r.fragmentShader=r.fragmentShader.replace("#include <opaque_fragment>",`
#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= transmissionAlpha + 0.1;
#endif
vec3 gradient = mix(uColor1, uColor2, vPosition.z/1.2);
outgoingLight = outgoingLight*gradient*vec3(1.12);
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
`)},[t,i]}getDefaultTownRanking(){return{title:"乡镇统计加载中",unit:"",rows:Cs.map(e=>({name:e.name,value:0,unit:""}))}}getTownRankingMeta(e=this.currentTownRanking){var i,r,o,u;const t=this.getDefaultTownRanking(),a=cu(e);return{title:(e==null?void 0:e.title)||t.title,unit:(e==null?void 0:e.unit)||t.unit,metricLabel:(e==null?void 0:e.metricLabel)||(e==null?void 0:e.legendName)||"",note:(e==null?void 0:e.note)||"",hideTownNames:$s(e),hideMapLabels:Na(e),hideTownLabelStats:(i=e==null?void 0:e.hideTownLabelStats)!=null?i:this.hideTownLabelStatsByDefault,calloutMode:a,showBars:(r=e==null?void 0:e.showBars)!=null?r:!1,showPointMarkers:(o=e==null?void 0:e.showPointMarkers)!=null?o:a,onlyRankedTownLabels:(u=e==null?void 0:e.onlyRankedTownLabels)!=null?u:!1,showMissingTownStats:(e==null?void 0:e.showMissingTownStats)===!0}}getTownRankingRows(e=this.currentTownRanking,t=7,a=!0){var d;const i=this.getDefaultTownRanking(),r=(d=e==null?void 0:e.rows)!=null&&d.length?e.rows:a?i.rows:[],o=this.getTownRankingMeta(e),u=r.map(c=>{const f=this.townMetaByName.get(lt(c.name));return f?O(A(A({},f),c),{name:f.name,enName:f.enName,center:f.center,centroid:f.centroid,value:ne(c.value),unit:c.unit||o.unit,metricTitle:o.title}):null}).filter(Boolean).sort((c,f)=>f.value-c.value).map((c,f)=>O(A({},c),{rank:f+1}));return Number.isFinite(t)?u.slice(0,t):u}getVillageRankingRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,i)=>{var c,f,m,T,M,F,x,G;const r=ne((c=a.lng)!=null?c:a.longitude,NaN),o=ne((f=a.lat)!=null?f:a.latitude,NaN);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const u=ne((m=a.displayValue)!=null?m:a.value),d=ne((F=(M=(T=a.rawValue)!=null?T:a.earTagCount)!=null?M:a.ear_tag_count)!=null?F:a.value);return O(A({},a),{key:a.key||`${a.town||""}-${a.village||a.name||i}`,name:a.name||a.village||`村${i+1}`,town:a.town||"",lng:r,lat:o,value:u,rawValue:d,recordCount:ne((x=a.recordCount)!=null?x:a.record_count,0),imageRate:ne((G=a.imageRate)!=null?G:a.image_rate,0),unit:a.displayUnit||a.unit||t.unit,metricTitle:t.title,metricLabel:a.metricLabel||t.metricLabel||""})}).filter(Boolean).sort((a,i)=>i.rawValue-a.rawValue).map((a,i)=>O(A({},a),{rank:i+1}))}getVillageRankingHtml(e,t){const a=t.hideTownNames?"":`<span>${ve(e.town||"红原县")}</span>`;return e.displayMode==="park-village"||t.displayMode==="park-village"?`<div class="epidemic-village-card is-park-village ${e.rank>8?"is-small":""}">
<div class="village-card-head">
<strong>${ve(e.name)}</strong>
${a}
</div>
<div class="village-card-body">
<span class="metric">${ve(e.metricLabel||t.metricLabel||"")}</span>
<span class="number">${this.formatMapRankingValue(e.value)}</span>
<span class="unit">${ve(e.unit||t.unit||"")}</span>
</div>
</div>`:`<div class="epidemic-village-card ${e.rank>8?"is-small":""}">
<div class="village-card-head">
<strong>${ve(e.name)}</strong>
${a}
</div>
<div class="village-card-body">
<span class="metric">${ve(e.metricLabel||"防疫")}</span>
<span class="number">${this.formatMapRankingValue(e.value)}</span>
<span class="unit">${ve(e.unit||t.unit||"")}</span>
</div>
<div class="village-card-foot">
<span>台账 ${this.formatMapCompactValue(e.recordCount)}条</span>
<span>耳标 ${this.formatMapCompactValue(e.rawValue)}头</span>
</div>
</div>`}ensureVillageRankingGroup(){this.villageRankingGroup||(this.villageRankingGroup=new ge,this.villageRankingGroup.rotation.x=-Math.PI/2,this.villageRankingGroup.visible=!1,this.scene.add(this.villageRankingGroup),this.villageRankingLabels=[])}hideVillageRankingLabels(){var e;this.villageRankingGroup&&(this.villageRankingGroup.visible=!1),(e=this.villageRankingLabels)==null||e.forEach(t=>{t.visible=!1})}hideAllMapStatisticLabels(){var e,t,a,i;this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!1),this.hideVillageRankingLabels(),this.hideTradeFlowLayer(),this.clearInfoPointStats(),(e=this.allProvinceLabel)==null||e.forEach(r=>{r.visible=!1}),(t=this.allBar)==null||t.forEach(r=>{r.visible=!1,r.scale.set(1,1,0)}),(a=this.allBarMaterial)==null||a.forEach(r=>{r.opacity=0}),(i=this.allGuangquan)==null||i.forEach(r=>{r.visible=!1})}setTownNameLabelsVisible(e=!0){var t;(t=this.townNameLabels)==null||t.forEach(a=>{a.visible=e})}updateVillageRankingLabels(e=this.currentTownRanking){if(this.ensureVillageRankingGroup(),!Bs(e)){this.hideVillageRankingLabels();return}const t=this.getVillageRankingRows(e),a=this.getTownRankingMeta(e);if(!t.length){this.hideVillageRankingLabels();return}this.villageRankingGroup.visible=this.mapAnimationComplete,t.forEach((i,r)=>{let o=this.villageRankingLabels[r];o||(o=this.label3d.create("","epidemic-village-label",!0),this.label3d.setLabelStyle(o,.0135,"x"),o.setParent(this.villageRankingGroup),this.villageRankingLabels.push(o));const[u,d]=this.geoProjection([i.lng,i.lat]),c=(r%3-1)*.06,f=Math.floor(r/3)%2*.04;o.init(this.getVillageRankingHtml(i,a),new Q(u+c,-d+f,this.depth+1.55+Math.min(r,6)*.015)),o.visible=!0,o.userData=A({},i)}),this.villageRankingLabels.slice(t.length).forEach(i=>{i.visible=!1})}ensureTradeFlowGroup(){this.tradeFlowGroup||(this.tradeFlowGroup=new ge,this.tradeFlowGroup.name="yak-trade-flow",this.tradeFlowGroup.visible=!1,this.tradeFlowMeshGroup=new ge,this.tradeFlowMeshGroup.name="yak-trade-flow-mesh",this.tradeFlowMeshGroup.rotation.x=-Math.PI/2,this.tradeFlowLabelGroup=new ge,this.tradeFlowLabelGroup.name="yak-trade-flow-label",this.tradeFlowLabelGroup.rotation.x=-Math.PI/2,this.tradeFlowGroup.add(this.tradeFlowMeshGroup,this.tradeFlowLabelGroup),this.scene.add(this.tradeFlowGroup))}hideTradeFlowLayer(){var e,t;this.tradeFlowGroup&&(this.tradeFlowGroup.visible=!1),(e=this.tradeFlowLabels)==null||e.forEach(a=>{a.visible=!1}),(t=this.tradeFlowPulseSprites)==null||t.forEach(a=>{a.visible=!1})}clearTradeFlowLayer(){this.tradeFlowMeshGroup&&(this.tradeFlowMeshGroup.children.forEach(e=>{var t;(t=e.traverse)==null||t.call(e,a=>this.disposeObject3D(a))}),this.tradeFlowMeshGroup.clear(),this.tradeFlowMaterials=[],this.tradeFlowPulseSprites=[])}getTradeFlowSource(e=this.currentTownRanking){var r,o,u,d;const t=(e==null?void 0:e.source)||{},a=ne((r=t.lng)!=null?r:t.longitude,NaN),i=ne((o=t.lat)!=null?o:t.latitude,NaN);return!Number.isFinite(a)||!Number.isFinite(i)?null:{name:t.name||"红原牦牛交易市场",lng:a,lat:i,total:ne((d=(u=t.total)!=null?u:t.headCount)!=null?d:t.value,NaN)}}getTradeFlowRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,i)=>{var T,M,F,x,G,j;const r=ne((T=a.lng)!=null?T:a.longitude,NaN),o=ne((M=a.lat)!=null?M:a.latitude,NaN),u=ne((G=(x=(F=a.headCount)!=null?F:a.head_count)!=null?x:a.rawValue)!=null?G:a.value),d=a.displayName||a.display_name||a.name,c=a.mapTownName||a.map_town_name||a.town||a.startTown||a.start_town||d,f=this.townMetaByName.get(lt(c)),m=Number.isFinite(r)&&Number.isFinite(o)?{lng:r,lat:o}:f!=null&&f.center?{lng:f.center[0],lat:f.center[1]}:null;return!m||!Number.isFinite(u)?null:O(A(A({},a),f),{key:a.key||`${(f==null?void 0:f.name)||d||c||"trade-source"}-${i}`,name:d||c||(f==null?void 0:f.name)||`来源${i+1}`,townName:(f==null?void 0:f.name)||c,lng:m.lng,lat:m.lat,labelSide:a.labelSide||a.label_side||this.getTradeSourceLabelSide(f,i),value:u,headCount:u,recordCount:ne((j=a.recordCount)!=null?j:a.record_count,0),unit:a.unit||t.unit||"头"})}).filter(Boolean).sort((a,i)=>i.value-a.value).map((a,i)=>O(A({},a),{rank:i+1}))}getTradeMarketHtml(e,t){const a=Number.isFinite(e.total)?e.total:t.reduce((i,r)=>i+ne(r.value),0);return`<div class="trade-market-card">
<div class="market-title">${ve(e.name)}</div>
<div class="market-total"><span>${this.formatMapIntegerValue(a)}</span><em>头</em></div>
</div>`}getTradeFlowDisplayName(e=""){const t=String(e||"").replace(/^.*红原县/,"").replace(/\s+/g,"");return t.length>7?`${t.slice(0,7)}…`:t||"来源区域"}getTradeFlowLabelHtml(e){return`<div class="trade-flow-card${e.labelSide?` is-${String(e.labelSide).replace(/[^a-z0-9-]/gi,"")}`:""}">
<div class="flow-head"><span>${String(e.rank).padStart(2,"0")}</span><strong>${ve(this.getTradeFlowDisplayName(e.name))}</strong></div>
<div class="flow-body"><em>${this.formatMapIntegerValue(e.value)}</em><b>${ve(e.unit||"头")}</b></div>
</div>`}getTradeFlowLabelOffset(e,t){return new Q(0,0,0)}getTradeSourceLabelSide(e,t=0){var r,o;const a=Number((r=e==null?void 0:e.center)==null?void 0:r[0]),i=Number((o=e==null?void 0:e.center)==null?void 0:o[1]);return Number.isFinite(a)&&a<this.geoProjectionCenter[0]-.18?"left":Number.isFinite(a)&&a>this.geoProjectionCenter[0]+.2?"right":Number.isFinite(i)&&i>this.geoProjectionCenter[1]+.22?"top":Number.isFinite(i)&&i<this.geoProjectionCenter[1]-.26?"bottom":["right","left","top","bottom"][t%4]}getTradeLocalPoint(e,t,a=0){const[i,r]=this.geoProjection([e,t]);return new Q(i,-r,this.depth+a)}getTradeFlowPoint(e,t=0){return this.getTradeLocalPoint(e.lng,e.lat,t)}getLocalTradeFlowCurve(e,t,a){const i=this.getTradeFlowPoint(e,.76),r=this.getTradeLocalPoint(t.lng,t.lat,.86),o=i.clone().lerp(r,.5),u=i.distanceTo(r);o.z+=Math.max(.32,Math.min(.82,u*.22+a*.012));const d=new Q(-(r.y-i.y),r.x-i.x,0);return d.lengthSq()>0&&(d.normalize().multiplyScalar((a%2===0?1:-1)*Math.min(.18,.05+u*.02)),o.add(d)),new ol([i,o,r])}tradeGeoProjection(e){return Ht().center(this.tradeGeoProjectionCenter).scale(this.tradeGeoProjectionScale).translate([0,0])(e)}setTradeNationalMapVisible(e){const t=!!e;if(!(!t&&!this.isTradeNationalMapActive&&!this.tradeNationalMapGroup&&!this.tradeFlowGroup)){if(t&&!this.createTradeNationalMap()){this.isTradeNationalMapActive=!1;return}this.isTradeNationalMapActive=t,this.tradeNationalMapGroup&&(this.tradeNationalMapGroup.visible=t&&this.mapAnimationComplete),this.tradeNationalLabelGroup&&(this.tradeNationalLabelGroup.visible=t&&this.mapAnimationComplete),this.mapGroup&&(this.mapGroup.visible=!t),this.labelGroup&&(this.labelGroup.visible=!t),this.flyLineGroup&&(this.flyLineGroup.visible=!t&&this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=!t&&this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=!t&&this.mapAnimationComplete),this.topicLayerMaterial&&t&&(this.topicLayerMaterial.opacity=0),t&&this.mapAnimationComplete?this.animateMapCamera(new Q(0,11.4,16.2),new Q(0,-.05,0),.65):!t&&this.mapAnimationComplete&&this.applyLayerMapView(this.currentTopicLayer,{force:!0})}}createTradeSourceMarker(e,t,a,i,r=!0){const o=new wt(t%3===1?16766828:t%3===2?2617536:3202303),u=this.getTradeFlowPoint(e,.72);if(i&&r){const x=this.getLocalTradeFlowCurve(e,i,t),G=new me({color:o,transparent:!0,opacity:.42,depthWrite:!1,depthTest:!1,fog:!1,blending:xe}),j=.012+Math.min(.012,ne(e.value)/Math.max(a,1)*.01),X=new We(new ll(x,48,j,8,!1),G);X.renderOrder=31,this.tradeFlowMeshGroup.add(X),this.tradeFlowMaterials.push(G);const se=new na({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.92,depthWrite:!1,depthTest:!1,fog:!1,blending:xe}),q=new ia(se),R=.12+Math.min(.08,ne(e.value)/Math.max(a,1)*.06);q.renderOrder=36,q.scale.set(R,R,R),q.userData={curve:x,phase:t*.13%1,speed:.16+Math.min(.16,ne(e.value)/Math.max(a,1)*.12)},q.position.copy(x.getPointAt(q.userData.phase)),this.tradeFlowPulseSprites.push(q),this.tradeFlowMeshGroup.add(q)}const d=new na({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.95,depthWrite:!1,depthTest:!1,fog:!1,blending:xe}),c=new ia(d),f=.22+Math.min(.34,ne(e.value)/Math.max(a,1)*.28);c.renderOrder=34,c.scale.set(f,f,f),c.position.copy(u),this.tradeFlowMeshGroup.add(c);const m=this.assets.instance.getResource("guangquan1"),T=new me({map:m,alphaMap:m,color:o,transparent:!0,opacity:.52,depthWrite:!1,depthTest:!1,fog:!1,blending:xe,side:Ne}),M=.38+Math.min(.36,ne(e.value)/Math.max(a,1)*.28),F=new We(new _t(M,M),T);F.renderOrder=29,F.position.copy(this.getTradeFlowPoint(e,.5)),this.tradeFlowMeshGroup.add(F)}createTradeMarketMarker(e){const t=this.assets.instance.getResource("point"),a=this.assets.instance.getResource("guangquan1"),i=this.getTradeLocalPoint(e.lng,e.lat,.82),r=new na({map:t,color:16773997,transparent:!0,opacity:1,depthWrite:!1,depthTest:!1,fog:!1,blending:xe}),o=new ia(r);o.renderOrder=35,o.scale.set(.34,.34,.34),o.position.copy(i),this.tradeFlowMeshGroup.add(o);const u=new me({map:a,alphaMap:a,color:16773997,transparent:!0,opacity:.72,depthWrite:!1,depthTest:!1,fog:!1,blending:xe,side:Ne}),d=new We(new _t(.58,.58),u);d.renderOrder=29,d.position.copy(this.getTradeLocalPoint(e.lng,e.lat,.58)),this.tradeFlowMeshGroup.add(d)}disposeObject3D(e){var t,a,i,r;(a=(t=e.geometry)==null?void 0:t.dispose)==null||a.call(t),Array.isArray(e.material)?e.material.forEach(o=>{var u;return(u=o==null?void 0:o.dispose)==null?void 0:u.call(o)}):(r=(i=e.material)==null?void 0:i.dispose)==null||r.call(i)}updateTradeFlowPulses(e=.016){var t,a;!((t=this.tradeFlowGroup)!=null&&t.visible)||!((a=this.tradeFlowPulseSprites)!=null&&a.length)||this.tradeFlowPulseSprites.forEach(i=>{var u;const r=(u=i.userData)==null?void 0:u.curve;if(!r)return;const o=(ne(i.userData.phase)+ne(i.userData.speed,.16)*e)%1;i.userData.phase=o,i.position.copy(r.getPointAt(o))})}updateTradeFlowLayer(e=this.currentTownRanking){if(!Es(e)){this.hideTradeFlowLayer();return}this.ensureTradeFlowGroup();const t=this.getTradeFlowSource(e),a=this.getTradeFlowRows(e);if(!t||!a.length){this.clearTradeFlowLayer(),this.hideTradeFlowLayer();return}this.clearTradeFlowLayer(),this.tradeFlowGroup.visible=this.mapAnimationComplete;const i=uu(e);this.createTradeMarketMarker(t);const r=Math.max(...a.map(d=>d.value),1);a.forEach((d,c)=>{this.createTradeSourceMarker(d,c,r,t,i)});const o=a.length+1;for(let d=this.tradeFlowLabels.length;d<o;d+=1){const c=this.label3d.create("",d===0?"trade-market-label":"trade-flow-label",!0);this.label3d.setLabelStyle(c,d===0?.014:.0125,"x"),c.setParent(this.tradeFlowLabelGroup),this.tradeFlowLabels.push(c)}const u=this.tradeFlowLabels[0];u.element.className="trade-market-label",u.init(this.getTradeMarketHtml(t,a),this.getTradeLocalPoint(t.lng,t.lat,.9)),u.visible=!0,u.userData=O(A({},t),{rows:a.length}),a.forEach((d,c)=>{const f=this.tradeFlowLabels[c+1];f.element.className="trade-flow-label",f.init(this.getTradeFlowLabelHtml(d),this.getTradeFlowPoint(d,.78).add(this.getTradeFlowLabelOffset(d,c))),f.visible=!0,f.userData=A({},d)}),this.tradeFlowLabels.slice(o).forEach(d=>{d.visible=!1})}hasTownRankingRows(e=this.currentTownRanking){return this.getTownRankingRows(e,Number.POSITIVE_INFINITY,!1).length>0}formatMapRankingValue(e){const t=ne(e);return Math.abs(t)>=100?String(Math.round(t)):Math.abs(t)>=10?String(Number(t.toFixed(1))):String(Number(t.toFixed(2)))}formatMapCompactValue(e){const t=ne(e);return Math.abs(t)>=1e4?`${Number((t/1e4).toFixed(Math.abs(t)>=1e5?1:2))}万`:Math.abs(t)>=1e3?`${Number((t/1e3).toFixed(1))}千`:this.formatMapRankingValue(t)}formatMapIntegerValue(e){const t=ne(e);return Math.round(t).toLocaleString("zh-CN")}getBarHeight(e,t){return t?Math.max(2.8*.12,2.8*(ne(e)/t)):2.8*.25}createBarGeometry(e){const a=new ul(.06999999999999999,.06999999999999999,e);return a.translate(0,0,e/2),a}getProvinceLabelHtml(e,t,a){return`<div class="provinces-label ${t>4?"yellow":""}">
<div class="provinces-label-wrap">
<div class="label-main">
<div class="label-title">${a.title}</div>
<div class="number"><span class="value" data-target-value="${e.value}">${this.formatMapRankingValue(e.value)}</span><span class="unit">${e.unit||a.unit}</span></div>
<div class="name">${e.name}</div>
</div>
<div class="no">${t+1}</div>
</div>
</div>`}updateBarItem(e,t,a,i,r=!0){var c,f;const o=this.getBarHeight(t.value,i),[u,d]=this.geoProjection(t.centroid);return e.visible=!0,(f=(c=e.geometry)==null?void 0:c.dispose)==null||f.call(c),e.geometry=this.createBarGeometry(o),e.position.set(u,-d,this.depth+.45),e.userData=O(A({},t),{targetValue:t.value,geoHeight:o}),e.children.forEach(m=>{var T,M,F,x;(M=(T=m.geometry)==null?void 0:T.dispose)==null||M.call(T),Array.isArray(m.material)?m.material.forEach(G=>{var j;return(j=G==null?void 0:G.dispose)==null?void 0:j.call(G)}):(x=(F=m.material)==null?void 0:F.dispose)==null||x.call(F)}),e.clear(),e.add(...this.createHUIGUANG(o,a>3?16776948:7863285)),r?ra.to(e.scale,{duration:.45,x:1,y:1,z:1,ease:"power2.out"}):this.mapAnimationComplete&&e.scale.set(1,1,1),{x:u,y:d,geoHeight:o}}updateProvinceLabel(e,t,a,i,r,o=!0){var F;const u=ne((F=e.userData)==null?void 0:F.targetValue,t.value);e.visible=!0,e.userData=O(A({},t),{targetValue:t.value}),e.position.copy(i);const d=e.element.querySelector(".label-title"),c=e.element.querySelector(".number .value"),f=e.element.querySelector(".number .unit"),m=e.element.querySelector(".name"),T=e.element.querySelector(".no");!d||!c||!f||!m||!T?e.element.innerHTML=this.getProvinceLabelHtml(t,a,r):(d.innerText=r.title,c.dataset.targetValue=String(t.value),c.innerText=this.formatMapRankingValue(t.value),f.innerText=t.unit||r.unit,m.innerText=t.name,T.innerText=a+1);const M=e.element.querySelector(".provinces-label-wrap");if(this.mapAnimationComplete&&(M.style.opacity="1",M.style.transform="translate3d(0, 0, 0)"),o&&this.mapAnimationComplete){const x=e.element.querySelector(".number .value"),j={value:u};ra.to(j,{value:t.value,duration:.45,ease:"power2.out",onUpdate:()=>{x.innerText=this.formatMapRankingValue(j.value)},onComplete:()=>{x.dataset.previousValue=String(t.value),x.innerText=this.formatMapRankingValue(t.value)}})}}clearTownNameLabelStat(e){const t=e.element.querySelector(".town-stat-label"),a=e.element.querySelector(".town-stat-value"),i=e.element.querySelector(".town-stat-unit"),r=e.element.querySelector(".town-rank"),o=e.element.querySelector(".town-stat-metric");t==null||t.classList.remove("has-stat"),e.element.style.pointerEvents="none",e.element.style.cursor="",a&&(a.innerText=""),i&&(i.innerText=""),r&&(r.innerText=""),o&&(o.innerText="")}updateTownNameLabelStats(e=this.currentTownRanking){var o;if(!((o=this.townNameLabels)!=null&&o.length))return;const t=this.getTownRankingRows(e,Number.POSITIVE_INFINITY,!1),a=this.getTownRankingMeta(e);if(a.hideTownLabelStats){this.townNameLabels.forEach(u=>{var f,m;const d=((f=u.userData)==null?void 0:f.townName)||((m=u.userData)==null?void 0:m.name),c=u.element.querySelector(".town-name");c&&(c.innerText=d||""),this.clearTownNameLabelStat(u),u.visible=!a.hideTownNames});return}const i=new Map(t.map(u=>[lt(u.name),u])),r=!!(a.showMissingTownStats&&e&&t.length&&(a.metricLabel||a.unit||a.title));this.townNameLabels.forEach(u=>{var X,se;const d=((X=u.userData)==null?void 0:X.townName)||((se=u.userData)==null?void 0:se.name),c=i.get(lt(d));if(a.onlyRankedTownLabels&&!c){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="",u.visible=!1;return}const f=c||(r?{name:d,value:0,unit:a.unit,metricLabel:a.metricLabel,rank:null}:null);if(!f){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="";return}const m=u.element.querySelector(".town-stat-label"),T=u.element.querySelector(".town-name"),M=u.element.querySelector(".town-stat-value"),F=u.element.querySelector(".town-stat-unit"),x=u.element.querySelector(".town-rank"),G=u.element.querySelector(".town-stat-metric");m==null||m.classList.add("has-stat"),T&&(T.innerText=d),G&&(G.innerText=f.metricLabel||a.metricLabel||""),M&&(M.innerText=this.formatMapRankingValue(f.value)),F&&(F.innerText=f.unit||a.unit||""),x&&(x.innerText=f.rank?`第${f.rank}名`:"");const j=this.isNationalParkTownSelectionActive()&&!!c;u.element.style.pointerEvents=j?"auto":"none",u.element.style.cursor=j?"pointer":"",u.userData=O(A(A({},u.userData),f),{townName:d,targetValue:f.value})})}getInfoPointHtml(e,t=this.getTownRankingMeta()){const a=String(e.metricLabel||t.metricLabel||t.title||"统计指标").replace(/排行$/,""),i=Number(e.rank),r=Number.isFinite(i)?String(i).padStart(2,"0"):"--";return`<div class="info-point-wrap ${i<=3?"is-prime":""}">
<div class="info-point-wrap-inner">
<div class="info-point-head">
<span class="rank">${r}</span>
<strong>${ve(e.name||"红原县")}</strong>
</div>
<div class="info-point-metric">${ve(a)}</div>
<div class="info-point-value">
<span>${this.formatMapRankingValue(e.value)}</span>
<em>${ve(e.unit||t.unit||"")}</em>
</div>
</div>
</div>`}updateInfoPointStats(){var o,u,d;if(!((o=this.infoPointSprites)!=null&&o.length)||!((u=this.infoLabelElement)!=null&&u.length))return;if(!this.showTownRankingPointMarkers){this.clearInfoPointStats();return}const e=this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1);if(!e.length){this.clearInfoPointStats();return}const t=this.getTownRankingMeta(),a=e.slice(0,this.infoPointSprites.length),i=Math.max(...a.map(c=>c.value),1);this.infoPointSprites.forEach((c,f)=>{const m=a[f],T=this.infoLabelElement[f];if(!m){c.visible=!1,c.scale.set(0,0,0),T&&(T.visible=!1);return}const[M,F]=this.geoProjection(m.centroid||m.center),x=[M,-F,this.depth+.72];c.userData=O(A(A({},c.userData),m),{position:x,value:m.value,unit:m.unit||t.unit,rank:m.rank,metricTitle:t.title,index:f}),c.position.set(...x),c.visible=this.showTownRankingPointMarkers;const G=.78+m.value/i*.44;if(c.scale.set(G,G,G),T){const j=(f%2===0?.22:-.18)+(f===0?.12:0),X=f%3===0?.08:-.04;T.position.set(M+j,-F+X,this.depth+1.88+Math.min(f,4)*.03),T.userData=O(A({},m),{index:f}),T.element.innerHTML=this.getInfoPointHtml(m,t)}});const r=Yi(this.infoPointSprites,this.infoLabelElement);r.includes(this.infoPointIndex)||(this.infoPointIndex=(d=r[0])!=null?d:0),this.infoLabelElement.forEach((c,f)=>{c.visible=f===this.infoPointIndex&&r.includes(f)&&this.showTownRankingPointMarkers&&this.mapAnimationComplete}),this.showTownRankingPointMarkers&&this.mapAnimationComplete&&!this.infoPointLabelTime&&this.createInfoPointLabelLoop()}clearInfoPointStats(){var e,t;clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=null,this.infoPointIndex=0,this.InfoPointGroup&&(this.InfoPointGroup.visible=!1),(e=this.infoLabelElement)==null||e.forEach(a=>{a.visible=!1}),(t=this.infoPointSprites)==null||t.forEach(a=>{a.visible=!1,a.scale.set(0,0,0)})}createBar(){const e=this.getTownRankingRows();this.getTownRankingMeta();const t=new ge;this.barGroup=t;const a=Math.max(...e.map(i=>i.value),1);this.allBar=[],this.allBarMaterial=[],this.allGuangquan=[],this.allProvinceLabel=[],e.map((i,r)=>{const o=this.getBarHeight(i.value,a),u=new me({color:16777215,transparent:!0,opacity:0,depthTest:!1,fog:!1});new ei(u,{uColor1:r>3?16506760:5291006,uColor2:r>3?16776948:7863285,size:o,dir:"y"});const d=new We(this.createBarGeometry(o),u);d.renderOrder=5;const[c,f]=this.geoProjection(i.centroid);d.position.set(c,-f,this.depth+.45),d.scale.set(1,1,0),d.userData=O(A({},i),{targetValue:i.value,geoHeight:o});const m=this.createQuan(new Q(c,this.depth+.44,f),r);d.add(...this.createHUIGUANG(o,r>3?16776948:7863285)),t.add(d),t.rotation.x=-Math.PI/2,this.allBar.push(d),this.allBarMaterial.push(u),this.allGuangquan.push(m)}),this.scene.add(t),this.updateTownNameLabelStats(this.currentTownRanking)}setTownRanking(e){var r,o,u,d,c,f,m,T,M,F,x,G,j,X,se,q;this.currentTownRanking=e;const t=this.getTownRankingMeta(e);if(this.showTownRankingBars=!!t.showBars,this.showTownRankingPointMarkers=!!t.showPointMarkers,t.hideMapLabels){this.hideAllMapStatisticLabels(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=this.mapAnimationComplete);return}if(Es(e)){this.setTradeNationalMapVisible(!1),this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!1),this.hideVillageRankingLabels(),this.clearInfoPointStats(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!1),this.flyLineGroup&&(this.flyLineGroup.visible=!1),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=!1),this.scatterGroup&&(this.scatterGroup.visible=!1),(r=this.allBar)!=null&&r.length&&(this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(o=this.allBarMaterial)==null||o.forEach(R=>{R.opacity=0}),(u=this.allProvinceLabel)==null||u.forEach(R=>{R.visible=!1}),(d=this.allGuangquan)==null||d.forEach(R=>{R.visible=!1})),this.updateTradeFlowLayer(e),(e!=null&&e.mapView||e!=null&&e.cameraPosition)&&this.applyLayerMapView(null);return}if(this.setTradeNationalMapVisible(!1),this.hideTradeFlowLayer(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=this.mapAnimationComplete),Bs(e)){this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!$s(e)),this.clearInfoPointStats(),this.updateVillageRankingLabels(e),(c=this.allBar)!=null&&c.length&&(this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(f=this.allBarMaterial)==null||f.forEach(R=>{R.opacity=0}),(m=this.allProvinceLabel)==null||m.forEach(R=>{R.visible=!1}),(T=this.allGuangquan)==null||T.forEach(R=>{R.visible=!1}));return}if(this.setTownNameLabelsVisible(!t.calloutMode&&!t.hideTownNames),this.hideVillageRankingLabels(),t.calloutMode?this.updateTownNameLabelStats(null):this.updateTownNameLabelStats(e),!((M=this.allBar)!=null&&M.length))return;if(!this.showTownRankingBars){this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(F=this.allBarMaterial)==null||F.forEach(R=>{R.opacity=0}),(x=this.allProvinceLabel)==null||x.forEach(R=>{R.visible=!1}),(G=this.allGuangquan)==null||G.forEach(R=>{R.visible=!1}),this.showTownRankingPointMarkers?(this.InfoPointGroup&&(this.InfoPointGroup.visible=this.mapAnimationComplete&&this.hasTownRankingRows(e)),this.updateInfoPointStats()):this.clearInfoPointStats();return}const a=this.getTownRankingRows(e,7,!1);if(!a.length){this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(j=this.allProvinceLabel)==null||j.forEach(R=>{R.visible=!1}),(X=this.allGuangquan)==null||X.forEach(R=>{R.visible=!1}),this.clearInfoPointStats();return}this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.mapAnimationComplete),(se=this.infoPointSprites)==null||se.forEach(R=>{R.visible=this.showTownRankingPointMarkers});const i=Math.max(...a.map(R=>R.value),1);this.allBar.forEach((R,Se)=>{const Ye=Se<a.length;R.visible=Ye,Ye||R.scale.set(1,1,0)}),(q=this.allProvinceLabel)==null||q.forEach(R=>{R.visible=!1}),this.allGuangquan.forEach((R,Se)=>{R.visible=Se<a.length}),a.forEach((R,Se)=>{const Ye=this.allBar[Se],je=this.allGuangquan[Se];if(!Ye)return;const{x:D,y:He}=this.updateBarItem(Ye,R,Se,i,this.mapAnimationComplete);je&&(je.visible=!0,je.position.set(0,0,0),je.children.forEach(_e=>{_e.position.set(D,this.depth+.44,He),this.mapAnimationComplete&&_e.scale.set(1,1,1)}))}),this.updateInfoPointStats()}createEvent(){let e=[];const t=i=>{i.traverse(r=>{r.isMesh&&(r.material=this.defaultMaterial)})},a=i=>{i.traverse(r=>{r.isMesh&&(r.material=this.defaultLightMaterial)})};this.eventElement.map(i=>{this.interactionManager.add(i),i.addEventListener("mousedown",r=>{this.handleMapClick(r)}),i.addEventListener("mouseover",r=>{e.includes(r.target.parent)||e.push(r.target.parent),document.body.style.cursor="pointer",a(r.target.parent)}),i.addEventListener("mouseout",r=>{e=e.filter(o=>o.userData.name!==r.target.parent.userData.name),e.length>0&&e[e.length-1],t(r.target.parent),document.body.style.cursor="default"})})}createHUIGUANG(e,t){let a=new _t(.35,e);a.translate(0,e/2,0);const i=this.assets.instance.getResource("huiguang");i.colorSpace=la,i.wrapS=ot,i.wrapT=ot;let r=new me({color:t,map:i,transparent:!0,opacity:.4,depthWrite:!1,side:Ne,blending:xe}),o=new We(a,r);o.renderOrder=10,o.rotateX(Math.PI/2);let u=o.clone(),d=o.clone();return u.rotateY(Math.PI/180*60),d.rotateY(Math.PI/180*120),[o,u,d]}createQuan(e,t){const a=this.assets.instance.getResource("guangquan1"),i=this.assets.instance.getResource("guangquan2");let r=new _t(.5,.5),o=new me({color:16777215,map:a,alphaMap:a,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:xe}),u=new me({color:16777215,map:i,alphaMap:i,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:xe}),d=new We(r,o),c=new We(r,u);return d.renderOrder=6,c.renderOrder=6,d.rotateX(-Math.PI/2),c.rotateX(-Math.PI/2),d.position.copy(e),c.position.copy(e),c.position.y-=.001,d.scale.set(0,0,0),c.scale.set(0,0,0),this.quanGroup=new ge,this.quanGroup.add(d,c),this.scene.add(this.quanGroup),this.time.on("tick",()=>{d.rotation.z+=.05}),this.quanGroup}createDiffuse(){let e=new _t(200,200),t=new me({color:0,depthWrite:!1,transparent:!0,blending:cl});t.blendEquation=dl,t.blendSrc=hl,t.blendDst=pl,new Tl({material:t,time:this.time,size:60,diffuseSpeed:8,diffuseColor:7442830,diffuseWidth:2,callback:i=>{const r=setTimeout(()=>{this.addSceneTween(ra.to(i.uniforms.uTime,{value:4,repeat:-1,duration:6,ease:"power1.easeIn"}))},3);this.addSceneTimer(r)}});let a=new We(e,t);a.renderOrder=3,a.rotation.x=-Math.PI/2,a.position.set(0,.21,0),this.scene.add(a)}createGrid(){new kl(this,{gridSize:54,gridDivision:24,gridColor:1990543,shapeSize:.55,shapeColor:3309487,pointSize:.085,pointColor:1993891,pointBlending:xe})}createBottomBg(){let e=new _t(24,24);const t=this.assets.instance.getResource("ocean");t.colorSpace=la,t.wrapS=ot,t.wrapT=ot,t.repeat.set(1,1);let a=new me({map:t,opacity:.92,fog:!1}),i=new We(e,a);i.rotation.x=-Math.PI/2,i.position.set(0,-.7,0),this.scene.add(i)}createChinaBlurLine(){let e=new _t(154,154);const t=this.assets.instance.getResource("chinaBlurLine");t.colorSpace=la,t.wrapS=ot,t.wrapT=ot,t.generateMipmaps=!1,t.minFilter=ms,t.repeat.set(1,1);let a=new me({color:4162253,alphaMap:t,transparent:!0,opacity:.62}),i=new We(e,a);i.rotateX(-Math.PI/2),i.position.set(-19.3,-.5,-19.7),this.scene.add(i)}createLabel(){let e=this,t=this.labelGroup,a=this.label3d,i=[],r=[];Dl.map(u=>{if(u.hide==!0)return!1;let d=o(u,a,t);i.push(d),r.push(d)}),this.otherLabel=i,this.townNameLabels=r;function o(u,d,c){let f=d.create("",`china-label ${u.blur?" blur":""}`,!0);const[m,T]=e.geoProjection(u.center);return f.init(`<div class="other-label town-stat-label">
<div class="town-name-row"><img class="label-icon" src="${Sl}"><span class="town-name">${u.name}</span><span class="town-rank"></span></div>
<div class="town-stat-row"><span class="town-stat-metric"></span><span class="town-stat-value"></span><span class="town-stat-unit"></span></div>
</div>`,new Q(m,-T,e.depth+.85)),d.setLabelStyle(f,.018,"x"),f.setParent(c),f.userData=O(A({},u),{labelType:"town-label",baseScale:.018,townName:u.name}),f.element.addEventListener("pointerdown",M=>{e.handleTownRankingSelect(u.name,{preserveCamera:!0,statusText:`已选中${u.name}`})&&(M.preventDefault(),M.stopPropagation())}),f}}createRotateBorder(){let e=13.2,t=this.assets.instance.getResource("rotationBorder1"),a=this.assets.instance.getResource("rotationBorder2"),i=new ks(this,{width:e*1.178,needRotate:!0,rotateSpeed:.001,material:new me({map:t,color:4763647,transparent:!0,opacity:.26,side:Ne,depthWrite:!1,blending:xe}),position:new Q(0,.31,0)});i.instance.rotation.x=-Math.PI/2,i.instance.renderOrder=6,i.instance.scale.set(0,0,0),i.setParent(this.scene);let r=new ks(this,{width:e*1.116,needRotate:!0,rotateSpeed:-.004,material:new me({map:a,color:4763647,transparent:!0,opacity:.5,side:Ne,depthWrite:!1,blending:xe}),position:new Q(0,.33,0)});r.instance.rotation.x=-Math.PI/2,r.instance.renderOrder=6,r.instance.scale.set(0,0,0),r.setParent(this.scene),this.rotateBorder1=i.instance,this.rotateBorder2=r.instance}createFlyLine(){this.flyLineGroup=new ge,this.flyLineGroup.visible=!1,this.scene.add(this.flyLineGroup)}createFocus(){this.flyLineFocusGroup.clear()}createParticles(){this.particles=new Ss(this,{num:10,range:30,dir:"up",speed:.05,material:new fl({map:Ss.createTexture(),size:1,color:61166,transparent:!0,opacity:1,depthTest:!1,depthWrite:!1,vertexColors:!0,blending:xe,sizeAttenuation:!0})}),this.particleGroup=new ge,this.scene.add(this.particleGroup),this.particleGroup.rotation.x=-Math.PI/2,this.particles.setParent(this.particleGroup),this.particles.enable=!0,this.particleGroup.visible=!0}createScatter(){this.scatterGroup=new ge,this.scatterGroup.visible=!1,this.scatterGroup.rotation.x=-Math.PI/2,this.scene.add(this.scatterGroup);const e=this.assets.instance.getResource("arrow"),t=new na({map:e,color:16776948,fog:!1,transparent:!0,depthTest:!1});Ol.forEach(a=>{const i=new ia(t);i.renderOrder=23;const r=.22;i.scale.set(r,r,r);let[o,u]=this.geoProjection([a.lng,a.lat]);i.position.set(o,-u,this.depth+.45),i.userData.position=[o,-u,this.depth+.45],this.scatterGroup.add(i)})}createInfoPoint(){let e=this;this.InfoPointGroup=new ge,this.scene.add(this.InfoPointGroup),this.InfoPointGroup.visible=!1,this.InfoPointGroup.rotation.x=-Math.PI/2,this.infoPointIndex=0,this.infoPointLabelTime=null,this.infoLabelElement=[],this.infoPointSprites=[];let t=this.label3d;const a=this.assets.instance.getResource("point");let i=[16776948,7863285];zl.forEach((o,u)=>{const d=new na({map:a,color:i[u%i.length],fog:!1,transparent:!0,depthTest:!1}),c=new ia(d);c.renderOrder=23,c.visible=!1,c.scale.set(0,0,0);let[f,m]=this.geoProjection([o.lng,o.lat]),T=[f,-m,this.depth+.7];c.position.set(...T),c.userData.position=[...T],c.userData={position:[f,-m,this.depth+.7],name:o.name,index:u},this.InfoPointGroup.add(c);let M=r(o,t,this.InfoPointGroup,u);this.infoLabelElement.push(M),this.infoPointSprites.push(c),this.interactionManager.add(c),c.addEventListener("mousedown",F=>{var x,G;if(this.clicked||!this.InfoPointGroup.visible)return!1;this.clicked=!0,this.infoPointIndex=F.target.userData.index,this.infoLabelElement.map(j=>{j.visible=!1}),M.visible=!0,this.handleTownRankingSelect(((x=F.target.userData)==null?void 0:x.name)||((G=F.target.userData)==null?void 0:G.townName)),this.createInfoPointLabelLoop()}),c.addEventListener("mouseup",F=>{this.clicked=!1}),c.addEventListener("mouseover",F=>{document.body.style.cursor="pointer"}),c.addEventListener("mouseout",F=>{document.body.style.cursor="default"})});function r(o,u,d,c){let f=u.create("","info-point",!0);const[m,T]=e.geoProjection([o.lng,o.lat]);return f.init(e.getInfoPointHtml(O(A({},o),{value:0,rank:c+1,unit:""}),e.getTownRankingMeta()),new Q(m,-T,e.depth+1.9)),u.setLabelStyle(f,.015,"x"),f.setParent(d),f.visible=!1,f}}createInfoPointLabelLoop(){var t;if(clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=null,this.scenePaused||!((t=this.infoLabelElement)!=null&&t.length))return;const e=Yi(this.infoPointSprites,this.infoLabelElement);if(!e.length){this.infoLabelElement.forEach(a=>{a.visible=!1});return}e.includes(this.infoPointIndex)||(this.infoPointIndex=e[0]),e.length!==1&&(this.infoPointLabelTime=setInterval(()=>{const a=Yi(this.infoPointSprites,this.infoLabelElement);if(!a.length){clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=null,this.infoLabelElement.forEach(r=>{r.visible=!1});return}const i=a.indexOf(this.infoPointIndex);this.infoPointIndex=a[(i+1)%a.length],this.infoLabelElement.forEach((r,o)=>{r.visible=o===this.infoPointIndex&&a.includes(o)})},3e3))}createStorke(){const e=this.staticMapData.mapStroke,t=this.assets.instance.getResource("pathLine3");t.wrapS=t.wrapT=ot,t.repeat.set(2,1);let a=new sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new Q(0,0,this.depth+.24),data:e,material:new me({color:2868444,map:t,alphaMap:t,fog:!1,transparent:!0,opacity:1,blending:xe}),type:"Line3",renderOrder:22,tubeRadius:.03});this.focusMapGroup.add(a.lineGroup),this.time.on("tick",()=>{t.offset.x+=.005})}handleMapClick(e){return re(this,null,function*(){var r,o,u,d,c,f,m,T,M,F,x,G,j,X,se,q,R,Se,Ye,je,D,He,_e,ut,Lt,tt,Re,qe,Ue,Ve,Ke,Ie,at,Le,ae,Tt,kt,ct,it,Ge,k;if(!this.currentTopicLayer)return;const t=this.getScreenPointFromEvent(e),a=this.getLngLatFromEvent(e);if(!a){this.clearSelectedFeature(),(o=(r=this.callbacks).onFeatureInfo)==null||o.call(r,{feature:null});return}if(this.boundaryDrawingEnabled){const v=((u=e==null?void 0:e.data)==null?void 0:u.originalEvent)||(e==null?void 0:e.originalEvent)||e;if(v!=null&&v.__analysisBoundaryHandled)return;this.addBoundaryDrawPoint(a);return}if(this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)&&!this.isLngLatInHongyuanBoundary(a)){this.clearSelectedFeature(),(c=(d=this.callbacks).onFeatureInfo)==null||c.call(d,{feature:null}),(m=(f=this.callbacks).onLayerStatus)==null||m.call(f,{type:"success",text:"当前点击位置不在红原县边界内"});return}if(this.shouldClipLayerToLayerBounds(this.currentTopicLayer)&&!this.isLngLatInLayerClipBounds(a,this.currentTopicLayer)){this.clearSelectedFeature(),(M=(T=this.callbacks).onFeatureInfo)==null||M.call(T,{feature:null}),(x=(F=this.callbacks).onLayerStatus)==null||x.call(F,{type:"success",text:"当前点击位置不在图层显示范围内"});return}if(du(this.currentTopicLayer)){this.clearSelectedFeature(),(j=(G=this.callbacks).onFeatureInfo)==null||j.call(G,{feature:null});return}if(ii(this.currentTopicLayer)){const v=this.pickVectorFeatureAtPoint(a,t),C=(v==null?void 0:v.feature)||v;let B=(v==null?void 0:v.screen)||t;if(C)this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)?(this.clearSelectedGeometryGroup(),this.setSelectedVectorFeatures([C])):this.showSelectedFeature(C),((X=this.currentTopicLayer)==null?void 0:X.key)==="yak-industry-points"&&(this.setSelectedVectorFeatures([C]),B=this.getPointFeatureScreenPoint(C)||B),(Ye=(Se=this.callbacks).onFeatureInfo)==null||Ye.call(Se,{feature:{id:((se=C.properties)==null?void 0:se.id)||((q=C.properties)==null?void 0:q.feature_id)||((R=C.properties)==null?void 0:R.project_name),properties:C.properties||{},feature:C,layer:this.currentTopicLayer,lngLat:a},screen:B}),(D=(je=this.callbacks).onLayerStatus)==null||D.call(je,{type:"success",text:"真实矢量要素已选中"});else{const $=this.getTownNameFromMapEvent(e);if(this.handleTownRankingSelect($))return;this.clearSelectedFeature(),(_e=(He=this.callbacks).onFeatureInfo)==null||_e.call(He,{feature:null}),(Lt=(ut=this.callbacks).onLayerStatus)==null||Lt.call(ut,{type:"success",text:"当前点击位置无生态保护要素"})}return}const i=this.lngLatToWmsPixel(a);(Re=(tt=this.callbacks).onFeatureInfo)==null||Re.call(tt,{feature:null}),(Ue=(qe=this.callbacks).onFeatureLoading)==null||Ue.call(qe,!0);try{const v=yield Ps(this.currentTopicLayer,i,{size:Rt,buffer:10}),C=this.normalizeFeatureInfoAtPoint(v,a),B=C?null:yield this.queryFallbackFeatureInfo(a),$=C||(B==null?void 0:B.feature);if($){const U=yield this.enrichFeatureInfo($,i,a);this.showSelectedFeature(U.feature||U),(Ke=(Ve=this.callbacks).onFeatureInfo)==null||Ke.call(Ve,{feature:O(A({},U),{layer:(B==null?void 0:B.layer)||this.currentTopicLayer,lngLat:a}),screen:t})}else this.clearSelectedFeature(),(at=(Ie=this.callbacks).onFeatureInfo)==null||at.call(Ie,{feature:null});$||(ae=(Le=this.callbacks).onLayerStatus)==null||ae.call(Le,{type:"success",text:"当前点击位置无图斑"})}catch(v){this.clearSelectedFeature(),(kt=(Tt=this.callbacks).onFeatureInfo)==null||kt.call(Tt,{feature:null}),(it=(ct=this.callbacks).onLayerStatus)==null||it.call(ct,{type:"error",text:"图斑信息查询失败"})}finally{(k=(Ge=this.callbacks).onFeatureLoading)==null||k.call(Ge,!1)}})}handleCanvasBoundaryPointerDown(e){var a,i;if(!this.boundaryDrawingEnabled)return;const t=this.getLngLatFromCanvasEvent(e);t&&this.addBoundaryDrawPoint(t)&&(e.__analysisBoundaryHandled=!0),(a=e.preventDefault)==null||a.call(e),(i=e.stopPropagation)==null||i.call(e)}handleCanvasBoundaryDoubleClick(e){var a,i;if(!this.boundaryDrawingEnabled)return;const t=this.getLngLatFromCanvasEvent(e);(this.boundaryDrawPoints||[]).length<3&&t&&this.addBoundaryDrawPoint(t),(this.boundaryDrawPoints||[]).length>=3&&(this.finishBoundaryDrawing(),e.__analysisBoundaryHandled=!0),(a=e.preventDefault)==null||a.call(e),(i=e.stopPropagation)==null||i.call(e)}getLngLatFromCanvasEvent(e){var T,M,F;if(!((T=this.camera)!=null&&T.instance)||!this.focusMapGroup||!this.canvas)return null;const t=this.canvas.getBoundingClientRect();if(!t.width||!t.height)return null;const a=(M=this.interactionManager)==null?void 0:M.raycaster;if(!(a!=null&&a.setFromCamera))return null;const i={x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height)*2+1};a.setFromCamera(i,this.camera.instance);const o=((F=a.intersectObjects(this.eventElement||[],!0)[0])==null?void 0:F.point)||this.getRayMapPlaneIntersection(a.ray);if(!o)return null;const u=this.focusMapGroup.worldToLocal(o.clone()),c=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([u.x,-u.y]);if(!c)return null;const f=Number(c[0]),m=Number(c[1]);return!Number.isFinite(f)||!Number.isFinite(m)?null:f<Y.west-.03||f>Y.east+.03||m<Y.south-.03||m>Y.north+.03?this.getFallbackLngLatFromPointer(e,t):{lng:f,lat:m}}getFallbackLngLatFromPointer(e,t=(i=>(i=(a=>(a=this.canvas)==null?void 0:a.getBoundingClientRect)())==null?void 0:i.call(a))()){if(!(t!=null&&t.width)||!(t!=null&&t.height))return null;const r=Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),o=Math.min(1,Math.max(0,(e.clientY-t.top)/t.height)),u=Y.west+(Y.east-Y.west)*r,d=Y.north-(Y.north-Y.south)*o;return{lng:u,lat:d}}getRayMapPlaneIntersection(e){if(!(e!=null&&e.origin)||!(e!=null&&e.direction)||!this.focusMapGroup)return null;const t=this.focusMapGroup.worldToLocal(e.origin.clone()),i=this.focusMapGroup.worldToLocal(e.origin.clone().add(e.direction.clone())).sub(t),r=this.depth+.22;if(Math.abs(i.z)<1e-8)return null;const o=(r-t.z)/i.z;if(!Number.isFinite(o)||o<0)return null;const u=t.add(i.multiplyScalar(o));return this.focusMapGroup.localToWorld(u)}enrichFeatureInfo(e,t,a){return re(this,null,function*(){const i=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(i))return e;const o=(Oi[i]||[]).find(m=>m.key===`${i}-distribution`),u=(this.visibleTopicLayers||[]).filter(m=>this.getLayerTopicKey(m)===i).slice(0,5),d=[o,this.currentTopicLayer,...u].filter(m=>m==null?void 0:m.layerName).filter((m,T,M)=>M.findIndex(F=>this.getLayerQueryKey(F)===this.getLayerQueryKey(m))===T);if(!d.length)return e;const c=yield Promise.allSettled([...d.filter(m=>this.getLayerQueryKey(m)!==this.getLayerQueryKey(this.currentTopicLayer)).map(m=>re(this,null,function*(){const T=yield Ps(m,t,{size:Rt,buffer:10}),M=this.normalizeFeatureInfoAtPoint(T,a);return M?{layer:m,feature:M,source:"wms"}:null})),...d.map(m=>re(this,null,function*(){const T=yield this.queryLayerFeatureByPoint(m,a);return T?{layer:m,feature:T,source:"wfs"}:null}))]),f=A({},e.properties||{});return c.forEach(m=>{var T,M;m.status!=="fulfilled"||!((M=(T=m.value)==null?void 0:T.feature)!=null&&M.properties)||this.mergeBusinessProperties(f,m.value.feature.properties,m.value.layer)}),O(A({},e),{properties:f,relatedFeatures:c.filter(m=>{var T;return m.status==="fulfilled"&&((T=m.value)==null?void 0:T.feature)}).map(m=>m.value),feature:O(A({},e.feature||{}),{properties:f})})})}queryFallbackFeatureInfo(e){return re(this,null,function*(){const t=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(t))return null;const i=[(Oi[t]||[]).find(r=>r.key===`${t}-distribution`),this.currentTopicLayer,...(this.visibleTopicLayers||[]).filter(r=>this.getLayerTopicKey(r)===t)].filter((r,o,u)=>(r==null?void 0:r.layerName)&&u.findIndex(d=>this.getLayerQueryKey(d)===this.getLayerQueryKey(r))===o);for(const r of i){const o=yield this.queryLayerFeatureByPoint(r,e,{requireContainment:!0});if(o)return{layer:r,feature:o}}return null})}normalizeFeatureInfoAtPoint(e,t){const a=Array.isArray(e==null?void 0:e.features)?e.features:[];if(!a.length)return null;const i=this.pickFeatureAtPoint(a,t,{requireContainment:!0});if(!i)return null;const r=i.properties||{};return{id:i.id||r.gid||r.objectid||r.OBJECTID,properties:r,feature:i}}queryLayerFeatureByPoint(i,r){return re(this,arguments,function*(e,t,a={}){var F,x,G;if(!(e!=null&&e.layerName)||!Number.isFinite(t==null?void 0:t.lng)||!Number.isFinite(t==null?void 0:t.lat))return null;const o=e.pointQueryTolerance||.0015,u=e.geometryField||"geom",d=t.lng-o,c=t.lat-o,f=t.lng+o,m=t.lat+o,T=yield Ms(e.layerName,{cqlFilter:`BBOX(${u},${d},${c},${f},${m})`,maxFeatures:8,timeout:12e3}),M=this.pickFeatureAtPoint((T==null?void 0:T.features)||[],t,a);return M?{id:M.id||((F=M.properties)==null?void 0:F.gid)||((x=M.properties)==null?void 0:x.objectid)||((G=M.properties)==null?void 0:G.OBJECTID),properties:M.properties||{},feature:M}:null})}pickFeatureAtPoint(e,t,a={}){var r;if(!Array.isArray(e)||!e.length)return null;const i=e.filter(o=>this.isLngLatInGeometry(t,o.geometry)).sort((o,u)=>this.getGeometryAreaScore(o.geometry)-this.getGeometryAreaScore(u.geometry));return i.length?i[0]:a.requireContainment?null:((r=e.map(o=>({feature:o,distance:this.getGeometryDistanceScore(o.geometry,t)})).sort((o,u)=>o.distance-u.distance)[0])==null?void 0:r.feature)||null}isLngLatInGeometry(e,t){return!e||!(t!=null&&t.coordinates)?!1:t.type==="Polygon"?this.isLngLatInPolygon(e,t.coordinates):t.type==="MultiPolygon"?t.coordinates.some(a=>this.isLngLatInPolygon(e,a)):!1}isLngLatInPolygon(e,t=[]){return!t.length||!this.isLngLatInRing(e,t[0])?!1:!t.slice(1).some(i=>this.isLngLatInRing(e,i))}isLngLatInRing(e,t=[]){if(t.length<3)return!1;let a=!1;const i=e.lng,r=e.lat;for(let o=0,u=t.length-1;o<t.length;u=o++){const d=t[o],c=t[u],f=Number(d==null?void 0:d[0]),m=Number(d==null?void 0:d[1]),T=Number(c==null?void 0:c[0]),M=Number(c==null?void 0:c[1]);if(this.isPointOnSegment(i,r,f,m,T,M))return!0;m>r!=M>r&&i<(T-f)*(r-m)/(M-m)+f&&(a=!a)}return a}isPointOnSegment(e,t,a,i,r,o){const u=(e-a)*(o-i)-(t-i)*(r-a);return Math.abs(u)>1e-10?!1:(e-a)*(e-r)+(t-i)*(t-o)<=1e-10}getGeometryAreaScore(e){return e!=null&&e.coordinates?e.type==="Polygon"?this.getLngLatPolygonAreaScore(e.coordinates):e.type==="MultiPolygon"?e.coordinates.reduce((t,a)=>t+this.getLngLatPolygonAreaScore(a),0):Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY}getLngLatPolygonAreaScore(e=[]){const t=e[0]||[];if(t.length<3)return Number.POSITIVE_INFINITY;let a=0;for(let i=0;i<t.length;i++){const r=t[i],o=t[(i+1)%t.length];a+=Number((r==null?void 0:r[0])||0)*Number((o==null?void 0:o[1])||0)-Number((o==null?void 0:o[0])||0)*Number((r==null?void 0:r[1])||0)}return Math.abs(a)}getGeometryDistanceScore(e,t){const a=this.getGeometryLngLatBounds(e);if(!a)return Number.POSITIVE_INFINITY;const i=(a.minLng+a.maxLng)/2,r=(a.minLat+a.maxLat)/2;return Math.hypot(i-t.lng,r-t.lat)}getGeometryLngLatBounds(e){const t=this.getGeometryCoordinateList(e);return t.length?t.reduce((a,i)=>({minLng:Math.min(a.minLng,Number((i==null?void 0:i[0])||0)),minLat:Math.min(a.minLat,Number((i==null?void 0:i[1])||0)),maxLng:Math.max(a.maxLng,Number((i==null?void 0:i[0])||0)),maxLat:Math.max(a.maxLat,Number((i==null?void 0:i[1])||0))}),{minLng:Number.POSITIVE_INFINITY,minLat:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY}):null}getGeometryCoordinateList(e){const t=[],a=i=>{if(Array.isArray(i)){if(typeof i[0]=="number"&&typeof i[1]=="number"){t.push(i);return}i.forEach(a)}};return a(e==null?void 0:e.coordinates),t}pickVectorFeatureAtPoint(e,t){var o;const a=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]);if(((o=this.currentTopicLayer)==null?void 0:o.key)==="yak-industry-points"){const u=this.pickPointFeatureAtScreenPoint(a,t);if(u)return u}const i=a.filter(u=>this.isLngLatInGeometry(e,u.geometry)).sort((u,d)=>this.getGeometryAreaScore(u.geometry)-this.getGeometryAreaScore(d.geometry));if(i.length)return i[0];const r=a.find(u=>this.isPointOrLineNearLngLat(u.geometry,e));return r||null}pickPointFeatureAtScreenPoint(e,t){var r;if(!t||!((r=this.camera)!=null&&r.instance)||!this.focusMapGroup||!this.canvas)return null;const i=(e||[]).filter(o=>{var u;return((u=o==null?void 0:o.geometry)==null?void 0:u.type)==="Point"}).map(o=>{const u=this.getPointFeatureScreenPoint(o);return u?{feature:o,screen:u,distance:Math.hypot(u.x-t.x,u.y-t.y)}:null}).filter(Boolean).sort((o,u)=>o.distance-u.distance)[0];return(i==null?void 0:i.distance)<=22?{feature:i.feature,screen:i.screen}:null}getPointFeatureScreenPoint(e){var a,i;const t=(e==null?void 0:e.geometry)||((a=e==null?void 0:e.feature)==null?void 0:a.geometry);return(t==null?void 0:t.type)!=="Point"?null:((i=this.currentTopicLayer)==null?void 0:i.key)==="yak-industry-points"?this.lngLatToLayerScreenPoint(t.coordinates,this.depth+.36):this.lngLatToScreenPoint(t.coordinates,this.depth+.32)}lngLatToLayerLocalPoint(e,t=0){const a=()=>{const c=Number(e==null?void 0:e[0]),f=Number(e==null?void 0:e[1]);if(!Number.isFinite(c)||!Number.isFinite(f))return new Q(0,0,Number(t)||0);const[m,T]=this.geoProjection([c,f]);return new Q(m,-T,Number(t)||0)},i=this.topicLayerUvBounds;if(!i)return a();const r=this.lngLatToLayerCanvasPoint(e),o=this.topicLayerCanvas;if(!(o!=null&&o.width)||!(o!=null&&o.height))return a();const u=i.left+r.x/o.width*(i.right-i.left),d=i.bottom+(o.height-r.y)/o.height*(i.top-i.bottom);return new Q(u,d,Number(t)||0)}lngLatToLayerScreenPoint(e,t=0){return this.localMapPointToScreenPoint(this.lngLatToLayerLocalPoint(e,t))}lngLatToScreenPoint(e,t=0){const a=Number(e==null?void 0:e[0]),i=Number(e==null?void 0:e[1]);if(!Number.isFinite(a)||!Number.isFinite(i))return null;const r=this.lngLatToWorldPoint([a,i],t);return this.worldPointToScreenPoint(r)}localMapPointToScreenPoint(e){const t=this.focusMapGroup?this.focusMapGroup.localToWorld(e):e;return this.worldPointToScreenPoint(t)}worldPointToScreenPoint(e){var i;if(!((i=this.camera)!=null&&i.instance)||!this.canvas||!e)return null;const t=this.canvas.getBoundingClientRect();if(!t.width||!t.height)return null;const a=e.clone().project(this.camera.instance);return!Number.isFinite(a.x)||!Number.isFinite(a.y)?null:{x:t.left+(a.x+1)/2*t.width,y:t.top+(1-a.y)/2*t.height}}focusProject(e){var T,M,F,x;const t=String(e||"").trim();if(!t)return!1;const a=(this.currentVectorFeatures||[]).filter(G=>{var j;return String(((j=G==null?void 0:G.properties)==null?void 0:j.project_name)||"").trim()===t});if(!a.length)return(M=(T=this.callbacks).onLayerStatus)==null||M.call(T,{type:"success",text:"当前项目图斑尚未加载"}),!1;const i=this.getFeatureListLngLatBounds(a);if(!i)return!1;const r=this.getProjectHighlightFeatures(a);r.length?(this.showSelectedFeatures(r),this.setSelectedVectorFeatures(r)):this.clearSelectedFeature();const o=[(i.minLng+i.maxLng)/2,(i.minLat+i.maxLat)/2],u=Math.max(i.maxLng-i.minLng,i.maxLat-i.minLat),d=Math.max(.22,Math.min(.55,u*1.25)),c=this.lngLatToWorldPoint(o,.72),f=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(d),m=c.clone().add(f);return this.animateMapCamera(m,c,.75),(x=(F=this.callbacks).onLayerStatus)==null||x.call(F,{type:"success",text:"已定位项目"}),!0}setBoundaryDrawing(e){var t,a,i,r;this.boundaryDrawingEnabled=!!e,this.boundaryDrawingEnabled?(this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=null,this.analysisMatchedFeatures=[],this.clearSelectedFeature(),(a=(t=this.callbacks).onLayerStatus)==null||a.call(t,{type:"success",text:"请在地图上依次点击绘制分析边界"})):(r=(i=this.callbacks).onLayerStatus)==null||r.call(i,{type:"success",text:"已退出边界绘制"}),this.redrawVectorTopicLayer()}addBoundaryDrawPoint(e){var r,o,u,d;if(!Number.isFinite(e==null?void 0:e.lng)||!Number.isFinite(e==null?void 0:e.lat))return!1;const t=Date.now(),a=this.lastBoundaryDrawPoint;return a&&t-a.time<350&&Math.hypot(e.lng-a.lng,e.lat-a.lat)<8e-4?!1:(this.lastBoundaryDrawPoint={lng:e.lng,lat:e.lat,time:t},this.boundaryDrawPoints=[...this.boundaryDrawPoints||[],{lng:e.lng,lat:e.lat}],(o=(r=this.callbacks).onDrawBoundary)==null||o.call(r,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),(d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"success",text:`已添加边界点 ${this.boundaryDrawPoints.length} 个`}),this.redrawVectorTopicLayer(),!0)}undoBoundaryPoint(){var e,t,a;return(e=this.boundaryDrawPoints)!=null&&e.length?(this.boundaryDrawPoints=this.boundaryDrawPoints.slice(0,-1),(a=(t=this.callbacks).onDrawBoundary)==null||a.call(t,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),this.redrawVectorTopicLayer(),!0):!1}finishBoundaryDrawing(){var o,u,d,c,f,m;const e=this.boundaryDrawPoints||[];if(e.length<3)return(u=(o=this.callbacks).onLayerStatus)==null||u.call(o,{type:"error",text:"至少需要 3 个点才能形成分析边界"}),null;const t=e.map(T=>[T.lng,T.lat]),a=t[0],i=t[t.length-1];(a[0]!==i[0]||a[1]!==i[1])&&t.push([...a]);const r={type:"Feature",properties:{source:"draw",pointCount:e.length},geometry:{type:"Polygon",coordinates:[t]}};return this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=r,(c=(d=this.callbacks).onDrawBoundary)==null||c.call(d,{status:"complete",feature:r,points:e,pointCount:e.length}),(m=(f=this.callbacks).onLayerStatus)==null||m.call(f,{type:"success",text:"分析边界已生成"}),this.redrawVectorTopicLayer(),r}clearAnalysisBoundary(){var e,t;return this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=null,this.analysisMatchedFeatures=[],this.redrawVectorTopicLayer(),(t=(e=this.callbacks).onDrawBoundary)==null||t.call(e,{status:"clear",points:[],pointCount:0}),!0}showAnalysisResult(e={}){var r;const t=Object.prototype.hasOwnProperty.call(e,"boundary")||Object.prototype.hasOwnProperty.call(e,"boundaryFeature")||Object.prototype.hasOwnProperty.call(e,"feature"),a=e.boundary||e.boundaryFeature||e.feature||null,i=Array.isArray(e.matches)?e.matches:[];return t&&(this.analysisBoundaryFeature=(a==null?void 0:a.type)==="Feature"?a:a!=null&&a.geometry?{type:"Feature",properties:a.properties||{},geometry:a.geometry}:null),this.analysisMatchedFeatures=i.map(o=>(o==null?void 0:o.feature)||o).filter(o=>o==null?void 0:o.geometry),e.preserveView||(!t&&this.analysisMatchedFeatures.length?this.focusAnalysisFeatures(this.analysisMatchedFeatures):(r=this.analysisBoundaryFeature)!=null&&r.geometry&&this.focusAnalysisGeometry(this.analysisBoundaryFeature.geometry)),this.redrawVectorTopicLayer(),!0}focusAnalysisFeatures(e=[]){const t=this.getFeatureListLngLatBounds(e);if(!t)return!1;const a=[(t.minLng+t.maxLng)/2,(t.minLat+t.maxLat)/2];return this.flyToLngLat(a,{span:Math.max(t.maxLng-t.minLng,t.maxLat-t.minLat),statusText:"已定位命中项目"})}focusAnalysisGeometry(e){const t=this.getGeometryLngLatBounds(e);if(!t)return!1;const a=[(t.minLng+t.maxLng)/2,(t.minLat+t.maxLat)/2];return this.flyToLngLat(a,{span:Math.max(t.maxLng-t.minLng,t.maxLat-t.minLat),statusText:"已定位分析边界"})}focusPasture(e={}){var i,r;const a=[...this.normalizePastureGrasslandRows(e==null?void 0:e.grasslands),...this.normalizePastureGrasslandRows(e==null?void 0:e.wkt)].map((o,u)=>{const d=this.normalizePastureGrasslandGeometry(o);if(!d)return null;const c=this.normalizePastureGrasslandProperties(o);return{type:"Feature",properties:O(A({},c),{id:c.id||c.gid||`${(e==null?void 0:e.name)||"pasture"}-${u}`,pasture_name:(e==null?void 0:e.name)||c.pastureName||c.name}),geometry:d}}).filter(Boolean);if(a.length){const o=this.getFeatureListLngLatBounds(a);if(!o)return!1;this.showSelectedFeatures(a,{mode:"pasture"}),this.setSelectedVectorFeatures(a);const u=[(o.minLng+o.maxLng)/2,(o.minLat+o.maxLat)/2];return this.flyToLngLat(u,{span:Math.max(o.maxLng-o.minLng,o.maxLat-o.minLat),statusText:"已定位具体草场"}),!0}return(r=(i=this.callbacks).onLayerStatus)==null||r.call(i,{type:"warning",text:"当前牧户暂无可定位数据"}),!1}normalizePastureGrasslandRows(e){return e?typeof e=="string"?[e]:Array.isArray(e)?e:(e==null?void 0:e.type)==="FeatureCollection"&&Array.isArray(e.features)?e.features:(e==null?void 0:e.type)==="Feature"||this.isGeoJsonGeometry(e)?[e]:Array.isArray(e==null?void 0:e.rows)?e.rows:Array.isArray(e==null?void 0:e.data)?e.data:e!=null&&e.data?this.normalizePastureGrasslandRows(e.data):Array.isArray(e==null?void 0:e.list)?e.list:Array.isArray(e==null?void 0:e.features)?e.features:e!=null&&e.wkt||e!=null&&e.geo||e!=null&&e.geom||e!=null&&e.geometryWkt||e!=null&&e.geometry_wkt||e!=null&&e.shape||e!=null&&e.location||e!=null&&e.geometry?[e]:[]:[]}normalizePastureGrasslandGeometry(e){var t;return typeof e=="string"?this.parseGeometryText(e):(e==null?void 0:e.type)==="Feature"?this.normalizePastureGrasslandGeometry(e.geometry):this.isGeoJsonGeometry(e)?e:typeof(e==null?void 0:e.geometry)=="string"?this.parseGeometryText(e.geometry):((t=e==null?void 0:e.geometry)==null?void 0:t.type)==="Feature"?this.normalizePastureGrasslandGeometry(e.geometry.geometry):this.isGeoJsonGeometry(e==null?void 0:e.geometry)?e.geometry:this.parseGeometryText((e==null?void 0:e.wkt)||(e==null?void 0:e.geo)||(e==null?void 0:e.geom)||(e==null?void 0:e.geometryWkt)||(e==null?void 0:e.geometry_wkt)||(e==null?void 0:e.shape)||(e==null?void 0:e.location))}normalizePastureGrasslandProperties(e){return!e||typeof e!="object"||Array.isArray(e)?{wkt:e}:e.type==="Feature"?e.properties||{}:e}parseGeometryText(e){const t=String(e||"").trim();if(!t)return null;if(t.startsWith("{")||t.startsWith("["))try{const a=JSON.parse(t);if((a==null?void 0:a.type)==="Feature")return this.normalizePastureGrasslandGeometry(a);if(this.isGeoJsonGeometry(a))return a}catch(a){return null}return this.parseWktGeometry(t)}isGeoJsonGeometry(e){return!!(e&&["Polygon","MultiPolygon","LineString","MultiLineString","Point"].includes(e.type)&&e.coordinates)}flyToLngLat(e,t={}){var m,T;const a=Array.isArray(e)?e:[e==null?void 0:e.lng,e==null?void 0:e.lat],i=Number(a==null?void 0:a[0]),r=Number(a==null?void 0:a[1]);if(!Number.isFinite(i)||!Number.isFinite(r))return!1;const o=Number(t.span),u=Number.isFinite(o)?Math.max(.2,Math.min(.55,o*1.25)):.32,d=this.lngLatToWorldPoint([i,r],.72),c=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(u),f=d.clone().add(c);return this.animateMapCamera(f,d,t.duration||.75),(T=(m=this.callbacks).onLayerStatus)==null||T.call(m,{type:"success",text:t.statusText||"已定位"}),!0}getProjectHighlightFeatures(e){const t=e.filter(i=>{var o;const r=String(((o=i==null?void 0:i.geometry)==null?void 0:o.type)||"");return r.includes("Polygon")||r.includes("LineString")}),a=t.filter(i=>{var r;return((r=i==null?void 0:i.properties)==null?void 0:r.feature_role)==="工程范围"});return a.length?a:t}getFeatureListLngLatBounds(e){return e.reduce((t,a)=>{const i=this.getGeometryLngLatBounds(a.geometry);return i?t?{minLng:Math.min(t.minLng,i.minLng),minLat:Math.min(t.minLat,i.minLat),maxLng:Math.max(t.maxLng,i.maxLng),maxLat:Math.max(t.maxLat,i.maxLat)}:A({},i):t},null)}isPointOrLineNearLngLat(e,t){return e!=null&&e.coordinates?e.type==="Point"?this.getCoordinateDistance(e.coordinates,[t.lng,t.lat])<=.02:e.type==="LineString"?this.isCoordinateNearLine(e.coordinates,t,.004):e.type==="MultiLineString"?e.coordinates.some(a=>this.isCoordinateNearLine(a,t,.004)):!1:!1}isCoordinateNearLine(e,t,a){if(!Array.isArray(e)||e.length<2)return!1;const i=[t.lng,t.lat];for(let r=1;r<e.length;r+=1)if(this.getCoordinateSegmentDistance(i,e[r-1],e[r])<=a)return!0;return!1}getCoordinateDistance(e,t){return Math.hypot(Number(e==null?void 0:e[0])-Number(t==null?void 0:t[0]),Number(e==null?void 0:e[1])-Number(t==null?void 0:t[1]))}getCoordinateSegmentDistance(e,t,a){const i=Number(t==null?void 0:t[0]),r=Number(t==null?void 0:t[1]),o=Number(a==null?void 0:a[0])-i,u=Number(a==null?void 0:a[1])-r;if(!Number.isFinite(o)||!Number.isFinite(u))return Number.POSITIVE_INFINITY;if(!o&&!u)return this.getCoordinateDistance(e,t);const d=Math.max(0,Math.min(1,((e[0]-i)*o+(e[1]-r)*u)/(o*o+u*u)));return this.getCoordinateDistance(e,[i+d*o,r+d*u])}getLayerTopicKey(e){const t=e==null?void 0:e.layerName,a=e==null?void 0:e.key,i=Object.entries(A(A({},Oi),Pl)).find(([,r])=>r.some(o=>o.key===a||o.layerName===t));return(i==null?void 0:i[0])||""}getLayerQueryKey(e){return[(e==null?void 0:e.layerName)||"",(e==null?void 0:e.styles)||"",(e==null?void 0:e.cqlFilter)||"",(e==null?void 0:e.key)||""].join("|")}mergeBusinessProperties(e,t,a){const i=(a==null?void 0:a.key)||"";if(Object.entries(t||{}).forEach(([r,o])=>{o==null||o===""||(e[r]===void 0||e[r]===null||e[r]==="")&&(e[r]=o)}),i==="basic-grassland"){const r=(t==null?void 0:t.basic_type_name)||(t==null?void 0:t.grassland_category_name)||(t==null?void 0:t.land_class_name)||(t==null?void 0:t.land_use_name)||(t==null?void 0:t.base_grass);r!=null&&r!==""&&(e.basic_type_name=r)}if(i==="grassland-level"){const r=(t==null?void 0:t.grassland_level)||(t==null?void 0:t.level)||(t==null?void 0:t.grassland_level_name)||(t==null?void 0:t.level_name);r!=null&&r!==""&&(e.grassland_level=r)}if(i==="grassland-type"||i==="wetland-type"){const r=(t==null?void 0:t.grass_min_type)||(t==null?void 0:t.grass_type)||(t==null?void 0:t.grassland_type)||(t==null?void 0:t.type_name)||(t==null?void 0:t.type);r!=null&&r!==""&&(e.grass_min_type=r)}if(i==="grassland-yield"||i==="wetland-yield"){const r=(t==null?void 0:t.yield)||(t==null?void 0:t.xc_yield)||(t==null?void 0:t.xb_xc_yield)||(t==null?void 0:t.fresh_grass_yield)||(t==null?void 0:t.value),o=(t==null?void 0:t.mu_yield)||(t==null?void 0:t.xc_mu_yield)||(t==null?void 0:t.xb_xc_mu_yield)||(t==null?void 0:t.yield_per_mu);r!=null&&r!==""&&(e.fresh_grass_yield=r),o!=null&&o!==""&&(e.mu_yield=o)}if(i==="grassland-health"){const r=(t==null?void 0:t.health_level)||(t==null?void 0:t.health_level_name)||(t==null?void 0:t.ndvi_level)||(t==null?void 0:t.level)||(t==null?void 0:t.level_name),o=(t==null?void 0:t.ndvi)||(t==null?void 0:t.NDVI)||(t==null?void 0:t.value);r!=null&&r!==""&&(e.health_level=r),o!=null&&o!==""&&(e.ndvi=o);const u=(t==null?void 0:t.degradation_level)||(t==null?void 0:t.degradation_level_name)||(t==null?void 0:t.level)||(t==null?void 0:t.level_name);u!=null&&u!==""&&(e.degradation_level=u)}}getScreenPointFromEvent(e){var a;const t=((a=e==null?void 0:e.data)==null?void 0:a.originalEvent)||(e==null?void 0:e.originalEvent)||e;return(t==null?void 0:t.clientX)!==void 0&&(t==null?void 0:t.clientY)!==void 0?{x:t.clientX,y:t.clientY}:null}getLngLatFromEvent(e){var u,d,c;const a=(c=(((d=(u=this.interactionManager)==null?void 0:u.raycaster)==null?void 0:d.intersectObject(e.target,!1))||[])[0])==null?void 0:c.point;if(!a)return null;const i=this.focusMapGroup.worldToLocal(a.clone()),o=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([i.x,-i.y]);return o?{lng:o[0],lat:o[1]}:null}lngLatToWmsPixel({lng:e,lat:t}){const a=(e-Y.west)/(Y.east-Y.west)*Rt.width,i=(Y.north-t)/(Y.north-Y.south)*Rt.height;return{x:a,y:i}}showSelectedFeature(e,t={}){var i;const a=(e==null?void 0:e.geometry)||((i=e==null?void 0:e.feature)==null?void 0:i.geometry);this.clearSelectedFeature(),this.createSelectedFeatureGroup(),this.addSelectedGeometry(a,t),this.selectedFeatureGroup.children.length||this.clearSelectedFeature()}showSelectedFeatures(e=[],t={}){this.clearSelectedFeature(),this.createSelectedFeatureGroup(),e.forEach(a=>{var r;const i=(a==null?void 0:a.geometry)||((r=a==null?void 0:a.feature)==null?void 0:r.geometry);this.addSelectedGeometry(i,t)}),this.selectedFeatureGroup.children.length||this.clearSelectedFeature()}setSelectedVectorFeatures(e=[]){this.selectedVectorFeatures=[...e],this.redrawVectorTopicLayer()}getSelectedFeatureStyle(e={}){const t=e.mode==="pasture",a=e.mode==="town";return{fillColor:Is,fillOpacity:t?.46:a?.24:.54,lineColor:lu,lineOpacity:.98,glowColor:Gs,glowOpacity:t?.92:.96,renderOrderBase:t?42:a?40:35,boundary:t||a,boundaryColor:Is,boundaryGlowColor:Gs,boundaryWidth:a?.012:.018,boundaryGlowWidth:a?.045:.06,boundaryOpacity:.95,boundaryGlowOpacity:a?.34:.42}}addSelectedGeometry(e,t={}){if(!(e!=null&&e.coordinates)||!this.selectedFeatureGroup)return;const a=this.getSelectedFeatureStyle(t),i=this.getDisplayFeaturePolygons(e),r=new me({color:a.fillColor,transparent:!0,opacity:a.fillOpacity,side:Ne,depthWrite:!1,fog:!1}),o=new aa({color:a.lineColor,transparent:!0,opacity:a.lineOpacity,linewidth:2,depthTest:!1,depthWrite:!1,fog:!1}),u=new aa({color:a.glowColor,transparent:!0,opacity:a.glowOpacity,linewidth:3,depthTest:!1,depthWrite:!1,fog:!1}),d=a.boundary?new me({color:a.boundaryColor,transparent:!0,opacity:a.boundaryOpacity,side:Ne,depthTest:!1,depthWrite:!1,fog:!1}):null,c=a.boundary?new me({color:a.boundaryGlowColor,transparent:!0,opacity:a.boundaryGlowOpacity,side:Ne,depthTest:!1,depthWrite:!1,fog:!1,blending:xe}):null;i.length&&i.forEach(m=>{const T=this.createProjectedShape(m);if(!T)return;const M=new ml(T),F=new We(M,r);F.renderOrder=a.renderOrderBase,this.selectedFeatureGroup.add(F),m.forEach(x=>{const G=this.createProjectedRingPoints(x);if(G.length<3)return;a.boundary&&(this.addSelectedBoundaryBand(G,c,a.boundaryGlowWidth,a.renderOrderBase+1,!0),this.addSelectedBoundaryBand(G,d,a.boundaryWidth,a.renderOrderBase+4,!0));const j=new Pa().setFromPoints(G),X=new ys(j,o);X.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(X);const se=new Pa().setFromPoints(G),q=new ys(se,u);q.renderOrder=a.renderOrderBase+3,q.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(q)})});const f=this.normalizeFeatureLineStrings(e);f.length&&f.forEach(m=>{const T=this.createProjectedRingPoints(m);if(T.length<2)return;a.boundary&&(this.addSelectedBoundaryBand(T,c,a.boundaryGlowWidth,a.renderOrderBase+1,!1),this.addSelectedBoundaryBand(T,d,a.boundaryWidth,a.renderOrderBase+4,!1));const M=new Pa().setFromPoints(T),F=new gs(M,u);F.renderOrder=a.renderOrderBase+3,F.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(F);const x=new Pa().setFromPoints(T),G=new gs(x,o);G.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(G)})}addSelectedBoundaryBand(e,t,a,i,r=!0){if(!t||!this.selectedFeatureGroup)return;const o=this.createPathBandGeometry(e,a,r);if(!o)return;const u=new We(o,t);u.renderOrder=i,this.selectedFeatureGroup.add(u)}createPathBandGeometry(e,t,a=!0){const i=this.normalizePathBandPoints(e,a);if(i.length<(a?3:2))return null;const r=Math.max(Number(t)||0,0)/2;if(!r)return null;const o=[],u=a?i.length:i.length-1;for(let c=0;c<u;c+=1){const f=i[c],m=i[(c+1)%i.length],T=m.x-f.x,M=m.y-f.y,F=Math.hypot(T,M);if(!F)continue;const x=-M/F*r,G=T/F*r,j=[f.x+x,f.y+G,.006],X=[f.x-x,f.y-G,.006],se=[m.x+x,m.y+G,.006],q=[m.x-x,m.y-G,.006];o.push(...j,...X,...se,...se,...X,...q)}if(!o.length)return null;const d=new Pa;return d.setAttribute("position",new yl(o,3)),d.computeVertexNormals(),d}normalizePathBandPoints(e,t){const a=(e||[]).filter(i=>Number.isFinite(i==null?void 0:i.x)&&Number.isFinite(i==null?void 0:i.y)).map(i=>i.clone());if(t&&a.length>2){const i=a[0],r=a[a.length-1];i.distanceToSquared(r)<1e-10&&a.pop()}return a}clearSelectedFeature(){var t;const e=!!((t=this.selectedVectorFeatures)!=null&&t.length);this.selectedVectorFeatures=[],e&&this.redrawVectorTopicLayer(),this.clearSelectedGeometryGroup()}clearSelectedGeometryGroup(){var t,a;if(!this.selectedFeatureGroup)return;const e=new Set;for(;this.selectedFeatureGroup.children.length;){const i=this.selectedFeatureGroup.children.pop();(a=(t=i.geometry)==null?void 0:t.dispose)==null||a.call(t),Array.isArray(i.material)?i.material.forEach(r=>e.add(r)):e.add(i.material)}e.forEach(i=>{var r;return(r=i==null?void 0:i.dispose)==null?void 0:r.call(i)})}normalizeFeaturePolygons(e){return Ws(e)}normalizeFeatureLineStrings(e){return e!=null&&e.coordinates?e.type==="LineString"?[e.coordinates]:e.type==="MultiLineString"?e.coordinates:[]:[]}getDisplayFeaturePolygons(e){const t=this.normalizeFeaturePolygons(e),a=this.getLayerClipBounds(this.currentTopicLayer);return a?t.map(i=>{const r=this.clipRingToBounds(i==null?void 0:i[0],a);if(r.length<3)return null;const o=i.slice(1).map(u=>this.clipRingToBounds(u,a)).filter(u=>u.length>=3);return[r,...o]}).filter(Boolean):t}clipRingToBounds(e=[],t){let a=e.map(r=>[Number(r==null?void 0:r[0]),Number(r==null?void 0:r[1])]).filter(([r,o])=>Number.isFinite(r)&&Number.isFinite(o));return[{inside:([r])=>r>=t.west,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lng",t.west)},{inside:([r])=>r<=t.east,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lng",t.east)},{inside:([,r])=>r>=t.south,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lat",t.south)},{inside:([,r])=>r<=t.north,intersect:(r,o)=>this.getLngLatLineIntersection(r,o,"lat",t.north)}].forEach(r=>{const o=a;a=[],o.length&&o.forEach((u,d)=>{const c=o[(d+o.length-1)%o.length],f=r.inside(u),m=r.inside(c);f?(m||a.push(r.intersect(c,u)),a.push(u)):m&&a.push(r.intersect(c,u))})}),a}getLngLatLineIntersection(e,t,a,i){const r=a==="lng"?0:1,o=a==="lng"?1:0,u=t[r]-e[r];if(!u)return[...e];const d=(i-e[r])/u,c=[...e];return c[r]=i,c[o]=e[o]+(t[o]-e[o])*d,c}createProjectedShape(e){const t=e==null?void 0:e[0];if(!Array.isArray(t)||t.length<3)return null;const a=new vs;return this.createProjectedRingPoints(t).forEach((r,o)=>{o===0?a.moveTo(r.x,r.y):a.lineTo(r.x,r.y)}),e.slice(1).forEach(r=>{const o=this.createProjectedRingPoints(r);if(o.length<3)return;const u=new vs;o.forEach((d,c)=>{c===0?u.moveTo(d.x,d.y):u.lineTo(d.x,d.y)}),a.holes.push(u)}),a}createProjectedRingPoints(e){if(!Array.isArray(e))return[];const t=[];return e.forEach(a=>{if(!Array.isArray(a)||a.length<2)return;const i=Number(a[0]),r=Number(a[1]);if(!Number.isFinite(i)||!Number.isFinite(r))return;const[o,u]=this.geoProjection([i,r]);t.push(new Q(o,-u,0))}),t}enhanceTexture(e){var a,i,r;const t=(i=(a=this.renderer)==null?void 0:a.instance)==null?void 0:i.capabilities;e.anisotropy=((r=t==null?void 0:t.getMaxAnisotropy)==null?void 0:r.call(t))||1,e.needsUpdate=!0}geoProjection(e){return Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0])(e)}updateTownLabelScale(){var u,d,c;const e=this.townNameLabels||this.otherLabel||[],t=(u=this.camera)==null?void 0:u.instance,a=(c=(d=this.camera)==null?void 0:d.controls)==null?void 0:c.target;if(!e.length||!t||!a)return;const i=t.position.distanceTo(a),r=Yt(i*72e-5,.011,.026),o=i>45?"0.76":i<22?"0.94":"1";e.forEach(f=>{var T,M,F;if(((T=f==null?void 0:f.userData)==null?void 0:T.labelType)!=="town-label")return;f.scale.set(r,r,r);const m=(F=(M=f.element)==null?void 0:M.querySelector)==null?void 0:F.call(M,".other-label");m&&(m.style.opacity=o)})}update(e){super.update(e),this.updateDynamicSatelliteTiles(),this.updateTownLabelScale(),this.updateTradeFlowPulses(e),this.interactionManager&&this.interactionManager.update()}pauseScene(){var e,t;this.scenePaused=!0,(t=(e=this.time)==null?void 0:e.pause)==null||t.call(e),this.sceneTweens.forEach(a=>{var i;return(i=a==null?void 0:a.pause)==null?void 0:i.call(a)}),clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=null}resumeScene(){var e,t;this.scenePaused=!1,(t=(e=this.time)==null?void 0:e.resume)==null||t.call(e),this.sceneTweens.forEach(a=>{var i;return(i=a==null?void 0:a.resume)==null?void 0:i.call(a)}),this.showTownRankingPointMarkers&&this.mapAnimationComplete&&!this.infoPointLabelTime&&this.createInfoPointLabelLoop()}destroy(){var e,t,a,i;this.pauseScene(),this.sceneTimers.forEach(r=>clearTimeout(r)),this.sceneTimers=[],this.sceneTweens.forEach(r=>{var o;return(o=r==null?void 0:r.kill)==null?void 0:o.call(r)}),this.sceneTweens=[],this.callbacks={},(t=(e=this.canvas)==null?void 0:e.removeEventListener)==null||t.call(e,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(i=(a=this.canvas)==null?void 0:a.removeEventListener)==null||i.call(a,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.clearTradeFlowLayer(),this.clearSelectedFeature(),super.destroy(),this.label3d&&this.label3d.destroy()}}const gu={class:"map"},vu={__name:"map",props:{activeLayer:{type:Object,default:null},mapRanking:{type:Object,default:null},tileUrlTemplate:{type:String,default:""},satelliteTextureZoom:{type:Number,default:0},satelliteMaxZoom:{type:Number,default:21},adminBoundaryLineScale:{type:Number,default:1},useSatelliteBase:{type:Boolean,default:!0},showNationalBackdrop:{type:Boolean,default:!1},topicLayerPresentation:{type:String,default:"default"},hideTownLabelStats:{type:Boolean,default:!1}},emits:["feature-loading","feature-info","layer-status","tile-status","draw-boundary","scene-mounted"],setup(g,{expose:e,emit:t}){const a=g,i=t,r=I(null),o=el(null);let u=null,d=null,c=null,f=null,m=null,T="",M="",F=!1;qs(()=>{i("scene-mounted")}),Us(()=>{Ue()});function x(k){return o.value?!0:r.value?(o.value=new yu(r.value,k,{onFeatureLoading:v=>i("feature-loading",v),onFeatureInfo:v=>i("feature-info",v),onLayerStatus:v=>i("layer-status",v),onTileStatus:v=>i("tile-status",v),onDrawBoundary:v=>i("draw-boundary",v),tileUrlTemplate:a.tileUrlTemplate,satelliteTextureZoom:a.satelliteTextureZoom,satelliteMaxZoom:a.satelliteMaxZoom,adminBoundaryLineScale:a.adminBoundaryLineScale,useSatelliteBase:a.useSatelliteBase,showNationalBackdrop:a.showNationalBackdrop,topicLayerPresentation:a.topicLayerPresentation,hideTownLabelStats:a.hideTownLabelStats}),o.value.time.pause(),T=ct(a.activeLayer),M=Ge(a.mapRanking),o.value.setTopicLayers(it(a.activeLayer),a.activeLayer),o.value.setTownRanking(a.mapRanking),at(),Ie(),!0):!1}function G(){return!!o.value}function j(){return re(this,null,function*(){var k,v,C,B,$,U;if(o.value&&(X(),!o.value.mapAnimationComplete)){if(F){(v=(k=o.value.animateTl)==null?void 0:k.play)==null||v.call(k),Ve();return}F=!0,(B=(C=o.value.animateTl)==null?void 0:C.timeScale)==null||B.call(C,1),(U=($=o.value.animateTl)==null?void 0:$.play)==null||U.call($),Ve()}})}function X(){var k,v;o.value&&(at(),Ie(),window.requestAnimationFrame(()=>{var C,B,$,U,ee,Me;($=(B=(C=o.value)==null?void 0:C.label3d)==null?void 0:B.resize)==null||$.call(B),(Me=(ee=(U=o.value)==null?void 0:U.label3d)==null?void 0:ee.update)==null||Me.call(ee)}),(v=(k=o.value).resumeScene)==null||v.call(k),o.value.resumeScene||o.value.time.resume())}function se(){var k,v,C,B,$,U;o.value&&(Ke(),(v=(k=o.value.animateTl)==null?void 0:k.pause)==null||v.call(k),(B=(C=o.value).pauseScene)==null||B.call(C),o.value.pauseScene||(U=($=o.value.time)==null?void 0:$.pause)==null||U.call($),ae())}function q(){var k,v;(v=(k=o.value)==null?void 0:k.clearSelectedFeature)==null||v.call(k)}function R(k){var v,C;(C=(v=o.value)==null?void 0:v.focusProject)==null||C.call(v,k)}function Se(k){var v,C;(C=(v=o.value)==null?void 0:v.focusPasture)==null||C.call(v,k)}function Ye(k,v){var C,B;return(B=(C=o.value)==null?void 0:C.focusTownByName)==null?void 0:B.call(C,k,v)}function je(k){var v,C;return(C=(v=o.value)==null?void 0:v.focusYakIndustryPoint)==null?void 0:C.call(v,k)}function D(k){var v,C;return(C=(v=o.value)==null?void 0:v.focusVectorFeature)==null?void 0:C.call(v,k)}function He(k){var v,C;return(C=(v=o.value)==null?void 0:v.getVectorFeatureScreen)==null?void 0:C.call(v,k)}function _e(k){var v,C;return(C=(v=o.value)==null?void 0:v.getYakIndustryPointScreen)==null?void 0:C.call(v,k)}function ut(k){var v,C;(C=(v=o.value)==null?void 0:v.setBoundaryDrawing)==null||C.call(v,k)}function Lt(){var k,v;return(v=(k=o.value)==null?void 0:k.finishBoundaryDrawing)==null?void 0:v.call(k)}function tt(){var k,v;(v=(k=o.value)==null?void 0:k.undoBoundaryPoint)==null||v.call(k)}function Re(){var k,v;(v=(k=o.value)==null?void 0:k.clearAnalysisBoundary)==null||v.call(k)}function qe(k){var v,C;(C=(v=o.value)==null?void 0:v.showAnalysisResult)==null||C.call(v,k)}function Ue(){var k,v;Ke(),ae(),(v=(k=o.value)==null?void 0:k.destroy)==null||v.call(k),o.value=null}function Ve(){Ke(),m=window.setTimeout(()=>{var k,v;m=null,(v=(k=o.value)==null?void 0:k.ensureMapRevealed)==null||v.call(k)},5200)}function Ke(){m&&(window.clearTimeout(m),m=null)}function Ie(){d&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{var k,v,C,B,$;d=null,(C=(v=(k=o.value)==null?void 0:k.sizes)==null?void 0:v.init)==null||C.call(v),($=(B=o.value)==null?void 0:B.resize)==null||$.call(B)}),c&&window.clearTimeout(c),c=window.setTimeout(()=>{var k,v,C,B,$;c=null,(C=(v=(k=o.value)==null?void 0:k.sizes)==null?void 0:v.init)==null||C.call(v),($=(B=o.value)==null?void 0:B.resize)==null||$.call(B)},180)}function at(){var v;ae();const k=(v=r.value)==null?void 0:v.parentNode;k&&window.ResizeObserver&&(u=new ResizeObserver(()=>Ie()),u.observe(k)),f=window.setInterval(Le,1e3),jt(Ie)}function Le(){var ee;if(!o.value||!r.value)return;const k=r.value.parentNode,v=(k==null?void 0:k.offsetWidth)||window.innerWidth||1,C=(k==null?void 0:k.offsetHeight)||window.innerHeight||1,B=((ee=o.value.sizes)==null?void 0:ee.pixelRatio)||1,$=Math.floor(v*B),U=Math.floor(C*B);(r.value.width!==$||r.value.height!==U)&&Ie()}function ae(){u&&(u.disconnect(),u=null),d&&(window.cancelAnimationFrame(d),d=null),c&&(window.clearTimeout(c),c=null),f&&(window.clearInterval(f),f=null)}function Tt(){if(!o.value)return;at();const k=()=>{var v,C,B,$,U,ee,Me,Pe,ce,ue,Te,Ze,Ae,De,Fe,nt,St,Xe,dt,Pt,Kt;o.value&&((C=(v=o.value)==null?void 0:v.resumeScene)==null||C.call(v),o.value.resumeScene||($=(B=o.value.time)==null?void 0:B.resume)==null||$.call(B),(Me=(ee=(U=o.value)==null?void 0:U.sizes)==null?void 0:ee.init)==null||Me.call(ee),(ce=(Pe=o.value)==null?void 0:Pe.resize)==null||ce.call(Pe),(Ze=(Te=(ue=o.value)==null?void 0:ue.label3d)==null?void 0:Te.resize)==null||Ze.call(Te),(Fe=(De=(Ae=o.value)==null?void 0:Ae.label3d)==null?void 0:De.update)==null||Fe.call(De),(St=(nt=o.value)==null?void 0:nt.setTopicLayers)==null||St.call(nt,it(a.activeLayer),a.activeLayer),(dt=(Xe=o.value)==null?void 0:Xe.setTownRanking)==null||dt.call(Xe,a.mapRanking),(Kt=(Pt=o.value)==null?void 0:Pt.ensureMapRevealed)==null||Kt.call(Pt))};Ie(),window.requestAnimationFrame(k),window.setTimeout(()=>{k()},80),window.setTimeout(()=>{k()},220)}function kt(){if(!o.value)return;at();const k=()=>{var C,B,$,U,ee,Me,Pe,ce,ue,Te,Ze,Ae,De,Fe,nt,St;const v=o.value;v&&((C=v.resumeScene)==null||C.call(v),v.resumeScene||($=(B=v.time)==null?void 0:B.resume)==null||$.call(B),(ee=(U=v.sizes)==null?void 0:U.init)==null||ee.call(U),(Me=v.resize)==null||Me.call(v),(Pe=v.ensureMapRevealed)==null||Pe.call(v),(ce=v.setTradeNationalMapVisible)==null||ce.call(v,!1),(ue=v.setTopicLayers)==null||ue.call(v,it(a.activeLayer),a.activeLayer),(Te=v.setTownRanking)==null||Te.call(v,a.mapRanking),(Ze=v.applyLayerMapView)==null||Ze.call(v,v.currentTopicLayer||a.activeLayer||null,{force:!0}),(De=(Ae=v.label3d)==null?void 0:Ae.resize)==null||De.call(Ae),(nt=(Fe=v.label3d)==null?void 0:Fe.update)==null||nt.call(Fe),(St=v.updateDynamicSatelliteTiles)==null||St.call(v,!0))};Ie(),window.requestAnimationFrame(k),window.setTimeout(k,100),window.setTimeout(k,260)}qt(()=>a.activeLayer,k=>{const v=ct(k);v!==T&&(T=v,o.value&&o.value.setTopicLayers(it(k),k))},{deep:!0}),qt(()=>a.mapRanking,k=>{const v=Ge(k);v!==M&&(M=v,o.value&&o.value.setTownRanking(k))},{deep:!0}),e({loadMap:x,hasMap:G,play:j,resume:X,pause:se,clearSelectedFeature:q,focusProject:R,focusPasture:Se,focusTown:Ye,focusYakIndustryPoint:je,focusVectorFeature:D,getVectorFeatureScreen:He,getYakIndustryPointScreen:_e,setBoundaryDrawing:ut,finishBoundaryDrawing:Lt,undoBoundaryPoint:tt,clearAnalysisBoundary:Re,showAnalysisResult:qe,refreshView:Tt,resetView:kt,destroyMap:Ue,canvasMap:o});function ct(k){return k?it(k).map(v=>{var C,B;return[v.key||"",v.layerName||"",v.styles||"",v.sldBody||"",v.cqlFilter||"",((C=v.activeLegend)==null?void 0:C.key)||"",Array.isArray(v.activeLegends)?v.activeLegends.map($=>($==null?void 0:$.key)||"").join(","):"",v.timelineDate||"",((B=v.timelineItem)==null?void 0:B.key)||"",v.sourceType||"",v.dataPath||"",v.fallbackPath||""].join("|")}).join("||"):""}function it(k){if(!k)return[];const v=Array.isArray(k.overlayLayers)?k.overlayLayers.filter(Boolean):[];return[k,...v]}function Ge(k){var v,C,B,$,U,ee,Me,Pe,ce,ue;return k?[k.status||"",k.topicKey||"",k.layerKey||"",k.title||"",k.metricLabel||"",k.scope||"",k.displayMode||"",(v=k.showPointMarkers)!=null?v:"",(C=k.showBars)!=null?C:"",(B=k.showTownNames)!=null?B:"",($=k.showMapLabels)!=null?$:"",(U=k.hideTownLabelStats)!=null?U:"",(ee=k.showFlowLines)!=null?ee:"",(Me=k.onlyRankedTownLabels)!=null?Me:"",(Pe=k.showMissingTownStats)!=null?Pe:"",((ce=k.rows)==null?void 0:ce.length)||0,((ue=k.rows)==null?void 0:ue.map(Te=>{var Ze;return`${Te.key||Te.name||""}:${(Ze=Te.value)!=null?Ze:""}`}).join(","))||""].join("|"):""}return(k,v)=>(b(),L("div",gu,[h("canvas",{ref_key:"canvasRef",ref:r},null,512)]))}};const bu={class:"yak-management"},wu={key:0},Lu={class:"yak-management-ui"},Tu={key:0,class:"trade-year-switcher","aria-label":"交易年份切换"},ku=["onClick"],Su={key:1,class:"epidemic-year-switcher","aria-label":"防疫年份切换"},Mu=["onClick"],Pu={key:2,class:"forecast-year-switcher","aria-label":"预测年份切换"},Fu=["onClick"],Cu={class:"yak-left"},Nu={class:"yak-side-stack is-left"},xu={key:0,class:"yak-data-status"},_u={key:1,class:"yak-data-status is-warning"},Ru={key:2,class:"yak-data-status is-warning"},Iu={key:3,class:"breeding-health-card"},Gu={class:"breeding-health-head"},Au={class:"breeding-health-grid"},Bu={class:"structure-chart-card"},Eu={class:"structure-ratio-card"},$u={class:"structure-ratio-chart"},Vu={viewBox:"0 0 150 150",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true"},Du={class:"structure-rose-segments"},Ou=["d","fill","stroke"],zu={class:"structure-ratio-list"},Wu={key:0,class:"yak-data-status"},Yu={key:1,class:"yak-data-status is-warning"},ju={key:0,class:"yak-data-status"},Hu={key:1,class:"yak-data-status is-warning"},qu={key:2,class:"yak-data-status is-warning"},Uu={key:0,class:"yak-data-status"},Ku={key:1,class:"yak-data-status is-warning"},Zu={key:2,class:"yak-data-status is-warning"},Xu={key:0,class:"yak-data-status"},Ju={key:1,class:"yak-data-status is-warning"},Qu={key:2,class:"yak-data-status is-warning"},ec={key:3,class:"forecast-waterfall-card"},tc={class:"forecast-waterfall-head"},ac={class:"forecast-waterfall-list"},ic={key:0,class:"yak-data-status"},nc={key:1,class:"yak-data-status is-warning"},sc={key:2,class:"yak-data-status is-warning"},rc={key:0,class:"yak-data-status"},oc={key:1,class:"yak-data-status is-warning"},lc={key:2,class:"yak-data-status is-warning"},uc={key:0,class:"yak-data-status"},cc={key:1,class:"yak-data-status is-warning"},dc={key:2,class:"yak-data-status is-warning"},hc={key:3,class:"forecast-waterfall-list"},pc={key:0,class:"yak-data-status"},fc={key:1,class:"yak-data-status is-warning"},mc={key:2,class:"yak-data-status is-warning"},yc={key:0,class:"yak-data-status"},gc={key:1,class:"yak-data-status is-warning"},vc={key:2,class:"yak-data-status is-warning"},bc={key:0,class:"yak-data-status"},wc={key:1,class:"yak-data-status is-warning"},Lc={key:2,class:"yak-data-status is-warning"},Tc={key:0,class:"yak-data-status"},kc={key:1,class:"yak-data-status is-warning"},Sc={key:2,class:"epidemic-three-pie-card"},Mc={class:"epidemic-three-pie-visual"},Pc={class:"epidemic-three-pie-center"},Fc={class:"epidemic-three-pie-legend"},Cc={key:3,class:"epidemic-empty"},Nc={class:"trade-risk-card"},xc={key:0,class:"yak-data-status"},_c={key:1,class:"yak-data-status is-warning"},Rc={key:2,class:"yak-data-status is-warning"},Ic={class:"trade-risk-head"},Gc={class:"trade-risk-list"},Ac={key:0,class:"yak-data-status"},Bc={key:1,class:"yak-data-status is-warning"},Ec={key:2,class:"yak-data-status is-warning"},$c={key:0,class:"yak-data-status"},Vc={key:1,class:"yak-data-status is-warning"},Dc={key:2,class:"yak-data-status is-warning"},Oc={key:0,class:"yak-data-status"},zc={key:1,class:"yak-data-status is-warning"},Wc={key:2,class:"yak-data-status is-warning"},Yc={class:"yak-right"},jc={class:"yak-side-stack is-right"},Hc={key:0,class:"yak-data-status"},qc={key:1,class:"yak-data-status is-warning"},Uc={key:2,class:"yak-data-status is-warning"},Kc={key:0,class:"yak-data-status"},Zc={key:1,class:"yak-data-status is-warning"},Xc={key:2,class:"yak-data-status is-warning"},Jc={key:0,class:"yak-data-status"},Qc={key:1,class:"yak-data-status is-warning"},ed={key:2,class:"yak-data-status is-warning"},td={class:"structure-chart-card"},ad={key:0,class:"structure-summary-card"},id={key:1,class:"yak-data-status"},nd={key:2,class:"yak-data-status is-warning"},sd={key:0,class:"yak-data-status"},rd={key:1,class:"yak-data-status is-warning"},od={key:2,class:"yak-data-status is-warning"},ld={key:0,class:"yak-data-status"},ud={key:1,class:"yak-data-status is-warning"},cd={key:2,class:"yak-data-status is-warning"},dd={key:0,class:"yak-data-status"},hd={key:1,class:"yak-data-status is-warning"},pd={key:2,class:"yak-data-status is-warning"},fd={key:0,class:"yak-data-status"},md={key:1,class:"yak-data-status is-warning"},yd={key:2,class:"yak-data-status is-warning"},gd={key:3,class:"forecast-heat-list"},vd=["title"],bd={class:"epidemic-record-table is-full"},wd={class:"epidemic-record-toolbar"},Ld={class:"epidemic-record-rows"},Td=["onClick"],kd={key:0,class:"epidemic-empty"},Sd={class:"epidemic-record-pager"},Md=["disabled"],Pd=["disabled"],Fd={class:"trade-cert-card"},Cd={key:0,class:"yak-data-status"},Nd={key:1,class:"yak-data-status is-warning"},xd={key:2,class:"yak-data-status is-warning"},_d={class:"trade-cert-main"},Rd={class:"trade-dest-list"},Id={key:0,class:"epidemic-empty"},Gd={class:"trade-ledger-table"},Ad={class:"trade-ledger-toolbar"},Bd={class:"trade-ledger-rows"},Ed=["onClick"],$d={key:0,class:"epidemic-empty"},Vd={class:"trade-ledger-pager"},Dd=["disabled"],Od=["disabled"],zd={class:"yak-bottom-topic"},Wd={key:3,class:"yak-map-layer-tools"},Yd={class:"epidemic-ledger-dialog"},jd={class:"epidemic-ledger-dialog-head"},Hd={class:"epidemic-ledger-filters"},qd=["value"],Ud=["value"],Kd={class:"epidemic-ledger-workspace"},Zd={class:"epidemic-ledger-list"},Xd=["onClick"],Jd={key:0,class:"epidemic-empty"},Qd={class:"epidemic-ledger-detail trade-ledger-detail epidemic-ledger-record-detail"},eh={class:"epidemic-detail-head trade-detail-head"},th={class:"epidemic-detail-grid is-modal trade-detail-grid epidemic-detail-flat-grid"},ah={key:0,class:"epidemic-detail-photos"},ih={class:"epidemic-modal-photo-strip"},nh=["onClick"],sh=["src"],rh={class:"epidemic-ledger-pager"},oh=["disabled"],lh=["disabled"],uh={class:"epidemic-ledger-dialog trade-ledger-dialog"},ch={class:"epidemic-ledger-dialog-head"},dh={class:"epidemic-ledger-filters trade-ledger-filters"},hh=["value"],ph=["value"],fh=["value"],mh={class:"epidemic-ledger-workspace trade-ledger-workspace"},yh={class:"epidemic-ledger-list trade-ledger-modal-list"},gh=["onClick"],vh={key:0,class:"epidemic-empty"},bh={class:"epidemic-ledger-detail trade-ledger-detail"},wh={class:"epidemic-detail-head trade-detail-head"},Lh={class:"epidemic-detail-grid is-modal trade-detail-grid"},Th={class:"is-wide"},kh={class:"is-wide"},Sh={class:"is-wide"},Mh={class:"is-wide"},Ph=["disabled"],Fh={class:"epidemic-ledger-pager"},Ch=["disabled"],Nh=["disabled"],xh={class:"epidemic-image-preview-dialog"},_h={class:"epidemic-image-preview-head"},Rh={class:"epidemic-image-preview-body"},Ih={class:"epidemic-image-preview-frame"},Gh=["src"],Ah="https://qkl-hy.oss-cn-chengdu.aliyuncs.com/yak-vaccine-images",Bh="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",Eh=9,$h="oss-satellite-dynamic-zoom21-v5",ni="#43d9e8",si=8,Ys=14,ji=8,js=14,Vh=5e3,ri=6,Dh=4200,Hs="#FFE600",ap={__name:"index",props:{active:{type:Boolean,default:!0},viewKey:{type:String,default:"structure"}},emits:["module-stats","view-change"],setup(g,{expose:e,emit:t}){const a=g,i=t,r=bs.sideCardWidth;bs.sideCardGap;const o=I(typeof window=="undefined"?1080:window.innerHeight),u=P(()=>gl(o.value)),d=P(()=>ws(u.value,2)),c=P(()=>u.value),f=P(()=>ws(u.value,2)),m=Fa.textPrimary,T=Fa.textStrong,M=Fa.textSecondary,F=Fa.textMuted,x=Fa.chartGridLine,G=Fl,j=G,X=G,se=Cl,q={targetLngLat:[102.6,32.59],targetLocalZ:.72,distanceScale:1.05,duration:.75},R=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],Se=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],Ye=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff"],je=[{key:"structure",name:"畜群结构",color:"#30dcff"},{key:"forecast",name:"畜群预测",color:"#8bf7ff"},{key:"epidemic",name:"牦牛防疫",color:"#8bf7ff"},{key:"trade",name:"牦牛交易",color:"#63d7ff"}],D=I($i(a.viewKey)),He=I([]),_e=I(""),ut=I(0),Lt=I([]),tt=I([]),Re=I([]),qe=I({}),Ue=I([]),Ve=I([]),Ke=I([]),Ie=I({}),at=I({}),Le=I(!1),ae=I(""),Tt=I([]),kt=I([]),ct=I([]),it=I({}),Ge=I(!1),k=I(""),v=I([]),C=I(null),B=I(Ha()),$=I([]),U=I(0),ee=I(1),Me=I(""),Pe=I(""),ce=I(!1),ue=I(""),Te=I(""),Ze=I(!1),Ae=I([]),De=I(0),Fe=I(1),nt=I(!1),St=I(""),Xe=I(null),dt=I(null),Pt=I(!1),Kt=I(!1),ui=I(""),Ee=I(qa()),de=I({metrics:{},hasData:!1}),It=I([]),Gt=I(0),$e=I(null),Je=I(!1),be=I(""),Ra=I(""),ht=I(1),Ia=I(""),ci=I(""),di=I(!1),Ft=I([]),da=I(0),At=I(1),hi=I(!1),pi=I(""),ha=I(null),pt=I({keyword:"",startTown:"",usageType:"",certType:""}),Ce=I(null),pa=I(null),Zt=I(!1),fa=I(!1),Oe=I(!1),Ui=I(0),Ki=I(0),Ga=I({type:"idle",text:""}),Aa=I({type:"idle",text:""});let fi=null,Ba=!1,Zi=!1,Ct=!1,Mt=null,ma=!1,Ea=null,$a=null,Va=0,Xi=!1,mi=!1,Ji=!1,Qi=!1;const yi=P(()=>Re.value.find(s=>s.key===_e.value)||{}),Zs=new Set(["epidemic","trade"]),gi=P(()=>!Zs.has(D.value)),en=P(()=>gi.value?Bh:""),Xs=P(()=>gi.value?"oss-satellite":"solid-3d"),Js=P(()=>`yak-management-map-${Xs.value}-${$h}-${Ui.value}`),vi=P(()=>yt(qe.value.latestChange)),bi=P(()=>tt.value.length>0&&Ue.value.length>0),Qs=P(()=>{if(!bi.value)return[];const s=qe.value,n=[{key:"latest-total",name:"最新月预测量",value:Number(s.latestTotal),delta:0,color:"#30dcff"},{key:"month-change",name:"较上月变化",value:yt(s.latestChange),delta:yt(s.latestChange),color:"#8bf7ff"},{key:"growth-value",name:"预测增长值",value:Number(s.latestGrowthValue),delta:Number(s.latestGrowthValue),color:"#48cfff"}],l=Math.max(...n.map(p=>Math.abs(Number(p.value)||0)),1);return[{key:"latest-time",name:"最新预测月份",type:"anchor",delta:0,width:100,color:"#30dcff",display:String(s.latestTime||"-").slice(0,7)},...n.map(p=>O(A({},p),{type:p.key==="latest-total"?"anchor":"delta",width:Math.max(8,Math.round(Math.abs(Number(p.value)||0)/l*100)),display:p.key==="latest-total"?`${V(p.value)}头`:`${ba(p.value)}头`}))]}),tn=P(()=>{if(!bi.value)return[];const s=Ie.value,n=qe.value;return[{key:"source-range",name:"全源时间范围",display:`${String(s.sourceStartTime||"-").slice(0,10)} 至 ${String(s.sourceEndTime||"-").slice(0,10)}`,width:100,color:"#30dcff"},{key:"source-rows",name:"全源记录",display:`${V(s.sourceRowCount)}条`,width:82,color:"#8bf7ff"},{key:"selected-periods",name:"本年月份/乡镇",display:`${V(n.monthCount)}月 / ${V(n.townCount)}乡镇`,width:68,color:"#48cfff"},{key:"quality",name:"重复/缺失/负数",display:`${V(s.duplicateBusinessKeyCount)} / ${V(s.missingFieldCount)} / ${V(s.negativeValueCount)}`,width:52,color:"#30dcff"}]}),wi=P(()=>Go(Tt.value)),er=P(()=>wi.value.reduce((s,n)=>s+Number(n.count||0),0)),tr=P(()=>{const s=er.value||1;return wi.value.map((n,l)=>{const p=Number(n.count||0),y=Number(n.ratio);return O(A({},n),{count:p,color:R[l%R.length],percent:Number.isFinite(y)?y:p/s*100})})}),ar=P(()=>tr.value),ya=P(()=>ar.value),an=P(()=>jo(ya.value)),Li=P(()=>Ho(wi.value)),nn=P(()=>qo(Li.value)),ir=P(()=>Math.max(...an.value.map(s=>Number(s.count||0)),1)),Ti=P(()=>ya.value.length?0:-1),nr=P(()=>{const s=ya.value,n=s.length;if(!n)return[];const l=Math.max(...s.map(w=>Number(w.count||0)),1),p=360/n,y=Math.min(8,p*.16);return s.map((w,N)=>{const _=Number(w.count||0),E=N===Ti.value,z=36+Math.sqrt(_/l)*31+(E?5:0),H=17,ye=-90+N*p+y/2,gt=-90+(N+1)*p-y/2,vt=(ye+gt)/2,Dt=Vt(75,75,z+3,vt),Ot=Vt(75,75,z+15,vt),zt=Vt(75,75,z+20,vt);return{key:w.key||w.name||N,index:N,item:w,color:w.color||R[N%R.length],path:Yo(75,75,H,z,ye,gt),lineStart:Dt,lineEnd:Ot,label:zt,anchor:Math.cos(vt*Math.PI/180)>=0?"start":"end"}})}),Da=P(()=>kt.value),Nt=P(()=>Lt.value),Xt=P(()=>tt.value),Jt=P(()=>Ue.value),sr=P(()=>{var s;return((s=B.value)==null?void 0:s.overview)||{}}),sn=P(()=>{var s;return Ri((s=B.value)==null?void 0:s.dateTrend).sort(ho)}),rn=P(()=>{var s;return Ri((s=B.value)==null?void 0:s.medicineRows)}),Oa=P(()=>rn.value.filter(s=>s.value>0).map((s,n)=>O(A({},s),{key:s.key||`${s.name}-${n}`,unit:"条"}))),rr=P(()=>Oa.value.map(s=>`${s.name}:${s.value}`).join("|")||"epidemic-medicine-empty"),on=P(()=>{var s;return Ri((s=B.value)==null?void 0:s.ownerRows).slice(0,8)}),ln=P(()=>{var s;return Number(((s=sr.value)==null?void 0:s.recordCount)||0)}),un=P(()=>{var s;return Array.isArray((s=B.value)==null?void 0:s.topRows)?B.value.topRows:[]}),cn=P(()=>{var s;return oo((s=B.value)==null?void 0:s.townRows)}),dn=P(()=>cn.value),or=P(()=>{var n;const s=new Set;return In((n=B.value)==null?void 0:n.villageRows).filter(l=>Number.isFinite(l.lng)&&Number.isFinite(l.lat)).map((l,p)=>{const y=`${l.lng.toFixed(4)},${l.lat.toFixed(4)}`,w=s.has(y)?(p%3-1)*.012:0;return s.add(y),O(A({},l),{name:l.village,value:l.earTagCount,unit:"万头",lng:l.lng+w,lat:l.lat-w*.65,displayValue:Number((l.earTagCount/1e4).toFixed(2)),displayUnit:"万头",rankLabel:`第${p+1}名`})})}),ki=P(()=>Math.max(Math.ceil(U.value/si),1)),lr=P(()=>$.value.slice(0,si)),hn=P(()=>Math.max(Math.ceil(De.value/Ys),1)),Bt=P(()=>dt.value||Xe.value||{}),pn=P(()=>Gi(Bt.value)),ur=P(()=>{const s=Bt.value||{};return[we("台账编号",s.epidemicId,{wide:!0}),we("养殖户",s.owner,{wide:!0}),we("联系电话",Vn(s.phone)),we("证件类型",s.idType),we("证件号码",vo(s.idNo)),we("镇/乡",s.town),we("村",s.village),we("详细地址",s.location,{wide:!0}),we("畜种",s.livestockType),we("性别",s.sex),we("畜龄",s.age),we("体重",bo(s.weight)),we("疫苗/药品",s.medicine),we("防疫类型",s.preventionType),we("免疫方式",s.method),we("剂量",wo(s.dose)),we("免疫时间",$t(s.operateTime)),we("操作员",s.operator)].filter(Boolean)}),cr=P(()=>cn.value.map(s=>s.name)),dr=P(()=>rn.value.map(s=>s.name).filter(s=>s&&s!=="未填写")),fn=P(()=>{var s;return((s=de.value)==null?void 0:s.metrics)||{}}),mn=P(()=>{var s;return((s=de.value)==null?void 0:s.hasData)===!0}),yn=P(()=>{var s;return io((s=de.value)==null?void 0:s.yearRows)}),gn=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.monthRows,"name")}),vn=P(()=>{var s;return no((s=de.value)==null?void 0:s.yearRows)}),za=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.townRows,"name")}),Si=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.usageRows,"name")}),hr=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.certRows,"name")}),pr=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.vehicleRows,"name")}),fr=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.destinationRows,"name")}),bn=P(()=>{var s;return Array.isArray((s=de.value)==null?void 0:s.topRows)?de.value.topRows:[]}),wn=P(()=>{var p;const s=(p=de.value)==null?void 0:p.mapSource,n=ft(s==null?void 0:s.lng),l=ft(s==null?void 0:s.lat);return!(s!=null&&s.name)||!Number.isFinite(n)||!Number.isFinite(l)?null:{name:s.name,lng:n,lat:l}}),Wa=P(()=>{const s=za.value.map(l=>{const p=String(l.name||"").trim(),y=Et(p),w=ao(y||p);return O(A({},l),{rawName:p,name:w,displayName:w,town:y,mapTownName:y})}).filter(l=>l.name&&l.name!=="未填写").slice(0,10),n=Math.max(...s.map(l=>l.headCount),1);return s.map((l,p)=>O(A({},l),{key:l.key||`${l.mapTownName||l.name}-${p}`,value:l.headCount,unit:"头",ratio:Math.max(8,Math.round(l.headCount/n*100))}))}),Ln=P(()=>It.value.slice(0,ji)),Mi=P(()=>Math.max(Math.ceil(Gt.value/ji),1)),Pi=P(()=>Math.max(Math.ceil(da.value/js),1)),he=P(()=>ha.value||{}),mr=P(()=>he.value.certId||he.value.factoryCode||""),yr=P(()=>{var s;return Rn((s=de.value)==null?void 0:s.startTownOptions)}),gr=P(()=>{var s;return Rn((s=de.value)==null?void 0:s.usageTypeOptions)}),vr=P(()=>{var s;return so((s=de.value)==null?void 0:s.certTypeOptions)}),br=P(()=>Wa.value.map((s,n)=>({key:s.key||`${s.name}-${n}`,name:s.displayName||s.name,displayName:s.displayName||s.name,rawName:s.rawName,town:s.mapTownName||s.town||Et(s.name),mapTownName:s.mapTownName||s.town||Et(s.name),value:s.headCount,headCount:s.headCount,recordCount:s.recordCount,ratio:s.ratio,unit:"头"}))),Tn=P(()=>mo()),wr=P(()=>`${V(mt("recordCount"))}条 / ${oe(mt("headCount"))}头`),kn=P(()=>Nt.value.map(s=>O(A({},s),{breedingCow:Number(s.breedingCow||0),calf:Number(s.calf||0)})).filter(s=>s.breedingCow>0||s.calf>0)),Ya=P(()=>{const s=kn.value,n=s.length,l=Math.max(Math.ceil(n/ri),1),p=ut.value%l,y=p*ri,w=Math.min(y+ri,n);return{page:p,pageCount:l,start:y,end:w,total:n,rows:s.slice(y,w)}}),Lr=P(()=>D.value==="forecast"?Jt.value:Nt.value),Tr=P(()=>D.value==="forecast"?"value":"count"),kr=P(()=>_o(Lr.value,Tr.value)),ga=P(()=>({key:"yak-marks-layer",sourceType:"wmts",layerName:"ne:daping_yak_marks",style:"ne:yak_marks",styles:"ne:yak_marks",format:"image/png",tileMatrixSetID:"EPSG:900913",maximumLevel:21,url:"/geoserver/gwc/service/wmts",cqlFilter:"gov_show = true",name:"牦牛识别",opacity:.92,queryBuffer:10,geometryField:"geom",fillColor:"rgba(255, 230, 0, 0)",strokeColor:Hs,glowColor:"rgba(255, 230, 0, 0.42)",lineWidth:1.4,mapView:{targetLngLat:G,distanceScale:.82,targetLocalZ:.76,duration:.85},legends:[{key:"yak-marks",name:"牦牛",fillColor:Hs,strokeColor:"#FFF58A",selectable:!1}]})),Sr=P(()=>[ga.value]),Mr=P(()=>{const s=Array.isArray(He.value)?He.value:[He.value];return new Set(s.map(String).filter(Boolean))}),Fi=P(()=>Mr.value.has(ga.value.key)),Pr=P(()=>Fi.value?ga.value.legends||[]:[]),Fr=P(()=>Fi.value?202:172),Cr=P(()=>{var l;const n=In((l=B.value)==null?void 0:l.villageRows).map(p=>lo(p.town,p.village)).filter(Boolean);return{key:"yak-epidemic-village-boundary",sourceType:"wfs",layerName:"ne:t_pastures_map",styles:"牧场样式",name:"防疫村边界",opacity:.86,queryBuffer:8,cqlFilter:n.length?n.join(" OR "):"EXCLUDE",legends:[{key:"yak-epidemic-village-boundary",name:"防疫村边界",fillColor:"#30DCFF",strokeColor:"#C9FBFF",selectable:!1}]}}),Sn=P(()=>D.value==="epidemic"?Cr.value:D.value==="trade"?null:Qe.value?Fi.value?ga.value:null:ga.value),Qe=P(()=>D.value==="structure"||D.value==="forecast"),Nr=P(()=>D.value==="forecast"?X:j),xr=P(()=>Qe.value?null:Sn.value),_r=P(()=>Qe.value?null:Mn.value),Rr=P(()=>Qe.value?!fa.value:!Zt.value),Ir=P(()=>Qe.value?"地图加载中":"3D 地图加载中"),Mn=P(()=>D.value==="trade"?{scope:"trade-flow",title:`${$e.value||""}出栏来源`,metricLabel:"来源",unit:"头",source:wn.value?O(A({},wn.value),{total:mt("headCount")}):null,rows:br.value,showFlowLines:!1,mapView:q}:{scope:D.value==="epidemic"?"village":"town",hideTownNames:D.value==="epidemic",title:D.value==="forecast"?`${yi.value.shortLabel||""}最新月预测`:D.value==="epidemic"?`${C.value}年村级防疫信息`:"乡镇统计存栏",metricLabel:D.value==="forecast"?"预测":D.value==="epidemic"?"防疫":"存栏",unit:D.value==="forecast"?"头":"万头",rows:D.value==="epidemic"?or.value:kr.value.map(s=>D.value==="forecast"?{name:s.name,value:s.value,unit:"头"}:{name:s.name,value:Number((s.value/1e4).toFixed(2)),unit:"万头"})}),Gr=P(()=>({color:["#8bf7ff","#30dcff"],tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(s){const n=s.map(l=>`${l.marker}${l.seriesName}:${V(Math.abs(l.value))}头`);return`${s[0].name}<br/>${n.join("<br/>")}`}}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:M,fontSize:11}},grid:{left:22,right:22,top:32,bottom:12,containLabel:!0},xAxis:{type:"value",axisLabel:{color:F,fontSize:10,formatter:s=>oe(Math.abs(s))},splitLine:{lineStyle:{color:x,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:Da.value.map(s=>s.age),axisLabel:{color:m,fontSize:11,fontWeight:700},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"母牛",type:"bar",stack:"gender",barWidth:12,data:Da.value.map(s=>-s.cow),itemStyle:{borderRadius:[7,0,0,7]}},{name:"公牛",type:"bar",stack:"gender",barWidth:12,data:Da.value.map(s=>s.bull),itemStyle:{borderRadius:[0,7,7,0]}}]})),Ar=P(()=>{const s=Nt.value,n=s.map(l=>l.count);return{color:R,tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(l){const p=l.map(y=>`${y.marker}${y.seriesName}:${V(y.value)}头`);return`${l[0].name}<br/>${p.join("<br/>")}<br/>明细合计:${V(n[l[0].dataIndex])}头<br/>来源:数据库性别年龄乡镇明细`}}),legend:{top:-2,right:0,itemWidth:8,itemHeight:6,itemGap:6,textStyle:{color:M,fontSize:10}},grid:{left:54,right:30,top:22,bottom:8},xAxis:{type:"value",axisLabel:{color:F,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",inverse:!0,data:s.map(l=>l.name),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{key:"cow",name:"母牛"},{key:"bull",name:"公牛"}].map(l=>({name:l.name,type:"bar",stack:"town",barWidth:s.length>8?6:11,data:s.map(p=>Number(p[l.key]||0))}))}}),Br=P(()=>Ei(Nt.value,"count","头",{style:"ladder",tooltipFormatter(s){const n=Nt.value[s.dataIndex];return`${n.name}<br/>统计存栏:${V(n.count)}头<br/>来源:数据库性别年龄乡镇明细`}})),Er=P(()=>{const s=Ya.value,n=s.rows,l=Math.max(...n.map(p=>p.breedingCow+p.calf),1);return{color:["#30dcff","#8bf7ff"],animationDurationUpdate:700,animationEasingUpdate:"cubicOut",tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(p){const y=n[p[0].dataIndex],w=p.filter(N=>["能繁母牛","犊牛合计"].includes(N.seriesName)).map(N=>`${N.marker}${N.seriesName}:${V(N.value)}头`);return`${y.name}<br/>母犊合计:${V(y.breedingCow+y.calf)}头<br/>${w.join("<br/>")}<br/>来源:数据库明细聚合(犊牛=0-1岁;能繁母牛=2-5岁母牛)`}}),legend:{data:["能繁母牛","犊牛合计"],top:2,left:2,itemWidth:10,itemHeight:7,itemGap:9,textStyle:{color:M,fontSize:10}},graphic:s.total>ri?{type:"text",right:4,top:3,silent:!0,style:{text:`${s.start+1}-${s.end} / ${s.total}`,fill:F,fontSize:10,fontWeight:600}}:void 0,grid:{left:18,right:18,top:42,bottom:44,containLabel:!1},xAxis:{type:"category",data:n.map(p=>p.name),axisLabel:{color:F,fontSize:10,lineHeight:12,interval:0,margin:8,formatter:co},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"value",max:Math.ceil(l*1.28),axisLabel:{show:!1},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"基础群规模",type:"bar",barWidth:15,barGap:"-100%",data:n.map(p=>p.breedingCow+p.calf),tooltip:{show:!1},itemStyle:{borderRadius:[8,8,1,1],color:"rgba(48, 220, 255, 0.07)"},silent:!0},{name:"能繁母牛",type:"bar",stack:"foundation",barWidth:15,data:n.map(p=>p.breedingCow),itemStyle:{borderRadius:[1,1,0,0],color:new rt(0,0,0,1,[{offset:0,color:"rgba(48, 220, 255, 0.34)"},{offset:1,color:"#30dcff"}])}},{name:"犊牛合计",type:"bar",stack:"foundation",barWidth:15,data:n.map(p=>p.calf),itemStyle:{borderRadius:[8,8,1,1],color:new rt(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:1,color:"rgba(139, 247, 255, 0.2)"}])},label:{show:!0,position:"top",formatter:({dataIndex:p})=>oe(n[p].breedingCow+n[p].calf),color:"#ffffff",fontSize:10,fontWeight:700}}]}}),$r=P(()=>{const s=vn.value.slice().sort((y,w)=>y.year-w.year),n=s.map(y=>y.yoyPercent).filter(Number.isFinite),l=n.length?Math.floor(Math.min(...n)-4):-10,p=n.length?Math.ceil(Math.max(...n)+4):10;return{color:[ni,"#8bf7ff"],tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(y){const w=s[y[0].dataIndex],N=Number.isFinite(w.yoyPercent)?`${w.yoyPercent>0?"+":""}${w.yoyPercent}%`:"无上年口径";return`${w.year}年<br/>流通头数:${V(w.headCount)}头<br/>出证记录:${V(w.recordCount)}条<br/>同比:${N}`}}),grid:{left:36,right:30,top:20,bottom:34},xAxis:{type:"category",data:s.map(y=>`${y.year}年`),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0,margin:10},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.24)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:F,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",min:Math.min(-10,l),max:Math.max(10,p),axisLabel:{color:M,fontSize:10,formatter:"{value}%"},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"流通头数",type:"bar",barWidth:16,data:s.map(y=>({value:y.headCount,itemStyle:{borderRadius:[2,2,1,1],color:new rt(0,0,0,1,[{offset:0,color:ni},{offset:.58,color:"rgba(67, 217, 232, 0.72)"},{offset:1,color:"rgba(67, 217, 232, 0.16)"}]),shadowBlur:2,shadowColor:"rgba(48, 220, 255, 0.16)"},label:{show:!0,position:"top",color:T,fontSize:10,fontFamily:Di.number,fontWeight:700,formatter:({value:w})=>oe(w)}}))},{name:"同比",type:"line",yAxisIndex:1,smooth:!0,symbol:"circle",symbolSize:6,data:s.map(y=>y.yoyPercent),lineStyle:{width:2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2},label:{show:!0,position:"top",color:"#8bf7ff",fontSize:10,formatter:({value:y})=>Number.isFinite(y)?`${y>0?"+":""}${y}%`:""}}]}}),Vr=P(()=>{const s=Xt.value;return{color:["#30dcff","#8bf7ff"],tooltip:O(A({},Be()),{trigger:"axis",formatter(n){var p,y;const l=s[(y=(p=n==null?void 0:n[0])==null?void 0:p.dataIndex)!=null?y:0];return l?`${l.month}<br/>预测数量:${V(l.count)}头<br/>较上月:${ba(l.change)}头`:""}}),legend:{top:4,right:8,data:["预测数量","较上月变化"],itemWidth:12,itemHeight:8,textStyle:{color:M,fontSize:10}},grid:{left:46,right:42,top:34,bottom:28},xAxis:{type:"category",data:s.map(n=>n.month),axisLabel:{color:F,fontSize:10,interval:0},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},axisTick:{show:!1}},yAxis:[{type:"value",scale:!0,axisLabel:{color:F,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:M,fontSize:10,formatter:oe},splitLine:{show:!1}}],series:[xo("预测数量",s.map(n=>n.count),"#30dcff",0,!0),{name:"较上月变化",type:"bar",yAxisIndex:1,barWidth:8,data:s.map(n=>n.change),itemStyle:{borderRadius:2,color:({value:n})=>Number(n)>=0?"rgba(139,247,255,0.82)":"rgba(72,207,255,0.72)"}}]}}),Dr=P(()=>({color:["#30dcff","#8bf7ff"],tooltip:O(A({},Be()),{trigger:"axis"}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:M,fontSize:10}},grid:{left:52,right:42,top:34,bottom:28},xAxis:{type:"category",data:Xt.value.map(s=>s.month||s.name),axisLabel:{color:F,fontSize:10,interval:1},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.26)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:F,fontSize:10,formatter:s=>{const n=Number(s);return Number.isFinite(n)?Math.abs(n)>=1e4?`${Number((n/1e4).toFixed(1))}万`:`${n}`:s}},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:M,fontSize:10},splitLine:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:12,data:Xt.value.map(s=>s.count||s.value),itemStyle:{borderRadius:[8,8,0,0],color:new rt(0,0,0,1,[{offset:0,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.08)"}])}},{name:"预测增长值",type:"line",yAxisIndex:1,smooth:!0,symbolSize:5,data:Xt.value.map(s=>s.growthValue),lineStyle:{width:2.4,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff"}}]})),Or=P(()=>Ei(Jt.value,"value","头")),zr=P(()=>{const s=Jt.value,n=s.reduce((p,y)=>p+Number(y.value||0),0)||1,l=s.reduce((p,y,w)=>{const N=y.color||R[w%R.length];return p[`name${w}`]={color:N,fontSize:10,fontWeight:800},p[`percent${w}`]={color:N,fontSize:10,fontFamily:"D-DIN, Arial, sans-serif",fontWeight:800},p},{});return{color:R,tooltip:Be(p=>{const y=s.find(w=>w.name===p.name);return`${p.name}<br/>预测占比:${ea(Number((y==null?void 0:y.value)||0)/n*100)}<br/>预测数量:${V((y==null?void 0:y.value)||0)}头`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,formatter(p){const y=s.findIndex(N=>N.name===p),w=s[y];return w?`{name${y}|${p}} {percent${y}|${ea(Number(w.value||0)/n*100)}}`:p},textStyle:{color:M,fontSize:10,rich:l}},series:[{name:"乡镇预测占比",type:"pie",radius:["38%","66%"],center:["32%","54%"],startAngle:118,avoidLabelOverlap:!1,label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"rgba(3, 18, 31, 0.92)",borderWidth:3},data:s.map(p=>({name:p.name,value:p.value}))}]}}),Wr=P(()=>({color:["#8bf7ff","#48cfff"],tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"}}),legend:{top:4,right:8,itemWidth:12,itemHeight:8,textStyle:{color:M,fontSize:10}},grid:{left:44,right:26,top:34,bottom:28},xAxis:{type:"category",data:Ve.value.map(s=>String(s.sourceYear)),axisLabel:{color:m,fontSize:11,fontWeight:700},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.26)"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:F,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"最新月预测量",type:"bar",barWidth:12,data:Ve.value.map(s=>s.latestTotal),itemStyle:{borderRadius:[7,7,0,0]}},{name:"预测增长值",type:"line",smooth:!0,symbolSize:6,data:Ve.value.map(s=>s.latestGrowthValue),lineStyle:{width:2.4}}]})),Pn=P(()=>{const s=Jt.value,n=Math.max(...s.map(l=>Math.abs(l.change)),1);return s.map(l=>O(A({},l),{width:Math.max(8,Math.round(Math.abs(l.change)/n*100))}))});function Yr(s){const n=Number((s==null?void 0:s.change)||0)>=0;return{"--heat-width":`${s.width}%`,"--heat-color":n?"#30dcff":"#8bf7ff","--heat-color-soft":n?"rgba(48, 220, 255, 0.24)":"rgba(139, 247, 255, 0.22)","--heat-color-dim":n?"rgba(48, 220, 255, 0.07)":"rgba(139, 247, 255, 0.07)"}}function jr(s){return`${s.name}:${ba(s.change)}头`}const Hr=P(()=>{const s=sn.value,n=s.map(p=>p.value),l=Math.max(...n,1);return{color:["#30dcff","#8bf7ff"],tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"line",lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},formatter(p){const y=p[0];return`${y.name}<br/>防疫记录:${V(y.value)}条`}}),grid:{left:42,right:24,top:20,bottom:28},xAxis:{type:"category",data:s.map(p=>p.name),axisLabel:{color:F,fontSize:10,interval:Math.max(Math.floor(s.length/7),0)},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:F,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"防疫记录",type:"bar",barMaxWidth:12,data:n,itemStyle:{borderRadius:[7,7,0,0],color:new rt(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:.45,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.08)"}])},label:{show:!0,position:"top",color:"rgba(230, 255, 249, 0.92)",fontSize:10,formatter:({value:p})=>p>=l*.42?oe(p):""}},{name:"作业趋势",type:"line",smooth:!0,showSymbol:!1,data:n,lineStyle:{width:2.4,color:"#8bf7ff"}}]}}),qr=P(()=>{const s=dn.value,n=s.length>8?10:12,l=n+8,p=s.map(z=>Number(z.recordCount||0)),y=s.map(z=>Number(z.earTagCount||0)),w=Math.max(...p,1),N=s.map(()=>Math.ceil(w*1.08)),_=new rt(0,0,0,1,[{offset:0,color:"rgba(48, 220, 255, 0.18)"},{offset:.48,color:"rgba(48, 220, 255, 0.06)"},{offset:1,color:"rgba(48, 220, 255, 0.02)"}]),E=new rt(0,0,0,1,[{offset:0,color:"#31f7ff"},{offset:.36,color:"#1cbcff"},{offset:1,color:"#266dff"}]);return{color:["#31f7ff","#8bf7ff"],title:{text:`台账总量:{value|${oe(ln.value)}条}`,right:0,top:0,textStyle:{color:"#fff",fontSize:12,fontWeight:500,rich:{value:{color:"#22f1ff",borderColor:"#14bdf4",borderWidth:1,borderRadius:2,padding:[2,6,3,6],fontSize:12,fontWeight:700}}}},tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(z){const H=s[z[0].dataIndex];return[`${H.name}`,`防疫记录:${V(H.recordCount)}条`,`耳标数量:${V(H.earTagCount)}头`,"数据来源:防疫台账"].join("<br/>")}}),legend:[{data:["防疫记录"],top:0,left:0,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:m,fontSize:11},selectedMode:!1},{data:["耳标数"],top:0,left:82,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:m,fontSize:11},selectedMode:!1}],grid:{left:42,right:12,top:46,bottom:68},xAxis:{type:"category",data:s.map(z=>z.name),axisLabel:{color:m,fontSize:10,interval:0,lineHeight:11,margin:8,formatter:uo},axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1}},yAxis:{type:"value",name:"数量/条",max:Math.ceil(w*1.2),nameTextStyle:{color:F,fontSize:10,align:"left"},axisLabel:{color:F,fontSize:10,formatter:oe},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"统计底柱",type:"bar",barWidth:l,barGap:"-100%",data:N,tooltip:{show:!1},silent:!0,z:1,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(48, 220, 255, 0.22)",borderWidth:1,color:_}},{name:"防疫记录",type:"bar",barGap:"-100%",barWidth:n,barMinHeight:2,z:3,data:p.map(z=>({value:z,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(200, 252, 255, 0.22)",borderWidth:1,color:E,shadowBlur:10,shadowColor:"rgba(49, 247, 255, 0.28)"}}))},{name:"耳标数",type:"line",smooth:!0,showSymbol:!1,z:9,data:y,lineStyle:{width:1.6,color:"#8bf7ff",shadowBlur:0,shadowColor:"transparent"},itemStyle:{color:"#8bf7ff"}}]}}),Ur=P(()=>{const s=on.value;return{tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(n){const l=s[n[0].dataIndex];return`${l.name}<br/>防疫记录:${V(l.value)}条`}}),grid:{left:74,right:42,top:12,bottom:8},xAxis:{type:"value",axisLabel:{color:F,fontSize:10,formatter:oe},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:s.map(n=>n.name),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"记录",type:"bar",barWidth:9,data:s.map(n=>({value:n.value,itemStyle:{borderRadius:[1,2,2,1],color:new rt(0,0,1,0,[{offset:0,color:"rgba(67, 217, 232, 0.14)"},{offset:.58,color:"rgba(67, 217, 232, 0.7)"},{offset:1,color:ni}])}})),label:{show:!0,position:"right",color:"#eaffff",fontSize:10,formatter:({value:n})=>oe(n)}}]}}),Kr=P(()=>{const s=gn.value;return{color:["#30dcff","#8bf7ff"],tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(n){const l=n.find(y=>y.seriesName==="流通头数"),p=n.find(y=>y.seriesName==="出证记录");return`${(l==null?void 0:l.axisValue)||""}<br/>流通头数:${V((l==null?void 0:l.value)||0)}头<br/>出证记录:${V((p==null?void 0:p.value)||0)}条`}}),legend:{top:4,right:10,itemWidth:12,itemHeight:8,textStyle:{color:M,fontSize:10}},grid:{left:42,right:38,top:34,bottom:28},xAxis:{type:"category",data:s.map(n=>n.name),axisLabel:{color:F,fontSize:10,interval:1},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.24)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:F,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:M,fontSize:10,formatter:oe},splitLine:{show:!1}}],series:[{name:"流通头数",type:"bar",barMaxWidth:13,data:s.map(n=>n.headCount),itemStyle:{borderRadius:[7,7,0,0],color:new rt(0,0,0,1,[{offset:0,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.08)"}])}},{name:"出证记录",type:"line",yAxisIndex:1,smooth:!0,symbolSize:5,data:s.map(n=>n.recordCount),lineStyle:{width:2.2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2}}]}}),Zr=P(()=>Ei(za.value.slice(0,10),"headCount","头",{style:"ladder",axisTextColor:"rgba(255, 255, 255, 0.88)",dimAxisTextColor:"rgba(255, 255, 255, 0.74)",tooltipFormatter(s){const n=za.value[s.dataIndex];return`${n.name}<br/>流通头数:${V(n.headCount)}头<br/>出证记录:${V(n.recordCount)}条`}})),Xr=P(()=>{const s=Si.value;return{color:Ye,tooltip:Be(n=>{const l=s.find(p=>p.name===n.name);return`${n.name}<br/>占比:${n.percent}%<br/>流通头数:${V(n.value)}头<br/>出证记录:${V((l==null?void 0:l.recordCount)||0)}条`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,textStyle:{color:M,fontSize:10},formatter(n){const l=s.find(p=>p.name===n);return l?`${n} ${oe(l.headCount)}头`:n}},series:[{name:"用途结构",type:"pie",radius:["38%","64%"],center:["32%","54%"],startAngle:110,label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"rgba(3, 18, 31, 0.92)",borderWidth:3},data:s.map(n=>({name:n.name,value:n.headCount}))}]}}),Jr=P(()=>{const s=[{name:"省外A证",value:mt("outProvinceHeads","aCertHeads")},{name:"省内B证",value:mt("inProvinceHeads","bCertHeads")}];return{color:["#8bf7ff","#30dcff"],tooltip:Be(n=>`${n.name}<br/>流通头数:${V(n.value)}头<br/>占比:${n.percent}%`),series:[{type:"pie",radius:["48%","72%"],center:["50%","52%"],label:{show:!1},labelLine:{show:!1},itemStyle:{borderColor:"rgba(3, 18, 31, 0.92)",borderWidth:3},data:s}]}});function Ci(){o.value=typeof window=="undefined"?1080:window.innerHeight}function Fn(){var s,n,l,p,y,w;if(Qe.value){(n=(s=pa.value)==null?void 0:s.refreshView)==null||n.call(s);return}(p=(l=Ce.value)==null?void 0:l.resume)==null||p.call(l),(w=(y=Ce.value)==null?void 0:y.refreshView)==null||w.call(y)}function Cn(){Mt&&(window.clearTimeout(Mt),Mt=null)}function Nn(){var s,n,l,p,y,w;if(Oe.value=!1,Ga.value={type:"loading",text:"地图正在复位"},Aa.value={type:"idle",text:""},Qe.value){(n=(s=pa.value)==null?void 0:s.hasMap)!=null&&n.call(s)?(fa.value=!0,(p=(l=pa.value)==null?void 0:l.resetView)==null||p.call(l)):(fa.value=!1,Ki.value+=1,jt(()=>{window.setTimeout(()=>{var N,_;return(_=(N=pa.value)==null?void 0:N.refreshView)==null?void 0:_.call(N)},160)}));return}if((w=(y=Ce.value)==null?void 0:y.hasMap)!=null&&w.call(y)){Zt.value=!0,Fn();return}Cn(),Zt.value=!1,Ct=!1,Ui.value+=1,jt(()=>{Za()})}function Qr(){Oe.value=!1,Nn()}e({refreshMapView:Fn,resetMap:Nn,setActiveView(s){D.value=$i(s)}}),qs(()=>{Ci(),window.addEventListener("resize",Ci),ss(),rs(D.value),va(),ja()}),Us(()=>{var s,n;ma=!0,window.removeEventListener("resize",Ci),Mt&&window.clearTimeout(Mt),Ni(),xi(),(n=(s=Ce.value)==null?void 0:s.destroyMap)==null||n.call(s)}),qt([D,yi,Nt,ct,Ke,qe,un,ce,ue,C,$e,fn,bn,Je,be],()=>{Co()},{immediate:!0}),qt(D,(s,n)=>{i("view-change",s),rs(s);const l=s==="structure"||s==="forecast",p=n==="structure"||n==="forecast",y=!l&&!p&&(s==="trade"||n==="trade");l&&!p&&(Oe.value=!1,fa.value=!1,Ga.value={type:"idle",text:""},Aa.value={type:"idle",text:""}),!l&&p&&(ss(),Cn(),Oe.value=!1,Zt.value=!1,Ct=!1,Ga.value={type:"idle",text:""},Aa.value={type:"idle",text:""},jt(()=>{var w,N,_,E;Za(),(N=(w=Ce.value)==null?void 0:w.resume)==null||N.call(w),(E=(_=Ce.value)==null?void 0:_.refreshView)==null||E.call(_),window.setTimeout(()=>{var z,H;return(H=(z=Ce.value)==null?void 0:z.refreshView)==null?void 0:H.call(z)},180)})),y&&jt(()=>{var w,N,_,E;(N=(w=Ce.value)==null?void 0:w.resume)==null||N.call(w),(E=(_=Ce.value)==null?void 0:_.refreshView)==null||E.call(_)}),va(),ja()}),qt(()=>a.viewKey,s=>{const n=$i(s);n!==D.value&&(D.value=n)}),qt(()=>a.active,s=>{var n,l,p,y;s?(Za(),(l=(n=Ce.value)==null?void 0:n.resume)==null||l.call(n),va(),ja()):((y=(p=Ce.value)==null?void 0:p.pause)==null||y.call(p),Ni(),xi())}),qt(Ya,s=>{ut.value>=s.pageCount&&(ut.value=0),ja()});function xn(s){return re(this,null,function*(){s===_e.value&&!ae.value||(_e.value=s,yield On(Number(s)),va())})}function va(){Ni(),!(!a.active||D.value!=="forecast"||ma||Re.value.length<=1)&&(Ea=window.setInterval(eo,Vh))}function eo(){if(Le.value||Re.value.length<=1)return;const s=Re.value.findIndex(l=>l.key===_e.value),n=s>=0?(s+1)%Re.value.length:0;xn(Re.value[n].key)}function Ni(){Ea&&(window.clearInterval(Ea),Ea=null)}function ja(){xi(),!(!a.active||D.value!=="structure"||ma||Ya.value.pageCount<=1)&&($a=window.setInterval(to,Dh))}function to(){const s=Ya.value.pageCount;s<=1||(ut.value=(ut.value+1)%s)}function xi(){$a&&(window.clearInterval($a),$a=null)}function ao(s){return String(s||"").trim()}function Et(s){return String(s||"").trim()}function _n(s){var p;const n=v.value,l=Number(s);return Number.isFinite(l)&&n.includes(l)?l:(p=n[n.length-1])!=null?p:null}function _i(s=C.value){const n=_n(s);return n?{startDate:`${n}-01-01`,endDate:`${n}-12-31`}:{startDate:"",endDate:""}}function Ha(){return{hasData:!1,overview:{},years:[],townRows:[],villageRows:[],dateTrend:[],medicineRows:[],ownerRows:[],topRows:[]}}function qa(){return{keyword:"",town:"",medicine:"",startDate:"",endDate:""}}function Ri(s=[]){return Array.isArray(s)?s.map((n,l)=>{var p,y,w;return{key:n.key||n.id||`${n.name||n.label||"item"}-${l}`,name:String(n.name||n.label||n.town||n.village||"未填写"),value:Number((w=(y=(p=n.value)!=null?p:n.count)!=null?y:n.total)!=null?w:0)}}).filter(n=>n.name&&Number.isFinite(n.value)):[]}function io(...s){const n=s.flatMap(l=>Array.isArray(l)?l:[l]).map(l=>{var p,y,w;return l&&typeof l=="object"?(w=(y=(p=l.sourceYear)!=null?p:l.source_year)!=null?y:l.year)!=null?w:l.value:l}).map(Number).filter(l=>Number.isFinite(l)&&l>0);return[...new Set(n)].sort((l,p)=>l-p)}function Qt(s=[],n="name"){return Array.isArray(s)?s.map((l,p)=>{var y,w,N,_,E,z,H,ye,gt,vt,Dt,Ot,zt,wa,La,Ta,ka;return{key:l.key||l.id||`${l[n]||l.name||l.label||"trade"}-${p}`,name:String(l[n]||l.name||l.label||l.town||"未填写"),recordCount:Number((N=(w=(y=l.recordCount)!=null?y:l.record_count)!=null?w:l.count)!=null?N:0),headCount:Number((H=(z=(E=(_=l.headCount)!=null?_:l.head_count)!=null?E:l.amount)!=null?z:l.value)!=null?H:0),lng:ft((Ot=(Dt=(vt=(gt=(ye=l.lng)!=null?ye:l.longitude)!=null?gt:l.destLng)!=null?vt:l.dest_lng)!=null?Dt:l.destLongitude)!=null?Ot:l.dest_longitude),lat:ft((ka=(Ta=(La=(wa=(zt=l.lat)!=null?zt:l.latitude)!=null?wa:l.destLat)!=null?La:l.dest_lat)!=null?Ta:l.destLatitude)!=null?ka:l.dest_latitude)}}).filter(l=>l.name&&Number.isFinite(l.headCount)):[]}function no(s=[]){return Array.isArray(s)?s.map(n=>{var l,p,y,w,N,_,E,z,H;return{year:Number((p=(l=n.sourceYear)!=null?l:n.source_year)!=null?p:n.year),recordCount:Number((w=(y=n.recordCount)!=null?y:n.record_count)!=null?w:0),headCount:Number((z=(E=(_=(N=n.headCount)!=null?N:n.head_count)!=null?_:n.amount)!=null?E:n.value)!=null?z:0),yoyPercent:n.yoyPercent==null&&n.yoy_percent==null?null:Number((H=n.yoyPercent)!=null?H:n.yoy_percent)}}).filter(n=>Number.isFinite(n.year)&&Number.isFinite(n.headCount)):[]}function Rn(s=[]){return Array.isArray(s)?ro(s.map(n=>{var l,p,y;return n&&typeof n=="object"?(y=(p=(l=n.value)!=null?l:n.label)!=null?p:n.name)!=null?y:"":n})):[]}function so(s=[]){return Array.isArray(s)?s.map(n=>{var l,p,y,w,N,_;if(n&&typeof n=="object"){const E=(y=(p=(l=n.value)!=null?l:n.name)!=null?p:n.label)!=null?y:"",z=(_=(N=(w=n.label)!=null?w:n.name)!=null?N:n.value)!=null?_:E;return E?{value:String(E),label:String(z||E)}:null}return n?{value:String(n),label:String(n)}:null}).filter(Boolean):[]}function ro(s=[]){return[...new Set(s.map(n=>String(n||"").trim()).filter(Boolean))]}function oo(s=[]){return Array.isArray(s)?s.map((n,l)=>{var p,y,w,N,_,E,z,H;return{key:n.key||n.id||`${n.name||n.town||"town"}-${l}`,name:Et(n.name||n.town||""),recordCount:Number((y=(p=n.recordCount)!=null?p:n.record_count)!=null?y:0),earTagCount:Number((N=(w=n.earTagCount)!=null?w:n.ear_tag_count)!=null?N:0),ownerCount:Number((E=(_=n.ownerCount)!=null?_:n.owner_count)!=null?E:0),villageCount:Number((H=(z=n.villageCount)!=null?z:n.village_count)!=null?H:0),firstDate:n.firstDate||n.first_date||null,lastDate:n.lastDate||n.last_date||null,source:"ledger"}}).filter(n=>n.name&&Number.isFinite(n.recordCount)&&Number.isFinite(n.earTagCount)).sort((n,l)=>Number(l.recordCount||0)-Number(n.recordCount||0)):[]}function In(s=[]){return Array.isArray(s)?s.map((n,l)=>{var ye,gt,vt,Dt,Ot,zt,wa,La,Ta,ka,ds,hs;const p=Et(n.town||n.townName||n.town_name||""),y=String(n.village||n.villageName||n.village_name||n.name||"").trim(),w=ft((vt=(gt=(ye=n.recordCount)!=null?ye:n.record_count)!=null?gt:n.records)!=null?vt:n.total),N=ft((wa=(zt=(Ot=(Dt=n.earTagCount)!=null?Dt:n.ear_tag_count)!=null?Ot:n.headCount)!=null?zt:n.head_count)!=null?wa:n.value),_=ft((Ta=(La=n.imageCount)!=null?La:n.image_count)!=null?Ta:n.images),E=ft((ka=n.imageRate)!=null?ka:n.image_rate),z=ft((ds=n.lng)!=null?ds:n.longitude),H=ft((hs=n.lat)!=null?hs:n.latitude);return{key:n.key||n.id||`${p}-${y}-${l}`,town:p,village:y,recordCount:Number.isFinite(w)?w:0,earTagCount:Number.isFinite(N)?N:0,imageCount:Number.isFinite(_)?_:0,imageRate:Number.isFinite(E)?E:0,lng:z,lat:H}}).filter(n=>n.town&&n.village&&Number.isFinite(n.earTagCount)).sort((n,l)=>Number(l.earTagCount||0)-Number(n.earTagCount||0)):[]}function ft(s){if(s==null||s==="")return NaN;const n=Number(String(s).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(n)?n:NaN}function Gn(s){return String(s||"").replace(/'/g,"''").replace(/%/g,"\\%").replace(/_/g,"\\_")}function lo(s,n){const l=Et(s),p=String(n||"").trim();if(!l||!p)return"";const y=`${l}${p}`,w=Gn(y),N=Gn(p);return`(full_name LIKE '%${w}%' OR name = '${w}' OR name = '${N}')`}function uo(s){const n=String(s||"").trim().replace(/\s+/g,"");return n?Array.from(n).join(`
`):""}function co(s){const n=String(s||"").trim();if(!n)return"";const l=n.match(/^(.+)(镇|乡|村)$/);return l?`${l[1]}
${l[2]}`:n}function ho(s,n){return An(s.name)-An(n.name)}function An(s){const n=String(s||"").match(/(\d{1,2})\D+(\d{1,2})/);return n?Number(n[1])*100+Number(n[2]):Number.MAX_SAFE_INTEGER}function Ii(s=[]){return Array.isArray(s)?s.map(Bn).filter(Boolean):[]}function Bn(s){return s?{epidemicId:s.epidemicId||s.epidemic_id||s.id||"",earTag:s.earTag||s.ear_tag||"",owner:s.owner||"",idType:s.idType||s.id_type||"",idNo:s.idNo||s.id_no||"",phone:s.phone||"",town:s.town||"",village:s.village||"",location:s.location||"",livestockType:s.livestockType||s.livestock_type||"",age:s.age||"",sex:s.sex||"",weight:s.weight||s.weightKg||s.weight_kg||"",preventionType:s.preventionType||s.prevention_type||"",method:s.method||"",medicine:s.medicine||"",dose:s.dose||"",operator:s.operator||"",operateTime:s.operateTime||s.operate_time||"",imagePaths:s.imagePaths||s.image_paths||""}:null}function En(s=[]){return Array.isArray(s)?s.map(po).filter(Boolean):[]}function po(s){var n,l,p,y;return s?{certId:s.certId||s.cert_id||s.id||"",certType:s.certType||s.cert_type||"",certScopeName:s.certScopeName||s.cert_scope_name||"",factoryCode:s.factoryCode||s.factory_code||"",ownerName:s.ownerName||s.owner_name||"",ownerPhone:s.ownerPhone||s.owner_phone||"",transportNumber:s.transportNumber||s.transport_number||"",amount:Number((y=(p=(l=(n=s.amount)!=null?n:s.headCount)!=null?l:s.head_count)!=null?p:s.value)!=null?y:0),unitName:s.unitName||s.unit_name||"头",animalTypeName:s.animalTypeName||s.animal_type_name||"",usageTypeName:s.usageTypeName||s.usage_type_name||"",startTown:s.startTown||s.start_town||"",startRegionFullName:s.startRegionFullName||s.start_region_full_name||"",destProvince:s.destProvince||s.dest_province||"",destRegionFullName:s.destRegionFullName||s.dest_region_full_name||"",quarantineOfficerName:s.quarantineOfficerName||s.quarantine_officer_name||"",issueTime:s.issueTime||s.issue_time||"",statusName:s.statusName||s.status_name||""}:null}function fo(s,n){for(const l of n){const p=Number(s==null?void 0:s[l]);if(Number.isFinite(p))return p}return 0}function mt(...s){return fo(fn.value,s)}function mo(){if(!mn.value)return[];const s=Wa.value[0],n=Si.value[0],l=pr.value[0],p=fr.value[0],y=mt("vehicleCount");return[s?{key:"town",badge:"来源",name:"流通头数首位乡镇",value:s.displayName||s.name,desc:`${V(s.headCount)}头 / ${V(s.recordCount)}条`,color:"#63d7ff"}:null,n?{key:"usage",badge:"用途",name:"流通头数首位用途",value:n.name,desc:`${V(n.headCount)}头 / ${V(n.recordCount)}条`,color:"#30dcff"}:null,y>0?{key:"vehicle",badge:"车辆",name:"参与流通车辆",value:`${V(y)}辆`,desc:l?`头数首位 ${l.name}:${V(l.headCount)}头`:"台账未返回车辆排行",color:"#48cfff"}:null,p?{key:"destination",badge:"A证",name:"省外流通首位去向",value:p.name,desc:`${V(p.headCount)}头 / ${V(p.recordCount)}条`,color:"#8bf7ff"}:null].filter(Boolean)}function Gi(s={}){return String(s.imagePaths||"").split(";").map(n=>n.trim()).filter(Boolean)}function $n(s){const l=String(s||"").replace(/^images\//,"").split("/").map(encodeURIComponent).join("/");return`${Ah}/${l}`}function yo(s){ui.value=$n(s),Kt.value=!0}function Ai(){Kt.value=!1,ui.value=""}function Z(s){return s==null||s===""?"-":s}function go(s){const n=String(s!=null?s:"").trim();return!!(n&&n!=="-")}function we(s,n,l={}){return go(n)?A({label:s,value:n},l):null}function $t(s){return s?String(s).slice(0,10):"-"}function Vn(s){const n=String(s||"").trim();return n?n.length<7?n:`${n.slice(0,3)}****${n.slice(-4)}`:"-"}function vo(s){const n=String(s||"").trim();return n?n.length<=4?n:`****${n.slice(-4)}`:"-"}function bo(s){const n=String(s!=null?s:"").trim();if(!n)return"-";if(/kg|公斤|千克/i.test(n))return n;const l=Number(n);return Number.isFinite(l)?`${V(l)}kg`:n}function wo(s){return String(s!=null?s:"").trim()||"-"}function Dn(s={}){return s.certScopeName||s.certType||"-"}function Lo(){return re(this,null,function*(){Ge.value=!0,k.value="";try{const s=yield Al();if(Tt.value=Io(s.structureRows),kt.value=Ao(s.genderAgeRows),Lt.value=Bo(s.townRows),ct.value=cs(s.topRows),it.value=s.meta||{},!Tt.value.length||!kt.value.length||!Lt.value.length)throw new Error("结构数据暂无数据")}catch(s){k.value=zo(s,"结构数据异常"),Tt.value=[],kt.value=[],Lt.value=[],ct.value=[],it.value={}}Ge.value=!1})}function On(s){return re(this,null,function*(){var n,l;Le.value=!0,ae.value="",qe.value={},tt.value=[],Ue.value=[],Ve.value=[],Ke.value=[],Ie.value={},at.value={};try{const p=yield Bl(s),y=Eo(p.years),w=String((l=(n=p.selectedYear)!=null?n:p.selected_year)!=null?l:"");if(Re.value=y,_e.value=w,qe.value=$o(p.overview),tt.value=Vo(p.monthlyRows),Ue.value=Do(p.townRows),Ve.value=Oo(p.annualRows),Ke.value=cs(p.topRows),Ie.value=p.quality||{},at.value=p.meta||{},p.hasData===!1||!y.length||!tt.value.length||!Ue.value.length)throw new Error(p.emptyMessage||"预测数据暂无数据")}catch(p){ae.value=Wo(p),Re.value=[],_e.value="",qe.value={},tt.value=[],Ue.value=[],Ve.value=[],Ke.value=[],Ie.value={},at.value={},mi=!1}Le.value=!1,ae.value||va()})}function zn(){return re(this,arguments,function*(s=$e.value){Je.value=!0,be.value="",Ra.value="",de.value={metrics:{},hasData:!1},It.value=[],Gt.value=0,ht.value=1;try{const n=yield El(s);de.value=n||{metrics:{},hasData:!1};const l=Number(n==null?void 0:n.selectedYear);$e.value=Number.isFinite(l)?l:null,(n==null?void 0:n.hasData)===!0&&$e.value&&(yield Bi(1))}catch(n){be.value="交易数据接口异常",de.value={metrics:{},hasData:!1},It.value=[],Gt.value=0}finally{Je.value=!1}})}function Bi(){return re(this,arguments,function*(s=ht.value){var l,p;if(!$e.value)return;Ra.value="",It.value=[],Gt.value=0;const n={year:$e.value,page:s,pageSize:ji,keyword:ci.value};try{const y=yield Fs(n);It.value=En(y.rows),Gt.value=Number(((l=y.page)==null?void 0:l.totalCount)||y.totalCount||It.value.length||0),ht.value=Number(((p=y.page)==null?void 0:p.page)||s||1)}catch(y){Ra.value="交易台账接口异常",It.value=[],Gt.value=0}})}function To(s){const n=Number(s);!Number.isFinite(n)||n===Number($e.value)||($e.value=n,ht.value=1,Ia.value="",ci.value="",zn(n))}function ko(s){const n=_n(s);!n||n===Number(C.value)||(C.value=n,ee.value=1,Me.value="",Pe.value="",Fe.value=1,Ee.value=qa(),Zn(n))}function Wn(){ci.value=Ia.value.trim(),Bi(1)}function Yn(s){const n=Math.min(Math.max(Number(s)||1,1),Mi.value);Bi(n)}function jn(s=null){di.value=!0,s&&(ha.value=s),Ua(s?ht.value:1,s)}function Hn(){di.value=!1}function qn(){Ua(1)}function So(){pt.value={keyword:"",startTown:"",usageType:"",certType:""},Ua(1)}function Un(s){const n=Math.min(Math.max(Number(s)||1,1),Pi.value);Ua(n)}function Ua(){return re(this,arguments,function*(s=At.value,n=null){var y,w;if(!$e.value)return;hi.value=!0,pi.value="",Ft.value=[],da.value=0,ha.value=null;const l=pt.value,p={year:$e.value,page:s,pageSize:js,keyword:l.keyword.trim(),startTown:l.startTown,usageType:l.usageType,certType:l.certType};try{const N=yield Fs(p);Ft.value=En(N.rows),da.value=Number(((y=N.page)==null?void 0:y.totalCount)||N.totalCount||Ft.value.length||0),At.value=Number(((w=N.page)==null?void 0:w.page)||s||1);const _=n?n.certId||n.factoryCode:"",E=_?Ft.value.find(z=>(z.certId||z.factoryCode)===_)||n:Ft.value[0]||null;Kn(E)}catch(N){pi.value="交易台账接口异常",Ft.value=[],da.value=0,ha.value=null}finally{hi.value=!1}})}function Kn(s){ha.value=s||null}function Mo(s){s!=null&&s.startTown&&(D.value="trade",jt(()=>{var n,l,p,y,w,N;(l=(n=Ce.value)==null?void 0:n.resume)==null||l.call(n),(y=(p=Ce.value)==null?void 0:p.refreshView)==null||y.call(p),(N=(w=Ce.value)==null?void 0:w.focusTown)==null||N.call(w,Et(s.startTown),{distanceScale:.78,duration:.8})}))}function Zn(){return re(this,arguments,function*(s=C.value){var p,y;const n=Number(s),l=Number.isFinite(n)&&n>0?n:void 0;ce.value=!0,ue.value="",Te.value="",v.value=[],C.value=l!=null?l:null,B.value=Ha(),$.value=[],U.value=0;try{const w=yield $l(l);if(v.value=Array.isArray(w==null?void 0:w.years)?[...new Set(w.years.map(_=>{var E;return Number((E=_==null?void 0:_.sourceYear)!=null?E:_==null?void 0:_.source_year)}).filter(_=>Number.isFinite(_)&&_>0))].sort((_,E)=>_-E):[],C.value=Number((p=w==null?void 0:w.selectedYear)!=null?p:w==null?void 0:w.selected_year)||null,B.value=w||Ha(),!(w!=null&&w.hasData)||!C.value)return;const N=_i(C.value);try{const _=yield zi(A({page:ee.value,pageSize:si,keyword:Pe.value},N));$.value=Ii(_==null?void 0:_.rows),U.value=Number(((y=_==null?void 0:_.page)==null?void 0:y.totalCount)||(_==null?void 0:_.totalCount)||$.value.length||0)}catch(_){Te.value="防疫台账接口异常",$.value=[],U.value=0}}catch(w){ue.value="防疫汇总接口异常",v.value=[],C.value=null,B.value=Ha(),$.value=[],U.value=0}finally{ce.value=!1}})}function Xn(){return re(this,arguments,function*(s=ee.value){var p,y;if(!C.value)return;ce.value=!0,Te.value="";const n=Math.min(Math.max(Number(s)||1,1),ki.value),l=_i(C.value);$.value=[],U.value=0;try{const w=yield zi(A({page:n,pageSize:si,keyword:Pe.value},l));$.value=Ii(w.rows),U.value=Number(((p=w.page)==null?void 0:p.totalCount)||w.totalCount||$.value.length||0),ee.value=Number(((y=w.page)==null?void 0:y.page)||n||1)}catch(w){Te.value="防疫台账接口异常",$.value=[],U.value=0,ee.value=1}finally{ce.value=!1}})}function Jn(){Pe.value=Me.value.trim(),Ee.value=O(A({},qa()),{keyword:Pe.value}),Xn(1)}function Qn(s){Xn(s)}function es(s=null){Ze.value=!0,s&&(Xe.value=s,dt.value=null),Ka(1,s)}function ts(){Ze.value=!1,Ai()}function as(){Ka(1)}function Po(){Ee.value=qa(),Ka(1)}function is(s){Ka(s)}function Ka(){return re(this,arguments,function*(s=Fe.value,n=null){var w,N;nt.value=!0,St.value="",Ae.value=[],De.value=0,Xe.value=null,dt.value=null;const l=Ee.value,p=_i(C.value),y={keyword:l.keyword.trim(),town:l.town,medicine:l.medicine,startDate:l.startDate||p.startDate,endDate:l.endDate||p.endDate,page:s,pageSize:Ys};try{const _=yield zi(y);Ae.value=Ii(_.rows),De.value=Number(((w=_.page)==null?void 0:w.totalCount)||_.totalCount||Ae.value.length||0),Fe.value=Number(((N=_.page)==null?void 0:N.page)||s||1);const E=n||Ae.value[0]||null;E?ns(E):(Xe.value=null,dt.value=null)}catch(_){St.value="台账接口异常",Ae.value=[],De.value=0}finally{nt.value=!1}})}function ns(s){return re(this,null,function*(){if(Xe.value=s,dt.value=null,!(s!=null&&s.earTag)&&!(s!=null&&s.epidemicId))return;const n=++Va;Pt.value=!0;try{const l=yield Vl(s.earTag||s.epidemicId);n===Va&&(dt.value=Bn(l)||s)}catch(l){n===Va&&(dt.value=s)}finally{n===Va&&(Pt.value=!1)}})}function ss(){var s;Zi||Ba||(Zi=!0,fi=new Il,Ba=!1,(s=fi.ready)==null||s.then(()=>{Ba=!0,Oe.value=!1,Za()}).catch(n=>{console.warn("[yakManagement] map assets unavailable",n),Zt.value=!1,Oe.value=!0}))}function rs(s){Xi||(Xi=!0,Lo()),s==="forecast"&&!mi&&(mi=!0,On()),s==="epidemic"&&!Ji&&(Ji=!0,Zn()),Qi||(Qi=!0,zn())}function Za(){ma||!a.active||!Ba||Ct||(Oe.value=!1,Ct=!0,Mt&&window.clearTimeout(Mt),Mt=window.setTimeout(()=>{Mt=null,os()},600))}function os(s=0){return re(this,null,function*(){var l,p;if(ma)return;if(!a.active){Ct=!1;return}if(yield jt(),!a.active){Ct=!1;return}const n=Ce.value;if((l=n==null?void 0:n.loadMap)==null||l.call(n,fi),n!=null&&n.canvasMap){Ct=!1,Zt.value=!0,Oe.value=!1,(p=n.play)==null||p.call(n);return}if(s<24){window.setTimeout(()=>os(s+1),120);return}Ct=!1,Oe.value=!0})}function ls(s={}){Aa.value={type:s.type||"idle",text:s.text||""}}function Fo(){fa.value=!0,Oe.value=!1}function us(s={}){Ga.value={type:s.type||"idle",text:s.text||"",loaded:s.loaded,failed:s.failed,total:s.total,zoom:s.zoom,tileUrlTemplate:s.tileUrlTemplate}}function Co(){if(D.value==="epidemic"){i("module-stats",{moduleKey:"yak-management",items:ce.value||ue.value?[]:un.value});return}if(D.value==="forecast"){i("module-stats",{moduleKey:"yak-management",items:Le.value||ae.value?[]:Ke.value});return}if(D.value==="trade"){i("module-stats",{moduleKey:"yak-management",items:Je.value||be.value||!mn.value?[]:bn.value});return}i("module-stats",{moduleKey:"yak-management",items:ct.value})}function Ei(s,n,l,p={}){const y=p.labelKey||"name",w=s.length>8,N=p.style==="ladder",_=w?N?7:6:s.length>6?11:13,E=p.axisTextColor||m,z=p.dimAxisTextColor||F;return{tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(H){if(p.tooltipFormatter)return p.tooltipFormatter(H[0]);const ye=s[H[0].dataIndex];return`${ye[y]}<br/>数值:${V(ye[n])}${l}`}}),grid:{left:w?58:74,right:w?54:58,top:w?6:16,bottom:w?8:14},xAxis:{type:"value",axisLabel:{color:z,fontSize:10,formatter:l==="%"?"{value}%":oe},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:s.map(H=>H[y]),axisLabel:{color:E,fontSize:w?10:11,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{type:"bar",barWidth:_,barGap:"-100%",data:s.map(H=>({value:H[n],itemStyle:{borderRadius:[1,2,2,1],color:No(ni),shadowBlur:2,shadowColor:"rgba(48, 220, 255, 0.12)"}})),showBackground:!0,backgroundStyle:{color:N?"rgba(48, 220, 255, 0.05)":"rgba(48, 220, 255, 0.07)",borderRadius:[1,2,2,1]},label:{show:!0,position:"right",color:T,fontFamily:Di.number,fontSize:w?10:Ls.chartLabel,fontWeight:700,formatter:({value:H})=>`${l==="%"?ea(H):oe(H)}`}}]}}function No(s){return new rt(0,0,1,0,[{offset:0,color:"rgba(67, 217, 232, 0.14)"},{offset:.58,color:"rgba(67, 217, 232, 0.7)"},{offset:1,color:s}])}function xo(s,n,l,p=0,y=!1){return{name:s,type:"line",yAxisIndex:p,smooth:!0,symbolSize:5,data:n,lineStyle:{width:2.5,color:l},itemStyle:{color:l},areaStyle:y?{color:new rt(0,0,0,1,[{offset:0,color:`${l}44`},{offset:1,color:`${l}05`}])}:void 0}}function _o(s,n){const l=new Map;return s.forEach(p=>{const y=Ro(p.name);if(!y)return;const w=l.get(y)||{name:y,value:0};w.value+=Number(p[n]||0),l.set(y,w)}),[...l.values()].sort((p,y)=>y.value-p.value)}function Ro(s){return{色地镇:"色地镇",瓦切镇:"瓦切镇",安曲镇:"安曲镇",龙日镇:"龙日镇",邛溪镇:"邛溪镇",刷经寺镇:"刷经寺镇",阿木乡:"阿木乡",查尔玛乡:"查尔玛乡",江茸乡:"江茸乡",麦洼乡:"麦洼乡"}[s]||""}function Be(s){return{trigger:"item",backgroundColor:"rgba(5, 31, 51, 0.96)",borderColor:"rgba(0, 210, 255, 0.54)",borderWidth:1,padding:[7,10],textStyle:{color:m,fontFamily:Di.ui,fontSize:Ls.tooltip,lineHeight:18},extraCssText:"box-shadow:0 0 10px rgba(0,210,255,.12);",formatter:s}}function $i(s){return je.some(n=>n.key===s)?s:"structure"}function Io(s=[]){return xt(s).map((n,l)=>{var w,N,_,E;const p=String(n.name||n.label||n.type||`结构${l+1}`).trim(),y=st((N=(w=n.value)!=null?w:n.count)!=null?N:n.number);return{key:n.key||n.id||`${p}-${l}`,name:p,count:y,ratio:Number((E=(_=n.ratio)!=null?_:n.percent)!=null?E:0),source:n.source||"结构统计"}}).filter(n=>n.name&&n.count>0)}function Go(s=[]){return s.map((n,l)=>{var w,N;const p=String(n.name||n.label||`结构${l+1}`).trim(),y=st((N=(w=n.count)!=null?w:n.value)!=null?N:n.number);return O(A({},n),{key:n.key||`${p}-${l}`,name:p,count:y})}).filter(n=>n.name&&n.count>0)}function Ao(s=[]){return xt(s).map(n=>({key:n.key||n.age,age:String(n.age||"").trim(),cow:st(n.cow),bull:st(n.bull),total:st(n.total)})).filter(n=>n.age&&n.total>0)}function Bo(s=[]){return xt(s).map((n,l)=>{var p;return{key:n.key||n.areaCode||`town-${l}`,areaCode:String(n.areaCode||"").trim(),name:String(n.name||"").trim(),count:st((p=n.value)!=null?p:n.count),cow:st(n.cow),bull:st(n.bull),calf:st(n.calf),breedingCow:st(n.breedingCow),overageCow:st(n.overageCow)}}).filter(n=>n.name&&n.count>0).sort((n,l)=>l.count-n.count)}function cs(s=[]){return xt(s).map((n,l)=>({key:n.key||`structure-top-${l}`,zh:String(n.zh||n.name||"").trim(),value:Number(n.value),unit:String(n.unit||"").trim()})).filter(n=>n.zh&&Number.isFinite(n.value))}function Eo(s=[]){return xt(s).map(n=>{var p,y,w,N,_,E,z,H;const l=Number((p=n.sourceYear)!=null?p:n.source_year);return{key:String(l),label:`${l}年`,shortLabel:String(l),sourceYear:l,sourceRowCount:Number((y=n.sourceRowCount)!=null?y:n.source_row_count),monthCount:Number((w=n.monthCount)!=null?w:n.month_count),townCount:Number((N=n.townCount)!=null?N:n.town_count),latestTime:(_=n.latestTime)!=null?_:n.latest_time,latestTotal:Number((E=n.latestTotal)!=null?E:n.latest_total),latestGrowthValue:Number((z=n.latestGrowthValue)!=null?z:n.latest_growth_value),latestChange:yt((H=n.latestChange)!=null?H:n.latest_change)}}).filter(n=>Number.isInteger(n.sourceYear)).sort((n,l)=>n.sourceYear-l.sourceYear)}function $o(s={}){var n,l,p,y,w,N,_,E,z,H,ye;return{sourceYear:Number((n=s.sourceYear)!=null?n:s.source_year),sourceRowCount:Number((l=s.sourceRowCount)!=null?l:s.source_row_count),monthCount:Number((p=s.monthCount)!=null?p:s.month_count),townCount:Number((y=s.townCount)!=null?y:s.town_count),startTime:(w=s.startTime)!=null?w:s.start_time,endTime:(N=s.endTime)!=null?N:s.end_time,latestTime:(_=s.latestTime)!=null?_:s.latest_time,latestTotal:Number((E=s.latestTotal)!=null?E:s.latest_total),previousTotal:yt((z=s.previousTotal)!=null?z:s.previous_total),latestChange:yt((H=s.latestChange)!=null?H:s.latest_change),latestGrowthValue:Number((ye=s.latestGrowthValue)!=null?ye:s.latest_growth_value)}}function Vo(s=[]){return xt(s).map((n,l)=>{var p;return{key:n.time||n.month||`forecast-month-${l}`,month:String(n.month||n.time||"").trim(),time:String(n.time||"").slice(0,10),count:Number(n.value),growthValue:Number((p=n.growthValue)!=null?p:n.growth_value),change:yt(n.change)}}).filter(n=>n.month&&Number.isFinite(n.count)&&Number.isFinite(n.growthValue))}function Do(s=[]){return xt(s).map((n,l)=>{var y,w;const p=Number(n.value);return{key:n.id||n.areaCode||n.area_code||`forecast-town-${l}`,areaCode:String(n.areaCode||n.area_code||"").trim(),name:String(n.name||n.areaName||n.area_name||"").trim(),time:String(n.time||"").slice(0,10),value:p,count:p,forecast:p,growthRate:Number((y=n.growthRate)!=null?y:n.growth_rate),previousValue:yt((w=n.previousValue)!=null?w:n.previous_value),change:yt(n.change)}}).filter(n=>n.name&&Number.isFinite(n.value)&&Number.isFinite(n.growthRate)).sort((n,l)=>l.value-n.value||n.areaCode.localeCompare(l.areaCode))}function Oo(s=[]){return xt(s).map(n=>{var l,p,y,w,N;return{sourceYear:Number((l=n.sourceYear)!=null?l:n.source_year),latestTime:(p=n.latestTime)!=null?p:n.latest_time,latestTotal:Number((y=n.latestTotal)!=null?y:n.latest_total),latestGrowthValue:Number((w=n.latestGrowthValue)!=null?w:n.latest_growth_value),latestChange:yt((N=n.latestChange)!=null?N:n.latest_change)}}).filter(n=>Number.isInteger(n.sourceYear)&&Number.isFinite(n.latestTotal)).sort((n,l)=>n.sourceYear-l.sourceYear)}function yt(s){if(s==null||s==="")return null;const n=Number(s);return Number.isFinite(n)?n:null}function xt(s){if(Array.isArray(s))return s;if(s&&typeof s.value=="string")try{const n=JSON.parse(s.value);return Array.isArray(n)?n:[]}catch(n){return[]}return[]}function st(s){const n=Number(String(s!=null?s:"").replace(/,/g,"").replace(/%/g,""));return Number.isFinite(n)&&n>0?Math.round(n):0}function zo(s,n){const l=String((s==null?void 0:s.message)||s||"");return/未登录|401|HTTP_401/.test(l)?"结构数据未就绪":/超时|timeout/i.test(l)?"结构数据加载超时":n}function Wo(s){const n=String((s==null?void 0:s.message)||s||"");return/未登录|401|HTTP_401/.test(n)?"预测数据未就绪":/超时|timeout/i.test(n)?"预测数据加载超时":/暂无牦牛预测数据|预测数据暂无数据/.test(n)?n:"预测数据接口异常"}function V(s){const n=Number(s);return Number.isFinite(n)?n.toLocaleString("zh-CN",{maximumFractionDigits:Number.isInteger(n)?0:2}):"--"}function oe(s){const n=Number(s);return Number.isFinite(n)?Math.abs(n)>=1e4?`${(n/1e4).toFixed(Math.abs(n)>=1e5?0:1)}万`:Math.round(n).toLocaleString("zh-CN"):"--"}function ea(s){const n=Number(s);return Number.isFinite(n)?`${Number.isInteger(n)?n:n.toFixed(1)}%`:"--"}function Vt(s,n,l,p){const y=p*Math.PI/180;return{x:Number((s+l*Math.cos(y)).toFixed(2)),y:Number((n+l*Math.sin(y)).toFixed(2))}}function Yo(s,n,l,p,y,w){const N=Vt(s,n,p,y),_=Vt(s,n,p,w),E=Vt(s,n,l,w),z=Vt(s,n,l,y),H=w-y>180?1:0;return[`M ${N.x} ${N.y}`,`A ${p} ${p} 0 ${H} 1 ${_.x} ${_.y}`,`L ${E.x} ${E.y}`,`A ${l} ${l} 0 ${H} 0 ${z.x} ${z.y}`,"Z"].join(" ")}function jo(s=[]){const n=s.reduce((p,y)=>p+Number(y.count||0),0)||1;return[{key:"female",group:"性别",name:"母牛合计",color:"#8bf7ff",matcher:(p,y)=>["fertileCow","femaleYoung","overageCow"].includes(p)||y.includes("母")},{key:"male",group:"性别",name:"公牛合计",color:"#30dcff",matcher:(p,y)=>["meatBull","breedingBull","maleYoung"].includes(p)||y.includes("公")||y.includes("肉牛")},{key:"young",group:"阶段",name:"1-2岁牛合计",color:"#8bf7ff",matcher:(p,y)=>["femaleYoung","maleYoung"].includes(p)||y.includes("1-2岁")},{key:"breeding-cow",group:"阶段",name:"能繁母牛",color:"#48cfff",matcher:(p,y)=>["fertileCow","overageCow"].includes(p)||y.includes("能繁母牛")}].map(p=>{const y=s.filter(w=>p.matcher(String(w.key||""),String(w.name||""))).reduce((w,N)=>w+Number(N.count||0),0);return{key:p.key,group:p.group,name:p.name,color:p.color,count:y,percent:y/n*100}})}function Ho(s=[]){const n=s.reduce((p,y)=>p+Number(y.count||0),0)||1,l=(p,y,w,N,_)=>{const E=s.filter(ye=>N(String(ye.key||""),String(ye.name||""))),z=E.reduce((ye,gt)=>ye+Number(gt.count||0),0),H=E.length===1?Number(E[0].ratio):Number.NaN;return{key:p,name:y,color:w,count:z,percent:Number.isFinite(H)&&H>0?H:z/n*100,desc:_}};return[l("fertile-cow","适龄能繁母牛","#30dcff",(p,y)=>p==="fertileCow"||y.includes("适龄能繁母牛"),"繁殖基础"),l("young","1-2岁牛合计","#8bf7ff",(p,y)=>["femaleYoung","maleYoung"].includes(p)||y.includes("1-2岁"),"青年补充"),l("overage-cow","过龄能繁母牛","#30dcff",(p,y)=>p==="overageCow"||y.includes("过龄能繁母牛"),"更新压力"),l("breeding-bull","种公牛配比","#48cfff",(p,y)=>p==="breedingBull"||y.includes("种公牛"),"配种支撑")]}function qo(s=[]){const n=N=>{var _;return Number(((_=s.find(E=>E.key===N))==null?void 0:_.percent)||0)},l=n("fertile-cow"),p=n("young"),y=n("overage-cow"),w=n("breeding-bull");return l>=40&&p>=25&&w>=2&&w<=5&&y<=10?{label:"结构健康",title:"繁殖基础稳定",summary:"适龄母牛足,青年牛补充稳",note:"保持适龄能繁母牛、1-2岁青年牛与种公牛配置稳定。"}:p<25?{label:"结构健康",title:"青年牛补充需关注",summary:"繁殖基础稳定,补充端可优化",note:"关注青年牛承接和季节性补栏,保持生产连续性。"}:w<2?{label:"结构健康",title:"繁殖基础总体稳定",summary:"适龄母牛基础较稳",note:"结合实际配种需求,平稳优化公牛配置。"}:{label:"结构健康",title:"生产阶段较均衡",summary:"繁殖群和青年牛补充连续支撑",note:"延续结构管理,优先保障适龄母牛与青年牛质量。"}}function Uo(s){const n=Number((s==null?void 0:s.count)||0);return Math.max(8,Math.min(100,n/ir.value*100))}function ba(s){if(s==null||s==="")return"--";const n=Number(s);return Number.isFinite(n)?`${n>=0?"+":"-"}${V(Math.abs(n))}`:"--"}return(s,n)=>(b(),L("div",bu,[et((b(),pe(vu,{key:Js.value,ref_key:"mapSceneRef",ref:Ce,class:"yak-map-scene","active-layer":xr.value,"map-ranking":_r.value,"tile-url-template":en.value,"use-satellite-base":gi.value,"satellite-max-zoom":21,"admin-boundary-line-scale":1.35,onLayerStatus:ls,onTileStatus:us},null,8,["active-layer","map-ranking","tile-url-template","use-satellite-base"])),[[tl,!Qe.value]]),Qe.value?(b(),pe(Gl,{key:Ki.value,ref_key:"yakOlMapRef",ref:pa,class:"yak-ol-map-layer",active:a.active&&Qe.value,"tile-url-template":en.value,center:Nr.value,"initial-zoom":Eh,"minimum-zoom-distance":1,"county-view-target-offset":W(se),"admin-boundary-line-scale":1.65,"auto-apply-layer-map-view":!1,"max-zoom":21,"map-ranking":Mn.value,"overlay-layer":Sn.value,onReady:Fo,onLayerStatus:ls,onTileStatus:us},null,8,["active","tile-url-template","center","county-view-target-offset","map-ranking","overlay-layer"])):fe("",!0),h("div",{class:ze(["yak-map-scrim",{"is-ol-map":Qe.value}])},null,2),Rr.value?(b(),L("div",{key:1,class:ze(["yak-map-loading",{"is-timeout":Oe.value}]),role:"status","aria-live":"polite"},[h("strong",null,S(Oe.value?"地图暂未加载完成":Ir.value),1),Oe.value?(b(),L(K,{key:1},[n[24]||(n[24]=h("span",null,"其余业务数据仍可查看,您可以重新加载地图。",-1)),h("button",{type:"button",onClick:Qr},"重新加载地图")],64)):(b(),L("span",wu,"正在准备地图资源,请稍候"))],2)):fe("",!0),h("div",Lu,[D.value==="trade"&&yn.value.length?(b(),L("div",Tu,[n[25]||(n[25]=h("span",null,"交易年份",-1)),(b(!0),L(K,null,le(yn.value,l=>(b(),L("button",{key:l,type:"button",class:ze({active:Number(l)===Number($e.value)}),onClick:p=>To(l)},S(l),11,ku))),128))])):fe("",!0),D.value==="epidemic"&&v.value.length?(b(),L("div",Su,[n[26]||(n[26]=h("span",null,"防疫年份",-1)),(b(!0),L(K,null,le(v.value,l=>(b(),L("button",{key:l,type:"button",class:ze({active:Number(l)===Number(C.value)}),onClick:p=>ko(l)},S(l),11,Mu))),128))])):fe("",!0),D.value==="forecast"&&Re.value.length?(b(),L("div",Pu,[n[27]||(n[27]=h("span",null,"预测年份",-1)),(b(!0),L(K,null,le(Re.value,l=>(b(),L("button",{key:l.key,type:"button",class:ze({active:l.key===_e.value}),onClick:p=>xn(l.key)},S(l.shortLabel),11,Fu))),128))])):fe("",!0),h("div",Cu,[h("div",Nu,[D.value==="structure"?(b(),L(K,{key:0},[J(ie,{class:"yak-side-card left-card",title:"繁殖基础评估",width:W(r),height:u.value},{default:te(()=>[Ge.value?(b(),L("div",xu,"结构数据加载中")):k.value?(b(),L("div",_u,S(k.value),1)):Li.value.length?(b(),L("div",Iu,[h("div",Gu,[h("strong",null,S(nn.value.title)+","+S(nn.value.summary),1)]),h("div",Au,[(b(!0),L(K,null,le(Li.value,l=>(b(),L("div",{key:l.key,class:"breeding-health-item",style:bt({"--health-color":l.color,"--health-width":`${Math.max(5,Math.min(100,l.percent))}%`})},[h("span",null,S(l.name),1),h("strong",null,S(ea(l.percent)),1),n[28]||(n[28]=h("i",null,[h("b")],-1)),h("em",null,S(l.desc),1)],4))),128))])])):(b(),L("div",Ru,"繁殖结构暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"畜群结构占比",width:W(r),height:u.value},{default:te(()=>[h("div",Bu,[h("div",Eu,[h("div",$u,[(b(),L("svg",Vu,[h("g",Du,[(b(!0),L(K,null,le(nr.value,l=>(b(),L("path",{key:l.key,class:ze(["structure-rose-segment",{"is-active":l.index===Ti.value}]),d:l.path,fill:l.color,stroke:l.color},null,10,Ou))),128))]),n[29]||(n[29]=h("circle",{class:"structure-rose-glow",cx:"75",cy:"75",r:"24"},null,-1)),n[30]||(n[30]=h("circle",{class:"structure-rose-hole",cx:"75",cy:"75",r:"16"},null,-1)),n[31]||(n[31]=h("text",{class:"structure-rose-center",x:"75",y:"72","text-anchor":"middle"},"结构",-1)),n[32]||(n[32]=h("text",{class:"structure-rose-center is-sub",x:"75",y:"83","text-anchor":"middle"},"占比",-1))]))]),h("div",zu,[(b(!0),L(K,null,le(ya.value,(l,p)=>(b(),L("div",{key:l.key||l.name,class:ze(["structure-ratio-row",{"is-active":p===Ti.value}]),style:bt({"--row-color":l.color,"--row-percent":`${Math.max(4,l.percent)}%`})},[h("i",{style:bt({background:l.color,color:l.color})},null,4),h("span",null,[Wt(S(l.name),1),h("small",null,S(ea(l.percent)),1)]),h("strong",null,S(oe(l.count)),1),n[33]||(n[33]=h("em",null,"头",-1))],6))),128))])]),Ge.value?(b(),L("div",Wu,"结构数据加载中")):k.value?(b(),L("div",Yu,S(k.value),1)):fe("",!0)])]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"母牛/公牛年龄结构",width:W(r),height:u.value},{default:te(()=>[Ge.value?(b(),L("div",ju,"结构数据加载中")):k.value?(b(),L("div",Hu,S(k.value),1)):Da.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Gr.value,autoresize:!0},null,8,["option"])):(b(),L("div",qu,"年龄结构暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"牦牛乡镇分布",width:W(r),height:u.value},{default:te(()=>[Ge.value?(b(),L("div",Uu,"结构数据加载中")):k.value?(b(),L("div",Ku,S(k.value),1)):Nt.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Ar.value,autoresize:!0},null,8,["option"])):(b(),L("div",Zu,"乡镇结构暂无数据"))]),_:1},8,["width","height"])],64)):D.value==="forecast"?(b(),L(K,{key:1},[J(ie,{class:"yak-side-card left-card",title:"预测数据概览",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",Xu,"预测数据加载中")):ae.value?(b(),L("div",Ju,S(ae.value),1)):bi.value?(b(),L("div",ec,[h("div",tc,[h("span",null,S(yi.value.label)+"真实源数据",1),h("strong",{class:ze({positive:vi.value>0,negative:vi.value<0})},[Wt(" 环比 "+S(ba(vi.value)),1),n[34]||(n[34]=h("em",null,"头",-1))],2)]),h("div",ac,[(b(!0),L(K,null,le(Qs.value,l=>(b(),L("div",{key:l.key,class:ze(["forecast-waterfall-row",[`is-${l.type}`,{positive:l.delta>0,negative:l.delta<0}]]),style:bt({"--waterfall-left":"0%","--waterfall-width":`${l.width}%`,"--waterfall-color":l.color})},[h("span",null,S(l.name),1),n[35]||(n[35]=h("i",null,[h("b")],-1)),h("strong",null,S(l.display),1)],6))),128))])])):(b(),L("div",Qu,"预测数据暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"月度预测趋势",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",ic,"预测数据加载中")):ae.value?(b(),L("div",nc,S(ae.value),1)):Xt.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Vr.value,autoresize:!0},null,8,["option"])):(b(),L("div",sc,"月度预测暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"月度数量与增长值",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",rc,"预测数据加载中")):ae.value?(b(),L("div",oc,S(ae.value),1)):Xt.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Dr.value,autoresize:!0},null,8,["option"])):(b(),L("div",lc,"月度预测暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"数据覆盖与口径",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",uc,"预测数据加载中")):ae.value?(b(),L("div",cc,S(ae.value),1)):tn.value.length?(b(),L("div",hc,[(b(!0),L(K,null,le(tn.value,l=>(b(),L("div",{key:l.key,class:"forecast-waterfall-row is-anchor",style:bt({"--waterfall-left":"0%","--waterfall-width":`${l.width}%`,"--waterfall-color":l.color})},[h("span",null,S(l.name),1),n[36]||(n[36]=h("i",null,[h("b")],-1)),h("strong",null,S(l.display),1)],4))),128))])):(b(),L("div",dc,"数据覆盖信息暂无数据"))]),_:1},8,["width","height"])],64)):D.value==="epidemic"?(b(),L(K,{key:2},[J(ie,{class:"yak-side-card left-card",title:"防疫统计",width:W(r),height:u.value},{default:te(()=>[ce.value?(b(),L("div",pc,"防疫数据加载中")):ue.value?(b(),L("div",fc,S(ue.value),1)):dn.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:qr.value,autoresize:!0},null,8,["option"])):(b(),L("div",mc,"防疫统计暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"养殖户防疫排行",width:W(r),height:u.value},{default:te(()=>[ce.value?(b(),L("div",yc,"防疫数据加载中")):ue.value?(b(),L("div",gc,S(ue.value),1)):on.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Ur.value,autoresize:!0},null,8,["option"])):(b(),L("div",vc,"养殖户防疫排行暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"防疫作业趋势",width:W(r),height:u.value},{default:te(()=>[ce.value?(b(),L("div",bc,"防疫数据加载中")):ue.value?(b(),L("div",wc,S(ue.value),1)):sn.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Hr.value,autoresize:!0},null,8,["option"])):(b(),L("div",Lc,"防疫作业趋势暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"疫苗类型分布",width:W(r),height:u.value},{default:te(()=>[ce.value?(b(),L("div",Tc,"防疫数据加载中")):ue.value?(b(),L("div",kc,S(ue.value),1)):Oa.value.length?(b(),L("div",Sc,[h("div",Mc,[(b(),pe(vl,{key:rr.value,data:Oa.value,delay:3e3,colors:Se,opacity:.62,class:"epidemic-three-pie"},{default:te(({data:l})=>[h("div",Pc,[h("strong",null,S(oe((l==null?void 0:l.count)||ln.value)),1),h("span",null,S((l==null?void 0:l.name)||"疫苗类型"),1)])]),_:1},8,["data"]))]),h("div",Fc,[(b(!0),L(K,null,le(Oa.value,(l,p)=>(b(),L("div",{key:l.key||l.name,class:"epidemic-three-pie-row"},[h("i",{style:bt({borderColor:Se[p%Se.length]})},null,4),h("span",null,S(l.name),1),h("strong",null,S(oe(l.value)),1),h("em",null,S(l.unit),1)]))),128))])])):(b(),L("div",Cc,"暂无疫苗类型数据"))]),_:1},8,["width","height"])],64)):D.value==="trade"?(b(),L(K,{key:3},[J(ie,{class:"yak-side-card left-card",title:"交易流通要点",width:W(r),height:u.value},{default:te(()=>[h("div",Nc,[Je.value?(b(),L("div",xc,"交易数据加载中")):be.value?(b(),L("div",_c,S(be.value),1)):Tn.value.length?(b(),L(K,{key:3},[h("div",Ic,[h("span",null,S($e.value)+"年真实台账汇总",1),h("strong",null,S(wr.value),1)]),h("div",Gc,[(b(!0),L(K,null,le(Tn.value,l=>(b(),L("div",{key:l.key,class:"trade-risk-row",style:bt({"--risk-color":l.color})},[n[37]||(n[37]=h("i",null,null,-1)),h("span",null,[h("em",null,[h("b",null,S(l.badge),1),Wt(S(l.name),1)]),h("small",null,S(l.value)+"|"+S(l.desc),1)])],4))),128))])],64)):(b(),L("div",Rc,S(de.value.emptyMessage||"暂无交易流通数据"),1))])]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"交易流通趋势",width:W(r),height:u.value},{default:te(()=>[Je.value?(b(),L("div",Ac,"交易数据加载中")):be.value?(b(),L("div",Bc,S(be.value),1)):gn.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Kr.value,autoresize:!0},null,8,["option"])):(b(),L("div",Ec,"暂无月度交易数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"来源乡镇分布",width:W(r),height:u.value},{default:te(()=>[Je.value?(b(),L("div",$c,"交易数据加载中")):be.value?(b(),L("div",Vc,S(be.value),1)):za.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Zr.value,autoresize:!0},null,8,["option"])):(b(),L("div",Dc,"暂无来源乡镇数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card left-card",title:"用途结构统计",width:W(r),height:u.value},{default:te(()=>[Je.value?(b(),L("div",Oc,"交易数据加载中")):be.value?(b(),L("div",zc,S(be.value),1)):Si.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Xr.value,autoresize:!0},null,8,["option"])):(b(),L("div",Wc,"暂无交易用途数据"))]),_:1},8,["width","height"])],64)):fe("",!0)])]),h("div",Yc,[h("div",jc,[D.value==="structure"?(b(),L(K,{key:0},[J(ie,{class:"yak-side-card right-card",title:"乡镇存栏排行",width:W(r),height:u.value},{default:te(()=>[Ge.value?(b(),L("div",Hc,"结构数据加载中")):k.value?(b(),L("div",qc,S(k.value),1)):Nt.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Br.value,autoresize:!0},null,8,["option"])):(b(),L("div",Uc,"乡镇结构暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card",title:"能繁母牛与犊牛分布",width:W(r),height:u.value},{default:te(()=>[Ge.value?(b(),L("div",Kc,"结构数据加载中")):k.value?(b(),L("div",Zc,S(k.value),1)):kn.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Er.value,autoresize:!0},null,8,["option"])):(b(),L("div",Xc,"母牛与犊牛明细暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card",title:"年度交易流通",width:W(r),height:u.value},{default:te(()=>[Je.value?(b(),L("div",Jc,"交易数据加载中")):be.value?(b(),L("div",Qc,S(be.value),1)):vn.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:$r.value,autoresize:!0},null,8,["option"])):(b(),L("div",ed,"暂无年度交易数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card",title:"性别与生产阶段汇总",width:W(r),height:u.value},{default:te(()=>[h("div",td,[ya.value.length?(b(),L("div",ad,[(b(!0),L(K,null,le(an.value,l=>(b(),L("div",{key:l.key||l.name,class:"structure-summary-row",style:bt({"--structure-color":l.color,"--structure-width":`${Uo(l)}%`})},[h("span",null,[n[38]||(n[38]=h("i",null,null,-1)),Wt(S(l.name),1)]),n[40]||(n[40]=h("b",null,[h("em")],-1)),h("strong",null,[Wt(S(oe(l.count)),1),n[39]||(n[39]=h("em",null,"头",-1))]),h("small",null,S(ea(l.percent)),1)],4))),128))])):fe("",!0),Ge.value?(b(),L("div",id,"结构数据加载中")):k.value?(b(),L("div",nd,S(k.value),1)):fe("",!0)])]),_:1},8,["width","height"])],64)):D.value==="forecast"?(b(),L(K,{key:1},[J(ie,{class:"yak-side-card right-card",title:"最新月乡镇预测排行",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",sd,"预测数据加载中")):ae.value?(b(),L("div",rd,S(ae.value),1)):Jt.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Or.value,autoresize:!0},null,8,["option"])):(b(),L("div",od,"乡镇预测暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card",title:"最新月乡镇占比",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",ld,"预测数据加载中")):ae.value?(b(),L("div",ud,S(ae.value),1)):Jt.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:zr.value,autoresize:!0},null,8,["option"])):(b(),L("div",cd,"乡镇预测暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card",title:"各年度最新月对比",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",dd,"预测数据加载中")):ae.value?(b(),L("div",hd,S(ae.value),1)):Ve.value.length?(b(),pe(W(ke),{key:3,class:"yak-chart",option:Wr.value,autoresize:!0},null,8,["option"])):(b(),L("div",pd,"年度对比暂无数据"))]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card",title:"乡镇环比变化",width:W(r),height:u.value},{default:te(()=>[Le.value?(b(),L("div",fd,"预测数据加载中")):ae.value?(b(),L("div",md,S(ae.value),1)):Pn.value.length?(b(),L("div",gd,[(b(!0),L(K,null,le(Pn.value,l=>(b(),L("div",{key:l.name,class:ze(["heat-row",{"is-negative":l.change<0}]),style:bt(Yr(l)),title:jr(l)},[h("span",null,S(l.name),1),n[41]||(n[41]=h("b",null,[h("i")],-1)),h("strong",null,S(ba(l.change)),1)],14,vd))),128))])):(b(),L("div",yd,"乡镇环比暂无数据"))]),_:1},8,["width","height"])],64)):D.value==="epidemic"?(b(),pe(ie,{key:2,class:"yak-side-card right-card epidemic-ledger-card",title:"防疫记录台账",width:W(r),height:d.value},{default:te(()=>[h("div",bd,[h("div",wd,[h("span",null,S(C.value)+"年 共 "+S(V(U.value))+" 条",1),h("div",null,[et(h("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>Me.value=l),type:"search",placeholder:"耳标/养殖户/疫苗",onKeyup:Xa(Jn,["enter"])},null,544),[[ta,Me.value]]),h("button",{type:"button",onClick:Jn},"搜索"),h("button",{type:"button",class:"is-more",onClick:n[1]||(n[1]=l=>es())},"查看更多")])]),n[42]||(n[42]=h("div",{class:"epidemic-record-header"},[h("span",null,"电子耳标"),h("span",null,"养殖户"),h("span",null,"镇/乡"),h("span",null,"疫苗"),h("span",null,"时间")],-1)),h("div",Ld,[(b(!0),L(K,null,le(lr.value,l=>(b(),L("button",{key:l.epidemicId||l.earTag,type:"button",onClick:p=>es(l)},[h("span",null,S(Z(l.earTag)),1),h("span",null,S(Z(l.owner)),1),h("span",null,S(Z(l.town)),1),h("strong",null,S(Z(l.medicine)),1),h("span",null,S($t(l.operateTime)),1)],8,Td))),128)),$.value.length?fe("",!0):(b(),L("div",kd,S(ce.value?"防疫台账读取中":Te.value||ue.value||"暂无防疫记录"),1))]),h("div",Sd,[h("span",null,"第 "+S(ee.value)+" / "+S(ki.value)+" 页",1),h("button",{type:"button",disabled:ee.value<=1,onClick:n[2]||(n[2]=l=>Qn(ee.value-1))},"上一页",8,Md),h("button",{type:"button",disabled:ee.value>=ki.value,onClick:n[3]||(n[3]=l=>Qn(ee.value+1))},"下一页",8,Pd)])])]),_:1},8,["width","height"])):D.value==="trade"?(b(),L(K,{key:3},[J(ie,{class:"yak-side-card right-card",title:"出证结构统计",width:W(r),height:u.value},{default:te(()=>[h("div",Fd,[Je.value?(b(),L("div",Cd,"交易数据加载中")):be.value?(b(),L("div",Nd,S(be.value),1)):hr.value.length?(b(),L(K,{key:3},[h("div",_d,[h("span",null,[n[44]||(n[44]=h("em",null,"省外流通 A证",-1)),h("strong",null,[Wt(S(V(mt("outProvinceHeads","aCertHeads"))),1),n[43]||(n[43]=h("b",null,"头",-1))]),h("small",null,S(V(mt("outProvinceCount","aCertCount")))+"条记录",1)]),h("span",null,[n[46]||(n[46]=h("em",null,"省内流通 B证",-1)),h("strong",null,[Wt(S(V(mt("inProvinceHeads","bCertHeads"))),1),n[45]||(n[45]=h("b",null,"头",-1))]),h("small",null,S(V(mt("inProvinceCount","bCertCount")))+"条记录",1)])]),J(W(ke),{class:"trade-cert-chart",option:Jr.value,autoresize:!0},null,8,["option"])],64)):(b(),L("div",xd,"暂无出证结构数据"))])]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card trade-source-card",title:"出栏来源排行",width:W(r),height:c.value},{default:te(()=>[h("div",Rd,[(b(!0),L(K,null,le(Wa.value,(l,p)=>(b(),L("div",{key:l.name,class:"trade-dest-row",style:bt({"--trade-ratio":`${l.ratio}%`})},[h("span",null,S(p+1),1),h("strong",null,S(l.name),1),h("em",null,S(oe(l.headCount))+"头",1)],4))),128)),Wa.value.length?fe("",!0):(b(),L("div",Id,S(Je.value?"交易数据读取中":be.value||"暂无出栏来源数据"),1))])]),_:1},8,["width","height"]),J(ie,{class:"yak-side-card right-card trade-ledger-card",title:"交易出证台账",width:W(r),height:f.value},{default:te(()=>[h("div",Gd,[h("div",Ad,[h("span",null,"共 "+S(V(Gt.value))+" 条",1),h("div",null,[et(h("input",{"onUpdate:modelValue":n[4]||(n[4]=l=>Ia.value=l),type:"search",placeholder:"货主/车辆/检疫号/地区",onKeyup:Xa(Wn,["enter"])},null,544),[[ta,Ia.value]]),h("button",{type:"button",onClick:Wn},"搜索"),h("button",{type:"button",class:"is-more",onClick:n[5]||(n[5]=l=>jn())},"查看更多")])]),n[47]||(n[47]=h("div",{class:"trade-ledger-header"},[h("span",null,"货主"),h("span",null,"车牌"),h("span",null,"数量"),h("span",null,"来源"),h("span",null,"用途"),h("span",null,"时间")],-1)),h("div",Bd,[(b(!0),L(K,null,le(Ln.value,l=>(b(),L("button",{key:l.certId,type:"button",onClick:p=>jn(l)},[h("span",null,S(Z(l.ownerName)),1),h("span",null,S(Z(l.transportNumber)),1),h("strong",null,S(V(l.amount))+"头",1),h("span",null,S(Z(l.startTown)),1),h("span",null,S(Z(l.usageTypeName)),1),h("span",null,S($t(l.issueTime)),1)],8,Ed))),128)),Ln.value.length?fe("",!0):(b(),L("div",$d,S(Je.value?"交易台账读取中":Ra.value||be.value||"暂无交易记录"),1))]),h("div",Vd,[h("span",null,"第 "+S(ht.value)+" / "+S(Mi.value)+" 页",1),h("button",{type:"button",disabled:ht.value<=1,onClick:n[6]||(n[6]=l=>Yn(ht.value-1))},"上一页",8,Dd),h("button",{type:"button",disabled:ht.value>=Mi.value,onClick:n[7]||(n[7]=l=>Yn(ht.value+1))},"下一页",8,Od)])])]),_:1},8,["width","height"])],64)):fe("",!0)])]),h("div",zd,[J(_l,{"model-value":D.value,topics:je,"onUpdate:modelValue":n[8]||(n[8]=l=>D.value=l)},null,8,["model-value"])]),Qe.value?(b(),L("div",Wd,[J(Rl,{modelValue:He.value,"onUpdate:modelValue":n[9]||(n[9]=l=>He.value=l),"topic-key":"yak-management",layers:Sr.value,legends:Pr.value,multiple:"",compact:"",width:248,height:Fr.value},null,8,["modelValue","layers","legends","height"])])):fe("",!0)]),Ze.value?(b(),L("div",{key:2,class:"epidemic-ledger-modal",onClick:Ja(ts,["self"])},[h("div",Yd,[h("div",jd,[h("div",null,[n[48]||(n[48]=h("span",null,"牦牛防疫台账",-1)),h("strong",null,S(C.value)+"年 "+S(V(De.value))+" 条记录",1)]),h("button",{type:"button",onClick:ts},"关闭")]),h("div",Hd,[et(h("input",{"onUpdate:modelValue":n[10]||(n[10]=l=>Ee.value.keyword=l),type:"search",placeholder:"耳标 / 养殖户 / 药品","aria-label":"耳标 / 养殖户 / 药品",onKeyup:Xa(as,["enter"])},null,544),[[ta,Ee.value.keyword]]),et(h("select",{"onUpdate:modelValue":n[11]||(n[11]=l=>Ee.value.town=l)},[n[49]||(n[49]=h("option",{value:""},"全部镇/乡",-1)),(b(!0),L(K,null,le(cr.value,l=>(b(),L("option",{key:l,value:l},S(l),9,qd))),128))],512),[[Ma,Ee.value.town]]),et(h("select",{"onUpdate:modelValue":n[12]||(n[12]=l=>Ee.value.medicine=l)},[n[50]||(n[50]=h("option",{value:""},"全部疫苗",-1)),(b(!0),L(K,null,le(dr.value,l=>(b(),L("option",{key:l,value:l},S(l),9,Ud))),128))],512),[[Ma,Ee.value.medicine]]),et(h("input",{"onUpdate:modelValue":n[13]||(n[13]=l=>Ee.value.startDate=l),type:"date"},null,512),[[ta,Ee.value.startDate]]),et(h("input",{"onUpdate:modelValue":n[14]||(n[14]=l=>Ee.value.endDate=l),type:"date"},null,512),[[ta,Ee.value.endDate]]),h("button",{type:"button",onClick:as},"检索"),h("button",{type:"button",class:"is-ghost",onClick:Po},"重置")]),h("div",Kd,[h("div",Zd,[n[51]||(n[51]=h("div",{class:"epidemic-ledger-table-head"},[h("span",null,"电子耳标"),h("span",null,"养殖户"),h("span",null,"镇/乡"),h("span",null,"村"),h("span",null,"疫苗"),h("span",null,"免疫时间"),h("span",null,"图片")],-1)),(b(!0),L(K,null,le(Ae.value,l=>{var p,y;return b(),L("button",{key:l.epidemicId||l.earTag,type:"button",class:ze({active:(((p=Xe.value)==null?void 0:p.epidemicId)||((y=Xe.value)==null?void 0:y.earTag))===(l.epidemicId||l.earTag)}),onClick:w=>ns(l)},[h("span",null,S(Z(l.earTag)),1),h("span",null,S(Z(l.owner)),1),h("span",null,S(Z(l.town)),1),h("span",null,S(Z(l.village)),1),h("strong",null,S(Z(l.medicine)),1),h("span",null,S($t(l.operateTime)),1),h("span",null,S(Gi(l).length?`${Gi(l).length}张`:"无"),1)],10,Xd)}),128)),Ae.value.length?fe("",!0):(b(),L("div",Jd,S(nt.value?"台账读取中":St.value||"暂无匹配记录"),1))]),h("div",Qd,[h("div",eh,[h("div",null,[h("span",null,S(Z(Bt.value.earTag)),1),h("em",null,S(Z(Bt.value.medicine||Bt.value.preventionType)),1)]),h("strong",null,S(Pt.value?"加载中":$t(Bt.value.operateTime)),1)]),h("div",th,[(b(!0),L(K,null,le(ur.value,l=>(b(),L("span",{key:l.label,class:ze({"is-wide":l.wide})},[h("em",null,S(l.label),1),h("strong",null,S(l.value),1)],2))),128))]),pn.value.length?(b(),L("div",ah,[n[52]||(n[52]=h("div",{class:"epidemic-detail-photo-title"},"现场照片",-1)),h("div",ih,[(b(!0),L(K,null,le(pn.value.slice(0,6),l=>(b(),L("button",{key:l,type:"button",class:"epidemic-modal-photo-thumb",onClick:Ja(p=>yo(l),["stop"])},[h("img",{src:$n(l),alt:"防疫照片"},null,8,sh)],8,nh))),128))])])):fe("",!0)])]),h("div",rh,[h("span",null,"第 "+S(Fe.value)+" / "+S(hn.value)+" 页",1),h("button",{type:"button",disabled:Fe.value<=1,onClick:n[15]||(n[15]=l=>is(Fe.value-1))},"上一页",8,oh),h("button",{type:"button",disabled:Fe.value>=hn.value,onClick:n[16]||(n[16]=l=>is(Fe.value+1))},"下一页",8,lh)])])])):fe("",!0),di.value?(b(),L("div",{key:3,class:"epidemic-ledger-modal trade-ledger-modal",onClick:Ja(Hn,["self"])},[h("div",uh,[h("div",ch,[h("div",null,[n[53]||(n[53]=h("span",null,"牦牛交易出证台账",-1)),h("strong",null,S($e.value)+"年 "+S(V(da.value))+" 条记录",1)]),h("button",{type:"button",onClick:Hn},"关闭")]),h("div",dh,[et(h("input",{"onUpdate:modelValue":n[17]||(n[17]=l=>pt.value.keyword=l),type:"search",placeholder:"货主 / 车辆 / 检疫号 / 地区",onKeyup:Xa(qn,["enter"])},null,544),[[ta,pt.value.keyword]]),et(h("select",{"onUpdate:modelValue":n[18]||(n[18]=l=>pt.value.startTown=l)},[n[54]||(n[54]=h("option",{value:""},"全部来源乡镇",-1)),(b(!0),L(K,null,le(yr.value,l=>(b(),L("option",{key:l,value:l},S(l),9,hh))),128))],512),[[Ma,pt.value.startTown]]),et(h("select",{"onUpdate:modelValue":n[19]||(n[19]=l=>pt.value.usageType=l)},[n[55]||(n[55]=h("option",{value:""},"全部用途",-1)),(b(!0),L(K,null,le(gr.value,l=>(b(),L("option",{key:l,value:l},S(l),9,ph))),128))],512),[[Ma,pt.value.usageType]]),et(h("select",{"onUpdate:modelValue":n[20]||(n[20]=l=>pt.value.certType=l)},[n[56]||(n[56]=h("option",{value:""},"全部证书",-1)),(b(!0),L(K,null,le(vr.value,l=>(b(),L("option",{key:l.value,value:l.value},S(l.label),9,fh))),128))],512),[[Ma,pt.value.certType]]),h("button",{type:"button",onClick:qn},"检索"),h("button",{type:"button",class:"is-ghost",onClick:So},"重置")]),h("div",mh,[h("div",yh,[n[57]||(n[57]=h("div",{class:"trade-ledger-modal-table-head"},[h("span",null,"货主"),h("span",null,"证书"),h("span",null,"车牌号"),h("span",null,"数量"),h("span",null,"来源"),h("span",null,"用途"),h("span",null,"出证时间"),h("span",null,"状态")],-1)),(b(!0),L(K,null,le(Ft.value,l=>(b(),L("button",{key:l.certId||l.factoryCode,type:"button",class:ze({active:mr.value===(l.certId||l.factoryCode)}),onClick:p=>Kn(l)},[h("span",null,S(Z(l.ownerName)),1),h("span",null,S(Z(l.certType||l.certScopeName)),1),h("span",null,S(Z(l.transportNumber)),1),h("strong",null,S(V(l.amount))+"头",1),h("span",null,S(Z(l.startTown)),1),h("span",null,S(Z(l.usageTypeName)),1),h("span",null,S($t(l.issueTime)),1),h("span",null,S(Z(l.statusName)),1)],10,gh))),128)),Ft.value.length?fe("",!0):(b(),L("div",vh,S(hi.value?"交易台账读取中":pi.value||"暂无匹配记录"),1))]),h("div",bh,[h("div",wh,[h("div",null,[h("span",null,S(Z(he.value.factoryCode||he.value.certId)),1),h("em",null,S(Dn(he.value)),1)]),h("strong",null,S($t(he.value.issueTime)),1)]),h("div",Lh,[h("span",Th,[n[58]||(n[58]=h("em",null,"货主",-1)),h("strong",null,S(Z(he.value.ownerName)),1)]),h("span",null,[n[59]||(n[59]=h("em",null,"联系方式",-1)),h("strong",null,S(Vn(he.value.ownerPhone)),1)]),h("span",null,[n[60]||(n[60]=h("em",null,"证书类型",-1)),h("strong",null,S(Dn(he.value)),1)]),h("span",null,[n[61]||(n[61]=h("em",null,"车牌号",-1)),h("strong",null,S(Z(he.value.transportNumber)),1)]),h("span",null,[n[62]||(n[62]=h("em",null,"牦牛数量",-1)),h("strong",null,S(V(he.value.amount))+"头",1)]),h("span",null,[n[63]||(n[63]=h("em",null,"用途",-1)),h("strong",null,S(Z(he.value.usageTypeName)),1)]),h("span",null,[n[64]||(n[64]=h("em",null,"来源乡镇",-1)),h("strong",null,S(Z(he.value.startTown)),1)]),h("span",null,[n[65]||(n[65]=h("em",null,"目的省份",-1)),h("strong",null,S(Z(he.value.destProvince)),1)]),h("span",null,[n[66]||(n[66]=h("em",null,"检疫员",-1)),h("strong",null,S(Z(he.value.quarantineOfficerName)),1)]),h("span",kh,[n[67]||(n[67]=h("em",null,"状态",-1)),h("strong",null,S(Z(he.value.statusName)),1)]),h("span",Sh,[n[68]||(n[68]=h("em",null,"来源地区",-1)),h("strong",null,S(Z(he.value.startRegionFullName)),1)]),h("span",Mh,[n[69]||(n[69]=h("em",null,"目的地",-1)),h("strong",null,S(Z(he.value.destRegionFullName)),1)])]),h("button",{type:"button",class:"trade-detail-locate",disabled:!he.value.startTown,onClick:n[21]||(n[21]=l=>Mo(he.value))}," 查看乡镇位置 ",8,Ph)])]),h("div",Fh,[h("span",null,"第 "+S(At.value)+" / "+S(Pi.value)+" 页",1),h("button",{type:"button",disabled:At.value<=1,onClick:n[22]||(n[22]=l=>Un(At.value-1))},"上一页",8,Ch),h("button",{type:"button",disabled:At.value>=Pi.value,onClick:n[23]||(n[23]=l=>Un(At.value+1))},"下一页",8,Nh)])])])):fe("",!0),Kt.value?(b(),L("div",{key:4,class:"epidemic-image-preview-modal",onClick:Ja(Ai,["self"])},[h("div",xh,[h("div",_h,[h("div",null,[n[70]||(n[70]=h("span",null,"防疫照片",-1)),h("strong",null,S(Z(Bt.value.earTag)),1)]),h("button",{type:"button",onClick:Ai},"关闭")]),h("div",Rh,[h("div",Ih,[h("img",{src:ui.value,alt:"防疫照片预览"},null,8,Gh)])])])])):fe("",!0)]))}};export{ap as default};