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-ce6f7849-178651256475...

115 lines
254 KiB

var Ko=Object.defineProperty,Zo=Object.defineProperties;var Xo=Object.getOwnPropertyDescriptors;var ds=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable;var Sa=Math.pow,hs=(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)&&hs(g,t,e[t]);if(ds)for(var t of ds(e))Qo.call(e,t)&&hs(g,t,e[t]);return g},O=(g,e)=>Zo(g,Xo(e));var re=(g,e,t)=>new Promise((a,n)=>{var r=c=>{try{u(t.next(c))}catch(d){n(d)}},o=c=>{try{u(t.throw(c))}catch(d){n(d)}},u=c=>c.done?a(c.value):Promise.resolve(c.value).then(r,o);u((t=t.apply(g,e)).next())});import{q as Hs,h as qs,w as qt,o as b,c as T,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 Y,j as fe,n as ze,t as S,F as K,y as le,b as J,x as ae,K as bt,B as Wt,e as Xa,H as ta,f as Ja,O as Ma}from"./index-1786512564754.js";import{H as ke}from"./index.esm.min-d1465927-1786512564754.js";import{_ as ne}from"./index-30e79df6-1786512564754.js";import{t as Yi,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 $i,L as aa,D as Ne,a as me,h as Qa,R as ot,A as xe,N as ps,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 fs,H as ms,I as yl,J as ys,q as gs,r as gl,s as vs,K as Ca,U as Vi,W as bs,M as vl}from"./screen2Standard-f89de86b-1786512564754.js";import{g as Ht,M as bl,h as wl,L as Ll,B as Fa,a as sa,E as ws,G as ei,D as Tl,b as kl,l as Sl,P as Ls,c as Ts}from"./three.interactive-4fcb832e-1786512564754.js";import{g as ra}from"./index-e9f36657-1786512564754.js";import{h as Ml,a as Us,S as Pl,W as Rt,H as j,j as Di,k as Cl,l as Fl,m as Nl}from"./townshipBoundaries-8d64be19-1786512564754.js";import{b as xl,g as ks,a as Ss,c as _l}from"./geoserver-dfffb06f-1786512564754.js";import{_ as Rl}from"./TopicSwitcher-6338ac9d-1786512564754.js";import{_ as Il}from"./LayerPanel-0afc92c5-1786512564754.js";import{A as Gl}from"./assets-99019aa4-1786512564754.js";import{M as Al}from"./index-369d6a27-1786512564754.js";import{g as Bl,a as El,b as $l,c as Ms,d as Vl,e as Oi,f as Dl}from"./yakApi-c7dfe87a-1786512564754.js";import"./index-749a1b46-1786512564754.js";const Ol=Ml.map(g=>A({},g)),Ps=Us.map(g=>A({},g)),zl=Us.map(g=>{var e,t;return{name:g.name,value:g.value,lng:(e=g.center)==null?void 0:e[0],lat:(t=g.center)==null?void 0:t[1]}}),Wl=[{name:"邛溪镇",level:"县城驻地",value:895.94,lng:102.60242339873115,lat:32.83022561372293},{name:"瓦切镇",level:"北部牧区",value:991,lng:102.71535664604494,lat:33.12869670968013},{name:"刷经寺镇",level:"南部通道",value:986.44,lng:102.55651980382184,lat:32.204097908180216},{name:"色地镇",level:"东部片区",value:1199.06,lng:103.12540730227074,lat:33.010462261362875}],ua=256,ji="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",Yl=900,jl=10,Ut=new Map,ca={west:101.852492,south:31.851389,east:103.347518,north:33.319796};function zi(g,e,t){const a=Sa(2,t),n=Math.sin(e*Math.PI/180);return{x:(g+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function Cs(g,e,t){const a=Sa(2,t),n=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[n,o]}function ti(g,e,t){return Math.max(e,Math.min(t,g))}function Ks(g,e,{centerLngLat:t,maxCols:a,maxRows:n}={}){const r=zi(g.west,g.north,e),o=zi(g.east,g.south,e),u=Math.floor(r.x),c=Math.floor(o.x),d=Math.floor(r.y),m=Math.floor(o.y);let f=u,L=c,M=d,C=m,x=Math.floor((u+c)/2),G=Math.floor((d+m)/2);if(t&&Number.isFinite(a)&&Number.isFinite(n)){const z=ti(Number(t[0]),g.west,g.east),Z=ti(Number(t[1]),g.south,g.north),ee=zi(z,Z,e);x=Math.floor(ee.x),G=Math.floor(ee.y);const q=Math.max(1,Math.min(Math.floor(a),c-u+1)),R=Math.max(1,Math.min(Math.floor(n),m-d+1));f=ti(x-Math.floor(q/2),u,c-q+1),M=ti(G-Math.floor(R/2),d,m-R+1),L=f+q-1,C=M+R-1}return{zoom:e,minX:f,maxX:L,minY:M,maxY:C,centerX:x,centerY:G,cols:L-f+1,rows:C-M+1}}function Hl({zoom:g=11,centerLngLat:e,maxCols:t,maxRows:a,bounds:n=ca}={}){return Ks(n,g,{centerLngLat:e,maxCols:t,maxRows:a})}function ql(g,e){const[t,a]=Cs(g.minX,g.minY,g.zoom),[n,r]=Cs(g.maxX+1,g.maxY+1,g.zoom),[o]=e([t,ca.south]),[u]=e([n,ca.south]),[,c]=e([ca.west,a]),[,d]=e([ca.west,r]);return{left:o,right:u,bottom:-d,top:-c}}function Ul(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 n=g.createRadialGradient(t*.5,a*.48,t*.1,t*.5,a*.5,t*.72);n.addColorStop(0,"rgba(80, 230, 255, 0.16)"),n.addColorStop(1,"rgba(0, 18, 36, 0.03)"),g.fillStyle=n,g.fillRect(0,0,t,a),g.restore()}function Kl(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 Zl(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 Xl(g){const e=Ut.get(g);if(e)return e;const t=Zl(g);for(Ut.set(g,t);Ut.size>Yl;){const a=Ut.keys().next().value;if(!a)break;Ut.delete(a)}return t}function Jl(g,e,t,a=ji){return String(a||ji).replace(/\{x\}/g,g).replace(/\{y\}/g,e).replace(/\{z\}/g,t)}function Ql(u,c,d,m){return re(this,arguments,function*(g,e,t,a,{tileUrlTemplate:n,onTileStatus:r,applyTone:o=!0}={}){const f=[],L=a.cols*a.rows;let M=0,C=0;r==null||r({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:M,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n}),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)f.push({x:q,y:R});f.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<f.length;){const q=f[x];x+=1;const R=yield Xl(Jl(q.x,q.y,a.zoom,n));R?(M+=1,g.drawImage(R,(q.x-a.minX)*ua,(q.y-a.minY)*ua,ua,ua),t.needsUpdate=!0):C+=1,r==null||r({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:M,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n})}})}yield Promise.all(Array.from({length:Math.min(jl,f.length)},G)),g.restore(),o&&Ul(g,e),t.needsUpdate=!0;const z=L>0?M/L:0,Z=M===0?"error":z>=.75?"success":"warning",ee=M===L?`${a.zoom}级影像底图已加载`:M>0?`${a.zoom}级影像底图已加载(${M}/${L}张有效瓦片)`:`${a.zoom}级影像底图加载失败`;r==null||r({type:Z,text:ee,loaded:M,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n})})}function Fs({geoProjectionCenter:g,geoProjectionScale:e,zoom:t=11,tileUrlTemplate:a=ji,onTileStatus:n,centerLngLat:r,maxCols:o,maxRows:u,transparentBackground:c=!1,applyTone:d=!0}={}){const m=Ks(ca,t,{centerLngLat:r,maxCols:o,maxRows:u}),f=document.createElement("canvas");f.width=m.cols*ua,f.height=m.rows*ua;const L=f.getContext("2d");c?L.clearRect(0,0,f.width,f.height):Kl(L,f);const M=new Yi(f);M.colorSpace=la,M.wrapS=oi,M.wrapT=oi,M.minFilter=_a,M.magFilter=_a,M.needsUpdate=!0;const C=Ht().center(g).scale(e).translate([0,0]),x=ql(m,C);return Ql(L,f,M,m,{tileUrlTemplate:a,onTileStatus:n,applyTone:d}).catch(G=>{console.warn("load satellite tiles failed:",G),n==null||n({type:"error",text:`${m.zoom}级影像底图加载失败`,loaded:0,failed:m.cols*m.rows,total:m.cols*m.rows,zoom:m.zoom,tileRange:m,tileUrlTemplate:a})}),{texture:M,uvBounds:x,tileRange:m}}function Ns(g,e){const t=e.right-e.left,a=e.top-e.bottom;g.mapGroup.traverse(n=>{var u,c;const r=(c=(u=n.geometry)==null?void 0:u.attributes)==null?void 0:c.position;if(!n.isMesh||!r)return;const o=new Float32Array(r.count*2);for(let d=0;d<r.count;d+=1){const m=r.getX(d),f=r.getY(d);o[d*2]=(m-e.left)/t,o[d*2+1]=(f-e.bottom)/a}n.geometry.setAttribute("uv",new al(o,2)),n.geometry.attributes.uv.needsUpdate=!0})}const eu=new Q(-.17427287762525134,13.678992786206543,20.688611202093714),tu=new Q(0,0,0),au=new Q(-13.767695123014105,12.990152163077308,39.28228164159694),ai=21,iu=9,nu=260,su=12,ru=700,oa=new Map,xs="#30DCFF",ou="#F2FFFF",lu="#8BF7FF",_s=3202303,uu=15925247,Rs=9172991,Is={"family-pasture":"pasture","artificial-grassland":"grass","scale-breeding":"breeding","forage-storage":"storage","slaughter-processing":"processing","farm-equipment":"equipment","social-service":"service"};function Gs(g){return g.sort((e,t)=>t.value-e.value),g}function lt(g){return String(g||"").replace(/\s+/g,"").trim()}function se(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 As(g){return(g==null?void 0:g.scope)==="village"||(g==null?void 0:g.labelMode)==="village"}function Bs(g){return(g==null?void 0:g.scope)==="trade-flow"||(g==null?void 0:g.labelMode)==="trade-flow"}function cu(g){return(g==null?void 0:g.showFlowLines)!==!1}function Es(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 du(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 hu(g){return(g==null?void 0:g.interactive)===!1||(g==null?void 0:g.key)==="yak-recognition-layer"}function $s(g){return String((g==null?void 0:g.sourceType)||"").toLowerCase()==="wmts"}function Vs(g,e,t){const a=Sa(2,t),n=Math.sin(e*Math.PI/180);return{x:(g+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function Ds(g,e,t){const a=Sa(2,t),n=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[n,o]}function pu(g,e){const t=Vs(g.west,g.north,e),a=Vs(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 fu(g,e,t,a){const[n,r]=Ds(g,e,t),[o,u]=Ds(g+1,e+1,t),c=j.east-j.west,d=j.north-j.south;return{x:(n-j.west)/c*a.width,y:(j.north-r)/d*a.height,width:(o-n)/c*a.width,height:(r-u)/d*a.height}}function mu(g){const e=oa.get(g);if(e)return e;const t=new Promise(a=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>a(n),n.onerror=()=>{oa.delete(g),a(null)},n.src=g});for(oa.set(g,t);oa.size>ru;){const a=oa.keys().next().value;if(!a)break;oa.delete(a)}return t}function Os(g){return g?/^https?:\/\//.test(g)||g.startsWith("/")?g:`./${g}`:""}function yu(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=yu(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 zs(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 gu extends bl{constructor(e,t,a={}){var u,c,d,m;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(au),this.camera.instance.near=1,this.camera.instance.far=1e4,this.camera.instance.updateProjectionMatrix(),this.defaultMapCameraPosition=eu.clone(),this.defaultMapTarget=tu.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 n=Math.round(Number(a.satelliteTextureZoom));this.satelliteTextureZoom=Number.isFinite(n)&&n>0?Math.min(ai,n):Pl;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=iu,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(Ps.map(f=>[lt(f.name),f])),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),(c=(u=this.canvas)==null?void 0:u.addEventListener)==null||c.call(u,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(m=(d=this.canvas)==null?void 0:d.addEventListener)==null||m.call(d,"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,n)=>{let r=a.element.querySelector(".other-label");e.to(r,{duration:1,delay:.1*n,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,n;this.flyLineFocusGroup.visible=!0,(n=(a=this.callbacks).onPlayComplete)==null||n.call(a)}},"focusMapOpacity"),this.showTownRankingBars&&(this.allBar.map((a,n)=>{e.to(a.scale,{duration:1,delay:.1*n,x:1,y:1,z:1,ease:"circ.out"},"bar")}),this.allBarMaterial.map((a,n)=>{e.to(a,{duration:1,delay:.1*n,opacity:1,ease:"circ.out"},"bar")}));const t=this;this.allProvinceLabel.map((a,n)=>{let r=a.element.querySelector(".provinces-label-wrap"),o=a.element.querySelector(".number .value"),u={progress:0};e.to(r,{duration:1,delay:.2*n,translateY:0,opacity:1,ease:"circ.out"},"bar"),e.to(u,{duration:1,delay:.2*n,progress:1,onStart:()=>{u.progress=0},onUpdate:c},"bar");function c(){var m,f;const d=se((f=(m=a.userData)==null?void 0:m.targetValue)!=null?f:o.dataset.targetValue);o.innerText=t.formatMapRankingValue(d*u.progress)}}),this.showTownRankingBars&&this.allGuangquan.map((a,n)=>{e.to(a.children[0].scale,{duration:1,delay:.1*n,x:1,y:1,z:1,ease:"circ.out"},"bar"),e.to(a.children[1].scale,{duration:1,delay:.1*n,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:n}=this.createChina(),{map:r,mapTop:o,mapLine:u,mapBoundaryEmphasis:c}=this.createProvince();this.createNationalBackdrop(),a.setParent(e),n.setParent(e),this.createDiffuse(),r.setParent(t),o.setParent(t),u.setParent(t),c==null||c.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 $i({color:new wt(e.chinaBgMaterialColor),transparent:!0,opacity:.72}),n=new Fa(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:n,chinaTopLine:o}}createNationalBackdrop(){var d;if(!this.showNationalBackdrop||this.nationalBackdropGroup)return!1;let e=null;try{e=xa(this.assets.instance.getResource("chinaMap"))}catch(m){return console.warn("首页全国底图资源未加载",m),!1}if(!((d=e==null?void 0:e.features)!=null&&d.length))return!1;const t=this.geoProjectionCenter,a=120,n=new Q(0,0,-.08),r=new $i({color:new wt("#152c47"),transparent:!0,opacity:.72,depthWrite:!1,fog:!1,side:Ne}),o=new Fa(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,merge:!0,position:n,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}),c=new sa(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,position:new Q(n.x,n.y,n.z+.01),material:u,renderOrder:1});return c.lineGroup.name="home-national-backdrop-line",c.setParent(this.mapGroup),this.nationalBackdropGroup=o.mapGroup,this.nationalBackdropLineGroup=c.lineGroup,!0}createTradeNationalMap(){var f;if(this.tradeNationalMapGroup)return!0;let e=null;try{e=xa(this.assets.instance.getResource("chinaMap"))}catch(L){return console.warn("牦牛交易全国地图资源未加载",L),!1}const t=e;if(!e||!((f=t==null?void 0:t.features)!=null&&f.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 n=new me({color:403001,transparent:!0,opacity:.14,side:Ne,depthWrite:!1,fog:!1});new Fa(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new Q(.05,-.05,-.03),material:n,renderOrder:17}).setParent(a);const{topMaterial:o,sideMaterial:u}=this.createTradeNationalMaterials(),c=new ws(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});c.mapGroup.traverse(L=>{L.isMesh&&(L.renderOrder=20)}),c.setParent(a);const d=new aa({color:4777983,transparent:!0,opacity:.52,fog:!1,depthTest:!1}),m=new sa(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,material:d,renderOrder:21});return m.lineGroup.position.z+=this.tradeNationalDepth+.055,m.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 c;const n=((c=a.properties)==null?void 0:c.name)||"",r=this.normalizeTradeProvinceName(n);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 n=a.reduce((c,d)=>({minLng:Math.min(c.minLng,Number(d[0])),maxLng:Math.max(c.maxLng,Number(d[0])),minLat:Math.min(c.minLat,Number(d[1])),maxLat:Math.max(c.maxLat,Number(d[1]))}),{minLng:1/0,maxLng:-1/0,minLat:1/0,maxLat:-1/0});return{lng:(n.minLng+n.maxLng)/2,lat:(n.minLat+n.maxLat)/2}}isHomeTopicPresentation(){return this.topicLayerPresentation==="home"}createProvince(){let e=this.staticMapData.mapJson;this.mapJsonData=e;const t=this.useSatelliteBase?Fs({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:this.satelliteTextureZoom,tileUrlTemplate:this.tileUrlTemplate,onTileStatus:f=>{var L,M;return(M=(L=this.callbacks).onTileStatus)==null?void 0:M.call(L,f)}}):null;t!=null&&t.texture&&this.enhanceTexture(t.texture);let[a,n]=this.createProvinceMaterial();this.focusMapTopMaterial=a,this.focusMapSideMaterial=n;let r=new ws(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new Q(0,0,.11),data:e,depth:this.depth,topFaceMaterial:a,sideMaterial:n,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 Fa(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&&Ns(u,t.uvBounds),u.mapGroup.children.map(f=>{f.children.map(L=>{L.type==="Mesh"&&this.eventElement.push(L)})}),this.mapLineMaterial=new aa({color:12254463,opacity:0,transparent:!0,linewidth:this.adminBoundaryLineScale,fog:!1});let c=new sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapLineMaterial,renderOrder:this.isHomeTopicPresentation()?34:26});c.lineGroup.position.z+=this.depth+(this.isHomeTopicPresentation()?.315:.285);let d=null;const m=this.getAdminBoundaryEmphasisRadius();return m>0&&(this.mapBoundaryEmphasisMaterial=new me({color:9632767,transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1,blending:xe}),d=new sa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapBoundaryEmphasisMaterial,renderOrder:this.usesCustomSatelliteTiles?24:18,type:"Line3",tubeRadius:m}),d.lineGroup.position.z+=this.depth+.255),{map:r,mapTop:u,mapLine:c,mapBoundaryEmphasis:d}}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 Yi(e);a.colorSpace=la,a.wrapS=oi,a.wrapT=oi,a.minFilter=_a,a.magFilter=_a,this.enhanceTexture(a),a.needsUpdate=!0;const n=new me({map:a,transparent:!0,opacity:0,depthWrite:!1,depthTest:!this.isHomeTopicPresentation(),side:Ne,fog:!1}),r=this.createLayerUvBounds(),o=new Fa(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new Q(0,0,this.depth+(this.isHomeTopicPresentation()?.272:.255)),data:this.mapJsonData,material:n,renderOrder:this.isHomeTopicPresentation()?24:18});Ns(o,r),o.setParent(this.focusMapGroup),this.topicLayerUvBounds=r,this.topicLayerCanvas=e,this.topicLayerContext=t,this.topicLayerTexture=a,this.topicLayerMaterial=n,this.topicLayerMap=o}initHongyuanBoundaryPolygons(){var t,a,n;if((t=this.hongyuanBoundaryPolygons)!=null&&t.length)return;const e=this.staticMapData.mapStroke;this.hongyuanBoundaryPolygons=zs((n=(a=e==null?void 0:e.features)==null?void 0:a[0])==null?void 0:n.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([j.west,j.south]),[a]=e([j.east,j.south]),[,n]=e([j.west,j.north]),[,r]=e([j.west,j.south]);return{left:t,right:a,bottom:-r,top:-n}}setTopicLayer(e){var a,n;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,(n=(a=this.callbacks).onLayerStatus)==null||n.call(a,{type:"loading",text:`正在加载 ${e.name}`}),ii(e)){this.loadVectorTopicLayer(e,t);return}this.loadTopicLayerImage(e).then(r=>{var o,u,c,d;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),(d=(c=this.callbacks).onLayerStatus)==null||d.call(c,{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,c;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 n=++this.topicLayerLoadId;this.currentVectorFeatures=[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(c=(u=this.callbacks).onLayerStatus)==null||c.call(u,{type:"loading",text:`正在加载 ${a.length} 个地图图层`}),Promise.all(a.map(d=>this.loadCompositeTopicLayerItem(d))).then(d=>{var L,M,C;if(n!==this.topicLayerLoadId)return;const m=d.filter(Boolean),f=m.find(x=>{var G,z;return x.type==="vector"&&((G=x.layer)==null?void 0:G.key)===((z=this.currentTopicLayer)==null?void 0:z.key)});this.currentVectorFeatures=((L=f==null?void 0:f.geojson)==null?void 0:L.features)||[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),m.forEach((x,G)=>{var z,Z;if(x.type==="image"){this.topicLayerContext.save();const ee=G===m.length-1?Math.max(.78,(z=x.layer.opacity)!=null?z:.9):Math.min(.52,(Z=x.layer.opacity)!=null?Z:.52);this.topicLayerContext.globalAlpha=Math.min(1,Math.max(.28,ee)),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=m.length?this.getTopicLayerMaterialOpacity(this.currentTopicLayer,1):0,(C=(M=this.callbacks).onLayerStatus)==null||C.call(M,{type:m.length?"success":"error",text:m.length?`已加载 ${m.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 $s(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=xl(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 n=this.getWmtsTopicZoom(e),r=pu(j,n),o=[];for(let m=r.minX;m<=r.maxX;m+=1)for(let f=r.minY;f<=r.maxY;f+=1)o.push({x:m,y:f});let u=0,c=0;const d=()=>re(this,null,function*(){for(;c<o.length;){const m=o[c];c+=1;const f=yield mu(_l(e,{x:m.x,y:m.y,z:n}));if(!f)continue;const L=fu(m.x,m.y,n,t);a.drawImage(f,L.x,L.y,L.width,L.height),u+=1}});return yield Promise.all(Array.from({length:Math.min(su,o.length)},d)),u?(this.enhanceWmtsTopicCanvas(t,e),{image:t,layer:e,loaded:u}):null})}enhanceWmtsTopicCanvas(e,t={}){var c,d;if(t.homeWmtsEnhance===!1)return;const a=e.getContext("2d");if(!a)return;const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");if(!r)return;r.drawImage(e,0,0);const o=Yt((c=t.homeWmtsPointSpread)!=null?c:0,0,4),u=Yt((d=t.homeWmtsGlowRadius)!=null?d: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(n,0,0),a.restore()),o>0){const m=[[-o,0],[o,0],[0,-o],[0,o],[-o,-o],[o,-o],[-o,o],[o,o]];a.save(),a.globalAlpha=.72,m.forEach(([f,L])=>a.drawImage(n,f,L)),a.restore()}a.drawImage(n,0,0)}getWmtsTopicZoom(e={}){var o,u,c;const t=Math.round(Number(e.maximumLevel)),a=Number.isFinite(t)&&t>0?t:21,n=Number((c=(u=(o=e.homeWmtsZoom)!=null?o:e.wmtsZoom)!=null?u:e.tileZoom)!=null?c:this.satelliteTextureZoom),r=Number.isFinite(n)&&n>0?Math.round(n):11;return Yt(r,3,Math.min(a,ai))}updateTopicLayerTextureSampling(e={}){if(!this.topicLayerTexture)return;const t=$s(e)?ps:_a;this.topicLayerTexture.minFilter=t,this.topicLayerTexture.magFilter=t,this.topicLayerTexture.needsUpdate=!0}drawTopicRasterImage(e,t={}){const a=this.topicLayerCanvas,n=this.topicLayerContext;if(!a||!n)return;if(!t.softMask){this.drawHomeTopicRasterGlow(e,t),n.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){n.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),n.save(),n.imageSmoothingEnabled=!0,n.imageSmoothingQuality="high",n.drawImage(o,0,0,a.width,a.height),n.restore()}drawHomeTopicRasterGlow(e,t={}){var c,d;if(!this.isHomeTopicPresentation())return;const a=this.topicLayerCanvas,n=this.topicLayerContext;if(!a||!n)return;const r=Yt((c=t.homeGlowOpacity)!=null?c:0,0,.8),o=Yt((d=t.homeGlowBlur)!=null?d:0,0,32);if(!r||!o)return;const u=t.homeGlowColor||"#E5FCFF";n.save(),n.globalAlpha=r,n.filter=`drop-shadow(0 0 ${o}px ${u})`,n.drawImage(e,0,0,a.width,a.height),n.restore()}applyLayerMapView(e,t={}){var c,d;if(!((c=this.camera)!=null&&c.instance)||!((d=this.camera)!=null&&d.controls)||!this.mapAnimationComplete&&!t.force)return;const a=e?null:this.currentTownRanking,n=(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=n?this.getLayerMapViewTarget(n):this.defaultMapTarget.clone(),o=n?this.getLayerMapViewCameraPosition(n,r):this.defaultMapCameraPosition.clone(),u=n&&Number.isFinite(n.duration)?n.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),n=Number.isFinite(a)?a:t;if(!this.isHomeTopicPresentation())return n;const r=Number(e==null?void 0:e.homePresentationMaxOpacity),o=Number.isFinite(r)?r:.56;return Yt(n,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,c,d,m,f;const e=(c=(u=(o=(r=this.camera)==null?void 0:r.controls)==null?void 0:o.target)==null?void 0:u.clone)==null?void 0:c.call(u);if(!e)return[102.58,32.72];(m=(d=this.focusMapGroup)==null?void 0:d.updateWorldMatrix)==null||m.call(d,!0,!1);const t=this.focusMapGroup?this.focusMapGroup.worldToLocal(e):e,a=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),n=((f=a.invert)==null?void 0:f.call(a,[t.x,-t.y]))||[102.58,32.72];return[Math.max(j.west,Math.min(j.east,Number(n[0])||102.58)),Math.max(j.south,Math.min(j.north,Number(n[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<nu)return;this.dynamicSatelliteLastCheck=t;const a=this.camera.instance.position.distanceTo(this.camera.controls.target),n=this.getDynamicSatelliteZoom(a);if(n<=this.satelliteTextureZoom){this.hideDynamicSatelliteOverlay();return}const r=this.getCameraTargetLngLat(),o=this.getDynamicSatelliteTileWindow(n),u=Hl({zoom:n,centerLngLat:r,maxCols:o,maxRows:o}),c=this.getDynamicSatelliteKey(n,u);!c||c===this.dynamicSatelliteCurrentKey||c===this.dynamicSatelliteLoadingKey||this.loadDynamicSatelliteOverlay({zoom:n,centerLngLat:r,maxTiles:o,key:c})}loadDynamicSatelliteOverlay({zoom:e,centerLngLat:t,maxTiles:a,key:n}){const r=++this.dynamicSatelliteRequestId;this.dynamicSatelliteLoadingKey=n;let o;o=Fs({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:e,centerLngLat:t,maxCols:a,maxRows:a,tileUrlTemplate:this.tileUrlTemplate,transparentBackground:!0,applyTone:!1,onTileStatus:u=>{var c,d,m,f,L;if((m=(d=this.callbacks).onTileStatus)==null||m.call(d,O(A({},u),{text:((c=u.text)==null?void 0:c.replace("影像底图","高清影像底图"))||u.text})),u.type!=="loading"){if(r!==this.dynamicSatelliteRequestId){(L=(f=o==null?void 0:o.texture)==null?void 0:f.dispose)==null||L.call(f);return}if(this.dynamicSatelliteLoadingKey="",Number(u.loaded||0)<=0){this.dynamicSatelliteCurrentKey===n&&this.hideDynamicSatelliteOverlay();return}this.applyDynamicSatelliteOverlay(o,n)}}}),this.applyDynamicSatelliteOverlay(o,n)}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,n=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(n,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,n;if(!this.mapAnimationComplete){if((t=(e=this.animateTl)==null?void 0:e.progress)==null||t.call(e,1,!1),(n=(a=this.animateTl)==null?void 0:a.pause)==null||n.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,n=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(a),r=t.clone().add(n);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],n=Number(a==null?void 0:a[0]),r=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(r))return this.defaultMapTarget.clone();const[o,u]=this.geoProjection([n,r]),c=new Q(o,-u,Number(t)||0);return this.focusMapGroup?this.focusMapGroup.localToWorld(c):c}toVector3(e,t){if(Array.isArray(e)){const[o,u,c]=e.map(Number);return[o,u,c].every(Number.isFinite)?new Q(o,u,c):t.clone()}const a=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y),r=Number(e==null?void 0:e.z);return[a,n,r].every(Number.isFinite)?new Q(a,n,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 n=this.camera.controls,r=()=>n.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(n.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,c,d;const a=this.townMetaByName.get(lt(e)),n=t.select?this.selectTownFeatureByName(e,t):!1;if(t.preserveCamera)return n||!!(a!=null&&a.center);if(!(a!=null&&a.center))return n;const r=this.lngLatToWorldPoint(a.center,(u=t.targetLocalZ)!=null?u:.82),o=this.getLayerMapViewCameraPosition({distanceScale:(c=t.distanceScale)!=null?c:.82,cameraOffset:t.cameraOffset||{x:0,y:1.2,z:0}},r);return this.animateMapCamera(o,r,(d=t.duration)!=null?d:.75),!0}isNationalParkTownSelectionActive(){var e;return((e=this.currentTopicLayer)==null?void 0:e.key)==="national-park-zoning"&&this.getTownRankingMeta().onlyRankedTownLabels}getTownNameFromMapEvent(e){var a,n,r,o,u,c,d,m,f,L;return[(r=(n=(a=e==null?void 0:e.target)==null?void 0:a.parent)==null?void 0:n.userData)==null?void 0:r.name,(u=(o=e==null?void 0:e.target)==null?void 0:o.userData)==null?void 0:u.name,(m=(d=(c=e==null?void 0:e.target)==null?void 0:c.parent)==null?void 0:d.userData)==null?void 0:m.townName,(L=(f=e==null?void 0:e.target)==null?void 0:f.userData)==null?void 0:L.townName].find(M=>String(M||"").trim())||""}findTownFeatureByName(e){var n,r,o,u;const t=lt(e);if(!t)return null;const a=(((n=this.mapJsonData)==null?void 0:n.features)||((o=(r=this.staticMapData)==null?void 0:r.mapJson)==null?void 0:o.features)||[]).find(c=>{const d=(c==null?void 0:c.properties)||{};return[d.name,d.fullName,d.full_name,d.townName].some(f=>lt(f)===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 n,r,o,u,c;const a=this.findTownFeatureByName(e);return a?(this.showSelectedFeature(a,{mode:"town"}),t.silentStatus!==!0&&((c=(u=this.callbacks).onLayerStatus)==null||c.call(u,{type:"success",text:t.statusText||`已选中${((o=a.properties)==null?void 0:o.name)||e}`})),!0):(t.showMissingStatus!==!1&&((r=(n=this.callbacks).onLayerStatus)==null||r.call(n,{type:"warning",text:"未找到对应乡镇边界"})),!1)}handleTownRankingSelect(e,t={}){var u,c;if(!this.isNationalParkTownSelectionActive())return!1;const a=lt(e);if(!a||!this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1).some(d=>lt(d.name)===a))return!1;const o=this.focusTownByName(e,A({select:!0,preserveCamera:!0,statusText:`已选中${e}`},t));return o&&((c=(u=this.callbacks).onFeatureInfo)==null||c.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 d,m;const t=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),a=String(e.id||e.key||""),n=String(e.fullName||e.name||"").trim(),r=t.find(f=>{const L=(f==null?void 0:f.properties)||{};return a&&String(L.id||"")===a||n&&String(L.name||L.plot_name||"").trim()===n});if(!r)return(m=(d=this.callbacks).onLayerStatus)==null||m.call(d,{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 c;return String(((c=u==null?void 0:u.properties)==null?void 0:c.id)||"")===o})||null}const a=this.getGeometryLngLatBounds(t==null?void 0:t.geometry);if(!a)return null;const n=[(a.minLng+a.maxLng)/2,(a.minLat+a.maxLat)/2];return this.lngLatToLayerScreenPoint(n,this.depth+.34)||this.lngLatToScreenPoint(n,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,c,d;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]),n=Number((d=(c=e.latitude)!=null?c:e.lat)!=null?d:t==null?void 0:t[1]);return!Number.isFinite(a)||!Number.isFinite(n)?null:[a,n]}findYakIndustryPointFeature(e={},t=this.getYakIndustryPayloadCoordinate(e)){const a=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),n=String(e.id||e.key||""),r=String(e.fullName||e.name||"").trim(),o=String(e.stageKey||""),u=t&&a.find(d=>{var f;if(((f=d==null?void 0:d.geometry)==null?void 0:f.type)!=="Point")return!1;const m=d.properties||{};return o&&String(m.stageKey||"")!==o?!1:this.getCoordinateDistance(d.geometry.coordinates,t)<=8e-4})||null;if(e.preferCoordinateMatch)return u;const c=a.find(d=>{const m=(d==null?void 0:d.properties)||{};return!!(n&&String(m.id||"")===n||r&&String(m.name||m.fullName||"").trim()===r)});return c||u}loadVectorTopicLayer(e,t){return re(this,null,function*(){var a,n,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),(n=(a=this.callbacks).onLayerStatus)==null||n.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,c;if(e.sourceType==="geojson-api"){const d=yield fetch(e.apiUrl,{credentials:"include"});if(!d.ok)throw new Error(`HTTP ${d.status}`);const m=yield d.json();let f=(r=m==null?void 0:m.data)!=null?r:m;if(f=(o=f==null?void 0:f.geojson)!=null?o:f,f&&typeof f.value=="string"&&(f=f.value),typeof f=="string"&&(f=JSON.parse(f)),(f==null?void 0:f.type)!=="FeatureCollection"||!Array.isArray(f.features))throw new Error("Invalid GeoJSON API payload");return f}if(e.sourceType==="geojson"){if(((u=e.geojsonData)==null?void 0:u.type)==="FeatureCollection")return e.geojsonData;const d=yield fetch(Os(e.dataPath),{credentials:"include"});if(!d.ok)throw new Error(`HTTP ${d.status}`);return yield d.json()}if(e.sourceType==="wfs"){const d=yield ks(e.layerName,{cqlFilter:e.cqlFilter,maxFeatures:e.maxFeatures||1200,timeout:e.timeout||18e3});return(d==null?void 0:d.type)==="FeatureCollection"?d:{type:"FeatureCollection",features:(d==null?void 0:d.features)||[]}}let t=[],a=null;try{const d=yield fetch(e.apiUrl,{credentials:"include"});if(!d.ok)throw new Error(`HTTP ${d.status}`);const m=yield d.json();t=Array.isArray(m==null?void 0:m.data)?m.data:Array.isArray((c=m==null?void 0:m.data)==null?void 0:c.rows)?m.data.rows:[]}catch(d){a=d}let n=this.buildWktLayerFeatures(t);if((!t.length||!n.length)&&e.fallbackPath){const d=yield fetch(Os(e.fallbackPath),{credentials:"include"});if(!d.ok)throw a||new Error(`HTTP ${d.status}`);const m=yield d.json();t=Array.isArray(m==null?void 0:m.rows)?m.rows:[],n=this.buildWktLayerFeatures(t)}return{type:"FeatureCollection",features:n}})}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 n=this.topicLayerContext;a.clear!==!1&&n.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),n.save(),n.lineJoin="round",n.lineCap="round",this.clipVectorLayerContext(n,e);const o=this.getVisibleVectorFeatures(e,t).filter(u=>{var c;return!(e!=null&&e.hidePointFeatures)||((c=u==null?void 0:u.geometry)==null?void 0:c.type)!=="Point"}).sort((u,c)=>{var f,L;const d=this.getGeometryDrawRank((f=u.geometry)==null?void 0:f.type),m=this.getGeometryDrawRank((L=c.geometry)==null?void 0:L.type);return d-m});o.forEach(u=>{const c=this.getVectorFeatureStyle(e,u);this.drawVectorFeature(n,u.geometry,c)}),this.drawNationalParkBoundaryOverlay(n,e,o),this.drawSelectedVectorOverlay(n),n.restore()}drawNationalParkBoundaryOverlay(e,t,a=[]){(t==null?void 0:t.key)!=="national-park-zoning"||!a.length||a.forEach(n=>{const r=this.getVectorFeatureStyle(t,n);this.drawVectorFeature(e,n.geometry,O(A({},r),{fill:"#071A20",stroke:"#071A20",polygonAlpha:0,lineAlpha:.34,lineWidth:7,glow:!0})),this.drawVectorFeature(e,n.geometry,O(A({},r),{fill:"#E7FFF6",stroke:"#E7FFF6",polygonAlpha:0,lineAlpha:.68,lineWidth:2.1,glow:!1})),this.drawVectorFeature(e,n.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||[],n=this.analysisBoundaryFeature,r=this.boundaryDrawPoints||[];if(!t.length&&!a.length&&!n&&!r.length)return;const o=this.isEcologicalProjectLayer(this.currentTopicLayer),u={fill:xs,stroke:lu,polygonAlpha:o?.2:.28,lineAlpha:o?.78:.98,lineWidth:o?6:12,pointRadius:11,glow:!o,halo:!o},c={fill:xs,stroke:ou,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(d=>{var f;const m=(d==null?void 0:d.geometry)||((f=d==null?void 0:d.feature)==null?void 0:f.geometry);this.drawVectorFeature(e,m,u),this.drawVectorFeature(e,m,c)}),a.forEach(d=>{var f;const m=(d==null?void 0:d.geometry)||((f=d==null?void 0:d.feature)==null?void 0:f.geometry);this.drawVectorFeature(e,m,{fill:"#30DCFF",stroke:"#C9FBFF",polygonAlpha:o?.22:.28,lineAlpha:o?.88:.98,lineWidth:o?2.8:5,pointRadius:6,glow:!o})}),n!=null&&n.geometry&&this.drawVectorFeature(e,n.geometry,{fill:"#24F6C4",stroke:"#FFFFFF",polygonAlpha:o?.12:.18,lineAlpha:o?.92:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),r.length){const d=r.map(f=>[f.lng,f.lat]),m={type:"LineString",coordinates:this.boundaryDrawingEnabled?d:[...d,d[0]].filter(Boolean)};this.drawVectorFeature(e,m,{fill:"#24F6C4",stroke:"#24F6C4",polygonAlpha:o?.08:.12,lineAlpha:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),d.forEach(f=>{this.drawVectorFeature(e,{type:"Point",coordinates:f},{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 n=t==null?void 0:t.match;return n!=null&&n.field?String((r=e[n.field])!=null?r:"")===String(n.value):!0}getVisibleVectorFeatures(e,t){var u,c;const a=Array.isArray(e==null?void 0:e.activeLegends)?e.activeLegends.filter(d=>{var m,f;return((m=d==null?void 0:d.matches)==null?void 0:m.length)||((f=d==null?void 0:d.match)==null?void 0:f.field)}):[];if(a.length)return(t||[]).filter(d=>a.some(m=>this.featureMatchesLegend((d==null?void 0:d.properties)||{},m)));const n=e==null?void 0:e.activeLegend;if((u=n==null?void 0:n.matches)!=null&&u.length||(c=n==null?void 0:n.match)!=null&&c.field)return(t||[]).filter(d=>this.featureMatchesLegend((d==null?void 0:d.properties)||{},n));const o=String((e==null?void 0:e.cqlFilter)||"").trim().match(/^([a-zA-Z0-9_]+)\s*=\s*'((?:''|[^'])*)'$/);if(o){const[,d,m]=o,f=m.replace(/''/g,"'");return(t||[]).filter(L=>{var M,C;return String((C=(M=L==null?void 0:L.properties)==null?void 0:M[d])!=null?C:"")===f})}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((n,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(n),this.getYakIndustryPointLabelPosition(n,r)),o.visible=!0,(u=o.show)==null||u.call(o),o.userData={feature:n}}),this.yakIndustryPointLabels.slice(a.length).forEach(n=>{var r;n.visible=!1,(r=n.hide)==null||r.call(n),n.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(n=>{var r;return((r=n==null?void 0:n.geometry)==null?void 0:r.type)==="Point"});a.length&&(this.ensureYakIndustryPointMarkerGroup(),a.forEach((n,r)=>{let o=this.yakIndustryPointMarkers[r];const u=this.getVectorFeatureStyle(e,n),c=this.getYakIndustryMarkerMaterial(u,n),d=this.lngLatToLayerLocalPoint(n.geometry.coordinates,this.depth+.36),m=Number(e==null?void 0:e.pointSpriteScale)||.34,f=this.getYakIndustryMarkerType(n);o||(o=new ia(c),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=c,o.center.set(.5,.5),o.position.copy(d),o.scale.set(m*.88,m*.88,1),o.visible=!0,o.userData={feature:n,layer:e,index:r,markerType:f}}),this.yakIndustryPointMarkers.slice(a.length).forEach(n=>{n.visible=!1,n.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,c,d,m,f,L,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 n=((c=a.geometry)==null?void 0:c.coordinates)||[];this.setSelectedVectorFeatures([a]),(M=(L=this.callbacks).onFeatureInfo)==null||M.call(L,{feature:{id:((d=a.properties)==null?void 0:d.id)||((m=a.properties)==null?void 0:m.feature_id)||((f=a.properties)==null?void 0:f.project_name),properties:a.properties||{},feature:a,layer:this.currentTopicLayer,lngLat:{lng:Number(n[0]),lat:Number(n[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),n=`${e.fill||"#24F6C4"}-${e.stroke||"#B7FFF2"}-${a}`,r=this.yakIndustryMarkerMaterialCache.get(n);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(n,u),u}getYakIndustryMarkerType(e={}){var a;const t=String(((a=e==null?void 0:e.properties)==null?void 0:a.stageKey)||"");return Is[t]||"point"}createYakIndustryMarkerTexture(e="#24F6C4",t="#B7FFF2",a="point"){const n=document.createElement("canvas");n.width=112,n.height=112;const r=n.getContext("2d"),o=56,u=56;r.clearRect(0,0,n.width,n.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 c=new Yi(n);return c.colorSpace=la,c.needsUpdate=!0,c}drawYakIndustryMarkerFrame(e,t,a,n,r="#24F6C4",o="#B7FFF2"){if(e.save(),e.translate(a,n),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 c=-Math.PI/2+Math.PI*2*u/6,d=Math.cos(c)*35,m=Math.sin(c)*35;u===0?e.moveTo(d,m):e.lineTo(d,m)}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 c=-Math.PI/2+Math.PI*2*u/10,d=u%2===0?38:30,m=Math.cos(c)*d,f=Math.sin(c)*d;u===0?e.moveTo(m,f):e.lineTo(m,f)}e.closePath()}else if(t==="equipment"){e.beginPath();for(let u=0;u<16;u+=1){const c=-Math.PI/2+Math.PI*2*u/16,d=u%2===0?38:30,m=Math.cos(c)*d,f=Math.sin(c)*d;u===0?e.moveTo(m,f):e.lineTo(m,f)}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,n,r="#24F6C4"){if(e.save(),e.translate(a,n),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(c=>{var d;return((d=c==null?void 0:c.geometry)==null?void 0:d.type)==="Point"}),n=Number(e==null?void 0:e.pointLabelLimit)||(a.length>36?12:Math.min(a.length,16)),r=a.map(c=>{var d;return{feature:c,score:this.getYakIndustryFeatureScore(c),town:lt((d=c.properties)==null?void 0:d.town)}}).sort((c,d)=>{var m,f;return d.score-c.score||String(((m=c.feature.properties)==null?void 0:m.name)||"").localeCompare(String(((f=d.feature.properties)==null?void 0:f.name)||""),"zh-CN")}),o=[],u=new Set;return r.forEach(c=>{o.length>=n||!c.town||u.has(c.town)||(o.push(c.feature),u.add(c.town))}),r.forEach(c=>{o.length>=n||o.includes(c.feature)||o.push(c.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(n=>this.parseMapMetricNumber(n));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 n;const a=this.lngLatToLayerLocalPoint((n=e==null?void 0:e.geometry)==null?void 0:n.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||"产业主体"),n=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(n)}</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 n,r,o,u,c,d;const t=String(e.stageKey||""),a=(((n=this.currentTopicLayer)==null?void 0:n.legends)||[]).find(m=>{var f;return String(((f=m.match)==null?void 0:f.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)||((d=(c=this.currentTopicLayer)==null?void 0:c.activeLegend)==null?void 0:d.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 n=this.lngLatToLayerCanvasPoint([a.west,a.north]),r=this.lngLatToLayerCanvasPoint([a.east,a.south]),o=Math.min(n.x,r.x),u=Math.min(n.y,r.y),c=Math.abs(r.x-n.x),d=Math.abs(r.y-n.y);!c||!d||(e.beginPath(),e.rect(o,u,c,d),e.clip())}clipContextToHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];t.length&&(e.beginPath(),t.forEach(a=>{a.forEach(n=>{n.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),j.west),n=Math.max(Number(t.south),j.south),r=Math.min(Number(t.east),j.east),o=Math.min(Number(t.north),j.north);return![a,n,r,o].every(Number.isFinite)||a>=r||n>=o?null:{west:a,south:n,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 c,d,m;const a=t.properties||{},r=(e.legends||[]).find(f=>{var L,M;return(((L=f==null?void 0:f.matches)==null?void 0:L.length)||((M=f==null?void 0:f.match)==null?void 0:M.field))&&this.featureMatchesLegend(a,f)})||e.activeLegend||((c=e.legends)==null?void 0:c[0])||{},o=String(((d=t.geometry)==null?void 0:d.type)||"").includes("LineString"),u=((m=t.geometry)==null?void 0:m.type)==="Point";if(this.isEcologicalProjectLayer(e)){const f=o||String(a.feature_role||"")==="线性设施";return{fill:f||u?r.strokeColor||r.fillColor||"#D2EA78":r.fillColor||"#75AD49",stroke:r.strokeColor||r.fillColor||"#D2EA78",polygonAlpha:f?.08:.22,lineAlpha:f?.9:.82,lineWidth:f?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:Is[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 n,r;const a=Number(((n=t==null?void 0:t.properties)==null?void 0:n.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(n=>this.drawPolygonPath(e,n,a));return}if(t.type==="LineString"){this.drawLinePath(e,t.coordinates,a);return}if(t.type==="MultiLineString"){t.coordinates.forEach(n=>this.drawLinePath(e,n,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(n=>{n.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((n,r)=>{const o=this.lngLatToLayerCanvasPoint(n);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 n=this.lngLatToLayerCanvasPoint(t);e.save(),a.halo&&(e.beginPath(),e.arc(n.x,n.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(n.x,n.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 n=this.lngLatToLayerCanvasPoint(t),r=a.pointRadius||6;e.save(),e.beginPath(),e.arc(n.x,n.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(n.x,n.y+r*2.05),e.bezierCurveTo(n.x+r*1.46,n.y+r*.62,n.x+r*1.34,n.y-r*1.34,n.x,n.y-r*1.62),e.bezierCurveTo(n.x-r*1.34,n.y-r*1.34,n.x-r*1.46,n.y+r*.62,n.x,n.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(n.x,n.y-r*.34,r*.52,0,Math.PI*2),e.fillStyle=this.hexToRgba("#FFFFFF",.96),e.shadowBlur=0,e.fill(),e.beginPath(),e.arc(n.x,n.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-j.west)/(j.east-j.west)*this.topicLayerCanvas.width,y:(j.north-a)/(j.north-j.south)*this.topicLayerCanvas.height}}hexToRgba(e,t=1){const a=String(e||"#30DCFF").replace("#",""),n=a.length===3?a.split("").map(d=>d+d).join(""):a,r=Number.parseInt(n,16);if(!Number.isFinite(r))return`rgba(48, 220, 255, ${t})`;const o=r>>16&255,u=r>>8&255,c=r&255;return`rgba(${o}, ${u}, ${c}, ${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),n=(o=a==null?void 0:a[1])==null?void 0:o.toUpperCase();if(!n)return null;const r=t.slice(t.indexOf("("));return n==="POLYGON"?{type:"Polygon",coordinates:this.parseWktPolygonBody(r)}:n==="MULTIPOLYGON"?{type:"MultiPolygon",coordinates:this.parseWktMultiPolygonBody(r)}:n==="POINT"?{type:"Point",coordinates:this.parseWktPoint(r)}:n==="MULTIPOINT"?{type:"MultiPoint",coordinates:this.getWktChildGroups(r).map(u=>this.parseWktPoint(u)).filter(Boolean)}:n==="LINESTRING"?{type:"LineString",coordinates:this.parseWktRing(r)}:n==="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,n=[];let r=0,o=-1;for(let u=0;u<a.length;u+=1){const c=a[u];c==="("?(r===0&&(o=u),r+=1):c===")"&&(r-=1,r===0&&o>=0&&(n.push(a.slice(o,u+1)),o=-1))}return n.length?n:[a]}parseWktRing(e){return String(e||"").replace(/^\(+|\)+$/g,"").split(",").map(a=>a.trim().split(/\s+/).slice(0,2).map(Number)).filter(([a,n])=>Number.isFinite(a)&&Number.isFinite(n))}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 $i({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 n=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}),n.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,n]}getDefaultTownRanking(){return{title:"乡镇统计加载中",unit:"",rows:Ps.map(e=>({name:e.name,value:0,unit:""}))}}getTownRankingMeta(e=this.currentTownRanking){var n,r,o,u;const t=this.getDefaultTownRanking(),a=du(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:Es(e),hideMapLabels:Na(e),hideTownLabelStats:(n=e==null?void 0:e.hideTownLabelStats)!=null?n: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 c;const n=this.getDefaultTownRanking(),r=(c=e==null?void 0:e.rows)!=null&&c.length?e.rows:a?n.rows:[],o=this.getTownRankingMeta(e),u=r.map(d=>{const m=this.townMetaByName.get(lt(d.name));return m?O(A(A({},m),d),{name:m.name,enName:m.enName,center:m.center,centroid:m.centroid,value:se(d.value),unit:d.unit||o.unit,metricTitle:o.title}):null}).filter(Boolean).sort((d,m)=>m.value-d.value).map((d,m)=>O(A({},d),{rank:m+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,n)=>{var d,m,f,L,M,C,x,G;const r=se((d=a.lng)!=null?d:a.longitude,NaN),o=se((m=a.lat)!=null?m:a.latitude,NaN);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const u=se((f=a.displayValue)!=null?f:a.value),c=se((C=(M=(L=a.rawValue)!=null?L:a.earTagCount)!=null?M:a.ear_tag_count)!=null?C:a.value);return O(A({},a),{key:a.key||`${a.town||""}-${a.village||a.name||n}`,name:a.name||a.village||`村${n+1}`,town:a.town||"",lng:r,lat:o,value:u,rawValue:c,recordCount:se((x=a.recordCount)!=null?x:a.record_count,0),imageRate:se((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,n)=>n.rawValue-a.rawValue).map((a,n)=>O(A({},a),{rank:n+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,n;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}),(n=this.allGuangquan)==null||n.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(),!As(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((n,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,c]=this.geoProjection([n.lng,n.lat]),d=(r%3-1)*.06,m=Math.floor(r/3)%2*.04;o.init(this.getVillageRankingHtml(n,a),new Q(u+d,-c+m,this.depth+1.55+Math.min(r,6)*.015)),o.visible=!0,o.userData=A({},n)}),this.villageRankingLabels.slice(t.length).forEach(n=>{n.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,c;const t=(e==null?void 0:e.source)||{},a=se((r=t.lng)!=null?r:t.longitude,NaN),n=se((o=t.lat)!=null?o:t.latitude,NaN);return!Number.isFinite(a)||!Number.isFinite(n)?null:{name:t.name||"红原牦牛交易市场",lng:a,lat:n,total:se((c=(u=t.total)!=null?u:t.headCount)!=null?c:t.value,NaN)}}getTradeFlowRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,n)=>{var L,M,C,x,G,z;const r=se((L=a.lng)!=null?L:a.longitude,NaN),o=se((M=a.lat)!=null?M:a.latitude,NaN),u=se((G=(x=(C=a.headCount)!=null?C:a.head_count)!=null?x:a.rawValue)!=null?G:a.value),c=a.displayName||a.display_name||a.name,d=a.mapTownName||a.map_town_name||a.town||a.startTown||a.start_town||c,m=this.townMetaByName.get(lt(d)),f=Number.isFinite(r)&&Number.isFinite(o)?{lng:r,lat:o}:m!=null&&m.center?{lng:m.center[0],lat:m.center[1]}:null;return!f||!Number.isFinite(u)?null:O(A(A({},a),m),{key:a.key||`${(m==null?void 0:m.name)||c||d||"trade-source"}-${n}`,name:c||d||(m==null?void 0:m.name)||`来源${n+1}`,townName:(m==null?void 0:m.name)||d,lng:f.lng,lat:f.lat,labelSide:a.labelSide||a.label_side||this.getTradeSourceLabelSide(m,n),value:u,headCount:u,recordCount:se((z=a.recordCount)!=null?z:a.record_count,0),unit:a.unit||t.unit||"头"})}).filter(Boolean).sort((a,n)=>n.value-a.value).map((a,n)=>O(A({},a),{rank:n+1}))}getTradeMarketHtml(e,t){const a=Number.isFinite(e.total)?e.total:t.reduce((n,r)=>n+se(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]),n=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(n)&&n>this.geoProjectionCenter[1]+.22?"top":Number.isFinite(n)&&n<this.geoProjectionCenter[1]-.26?"bottom":["right","left","top","bottom"][t%4]}getTradeLocalPoint(e,t,a=0){const[n,r]=this.geoProjection([e,t]);return new Q(n,-r,this.depth+a)}getTradeFlowPoint(e,t=0){return this.getTradeLocalPoint(e.lng,e.lat,t)}getLocalTradeFlowCurve(e,t,a){const n=this.getTradeFlowPoint(e,.76),r=this.getTradeLocalPoint(t.lng,t.lat,.86),o=n.clone().lerp(r,.5),u=n.distanceTo(r);o.z+=Math.max(.32,Math.min(.82,u*.22+a*.012));const c=new Q(-(r.y-n.y),r.x-n.x,0);return c.lengthSq()>0&&(c.normalize().multiplyScalar((a%2===0?1:-1)*Math.min(.18,.05+u*.02)),o.add(c)),new ol([n,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,n,r=!0){const o=new wt(t%3===1?16766828:t%3===2?2617536:3202303),u=this.getTradeFlowPoint(e,.72);if(n&&r){const x=this.getLocalTradeFlowCurve(e,n,t),G=new me({color:o,transparent:!0,opacity:.42,depthWrite:!1,depthTest:!1,fog:!1,blending:xe}),z=.012+Math.min(.012,se(e.value)/Math.max(a,1)*.01),Z=new We(new ll(x,48,z,8,!1),G);Z.renderOrder=31,this.tradeFlowMeshGroup.add(Z),this.tradeFlowMaterials.push(G);const ee=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(ee),R=.12+Math.min(.08,se(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,se(e.value)/Math.max(a,1)*.12)},q.position.copy(x.getPointAt(q.userData.phase)),this.tradeFlowPulseSprites.push(q),this.tradeFlowMeshGroup.add(q)}const c=new na({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.95,depthWrite:!1,depthTest:!1,fog:!1,blending:xe}),d=new ia(c),m=.22+Math.min(.34,se(e.value)/Math.max(a,1)*.28);d.renderOrder=34,d.scale.set(m,m,m),d.position.copy(u),this.tradeFlowMeshGroup.add(d);const f=this.assets.instance.getResource("guangquan1"),L=new me({map:f,alphaMap:f,color:o,transparent:!0,opacity:.52,depthWrite:!1,depthTest:!1,fog:!1,blending:xe,side:Ne}),M=.38+Math.min(.36,se(e.value)/Math.max(a,1)*.28),C=new We(new _t(M,M),L);C.renderOrder=29,C.position.copy(this.getTradeFlowPoint(e,.5)),this.tradeFlowMeshGroup.add(C)}createTradeMarketMarker(e){const t=this.assets.instance.getResource("point"),a=this.assets.instance.getResource("guangquan1"),n=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(n),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}),c=new We(new _t(.58,.58),u);c.renderOrder=29,c.position.copy(this.getTradeLocalPoint(e.lng,e.lat,.58)),this.tradeFlowMeshGroup.add(c)}disposeObject3D(e){var t,a,n,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=(n=e.material)==null?void 0:n.dispose)==null||r.call(n)}updateTradeFlowPulses(e=.016){var t,a;!((t=this.tradeFlowGroup)!=null&&t.visible)||!((a=this.tradeFlowPulseSprites)!=null&&a.length)||this.tradeFlowPulseSprites.forEach(n=>{var u;const r=(u=n.userData)==null?void 0:u.curve;if(!r)return;const o=(se(n.userData.phase)+se(n.userData.speed,.16)*e)%1;n.userData.phase=o,n.position.copy(r.getPointAt(o))})}updateTradeFlowLayer(e=this.currentTownRanking){if(!Bs(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 n=cu(e);this.createTradeMarketMarker(t);const r=Math.max(...a.map(c=>c.value),1);a.forEach((c,d)=>{this.createTradeSourceMarker(c,d,r,t,n)});const o=a.length+1;for(let c=this.tradeFlowLabels.length;c<o;c+=1){const d=this.label3d.create("",c===0?"trade-market-label":"trade-flow-label",!0);this.label3d.setLabelStyle(d,c===0?.014:.0125,"x"),d.setParent(this.tradeFlowLabelGroup),this.tradeFlowLabels.push(d)}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((c,d)=>{const m=this.tradeFlowLabels[d+1];m.element.className="trade-flow-label",m.init(this.getTradeFlowLabelHtml(c),this.getTradeFlowPoint(c,.78).add(this.getTradeFlowLabelOffset(c,d))),m.visible=!0,m.userData=A({},c)}),this.tradeFlowLabels.slice(o).forEach(c=>{c.visible=!1})}hasTownRankingRows(e=this.currentTownRanking){return this.getTownRankingRows(e,Number.POSITIVE_INFINITY,!1).length>0}formatMapRankingValue(e){const t=se(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=se(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=se(e);return Math.round(t).toLocaleString("zh-CN")}getBarHeight(e,t){return t?Math.max(2.8*.12,2.8*(se(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,n,r=!0){var d,m;const o=this.getBarHeight(t.value,n),[u,c]=this.geoProjection(t.centroid);return e.visible=!0,(m=(d=e.geometry)==null?void 0:d.dispose)==null||m.call(d),e.geometry=this.createBarGeometry(o),e.position.set(u,-c,this.depth+.45),e.userData=O(A({},t),{targetValue:t.value,geoHeight:o}),e.children.forEach(f=>{var L,M,C,x;(M=(L=f.geometry)==null?void 0:L.dispose)==null||M.call(L),Array.isArray(f.material)?f.material.forEach(G=>{var z;return(z=G==null?void 0:G.dispose)==null?void 0:z.call(G)}):(x=(C=f.material)==null?void 0:C.dispose)==null||x.call(C)}),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:c,geoHeight:o}}updateProvinceLabel(e,t,a,n,r,o=!0){var C;const u=se((C=e.userData)==null?void 0:C.targetValue,t.value);e.visible=!0,e.userData=O(A({},t),{targetValue:t.value}),e.position.copy(n);const c=e.element.querySelector(".label-title"),d=e.element.querySelector(".number .value"),m=e.element.querySelector(".number .unit"),f=e.element.querySelector(".name"),L=e.element.querySelector(".no");!c||!d||!m||!f||!L?e.element.innerHTML=this.getProvinceLabelHtml(t,a,r):(c.innerText=r.title,d.dataset.targetValue=String(t.value),d.innerText=this.formatMapRankingValue(t.value),m.innerText=t.unit||r.unit,f.innerText=t.name,L.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"),z={value:u};ra.to(z,{value:t.value,duration:.45,ease:"power2.out",onUpdate:()=>{x.innerText=this.formatMapRankingValue(z.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"),n=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=""),n&&(n.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 m,f;const c=((m=u.userData)==null?void 0:m.townName)||((f=u.userData)==null?void 0:f.name),d=u.element.querySelector(".town-name");d&&(d.innerText=c||""),this.clearTownNameLabelStat(u),u.visible=!a.hideTownNames});return}const n=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 Z,ee;const c=((Z=u.userData)==null?void 0:Z.townName)||((ee=u.userData)==null?void 0:ee.name),d=n.get(lt(c));if(a.onlyRankedTownLabels&&!d){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="",u.visible=!1;return}const m=d||(r?{name:c,value:0,unit:a.unit,metricLabel:a.metricLabel,rank:null}:null);if(!m){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="";return}const f=u.element.querySelector(".town-stat-label"),L=u.element.querySelector(".town-name"),M=u.element.querySelector(".town-stat-value"),C=u.element.querySelector(".town-stat-unit"),x=u.element.querySelector(".town-rank"),G=u.element.querySelector(".town-stat-metric");f==null||f.classList.add("has-stat"),L&&(L.innerText=c),G&&(G.innerText=m.metricLabel||a.metricLabel||""),M&&(M.innerText=this.formatMapRankingValue(m.value)),C&&(C.innerText=m.unit||a.unit||""),x&&(x.innerText=m.rank?`第${m.rank}名`:"");const z=this.isNationalParkTownSelectionActive()&&!!d;u.element.style.pointerEvents=z?"auto":"none",u.element.style.cursor=z?"pointer":"",u.userData=O(A(A({},u.userData),m),{townName:c,targetValue:m.value})})}getInfoPointHtml(e,t=this.getTownRankingMeta()){const a=String(e.metricLabel||t.metricLabel||t.title||"统计指标").replace(/排行$/,""),n=Number(e.rank),r=Number.isFinite(n)?String(n).padStart(2,"0"):"--";return`<div class="info-point-wrap ${n<=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;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),n=Math.max(...a.map(c=>c.value),1);this.infoPointSprites.forEach((c,d)=>{const m=a[d],f=this.infoLabelElement[d];if(!m){c.visible=!1,c.scale.set(0,0,0),f&&(f.visible=!1);return}const[L,M]=this.geoProjection(m.centroid||m.center),C=[L,-M,this.depth+.72];c.userData=O(A(A({},c.userData),m),{position:C,value:m.value,unit:m.unit||t.unit,rank:m.rank,metricTitle:t.title,index:d}),c.position.set(...C),c.visible=this.showTownRankingPointMarkers;const x=.78+m.value/n*.44;if(c.scale.set(x,x,x),f){const G=(d%2===0?.22:-.18)+(d===0?.12:0),z=d%3===0?.08:-.04;f.position.set(L+G,-M+z,this.depth+1.88+Math.min(d,4)*.03),f.userData=O(A({},m),{index:d}),f.element.innerHTML=this.getInfoPointHtml(m,t)}});const r=this.infoLabelElement[this.infoPointIndex];r&&this.showTownRankingPointMarkers&&this.mapAnimationComplete&&(r.visible=!0),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(n=>n.value),1);this.allBar=[],this.allBarMaterial=[],this.allGuangquan=[],this.allProvinceLabel=[],e.map((n,r)=>{const o=this.getBarHeight(n.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 c=new We(this.createBarGeometry(o),u);c.renderOrder=5;const[d,m]=this.geoProjection(n.centroid);c.position.set(d,-m,this.depth+.45),c.scale.set(1,1,0),c.userData=O(A({},n),{targetValue:n.value,geoHeight:o});const f=this.createQuan(new Q(d,this.depth+.44,m),r);c.add(...this.createHUIGUANG(o,r>3?16776948:7863285)),t.add(c),t.rotation.x=-Math.PI/2,this.allBar.push(c),this.allBarMaterial.push(u),this.allGuangquan.push(f)}),this.scene.add(t),this.updateTownNameLabelStats(this.currentTownRanking)}setTownRanking(e){var r,o,u,c,d,m,f,L,M,C,x,G,z,Z,ee,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(Bs(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}),(c=this.allGuangquan)==null||c.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),As(e)){this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!Es(e)),this.clearInfoPointStats(),this.updateVillageRankingLabels(e),(d=this.allBar)!=null&&d.length&&(this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(m=this.allBarMaterial)==null||m.forEach(R=>{R.opacity=0}),(f=this.allProvinceLabel)==null||f.forEach(R=>{R.visible=!1}),(L=this.allGuangquan)==null||L.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)}),(C=this.allBarMaterial)==null||C.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)}),(z=this.allProvinceLabel)==null||z.forEach(R=>{R.visible=!1}),(Z=this.allGuangquan)==null||Z.forEach(R=>{R.visible=!1}),this.clearInfoPointStats();return}this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.mapAnimationComplete),(ee=this.infoPointSprites)==null||ee.forEach(R=>{R.visible=this.showTownRankingPointMarkers});const n=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,n,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=n=>{n.traverse(r=>{r.isMesh&&(r.material=this.defaultMaterial)})},a=n=>{n.traverse(r=>{r.isMesh&&(r.material=this.defaultLightMaterial)})};this.eventElement.map(n=>{this.interactionManager.add(n),n.addEventListener("mousedown",r=>{this.handleMapClick(r)}),n.addEventListener("mouseover",r=>{e.includes(r.target.parent)||e.push(r.target.parent),document.body.style.cursor="pointer",a(r.target.parent)}),n.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 n=this.assets.instance.getResource("huiguang");n.colorSpace=la,n.wrapS=ot,n.wrapT=ot;let r=new me({color:t,map:n,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(),c=o.clone();return u.rotateY(Math.PI/180*60),c.rotateY(Math.PI/180*120),[o,u,c]}createQuan(e,t){const a=this.assets.instance.getResource("guangquan1"),n=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:n,alphaMap:n,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:xe}),c=new We(r,o),d=new We(r,u);return c.renderOrder=6,d.renderOrder=6,c.rotateX(-Math.PI/2),d.rotateX(-Math.PI/2),c.position.copy(e),d.position.copy(e),d.position.y-=.001,c.scale.set(0,0,0),d.scale.set(0,0,0),this.quanGroup=new ge,this.quanGroup.add(c,d),this.scene.add(this.quanGroup),this.time.on("tick",()=>{c.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:n=>{const r=setTimeout(()=>{this.addSceneTween(ra.to(n.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}),n=new We(e,a);n.rotation.x=-Math.PI/2,n.position.set(0,-.7,0),this.scene.add(n)}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=ps,t.repeat.set(1,1);let a=new me({color:4162253,alphaMap:t,transparent:!0,opacity:.62}),n=new We(e,a);n.rotateX(-Math.PI/2),n.position.set(-19.3,-.5,-19.7),this.scene.add(n)}createLabel(){let e=this,t=this.labelGroup,a=this.label3d,n=[],r=[];Ol.map(u=>{if(u.hide==!0)return!1;let c=o(u,a,t);n.push(c),r.push(c)}),this.otherLabel=n,this.townNameLabels=r;function o(u,c,d){let m=c.create("",`china-label ${u.blur?" blur":""}`,!0);const[f,L]=e.geoProjection(u.center);return m.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(f,-L,e.depth+.85)),c.setLabelStyle(m,.018,"x"),m.setParent(d),m.userData=O(A({},u),{labelType:"town-label",baseScale:.018,townName:u.name}),m.element.addEventListener("pointerdown",M=>{e.handleTownRankingSelect(u.name,{preserveCamera:!0,statusText:`已选中${u.name}`})&&(M.preventDefault(),M.stopPropagation())}),m}}createRotateBorder(){let e=13.2,t=this.assets.instance.getResource("rotationBorder1"),a=this.assets.instance.getResource("rotationBorder2"),n=new Ls(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)});n.instance.rotation.x=-Math.PI/2,n.instance.renderOrder=6,n.instance.scale.set(0,0,0),n.setParent(this.scene);let r=new Ls(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=n.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 Ts(this,{num:10,range:30,dir:"up",speed:.05,material:new fl({map:Ts.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});let a=Gs(zl),n=a[0].value;a.map(r=>{const o=new ia(t);o.renderOrder=23;let u=.1+r.value/n*.2;o.scale.set(u,u,u);let[c,d]=this.geoProjection([r.lng,r.lat]);o.position.set(c,-d,this.depth+.45),o.userData.position=[c,-d,this.depth+.45],this.scatterGroup.add(o)})}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 n=[16776948,7863285],r=Gs(Wl),o=r[0].value;r.map((c,d)=>{const m=new na({map:a,color:n[d%n.length],fog:!1,transparent:!0,depthTest:!1}),f=new ia(m);f.renderOrder=23;let L=.7+c.value/o*.4;f.scale.set(L,L,L);let[M,C]=this.geoProjection([c.lng,c.lat]),x=[M,-C,this.depth+.7];f.position.set(...x),f.userData.position=[...x],f.userData={position:[M,-C,this.depth+.7],name:c.name,value:c.value,level:c.level,index:d},this.InfoPointGroup.add(f);let G=u(c,t,this.InfoPointGroup,d);this.infoLabelElement.push(G),this.infoPointSprites.push(f),this.interactionManager.add(f),f.addEventListener("mousedown",z=>{var Z,ee;if(this.clicked||!this.InfoPointGroup.visible)return!1;this.clicked=!0,this.infoPointIndex=z.target.userData.index,this.infoLabelElement.map(q=>{q.visible=!1}),G.visible=!0,this.handleTownRankingSelect(((Z=z.target.userData)==null?void 0:Z.name)||((ee=z.target.userData)==null?void 0:ee.townName)),this.createInfoPointLabelLoop()}),f.addEventListener("mouseup",z=>{this.clicked=!1}),f.addEventListener("mouseover",z=>{document.body.style.cursor="pointer"}),f.addEventListener("mouseout",z=>{document.body.style.cursor="default"})});function u(c,d,m,f){let L=d.create("","info-point",!0);const[M,C]=e.geoProjection([c.lng,c.lat]);return L.init(e.getInfoPointHtml(O(A({},c),{value:0,rank:f+1,unit:""}),e.getTownRankingMeta()),new Q(M,-C,e.depth+1.9)),d.setLabelStyle(L,.015,"x"),L.setParent(m),L.visible=!1,L}}createInfoPointLabelLoop(){var e;this.scenePaused||!((e=this.infoLabelElement)!=null&&e.length)||(clearInterval(this.infoPointLabelTime),this.infoPointLabelTime=setInterval(()=>{this.infoPointIndex++,this.infoPointIndex>=this.infoLabelElement.length&&(this.infoPointIndex=0),this.infoLabelElement.map((t,a)=>{this.infoPointIndex===a?t.visible=!0:t.visible=!1})},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,c,d,m,f,L,M,C,x,G,z,Z,ee,q,R,Se,Ye,je,D,He,_e,ut,Lt,tt,Re,qe,Ue,Ve,Ke,Ie,at,Le,ie,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(),(d=(c=this.callbacks).onFeatureInfo)==null||d.call(c,{feature:null}),(f=(m=this.callbacks).onLayerStatus)==null||f.call(m,{type:"success",text:"当前点击位置不在红原县边界内"});return}if(this.shouldClipLayerToLayerBounds(this.currentTopicLayer)&&!this.isLngLatInLayerClipBounds(a,this.currentTopicLayer)){this.clearSelectedFeature(),(M=(L=this.callbacks).onFeatureInfo)==null||M.call(L,{feature:null}),(x=(C=this.callbacks).onLayerStatus)==null||x.call(C,{type:"success",text:"当前点击位置不在图层显示范围内"});return}if(hu(this.currentTopicLayer)){this.clearSelectedFeature(),(z=(G=this.callbacks).onFeatureInfo)==null||z.call(G,{feature:null});return}if(ii(this.currentTopicLayer)){const v=this.pickVectorFeatureAtPoint(a,t),F=(v==null?void 0:v.feature)||v;let B=(v==null?void 0:v.screen)||t;if(F)this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)?(this.clearSelectedGeometryGroup(),this.setSelectedVectorFeatures([F])):this.showSelectedFeature(F),((Z=this.currentTopicLayer)==null?void 0:Z.key)==="yak-industry-points"&&(this.setSelectedVectorFeatures([F]),B=this.getPointFeatureScreenPoint(F)||B),(Ye=(Se=this.callbacks).onFeatureInfo)==null||Ye.call(Se,{feature:{id:((ee=F.properties)==null?void 0:ee.id)||((q=F.properties)==null?void 0:q.feature_id)||((R=F.properties)==null?void 0:R.project_name),properties:F.properties||{},feature:F,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 n=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 Ss(this.currentTopicLayer,n,{size:Rt,buffer:10}),F=this.normalizeFeatureInfoAtPoint(v,a),B=F?null:yield this.queryFallbackFeatureInfo(a),$=F||(B==null?void 0:B.feature);if($){const U=yield this.enrichFeatureInfo($,n,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});$||(ie=(Le=this.callbacks).onLayerStatus)==null||ie.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,n;if(!this.boundaryDrawingEnabled)return;const t=this.getLngLatFromCanvasEvent(e);t&&this.addBoundaryDrawPoint(t)&&(e.__analysisBoundaryHandled=!0),(a=e.preventDefault)==null||a.call(e),(n=e.stopPropagation)==null||n.call(e)}handleCanvasBoundaryDoubleClick(e){var a,n;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),(n=e.stopPropagation)==null||n.call(e)}getLngLatFromCanvasEvent(e){var L,M,C;if(!((L=this.camera)!=null&&L.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 n={x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height)*2+1};a.setFromCamera(n,this.camera.instance);const o=((C=a.intersectObjects(this.eventElement||[],!0)[0])==null?void 0:C.point)||this.getRayMapPlaneIntersection(a.ray);if(!o)return null;const u=this.focusMapGroup.worldToLocal(o.clone()),d=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([u.x,-u.y]);if(!d)return null;const m=Number(d[0]),f=Number(d[1]);return!Number.isFinite(m)||!Number.isFinite(f)?null:m<j.west-.03||m>j.east+.03||f<j.south-.03||f>j.north+.03?this.getFallbackLngLatFromPointer(e,t):{lng:m,lat:f}}getFallbackLngLatFromPointer(e,t=(n=>(n=(a=>(a=this.canvas)==null?void 0:a.getBoundingClientRect)())==null?void 0:n.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=j.west+(j.east-j.west)*r,c=j.north-(j.north-j.south)*o;return{lng:u,lat:c}}getRayMapPlaneIntersection(e){if(!(e!=null&&e.origin)||!(e!=null&&e.direction)||!this.focusMapGroup)return null;const t=this.focusMapGroup.worldToLocal(e.origin.clone()),n=this.focusMapGroup.worldToLocal(e.origin.clone().add(e.direction.clone())).sub(t),r=this.depth+.22;if(Math.abs(n.z)<1e-8)return null;const o=(r-t.z)/n.z;if(!Number.isFinite(o)||o<0)return null;const u=t.add(n.multiplyScalar(o));return this.focusMapGroup.localToWorld(u)}enrichFeatureInfo(e,t,a){return re(this,null,function*(){const n=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(n))return e;const o=(Di[n]||[]).find(f=>f.key===`${n}-distribution`),u=(this.visibleTopicLayers||[]).filter(f=>this.getLayerTopicKey(f)===n).slice(0,5),c=[o,this.currentTopicLayer,...u].filter(f=>f==null?void 0:f.layerName).filter((f,L,M)=>M.findIndex(C=>this.getLayerQueryKey(C)===this.getLayerQueryKey(f))===L);if(!c.length)return e;const d=yield Promise.allSettled([...c.filter(f=>this.getLayerQueryKey(f)!==this.getLayerQueryKey(this.currentTopicLayer)).map(f=>re(this,null,function*(){const L=yield Ss(f,t,{size:Rt,buffer:10}),M=this.normalizeFeatureInfoAtPoint(L,a);return M?{layer:f,feature:M,source:"wms"}:null})),...c.map(f=>re(this,null,function*(){const L=yield this.queryLayerFeatureByPoint(f,a);return L?{layer:f,feature:L,source:"wfs"}:null}))]),m=A({},e.properties||{});return d.forEach(f=>{var L,M;f.status!=="fulfilled"||!((M=(L=f.value)==null?void 0:L.feature)!=null&&M.properties)||this.mergeBusinessProperties(m,f.value.feature.properties,f.value.layer)}),O(A({},e),{properties:m,relatedFeatures:d.filter(f=>{var L;return f.status==="fulfilled"&&((L=f.value)==null?void 0:L.feature)}).map(f=>f.value),feature:O(A({},e.feature||{}),{properties:m})})})}queryFallbackFeatureInfo(e){return re(this,null,function*(){const t=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(t))return null;const n=[(Di[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(c=>this.getLayerQueryKey(c)===this.getLayerQueryKey(r))===o);for(const r of n){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 n=this.pickFeatureAtPoint(a,t,{requireContainment:!0});if(!n)return null;const r=n.properties||{};return{id:n.id||r.gid||r.objectid||r.OBJECTID,properties:r,feature:n}}queryLayerFeatureByPoint(n,r){return re(this,arguments,function*(e,t,a={}){var C,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",c=t.lng-o,d=t.lat-o,m=t.lng+o,f=t.lat+o,L=yield ks(e.layerName,{cqlFilter:`BBOX(${u},${c},${d},${m},${f})`,maxFeatures:8,timeout:12e3}),M=this.pickFeatureAtPoint((L==null?void 0:L.features)||[],t,a);return M?{id:M.id||((C=M.properties)==null?void 0:C.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 n=e.filter(o=>this.isLngLatInGeometry(t,o.geometry)).sort((o,u)=>this.getGeometryAreaScore(o.geometry)-this.getGeometryAreaScore(u.geometry));return n.length?n[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(n=>this.isLngLatInRing(e,n))}isLngLatInRing(e,t=[]){if(t.length<3)return!1;let a=!1;const n=e.lng,r=e.lat;for(let o=0,u=t.length-1;o<t.length;u=o++){const c=t[o],d=t[u],m=Number(c==null?void 0:c[0]),f=Number(c==null?void 0:c[1]),L=Number(d==null?void 0:d[0]),M=Number(d==null?void 0:d[1]);if(this.isPointOnSegment(n,r,m,f,L,M))return!0;f>r!=M>r&&n<(L-m)*(r-f)/(M-f)+m&&(a=!a)}return a}isPointOnSegment(e,t,a,n,r,o){const u=(e-a)*(o-n)-(t-n)*(r-a);return Math.abs(u)>1e-10?!1:(e-a)*(e-r)+(t-n)*(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 n=0;n<t.length;n++){const r=t[n],o=t[(n+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 n=(a.minLng+a.maxLng)/2,r=(a.minLat+a.maxLat)/2;return Math.hypot(n-t.lng,r-t.lat)}getGeometryLngLatBounds(e){const t=this.getGeometryCoordinateList(e);return t.length?t.reduce((a,n)=>({minLng:Math.min(a.minLng,Number((n==null?void 0:n[0])||0)),minLat:Math.min(a.minLat,Number((n==null?void 0:n[1])||0)),maxLng:Math.max(a.maxLng,Number((n==null?void 0:n[0])||0)),maxLat:Math.max(a.maxLat,Number((n==null?void 0:n[1])||0))}),{minLng:Number.POSITIVE_INFINITY,minLat:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY}):null}getGeometryCoordinateList(e){const t=[],a=n=>{if(Array.isArray(n)){if(typeof n[0]=="number"&&typeof n[1]=="number"){t.push(n);return}n.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 n=a.filter(u=>this.isLngLatInGeometry(e,u.geometry)).sort((u,c)=>this.getGeometryAreaScore(u.geometry)-this.getGeometryAreaScore(c.geometry));if(n.length)return n[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 n=(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(n==null?void 0:n.distance)<=22?{feature:n.feature,screen:n.screen}:null}getPointFeatureScreenPoint(e){var a,n;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:((n=this.currentTopicLayer)==null?void 0:n.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 d=Number(e==null?void 0:e[0]),m=Number(e==null?void 0:e[1]);if(!Number.isFinite(d)||!Number.isFinite(m))return new Q(0,0,Number(t)||0);const[f,L]=this.geoProjection([d,m]);return new Q(f,-L,Number(t)||0)},n=this.topicLayerUvBounds;if(!n)return a();const r=this.lngLatToLayerCanvasPoint(e),o=this.topicLayerCanvas;if(!(o!=null&&o.width)||!(o!=null&&o.height))return a();const u=n.left+r.x/o.width*(n.right-n.left),c=n.bottom+(o.height-r.y)/o.height*(n.top-n.bottom);return new Q(u,c,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]),n=Number(e==null?void 0:e[1]);if(!Number.isFinite(a)||!Number.isFinite(n))return null;const r=this.lngLatToWorldPoint([a,n],t);return this.worldPointToScreenPoint(r)}localMapPointToScreenPoint(e){const t=this.focusMapGroup?this.focusMapGroup.localToWorld(e):e;return this.worldPointToScreenPoint(t)}worldPointToScreenPoint(e){var n;if(!((n=this.camera)!=null&&n.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 L,M,C,x;const t=String(e||"").trim();if(!t)return!1;const a=(this.currentVectorFeatures||[]).filter(G=>{var z;return String(((z=G==null?void 0:G.properties)==null?void 0:z.project_name)||"").trim()===t});if(!a.length)return(M=(L=this.callbacks).onLayerStatus)==null||M.call(L,{type:"success",text:"当前项目图斑尚未加载"}),!1;const n=this.getFeatureListLngLatBounds(a);if(!n)return!1;const r=this.getProjectHighlightFeatures(a);r.length?(this.showSelectedFeatures(r),this.setSelectedVectorFeatures(r)):this.clearSelectedFeature();const o=[(n.minLng+n.maxLng)/2,(n.minLat+n.maxLat)/2],u=Math.max(n.maxLng-n.minLng,n.maxLat-n.minLat),c=Math.max(.22,Math.min(.55,u*1.25)),d=this.lngLatToWorldPoint(o,.72),m=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(c),f=d.clone().add(m);return this.animateMapCamera(f,d,.75),(x=(C=this.callbacks).onLayerStatus)==null||x.call(C,{type:"success",text:"已定位项目"}),!0}setBoundaryDrawing(e){var t,a,n,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=(n=this.callbacks).onLayerStatus)==null||r.call(n,{type:"success",text:"已退出边界绘制"}),this.redrawVectorTopicLayer()}addBoundaryDrawPoint(e){var r,o,u,c;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}),(c=(u=this.callbacks).onLayerStatus)==null||c.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,c,d,m,f;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(L=>[L.lng,L.lat]),a=t[0],n=t[t.length-1];(a[0]!==n[0]||a[1]!==n[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,(d=(c=this.callbacks).onDrawBoundary)==null||d.call(c,{status:"complete",feature:r,points:e,pointCount:e.length}),(f=(m=this.callbacks).onLayerStatus)==null||f.call(m,{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,n=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=n.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 n,r;const a=[...this.normalizePastureGrasslandRows(e==null?void 0:e.grasslands),...this.normalizePastureGrasslandRows(e==null?void 0:e.wkt)].map((o,u)=>{const c=this.normalizePastureGrasslandGeometry(o);if(!c)return null;const d=this.normalizePastureGrasslandProperties(o);return{type:"Feature",properties:O(A({},d),{id:d.id||d.gid||`${(e==null?void 0:e.name)||"pasture"}-${u}`,pasture_name:(e==null?void 0:e.name)||d.pastureName||d.name}),geometry:c}}).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=(n=this.callbacks).onLayerStatus)==null||r.call(n,{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 f,L;const a=Array.isArray(e)?e:[e==null?void 0:e.lng,e==null?void 0:e.lat],n=Number(a==null?void 0:a[0]),r=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(r))return!1;const o=Number(t.span),u=Number.isFinite(o)?Math.max(.2,Math.min(.55,o*1.25)):.32,c=this.lngLatToWorldPoint([n,r],.72),d=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(u),m=c.clone().add(d);return this.animateMapCamera(m,c,t.duration||.75),(L=(f=this.callbacks).onLayerStatus)==null||L.call(f,{type:"success",text:t.statusText||"已定位"}),!0}getProjectHighlightFeatures(e){const t=e.filter(n=>{var o;const r=String(((o=n==null?void 0:n.geometry)==null?void 0:o.type)||"");return r.includes("Polygon")||r.includes("LineString")}),a=t.filter(n=>{var r;return((r=n==null?void 0:n.properties)==null?void 0:r.feature_role)==="工程范围"});return a.length?a:t}getFeatureListLngLatBounds(e){return e.reduce((t,a)=>{const n=this.getGeometryLngLatBounds(a.geometry);return n?t?{minLng:Math.min(t.minLng,n.minLng),minLat:Math.min(t.minLat,n.minLat),maxLng:Math.max(t.maxLng,n.maxLng),maxLat:Math.max(t.maxLat,n.maxLat)}:A({},n):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 n=[t.lng,t.lat];for(let r=1;r<e.length;r+=1)if(this.getCoordinateSegmentDistance(n,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 n=Number(t==null?void 0:t[0]),r=Number(t==null?void 0:t[1]),o=Number(a==null?void 0:a[0])-n,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 c=Math.max(0,Math.min(1,((e[0]-n)*o+(e[1]-r)*u)/(o*o+u*u)));return this.getCoordinateDistance(e,[n+c*o,r+c*u])}getLayerTopicKey(e){const t=e==null?void 0:e.layerName,a=e==null?void 0:e.key,n=Object.entries(A(A({},Di),Cl)).find(([,r])=>r.some(o=>o.key===a||o.layerName===t));return(n==null?void 0:n[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 n=(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)}),n==="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(n==="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(n==="grassland-type"||n==="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(n==="grassland-yield"||n==="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(n==="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,c,d;const a=(d=(((c=(u=this.interactionManager)==null?void 0:u.raycaster)==null?void 0:c.intersectObject(e.target,!1))||[])[0])==null?void 0:d.point;if(!a)return null;const n=this.focusMapGroup.worldToLocal(a.clone()),o=Ht().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([n.x,-n.y]);return o?{lng:o[0],lat:o[1]}:null}lngLatToWmsPixel({lng:e,lat:t}){const a=(e-j.west)/(j.east-j.west)*Rt.width,n=(j.north-t)/(j.north-j.south)*Rt.height;return{x:a,y:n}}showSelectedFeature(e,t={}){var n;const a=(e==null?void 0:e.geometry)||((n=e==null?void 0:e.feature)==null?void 0:n.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 n=(a==null?void 0:a.geometry)||((r=a==null?void 0:a.feature)==null?void 0:r.geometry);this.addSelectedGeometry(n,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:_s,fillOpacity:t?.46:a?.24:.54,lineColor:uu,lineOpacity:.98,glowColor:Rs,glowOpacity:t?.92:.96,renderOrderBase:t?42:a?40:35,boundary:t||a,boundaryColor:_s,boundaryGlowColor:Rs,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),n=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}),c=a.boundary?new me({color:a.boundaryColor,transparent:!0,opacity:a.boundaryOpacity,side:Ne,depthTest:!1,depthWrite:!1,fog:!1}):null,d=a.boundary?new me({color:a.boundaryGlowColor,transparent:!0,opacity:a.boundaryGlowOpacity,side:Ne,depthTest:!1,depthWrite:!1,fog:!1,blending:xe}):null;n.length&&n.forEach(f=>{const L=this.createProjectedShape(f);if(!L)return;const M=new ml(L),C=new We(M,r);C.renderOrder=a.renderOrderBase,this.selectedFeatureGroup.add(C),f.forEach(x=>{const G=this.createProjectedRingPoints(x);if(G.length<3)return;a.boundary&&(this.addSelectedBoundaryBand(G,d,a.boundaryGlowWidth,a.renderOrderBase+1,!0),this.addSelectedBoundaryBand(G,c,a.boundaryWidth,a.renderOrderBase+4,!0));const z=new Pa().setFromPoints(G),Z=new fs(z,o);Z.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(Z);const ee=new Pa().setFromPoints(G),q=new fs(ee,u);q.renderOrder=a.renderOrderBase+3,q.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(q)})});const m=this.normalizeFeatureLineStrings(e);m.length&&m.forEach(f=>{const L=this.createProjectedRingPoints(f);if(L.length<2)return;a.boundary&&(this.addSelectedBoundaryBand(L,d,a.boundaryGlowWidth,a.renderOrderBase+1,!1),this.addSelectedBoundaryBand(L,c,a.boundaryWidth,a.renderOrderBase+4,!1));const M=new Pa().setFromPoints(L),C=new ms(M,u);C.renderOrder=a.renderOrderBase+3,C.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(C);const x=new Pa().setFromPoints(L),G=new ms(x,o);G.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(G)})}addSelectedBoundaryBand(e,t,a,n,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=n,this.selectedFeatureGroup.add(u)}createPathBandGeometry(e,t,a=!0){const n=this.normalizePathBandPoints(e,a);if(n.length<(a?3:2))return null;const r=Math.max(Number(t)||0,0)/2;if(!r)return null;const o=[],u=a?n.length:n.length-1;for(let d=0;d<u;d+=1){const m=n[d],f=n[(d+1)%n.length],L=f.x-m.x,M=f.y-m.y,C=Math.hypot(L,M);if(!C)continue;const x=-M/C*r,G=L/C*r,z=[m.x+x,m.y+G,.006],Z=[m.x-x,m.y-G,.006],ee=[f.x+x,f.y+G,.006],q=[f.x-x,f.y-G,.006];o.push(...z,...Z,...ee,...ee,...Z,...q)}if(!o.length)return null;const c=new Pa;return c.setAttribute("position",new yl(o,3)),c.computeVertexNormals(),c}normalizePathBandPoints(e,t){const a=(e||[]).filter(n=>Number.isFinite(n==null?void 0:n.x)&&Number.isFinite(n==null?void 0:n.y)).map(n=>n.clone());if(t&&a.length>2){const n=a[0],r=a[a.length-1];n.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 n=this.selectedFeatureGroup.children.pop();(a=(t=n.geometry)==null?void 0:t.dispose)==null||a.call(t),Array.isArray(n.material)?n.material.forEach(r=>e.add(r)):e.add(n.material)}e.forEach(n=>{var r;return(r=n==null?void 0:n.dispose)==null?void 0:r.call(n)})}normalizeFeaturePolygons(e){return zs(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(n=>{const r=this.clipRingToBounds(n==null?void 0:n[0],a);if(r.length<3)return null;const o=n.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,c)=>{const d=o[(c+o.length-1)%o.length],m=r.inside(u),f=r.inside(d);m?(f||a.push(r.intersect(d,u)),a.push(u)):f&&a.push(r.intersect(d,u))})}),a}getLngLatLineIntersection(e,t,a,n){const r=a==="lng"?0:1,o=a==="lng"?1:0,u=t[r]-e[r];if(!u)return[...e];const c=(n-e[r])/u,d=[...e];return d[r]=n,d[o]=e[o]+(t[o]-e[o])*c,d}createProjectedShape(e){const t=e==null?void 0:e[0];if(!Array.isArray(t)||t.length<3)return null;const a=new ys;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 ys;o.forEach((c,d)=>{d===0?u.moveTo(c.x,c.y):u.lineTo(c.x,c.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 n=Number(a[0]),r=Number(a[1]);if(!Number.isFinite(n)||!Number.isFinite(r))return;const[o,u]=this.geoProjection([n,r]);t.push(new Q(o,-u,0))}),t}enhanceTexture(e){var a,n,r;const t=(n=(a=this.renderer)==null?void 0:a.instance)==null?void 0:n.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,c,d;const e=this.townNameLabels||this.otherLabel||[],t=(u=this.camera)==null?void 0:u.instance,a=(d=(c=this.camera)==null?void 0:c.controls)==null?void 0:d.target;if(!e.length||!t||!a)return;const n=t.position.distanceTo(a),r=Yt(n*72e-5,.011,.026),o=n>45?"0.76":n<22?"0.94":"1";e.forEach(m=>{var L,M,C;if(((L=m==null?void 0:m.userData)==null?void 0:L.labelType)!=="town-label")return;m.scale.set(r,r,r);const f=(C=(M=m.element)==null?void 0:M.querySelector)==null?void 0:C.call(M,".other-label");f&&(f.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 n;return(n=a==null?void 0:a.pause)==null?void 0:n.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 n;return(n=a==null?void 0:a.resume)==null?void 0:n.call(a)}),this.showTownRankingPointMarkers&&this.mapAnimationComplete&&!this.infoPointLabelTime&&this.createInfoPointLabelLoop()}destroy(){var e,t,a,n;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),(n=(a=this.canvas)==null?void 0:a.removeEventListener)==null||n.call(a,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.clearTradeFlowLayer(),this.clearSelectedFeature(),super.destroy(),this.label3d&&this.label3d.destroy()}}const vu={class:"map"},bu={__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,n=t,r=I(null),o=el(null);let u=null,c=null,d=null,m=null,f=null,L="",M="",C=!1;Hs(()=>{n("scene-mounted")}),qs(()=>{Ue()});function x(k){return o.value?!0:r.value?(o.value=new gu(r.value,k,{onFeatureLoading:v=>n("feature-loading",v),onFeatureInfo:v=>n("feature-info",v),onLayerStatus:v=>n("layer-status",v),onTileStatus:v=>n("tile-status",v),onDrawBoundary:v=>n("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(),L=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 z(){return re(this,null,function*(){var k,v,F,B,$,U;if(o.value&&(Z(),!o.value.mapAnimationComplete)){if(C){(v=(k=o.value.animateTl)==null?void 0:k.play)==null||v.call(k),Ve();return}C=!0,(B=(F=o.value.animateTl)==null?void 0:F.timeScale)==null||B.call(F,1),(U=($=o.value.animateTl)==null?void 0:$.play)==null||U.call($),Ve()}})}function Z(){var k,v;o.value&&(at(),Ie(),window.requestAnimationFrame(()=>{var F,B,$,U,te,Me;($=(B=(F=o.value)==null?void 0:F.label3d)==null?void 0:B.resize)==null||$.call(B),(Me=(te=(U=o.value)==null?void 0:U.label3d)==null?void 0:te.update)==null||Me.call(te)}),(v=(k=o.value).resumeScene)==null||v.call(k),o.value.resumeScene||o.value.time.resume())}function ee(){var k,v,F,B,$,U;o.value&&(Ke(),(v=(k=o.value.animateTl)==null?void 0:k.pause)==null||v.call(k),(B=(F=o.value).pauseScene)==null||B.call(F),o.value.pauseScene||(U=($=o.value.time)==null?void 0:$.pause)==null||U.call($),ie())}function q(){var k,v;(v=(k=o.value)==null?void 0:k.clearSelectedFeature)==null||v.call(k)}function R(k){var v,F;(F=(v=o.value)==null?void 0:v.focusProject)==null||F.call(v,k)}function Se(k){var v,F;(F=(v=o.value)==null?void 0:v.focusPasture)==null||F.call(v,k)}function Ye(k,v){var F,B;return(B=(F=o.value)==null?void 0:F.focusTownByName)==null?void 0:B.call(F,k,v)}function je(k){var v,F;return(F=(v=o.value)==null?void 0:v.focusYakIndustryPoint)==null?void 0:F.call(v,k)}function D(k){var v,F;return(F=(v=o.value)==null?void 0:v.focusVectorFeature)==null?void 0:F.call(v,k)}function He(k){var v,F;return(F=(v=o.value)==null?void 0:v.getVectorFeatureScreen)==null?void 0:F.call(v,k)}function _e(k){var v,F;return(F=(v=o.value)==null?void 0:v.getYakIndustryPointScreen)==null?void 0:F.call(v,k)}function ut(k){var v,F;(F=(v=o.value)==null?void 0:v.setBoundaryDrawing)==null||F.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,F;(F=(v=o.value)==null?void 0:v.showAnalysisResult)==null||F.call(v,k)}function Ue(){var k,v;Ke(),ie(),(v=(k=o.value)==null?void 0:k.destroy)==null||v.call(k),o.value=null}function Ve(){Ke(),f=window.setTimeout(()=>{var k,v;f=null,(v=(k=o.value)==null?void 0:k.ensureMapRevealed)==null||v.call(k)},5200)}function Ke(){f&&(window.clearTimeout(f),f=null)}function Ie(){c&&window.cancelAnimationFrame(c),c=window.requestAnimationFrame(()=>{var k,v,F,B,$;c=null,(F=(v=(k=o.value)==null?void 0:k.sizes)==null?void 0:v.init)==null||F.call(v),($=(B=o.value)==null?void 0:B.resize)==null||$.call(B)}),d&&window.clearTimeout(d),d=window.setTimeout(()=>{var k,v,F,B,$;d=null,(F=(v=(k=o.value)==null?void 0:k.sizes)==null?void 0:v.init)==null||F.call(v),($=(B=o.value)==null?void 0:B.resize)==null||$.call(B)},180)}function at(){var v;ie();const k=(v=r.value)==null?void 0:v.parentNode;k&&window.ResizeObserver&&(u=new ResizeObserver(()=>Ie()),u.observe(k)),m=window.setInterval(Le,1e3),jt(Ie)}function Le(){var te;if(!o.value||!r.value)return;const k=r.value.parentNode,v=(k==null?void 0:k.offsetWidth)||window.innerWidth||1,F=(k==null?void 0:k.offsetHeight)||window.innerHeight||1,B=((te=o.value.sizes)==null?void 0:te.pixelRatio)||1,$=Math.floor(v*B),U=Math.floor(F*B);(r.value.width!==$||r.value.height!==U)&&Ie()}function ie(){u&&(u.disconnect(),u=null),c&&(window.cancelAnimationFrame(c),c=null),d&&(window.clearTimeout(d),d=null),m&&(window.clearInterval(m),m=null)}function Tt(){if(!o.value)return;at();const k=()=>{var v,F,B,$,U,te,Me,Pe,ce,ue,Te,Ze,Ae,De,Ce,nt,St,Xe,dt,Pt,Kt;o.value&&((F=(v=o.value)==null?void 0:v.resumeScene)==null||F.call(v),o.value.resumeScene||($=(B=o.value.time)==null?void 0:B.resume)==null||$.call(B),(Me=(te=(U=o.value)==null?void 0:U.sizes)==null?void 0:te.init)==null||Me.call(te),(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),(Ce=(De=(Ae=o.value)==null?void 0:Ae.label3d)==null?void 0:De.update)==null||Ce.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 F,B,$,U,te,Me,Pe,ce,ue,Te,Ze,Ae,De,Ce,nt,St;const v=o.value;v&&((F=v.resumeScene)==null||F.call(v),v.resumeScene||($=(B=v.time)==null?void 0:B.resume)==null||$.call(B),(te=(U=v.sizes)==null?void 0:U.init)==null||te.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=(Ce=v.label3d)==null?void 0:Ce.update)==null||nt.call(Ce),(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!==L&&(L=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:z,resume:Z,pause:ee,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 F,B;return[v.key||"",v.layerName||"",v.styles||"",v.sldBody||"",v.cqlFilter||"",((F=v.activeLegend)==null?void 0:F.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,F,B,$,U,te,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:"",(F=k.showBars)!=null?F:"",(B=k.showTownNames)!=null?B:"",($=k.showMapLabels)!=null?$:"",(U=k.hideTownLabelStats)!=null?U:"",(te=k.showFlowLines)!=null?te:"",(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(),T("div",vu,[h("canvas",{ref_key:"canvasRef",ref:r},null,512)]))}};const wu={class:"yak-management"},Lu={key:0},Tu={class:"yak-management-ui"},ku={key:0,class:"trade-year-switcher","aria-label":"交易年份切换"},Su=["onClick"],Mu={key:1,class:"epidemic-year-switcher","aria-label":"防疫年份切换"},Pu=["onClick"],Cu={key:2,class:"forecast-year-switcher","aria-label":"预测年份切换"},Fu=["onClick"],Nu={class:"yak-left"},xu={class:"yak-side-stack is-left"},_u={key:0,class:"yak-data-status"},Ru={key:1,class:"yak-data-status is-warning"},Iu={key:2,class:"yak-data-status is-warning"},Gu={key:3,class:"breeding-health-card"},Au={class:"breeding-health-head"},Bu={class:"breeding-health-grid"},Eu={class:"structure-chart-card"},$u={class:"structure-ratio-card"},Vu={class:"structure-ratio-chart"},Du={viewBox:"0 0 150 150",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true"},Ou={class:"structure-rose-segments"},zu=["d","fill","stroke"],Wu={class:"structure-ratio-list"},Yu={key:0,class:"yak-data-status"},ju={key:1,class:"yak-data-status is-warning"},Hu={key:0,class:"yak-data-status"},qu={key:1,class:"yak-data-status is-warning"},Uu={key:2,class:"yak-data-status is-warning"},Ku={key:0,class:"yak-data-status"},Zu={key:1,class:"yak-data-status is-warning"},Xu={key:2,class:"yak-data-status is-warning"},Ju={key:0,class:"yak-data-status"},Qu={key:1,class:"yak-data-status is-warning"},ec={key:2,class:"yak-data-status is-warning"},tc={key:3,class:"forecast-waterfall-card"},ac={class:"forecast-waterfall-head"},ic={class:"forecast-waterfall-list"},nc={key:0,class:"yak-data-status"},sc={key:1,class:"yak-data-status is-warning"},rc={key:2,class:"yak-data-status is-warning"},oc={key:0,class:"yak-data-status"},lc={key:1,class:"yak-data-status is-warning"},uc={key:2,class:"yak-data-status is-warning"},cc={key:0,class:"yak-data-status"},dc={key:1,class:"yak-data-status is-warning"},hc={key:2,class:"yak-data-status is-warning"},pc={key:3,class:"forecast-waterfall-list"},fc={key:0,class:"yak-data-status"},mc={key:1,class:"yak-data-status is-warning"},yc={key:2,class:"yak-data-status is-warning"},gc={key:0,class:"yak-data-status"},vc={key:1,class:"yak-data-status is-warning"},bc={key:2,class:"yak-data-status is-warning"},wc={key:0,class:"yak-data-status"},Lc={key:1,class:"yak-data-status is-warning"},Tc={key:2,class:"yak-data-status is-warning"},kc={key:0,class:"yak-data-status"},Sc={key:1,class:"yak-data-status is-warning"},Mc={key:2,class:"epidemic-three-pie-card"},Pc={class:"epidemic-three-pie-visual"},Cc={class:"epidemic-three-pie-center"},Fc={class:"epidemic-three-pie-legend"},Nc={key:3,class:"epidemic-empty"},xc={class:"trade-risk-card"},_c={key:0,class:"yak-data-status"},Rc={key:1,class:"yak-data-status is-warning"},Ic={key:2,class:"yak-data-status is-warning"},Gc={class:"trade-risk-head"},Ac={class:"trade-risk-list"},Bc={key:0,class:"yak-data-status"},Ec={key:1,class:"yak-data-status is-warning"},$c={key:2,class:"yak-data-status is-warning"},Vc={key:0,class:"yak-data-status"},Dc={key:1,class:"yak-data-status is-warning"},Oc={key:2,class:"yak-data-status is-warning"},zc={key:0,class:"yak-data-status"},Wc={key:1,class:"yak-data-status is-warning"},Yc={key:2,class:"yak-data-status is-warning"},jc={class:"yak-right"},Hc={class:"yak-side-stack is-right"},qc={key:0,class:"yak-data-status"},Uc={key:1,class:"yak-data-status is-warning"},Kc={key:2,class:"yak-data-status is-warning"},Zc={key:0,class:"yak-data-status"},Xc={key:1,class:"yak-data-status is-warning"},Jc={key:2,class:"yak-data-status is-warning"},Qc={key:0,class:"yak-data-status"},ed={key:1,class:"yak-data-status is-warning"},td={key:2,class:"yak-data-status is-warning"},ad={class:"structure-chart-card"},id={key:0,class:"structure-summary-card"},nd={key:1,class:"yak-data-status"},sd={key:2,class:"yak-data-status is-warning"},rd={key:0,class:"yak-data-status"},od={key:1,class:"yak-data-status is-warning"},ld={key:2,class:"yak-data-status is-warning"},ud={key:0,class:"yak-data-status"},cd={key:1,class:"yak-data-status is-warning"},dd={key:2,class:"yak-data-status is-warning"},hd={key:0,class:"yak-data-status"},pd={key:1,class:"yak-data-status is-warning"},fd={key:2,class:"yak-data-status is-warning"},md={key:0,class:"yak-data-status"},yd={key:1,class:"yak-data-status is-warning"},gd={key:2,class:"yak-data-status is-warning"},vd={key:3,class:"forecast-heat-list"},bd=["title"],wd={class:"epidemic-record-table is-full"},Ld={class:"epidemic-record-toolbar"},Td={class:"epidemic-record-rows"},kd=["onClick"],Sd={key:0,class:"epidemic-empty"},Md={class:"epidemic-record-pager"},Pd=["disabled"],Cd=["disabled"],Fd={class:"trade-cert-card"},Nd={key:0,class:"yak-data-status"},xd={key:1,class:"yak-data-status is-warning"},_d={key:2,class:"yak-data-status is-warning"},Rd={class:"trade-cert-main"},Id={class:"trade-dest-list"},Gd={key:0,class:"epidemic-empty"},Ad={class:"trade-ledger-table"},Bd={class:"trade-ledger-toolbar"},Ed={class:"trade-ledger-rows"},$d=["onClick"],Vd={key:0,class:"epidemic-empty"},Dd={class:"trade-ledger-pager"},Od=["disabled"],zd=["disabled"],Wd={class:"yak-bottom-topic"},Yd={key:3,class:"yak-map-layer-tools"},jd={class:"epidemic-ledger-dialog"},Hd={class:"epidemic-ledger-dialog-head"},qd={class:"epidemic-ledger-filters"},Ud=["value"],Kd=["value"],Zd={class:"epidemic-ledger-workspace"},Xd={class:"epidemic-ledger-list"},Jd=["onClick"],Qd={key:0,class:"epidemic-empty"},eh={class:"epidemic-ledger-detail trade-ledger-detail epidemic-ledger-record-detail"},th={class:"epidemic-detail-head trade-detail-head"},ah={class:"epidemic-detail-grid is-modal trade-detail-grid epidemic-detail-flat-grid"},ih={key:0,class:"epidemic-detail-photos"},nh={class:"epidemic-modal-photo-strip"},sh=["onClick"],rh=["src"],oh={class:"epidemic-ledger-pager"},lh=["disabled"],uh=["disabled"],ch={class:"epidemic-ledger-dialog trade-ledger-dialog"},dh={class:"epidemic-ledger-dialog-head"},hh={class:"epidemic-ledger-filters trade-ledger-filters"},ph=["value"],fh=["value"],mh=["value"],yh={class:"epidemic-ledger-workspace trade-ledger-workspace"},gh={class:"epidemic-ledger-list trade-ledger-modal-list"},vh=["onClick"],bh={key:0,class:"epidemic-empty"},wh={class:"epidemic-ledger-detail trade-ledger-detail"},Lh={class:"epidemic-detail-head trade-detail-head"},Th={class:"epidemic-detail-grid is-modal trade-detail-grid"},kh={class:"is-wide"},Sh={class:"is-wide"},Mh={class:"is-wide"},Ph={class:"is-wide"},Ch=["disabled"],Fh={class:"epidemic-ledger-pager"},Nh=["disabled"],xh=["disabled"],_h={class:"epidemic-image-preview-dialog"},Rh={class:"epidemic-image-preview-head"},Ih={class:"epidemic-image-preview-body"},Gh={class:"epidemic-image-preview-frame"},Ah=["src"],Bh="https://qkl-hy.oss-cn-chengdu.aliyuncs.com/yak-vaccine-images",Eh="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",$h=9,Vh="oss-satellite-dynamic-zoom21-v5",ni="#43d9e8",si=8,Ws=14,Wi=8,Ys=14,Dh=5e3,ri=6,Oh=4200,js="#FFE600",ip={__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,n=t,r=gs.sideCardWidth;gs.sideCardGap;const o=I(typeof window=="undefined"?1080:window.innerHeight),u=P(()=>gl(o.value)),c=P(()=>vs(u.value,2)),d=P(()=>u.value),m=P(()=>vs(u.value,2)),f=Ca.textPrimary,L=Ca.textStrong,M=Ca.textSecondary,C=Ca.textMuted,x=Ca.chartGridLine,G=Fl,z=G,Z=G,ee=Nl,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(Ei(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),ie=I(""),Tt=I([]),kt=I([]),ct=I([]),it=I({}),Ge=I(!1),k=I(""),v=I([]),F=I(null),B=I(Ha()),$=I([]),U=I(0),te=I(1),Me=I(""),Pe=I(""),ce=I(!1),ue=I(""),Te=I(""),Ze=I(!1),Ae=I([]),De=I(0),Ce=I(1),nt=I(!1),St=I(""),Xe=I(null),dt=I(null),Pt=I(!1),Kt=I(!1),li=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(""),ui=I(""),ci=I(!1),Ct=I([]),da=I(0),At=I(1),di=I(!1),hi=I(""),ha=I(null),pt=I({keyword:"",startTown:"",usageType:"",certType:""}),Fe=I(null),pa=I(null),Zt=I(!1),fa=I(!1),Oe=I(!1),Hi=I(0),qi=I(0),Ga=I({type:"idle",text:""}),Aa=I({type:"idle",text:""});let pi=null,Ba=!1,Ui=!1,Ft=!1,Mt=null,ma=!1,Ea=null,$a=null,Va=0,Ki=!1,fi=!1,Zi=!1,Xi=!1;const mi=P(()=>Re.value.find(s=>s.key===_e.value)||{}),Zs=new Set(["epidemic","trade"]),yi=P(()=>!Zs.has(D.value)),Ji=P(()=>yi.value?Eh:""),Xs=P(()=>yi.value?"oss-satellite":"solid-3d"),Js=P(()=>`yak-management-map-${Xs.value}-${Vh}-${Hi.value}`),gi=P(()=>yt(qe.value.latestChange)),vi=P(()=>tt.value.length>0&&Ue.value.length>0),Qs=P(()=>{if(!vi.value)return[];const s=qe.value,i=[{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(...i.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)},...i.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)}头`}))]}),Qi=P(()=>{if(!vi.value)return[];const s=Ie.value,i=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(i.monthCount)}月 / ${V(i.townCount)}乡镇`,width:68,color:"#48cfff"},{key:"quality",name:"重复/缺失/负数",display:`${V(s.duplicateBusinessKeyCount)} / ${V(s.missingFieldCount)} / ${V(s.negativeValueCount)}`,width:52,color:"#30dcff"}]}),bi=P(()=>Go(Tt.value)),er=P(()=>bi.value.reduce((s,i)=>s+Number(i.count||0),0)),tr=P(()=>{const s=er.value||1;return bi.value.map((i,l)=>{const p=Number(i.count||0),y=Number(i.ratio);return O(A({},i),{count:p,color:R[l%R.length],percent:Number.isFinite(y)?y:p/s*100})})}),ar=P(()=>tr.value),ya=P(()=>ar.value),en=P(()=>jo(ya.value)),wi=P(()=>Ho(bi.value)),tn=P(()=>qo(wi.value)),ir=P(()=>Math.max(...en.value.map(s=>Number(s.count||0)),1)),Li=P(()=>ya.value.length?0:-1),nr=P(()=>{const s=ya.value,i=s.length;if(!i)return[];const l=Math.max(...s.map(w=>Number(w.count||0)),1),p=360/i,y=Math.min(8,p*.16);return s.map((w,N)=>{const _=Number(w.count||0),E=N===Li.value,W=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,W+3,vt),Ot=Vt(75,75,W+15,vt),zt=Vt(75,75,W+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,W,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)||{}}),an=P(()=>{var s;return _i((s=B.value)==null?void 0:s.dateTrend).sort(ho)}),nn=P(()=>{var s;return _i((s=B.value)==null?void 0:s.medicineRows)}),Oa=P(()=>nn.value.filter(s=>s.value>0).map((s,i)=>O(A({},s),{key:s.key||`${s.name}-${i}`,unit:"条"}))),rr=P(()=>Oa.value.map(s=>`${s.name}:${s.value}`).join("|")||"epidemic-medicine-empty"),sn=P(()=>{var s;return _i((s=B.value)==null?void 0:s.ownerRows).slice(0,8)}),rn=P(()=>{var s;return Number(((s=sr.value)==null?void 0:s.recordCount)||0)}),on=P(()=>{var s;return Array.isArray((s=B.value)==null?void 0:s.topRows)?B.value.topRows:[]}),ln=P(()=>{var s;return oo((s=B.value)==null?void 0:s.townRows)}),un=P(()=>ln.value),or=P(()=>{var i;const s=new Set;return _n((i=B.value)==null?void 0:i.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}名`})})}),Ti=P(()=>Math.max(Math.ceil(U.value/si),1)),lr=P(()=>$.value.slice(0,si)),cn=P(()=>Math.max(Math.ceil(De.value/Ws),1)),Bt=P(()=>dt.value||Xe.value||{}),dn=P(()=>Ii(Bt.value)),ur=P(()=>{const s=Bt.value||{};return[we("台账编号",s.epidemicId,{wide:!0}),we("养殖户",s.owner,{wide:!0}),we("联系电话",En(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(()=>ln.value.map(s=>s.name)),dr=P(()=>nn.value.map(s=>s.name).filter(s=>s&&s!=="未填写")),hn=P(()=>{var s;return((s=de.value)==null?void 0:s.metrics)||{}}),pn=P(()=>{var s;return((s=de.value)==null?void 0:s.hasData)===!0}),fn=P(()=>{var s;return io((s=de.value)==null?void 0:s.yearRows)}),mn=P(()=>{var s;return Qt((s=de.value)==null?void 0:s.monthRows,"name")}),yn=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")}),ki=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")}),gn=P(()=>{var s;return Array.isArray((s=de.value)==null?void 0:s.topRows)?de.value.topRows:[]}),vn=P(()=>{var p;const s=(p=de.value)==null?void 0:p.mapSource,i=ft(s==null?void 0:s.lng),l=ft(s==null?void 0:s.lat);return!(s!=null&&s.name)||!Number.isFinite(i)||!Number.isFinite(l)?null:{name:s.name,lng:i,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),i=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/i*100))}))}),bn=P(()=>It.value.slice(0,Wi)),Si=P(()=>Math.max(Math.ceil(Gt.value/Wi),1)),Mi=P(()=>Math.max(Math.ceil(da.value/Ys),1)),he=P(()=>ha.value||{}),mr=P(()=>he.value.certId||he.value.factoryCode||""),yr=P(()=>{var s;return xn((s=de.value)==null?void 0:s.startTownOptions)}),gr=P(()=>{var s;return xn((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,i)=>({key:s.key||`${s.name}-${i}`,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:"头"}))),wn=P(()=>mo()),wr=P(()=>`${V(mt("recordCount"))}条 / ${oe(mt("headCount"))}头`),Ln=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=Ln.value,i=s.length,l=Math.max(Math.ceil(i/ri),1),p=ut.value%l,y=p*ri,w=Math.min(y+ri,i);return{page:p,pageCount:l,start:y,end:w,total:i,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:js,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:js,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))}),Pi=P(()=>Mr.value.has(ga.value.key)),Pr=P(()=>Pi.value?ga.value.legends||[]:[]),Cr=P(()=>Pi.value?202:172),Fr=P(()=>{var l;const i=_n((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:i.length?i.join(" OR "):"EXCLUDE",legends:[{key:"yak-epidemic-village-boundary",name:"防疫村边界",fillColor:"#30DCFF",strokeColor:"#C9FBFF",selectable:!1}]}}),Tn=P(()=>D.value==="epidemic"?Fr.value:D.value==="trade"?null:Qe.value?Pi.value?ga.value:null:ga.value),Qe=P(()=>D.value==="structure"||D.value==="forecast"),Nr=P(()=>D.value==="forecast"?Z:z),xr=P(()=>Qe.value?null:Tn.value),_r=P(()=>Qe.value?null:kn.value),Rr=P(()=>Qe.value?!fa.value:!Zt.value),Ir=P(()=>Qe.value?"地图加载中":"3D 地图加载中"),kn=P(()=>D.value==="trade"?{scope:"trade-flow",title:`${$e.value||""}出栏来源`,metricLabel:"来源",unit:"头",source:vn.value?O(A({},vn.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"?`${mi.value.shortLabel||""}最新月预测`:D.value==="epidemic"?`${F.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 i=s.map(l=>`${l.marker}${l.seriesName}:${V(Math.abs(l.value))}头`);return`${s[0].name}<br/>${i.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:C,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:f,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,i=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(i[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:C,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:f,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(()=>Bi(Nt.value,"count","头",{style:"ladder",tooltipFormatter(s){const i=Nt.value[s.dataIndex];return`${i.name}<br/>统计存栏:${V(i.count)}头<br/>来源:数据库性别年龄乡镇明细`}})),Er=P(()=>{const s=Ya.value,i=s.rows,l=Math.max(...i.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=i[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:C,fontSize:10,fontWeight:600}}:void 0,grid:{left:18,right:18,top:42,bottom:44,containLabel:!1},xAxis:{type:"category",data:i.map(p=>p.name),axisLabel:{color:C,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:i.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:i.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:i.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(i[p].breedingCow+i[p].calf),color:"#ffffff",fontSize:10,fontWeight:700}}]}}),$r=P(()=>{const s=yn.value.slice().sort((y,w)=>y.year-w.year),i=s.map(y=>y.yoyPercent).filter(Number.isFinite),l=i.length?Math.floor(Math.min(...i)-4):-10,p=i.length?Math.ceil(Math.max(...i)+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:f,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:C,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:L,fontSize:10,fontFamily:Vi.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(i){var p,y;const l=s[(y=(p=i==null?void 0:i[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(i=>i.month),axisLabel:{color:C,fontSize:10,interval:0},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},axisTick:{show:!1}},yAxis:[{type:"value",scale:!0,axisLabel:{color:C,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(i=>i.count),"#30dcff",0,!0),{name:"较上月变化",type:"bar",yAxisIndex:1,barWidth:8,data:s.map(i=>i.change),itemStyle:{borderRadius:2,color:({value:i})=>Number(i)>=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:C,fontSize:10,interval:1},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.26)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:C,fontSize:10,formatter:s=>{const i=Number(s);return Number.isFinite(i)?Math.abs(i)>=1e4?`${Number((i/1e4).toFixed(1))}万`:`${i}`: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(()=>Bi(Jt.value,"value","头")),zr=P(()=>{const s=Jt.value,i=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)/i*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)/i*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:f,fontSize:11,fontWeight:700},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.26)"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:C,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}}]})),Sn=P(()=>{const s=Jt.value,i=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)/i*100))}))});function Yr(s){const i=Number((s==null?void 0:s.change)||0)>=0;return{"--heat-width":`${s.width}%`,"--heat-color":i?"#30dcff":"#8bf7ff","--heat-color-soft":i?"rgba(48, 220, 255, 0.24)":"rgba(139, 247, 255, 0.22)","--heat-color-dim":i?"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=an.value,i=s.map(p=>p.value),l=Math.max(...i,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:C,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:C,fontSize:10,formatter:oe},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"防疫记录",type:"bar",barMaxWidth:12,data:i,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:i,lineStyle:{width:2.4,color:"#8bf7ff"}}]}}),qr=P(()=>{const s=un.value,i=s.length>8?10:12,l=i+8,p=s.map(W=>Number(W.recordCount||0)),y=s.map(W=>Number(W.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(rn.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(W){const H=s[W[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:f,fontSize:11},selectedMode:!1},{data:["耳标数"],top:0,left:82,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:f,fontSize:11},selectedMode:!1}],grid:{left:42,right:12,top:46,bottom:68},xAxis:{type:"category",data:s.map(W=>W.name),axisLabel:{color:f,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:C,fontSize:10,align:"left"},axisLabel:{color:C,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:i,barMinHeight:2,z:3,data:p.map(W=>({value:W,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=sn.value;return{tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(i){const l=s[i[0].dataIndex];return`${l.name}<br/>防疫记录:${V(l.value)}条`}}),grid:{left:74,right:42,top:12,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:oe},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:s.map(i=>i.name),axisLabel:{color:f,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"记录",type:"bar",barWidth:9,data:s.map(i=>({value:i.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:i})=>oe(i)}}]}}),Kr=P(()=>{const s=mn.value;return{color:["#30dcff","#8bf7ff"],tooltip:O(A({},Be()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(i){const l=i.find(y=>y.seriesName==="流通头数"),p=i.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(i=>i.name),axisLabel:{color:C,fontSize:10,interval:1},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.24)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:C,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(i=>i.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(i=>i.recordCount),lineStyle:{width:2.2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2}}]}}),Zr=P(()=>Bi(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 i=za.value[s.dataIndex];return`${i.name}<br/>流通头数:${V(i.headCount)}头<br/>出证记录:${V(i.recordCount)}条`}})),Xr=P(()=>{const s=ki.value;return{color:Ye,tooltip:Be(i=>{const l=s.find(p=>p.name===i.name);return`${i.name}<br/>占比:${i.percent}%<br/>流通头数:${V(i.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(i){const l=s.find(p=>p.name===i);return l?`${i} ${oe(l.headCount)}头`:i}},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(i=>({name:i.name,value:i.headCount}))}]}}),Jr=P(()=>{const s=[{name:"省外A证",value:mt("outProvinceHeads","aCertHeads")},{name:"省内B证",value:mt("inProvinceHeads","bCertHeads")}];return{color:["#8bf7ff","#30dcff"],tooltip:Be(i=>`${i.name}<br/>流通头数:${V(i.value)}头<br/>占比:${i.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 Mn(){var s,i,l,p,y,w;if(Qe.value){(i=(s=pa.value)==null?void 0:s.refreshView)==null||i.call(s);return}(p=(l=Fe.value)==null?void 0:l.resume)==null||p.call(l),(w=(y=Fe.value)==null?void 0:y.refreshView)==null||w.call(y)}function Pn(){Mt&&(window.clearTimeout(Mt),Mt=null)}function Cn(){var s,i,l,p,y,w;if(Oe.value=!1,Ga.value={type:"loading",text:"地图正在复位"},Aa.value={type:"idle",text:""},Qe.value){(i=(s=pa.value)==null?void 0:s.hasMap)!=null&&i.call(s)?(fa.value=!0,(p=(l=pa.value)==null?void 0:l.resetView)==null||p.call(l)):(fa.value=!1,qi.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=Fe.value)==null?void 0:y.hasMap)!=null&&w.call(y)){Zt.value=!0,Mn();return}Pn(),Zt.value=!1,Ft=!1,Hi.value+=1,jt(()=>{Za()})}function Qr(){Oe.value=!1,Cn()}e({refreshMapView:Mn,resetMap:Cn,setActiveView(s){D.value=Ei(s)}}),Hs(()=>{Ci(),window.addEventListener("resize",Ci),is(),ns(D.value),va(),ja()}),qs(()=>{var s,i;ma=!0,window.removeEventListener("resize",Ci),Mt&&window.clearTimeout(Mt),Fi(),Ni(),(i=(s=Fe.value)==null?void 0:s.destroyMap)==null||i.call(s)}),qt([D,mi,Nt,ct,Ke,qe,on,ce,ue,F,$e,hn,gn,Je,be],()=>{Fo()},{immediate:!0}),qt(D,(s,i)=>{n("view-change",s),ns(s);const l=s==="structure"||s==="forecast",p=i==="structure"||i==="forecast",y=!l&&!p&&(s==="trade"||i==="trade");l&&!p&&(Oe.value=!1,fa.value=!1,Ga.value={type:"idle",text:""},Aa.value={type:"idle",text:""}),!l&&p&&(is(),Pn(),Oe.value=!1,Zt.value=!1,Ft=!1,Ga.value={type:"idle",text:""},Aa.value={type:"idle",text:""},jt(()=>{var w,N,_,E;Za(),(N=(w=Fe.value)==null?void 0:w.resume)==null||N.call(w),(E=(_=Fe.value)==null?void 0:_.refreshView)==null||E.call(_),window.setTimeout(()=>{var W,H;return(H=(W=Fe.value)==null?void 0:W.refreshView)==null?void 0:H.call(W)},180)})),y&&jt(()=>{var w,N,_,E;(N=(w=Fe.value)==null?void 0:w.resume)==null||N.call(w),(E=(_=Fe.value)==null?void 0:_.refreshView)==null||E.call(_)}),va(),ja()}),qt(()=>a.viewKey,s=>{const i=Ei(s);i!==D.value&&(D.value=i)}),qt(()=>a.active,s=>{var i,l,p,y;s?(Za(),(l=(i=Fe.value)==null?void 0:i.resume)==null||l.call(i),va(),ja()):((y=(p=Fe.value)==null?void 0:p.pause)==null||y.call(p),Fi(),Ni())}),qt(Ya,s=>{ut.value>=s.pageCount&&(ut.value=0),ja()});function Fn(s){return re(this,null,function*(){s===_e.value&&!ie.value||(_e.value=s,yield Vn(Number(s)),va())})}function va(){Fi(),!(!a.active||D.value!=="forecast"||ma||Re.value.length<=1)&&(Ea=window.setInterval(eo,Dh))}function eo(){if(Le.value||Re.value.length<=1)return;const s=Re.value.findIndex(l=>l.key===_e.value),i=s>=0?(s+1)%Re.value.length:0;Fn(Re.value[i].key)}function Fi(){Ea&&(window.clearInterval(Ea),Ea=null)}function ja(){Ni(),!(!a.active||D.value!=="structure"||ma||Ya.value.pageCount<=1)&&($a=window.setInterval(to,Oh))}function to(){const s=Ya.value.pageCount;s<=1||(ut.value=(ut.value+1)%s)}function Ni(){$a&&(window.clearInterval($a),$a=null)}function ao(s){return String(s||"").trim()}function Et(s){return String(s||"").trim()}function Nn(s){var p;const i=v.value,l=Number(s);return Number.isFinite(l)&&i.includes(l)?l:(p=i[i.length-1])!=null?p:null}function xi(s=F.value){const i=Nn(s);return i?{startDate:`${i}-01-01`,endDate:`${i}-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 _i(s=[]){return Array.isArray(s)?s.map((i,l)=>{var p,y,w;return{key:i.key||i.id||`${i.name||i.label||"item"}-${l}`,name:String(i.name||i.label||i.town||i.village||"未填写"),value:Number((w=(y=(p=i.value)!=null?p:i.count)!=null?y:i.total)!=null?w:0)}}).filter(i=>i.name&&Number.isFinite(i.value)):[]}function io(...s){const i=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(i)].sort((l,p)=>l-p)}function Qt(s=[],i="name"){return Array.isArray(s)?s.map((l,p)=>{var y,w,N,_,E,W,H,ye,gt,vt,Dt,Ot,zt,wa,La,Ta,ka;return{key:l.key||l.id||`${l[i]||l.name||l.label||"trade"}-${p}`,name:String(l[i]||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=(W=(E=(_=l.headCount)!=null?_:l.head_count)!=null?E:l.amount)!=null?W: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(i=>{var l,p,y,w,N,_,E,W,H;return{year:Number((p=(l=i.sourceYear)!=null?l:i.source_year)!=null?p:i.year),recordCount:Number((w=(y=i.recordCount)!=null?y:i.record_count)!=null?w:0),headCount:Number((W=(E=(_=(N=i.headCount)!=null?N:i.head_count)!=null?_:i.amount)!=null?E:i.value)!=null?W:0),yoyPercent:i.yoyPercent==null&&i.yoy_percent==null?null:Number((H=i.yoyPercent)!=null?H:i.yoy_percent)}}).filter(i=>Number.isFinite(i.year)&&Number.isFinite(i.headCount)):[]}function xn(s=[]){return Array.isArray(s)?ro(s.map(i=>{var l,p,y;return i&&typeof i=="object"?(y=(p=(l=i.value)!=null?l:i.label)!=null?p:i.name)!=null?y:"":i})):[]}function so(s=[]){return Array.isArray(s)?s.map(i=>{var l,p,y,w,N,_;if(i&&typeof i=="object"){const E=(y=(p=(l=i.value)!=null?l:i.name)!=null?p:i.label)!=null?y:"",W=(_=(N=(w=i.label)!=null?w:i.name)!=null?N:i.value)!=null?_:E;return E?{value:String(E),label:String(W||E)}:null}return i?{value:String(i),label:String(i)}:null}).filter(Boolean):[]}function ro(s=[]){return[...new Set(s.map(i=>String(i||"").trim()).filter(Boolean))]}function oo(s=[]){return Array.isArray(s)?s.map((i,l)=>{var p,y,w,N,_,E,W,H;return{key:i.key||i.id||`${i.name||i.town||"town"}-${l}`,name:Et(i.name||i.town||""),recordCount:Number((y=(p=i.recordCount)!=null?p:i.record_count)!=null?y:0),earTagCount:Number((N=(w=i.earTagCount)!=null?w:i.ear_tag_count)!=null?N:0),ownerCount:Number((E=(_=i.ownerCount)!=null?_:i.owner_count)!=null?E:0),villageCount:Number((H=(W=i.villageCount)!=null?W:i.village_count)!=null?H:0),firstDate:i.firstDate||i.first_date||null,lastDate:i.lastDate||i.last_date||null,source:"ledger"}}).filter(i=>i.name&&Number.isFinite(i.recordCount)&&Number.isFinite(i.earTagCount)).sort((i,l)=>Number(l.recordCount||0)-Number(i.recordCount||0)):[]}function _n(s=[]){return Array.isArray(s)?s.map((i,l)=>{var ye,gt,vt,Dt,Ot,zt,wa,La,Ta,ka,us,cs;const p=Et(i.town||i.townName||i.town_name||""),y=String(i.village||i.villageName||i.village_name||i.name||"").trim(),w=ft((vt=(gt=(ye=i.recordCount)!=null?ye:i.record_count)!=null?gt:i.records)!=null?vt:i.total),N=ft((wa=(zt=(Ot=(Dt=i.earTagCount)!=null?Dt:i.ear_tag_count)!=null?Ot:i.headCount)!=null?zt:i.head_count)!=null?wa:i.value),_=ft((Ta=(La=i.imageCount)!=null?La:i.image_count)!=null?Ta:i.images),E=ft((ka=i.imageRate)!=null?ka:i.image_rate),W=ft((us=i.lng)!=null?us:i.longitude),H=ft((cs=i.lat)!=null?cs:i.latitude);return{key:i.key||i.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:W,lat:H}}).filter(i=>i.town&&i.village&&Number.isFinite(i.earTagCount)).sort((i,l)=>Number(l.earTagCount||0)-Number(i.earTagCount||0)):[]}function ft(s){if(s==null||s==="")return NaN;const i=Number(String(s).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(i)?i:NaN}function Rn(s){return String(s||"").replace(/'/g,"''").replace(/%/g,"\\%").replace(/_/g,"\\_")}function lo(s,i){const l=Et(s),p=String(i||"").trim();if(!l||!p)return"";const y=`${l}${p}`,w=Rn(y),N=Rn(p);return`(full_name LIKE '%${w}%' OR name = '${w}' OR name = '${N}')`}function uo(s){const i=String(s||"").trim().replace(/\s+/g,"");return i?Array.from(i).join(`
`):""}function co(s){const i=String(s||"").trim();if(!i)return"";const l=i.match(/^(.+)(镇|乡|村)$/);return l?`${l[1]}
${l[2]}`:i}function ho(s,i){return In(s.name)-In(i.name)}function In(s){const i=String(s||"").match(/(\d{1,2})\D+(\d{1,2})/);return i?Number(i[1])*100+Number(i[2]):Number.MAX_SAFE_INTEGER}function Ri(s=[]){return Array.isArray(s)?s.map(Gn).filter(Boolean):[]}function Gn(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 An(s=[]){return Array.isArray(s)?s.map(po).filter(Boolean):[]}function po(s){var i,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=(i=s.amount)!=null?i: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,i){for(const l of i){const p=Number(s==null?void 0:s[l]);if(Number.isFinite(p))return p}return 0}function mt(...s){return fo(hn.value,s)}function mo(){if(!pn.value)return[];const s=Wa.value[0],i=ki.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,i?{key:"usage",badge:"用途",name:"流通头数首位用途",value:i.name,desc:`${V(i.headCount)}头 / ${V(i.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 Ii(s={}){return String(s.imagePaths||"").split(";").map(i=>i.trim()).filter(Boolean)}function Bn(s){const l=String(s||"").replace(/^images\//,"").split("/").map(encodeURIComponent).join("/");return`${Bh}/${l}`}function yo(s){li.value=Bn(s),Kt.value=!0}function Gi(){Kt.value=!1,li.value=""}function X(s){return s==null||s===""?"-":s}function go(s){const i=String(s!=null?s:"").trim();return!!(i&&i!=="-")}function we(s,i,l={}){return go(i)?A({label:s,value:i},l):null}function $t(s){return s?String(s).slice(0,10):"-"}function En(s){const i=String(s||"").trim();return i?i.length<7?i:`${i.slice(0,3)}****${i.slice(-4)}`:"-"}function vo(s){const i=String(s||"").trim();return i?i.length<=4?i:`****${i.slice(-4)}`:"-"}function bo(s){const i=String(s!=null?s:"").trim();if(!i)return"-";if(/kg|公斤|千克/i.test(i))return i;const l=Number(i);return Number.isFinite(l)?`${V(l)}kg`:i}function wo(s){return String(s!=null?s:"").trim()||"-"}function $n(s={}){return s.certScopeName||s.certType||"-"}function Lo(){return re(this,null,function*(){Ge.value=!0,k.value="";try{const s=yield Bl();if(Tt.value=Io(s.structureRows),kt.value=Ao(s.genderAgeRows),Lt.value=Bo(s.townRows),ct.value=ls(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 Vn(s){return re(this,null,function*(){var i,l;Le.value=!0,ie.value="",qe.value={},tt.value=[],Ue.value=[],Ve.value=[],Ke.value=[],Ie.value={},at.value={};try{const p=yield El(s),y=Eo(p.years),w=String((l=(i=p.selectedYear)!=null?i: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=ls(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){ie.value=Wo(p),Re.value=[],_e.value="",qe.value={},tt.value=[],Ue.value=[],Ve.value=[],Ke.value=[],Ie.value={},at.value={},fi=!1}Le.value=!1,ie.value||va()})}function Dn(){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 i=yield $l(s);de.value=i||{metrics:{},hasData:!1};const l=Number(i==null?void 0:i.selectedYear);$e.value=Number.isFinite(l)?l:null,(i==null?void 0:i.hasData)===!0&&$e.value&&(yield Ai(1))}catch(i){be.value="交易数据接口异常",de.value={metrics:{},hasData:!1},It.value=[],Gt.value=0}finally{Je.value=!1}})}function Ai(){return re(this,arguments,function*(s=ht.value){var l,p;if(!$e.value)return;Ra.value="",It.value=[],Gt.value=0;const i={year:$e.value,page:s,pageSize:Wi,keyword:ui.value};try{const y=yield Ms(i);It.value=An(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 i=Number(s);!Number.isFinite(i)||i===Number($e.value)||($e.value=i,ht.value=1,Ia.value="",ui.value="",Dn(i))}function ko(s){const i=Nn(s);!i||i===Number(F.value)||(F.value=i,te.value=1,Me.value="",Pe.value="",Ce.value=1,Ee.value=qa(),Un(i))}function On(){ui.value=Ia.value.trim(),Ai(1)}function zn(s){const i=Math.min(Math.max(Number(s)||1,1),Si.value);Ai(i)}function Wn(s=null){ci.value=!0,s&&(ha.value=s),Ua(s?ht.value:1,s)}function Yn(){ci.value=!1}function jn(){Ua(1)}function So(){pt.value={keyword:"",startTown:"",usageType:"",certType:""},Ua(1)}function Hn(s){const i=Math.min(Math.max(Number(s)||1,1),Mi.value);Ua(i)}function Ua(){return re(this,arguments,function*(s=At.value,i=null){var y,w;if(!$e.value)return;di.value=!0,hi.value="",Ct.value=[],da.value=0,ha.value=null;const l=pt.value,p={year:$e.value,page:s,pageSize:Ys,keyword:l.keyword.trim(),startTown:l.startTown,usageType:l.usageType,certType:l.certType};try{const N=yield Ms(p);Ct.value=An(N.rows),da.value=Number(((y=N.page)==null?void 0:y.totalCount)||N.totalCount||Ct.value.length||0),At.value=Number(((w=N.page)==null?void 0:w.page)||s||1);const _=i?i.certId||i.factoryCode:"",E=_?Ct.value.find(W=>(W.certId||W.factoryCode)===_)||i:Ct.value[0]||null;qn(E)}catch(N){hi.value="交易台账接口异常",Ct.value=[],da.value=0,ha.value=null}finally{di.value=!1}})}function qn(s){ha.value=s||null}function Mo(s){s!=null&&s.startTown&&(D.value="trade",jt(()=>{var i,l,p,y,w,N;(l=(i=Fe.value)==null?void 0:i.resume)==null||l.call(i),(y=(p=Fe.value)==null?void 0:p.refreshView)==null||y.call(p),(N=(w=Fe.value)==null?void 0:w.focusTown)==null||N.call(w,Et(s.startTown),{distanceScale:.78,duration:.8})}))}function Un(){return re(this,arguments,function*(s=F.value){var p,y;const i=Number(s),l=Number.isFinite(i)&&i>0?i:void 0;ce.value=!0,ue.value="",Te.value="",v.value=[],F.value=l!=null?l:null,B.value=Ha(),$.value=[],U.value=0;try{const w=yield Vl(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):[],F.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)||!F.value)return;const N=xi(F.value);try{const _=yield Oi(A({page:te.value,pageSize:si,keyword:Pe.value},N));$.value=Ri(_==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=[],F.value=null,B.value=Ha(),$.value=[],U.value=0}finally{ce.value=!1}})}function Kn(){return re(this,arguments,function*(s=te.value){var p,y;if(!F.value)return;ce.value=!0,Te.value="";const i=Math.min(Math.max(Number(s)||1,1),Ti.value),l=xi(F.value);$.value=[],U.value=0;try{const w=yield Oi(A({page:i,pageSize:si,keyword:Pe.value},l));$.value=Ri(w.rows),U.value=Number(((p=w.page)==null?void 0:p.totalCount)||w.totalCount||$.value.length||0),te.value=Number(((y=w.page)==null?void 0:y.page)||i||1)}catch(w){Te.value="防疫台账接口异常",$.value=[],U.value=0,te.value=1}finally{ce.value=!1}})}function Zn(){Pe.value=Me.value.trim(),Ee.value=O(A({},qa()),{keyword:Pe.value}),Kn(1)}function Xn(s){Kn(s)}function Jn(s=null){Ze.value=!0,s&&(Xe.value=s,dt.value=null),Ka(1,s)}function Qn(){Ze.value=!1,Gi()}function es(){Ka(1)}function Po(){Ee.value=qa(),Ka(1)}function ts(s){Ka(s)}function Ka(){return re(this,arguments,function*(s=Ce.value,i=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=xi(F.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:Ws};try{const _=yield Oi(y);Ae.value=Ri(_.rows),De.value=Number(((w=_.page)==null?void 0:w.totalCount)||_.totalCount||Ae.value.length||0),Ce.value=Number(((N=_.page)==null?void 0:N.page)||s||1);const E=i||Ae.value[0]||null;E?as(E):(Xe.value=null,dt.value=null)}catch(_){St.value="台账接口异常",Ae.value=[],De.value=0}finally{nt.value=!1}})}function as(s){return re(this,null,function*(){if(Xe.value=s,dt.value=null,!(s!=null&&s.earTag)&&!(s!=null&&s.epidemicId))return;const i=++Va;Pt.value=!0;try{const l=yield Dl(s.earTag||s.epidemicId);i===Va&&(dt.value=Gn(l)||s)}catch(l){i===Va&&(dt.value=s)}finally{i===Va&&(Pt.value=!1)}})}function is(){var s;Ui||Ba||(Ui=!0,pi=new Gl,Ba=!1,(s=pi.ready)==null||s.then(()=>{Ba=!0,Oe.value=!1,Za()}).catch(i=>{console.warn("[yakManagement] map assets unavailable",i),Zt.value=!1,Oe.value=!0}))}function ns(s){Ki||(Ki=!0,Lo()),s==="forecast"&&!fi&&(fi=!0,Vn()),s==="epidemic"&&!Zi&&(Zi=!0,Un()),Xi||(Xi=!0,Dn())}function Za(){ma||!a.active||!Ba||Ft||(Oe.value=!1,Ft=!0,Mt&&window.clearTimeout(Mt),Mt=window.setTimeout(()=>{Mt=null,ss()},600))}function ss(s=0){return re(this,null,function*(){var l,p;if(ma)return;if(!a.active){Ft=!1;return}if(yield jt(),!a.active){Ft=!1;return}const i=Fe.value;if((l=i==null?void 0:i.loadMap)==null||l.call(i,pi),i!=null&&i.canvasMap){Ft=!1,Zt.value=!0,Oe.value=!1,(p=i.play)==null||p.call(i);return}if(s<24){window.setTimeout(()=>ss(s+1),120);return}Ft=!1,Oe.value=!0})}function rs(s={}){Aa.value={type:s.type||"idle",text:s.text||""}}function Co(){fa.value=!0,Oe.value=!1}function os(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 Fo(){if(D.value==="epidemic"){n("module-stats",{moduleKey:"yak-management",items:ce.value||ue.value?[]:on.value});return}if(D.value==="forecast"){n("module-stats",{moduleKey:"yak-management",items:Le.value||ie.value?[]:Ke.value});return}if(D.value==="trade"){n("module-stats",{moduleKey:"yak-management",items:Je.value||be.value||!pn.value?[]:gn.value});return}n("module-stats",{moduleKey:"yak-management",items:ct.value})}function Bi(s,i,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||f,W=p.dimAxisTextColor||C;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[i])}${l}`}}),grid:{left:w?58:74,right:w?54:58,top:w?6:16,bottom:w?8:14},xAxis:{type:"value",axisLabel:{color:W,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[i],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:L,fontFamily:Vi.number,fontSize:w?10:bs.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,i,l,p=0,y=!1){return{name:s,type:"line",yAxisIndex:p,smooth:!0,symbolSize:5,data:i,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,i){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[i]||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:f,fontFamily:Vi.ui,fontSize:bs.tooltip,lineHeight:18},extraCssText:"box-shadow:0 0 10px rgba(0,210,255,.12);",formatter:s}}function Ei(s){return je.some(i=>i.key===s)?s:"structure"}function Io(s=[]){return xt(s).map((i,l)=>{var w,N,_,E;const p=String(i.name||i.label||i.type||`结构${l+1}`).trim(),y=st((N=(w=i.value)!=null?w:i.count)!=null?N:i.number);return{key:i.key||i.id||`${p}-${l}`,name:p,count:y,ratio:Number((E=(_=i.ratio)!=null?_:i.percent)!=null?E:0),source:i.source||"结构统计"}}).filter(i=>i.name&&i.count>0)}function Go(s=[]){return s.map((i,l)=>{var w,N;const p=String(i.name||i.label||`结构${l+1}`).trim(),y=st((N=(w=i.count)!=null?w:i.value)!=null?N:i.number);return O(A({},i),{key:i.key||`${p}-${l}`,name:p,count:y})}).filter(i=>i.name&&i.count>0)}function Ao(s=[]){return xt(s).map(i=>({key:i.key||i.age,age:String(i.age||"").trim(),cow:st(i.cow),bull:st(i.bull),total:st(i.total)})).filter(i=>i.age&&i.total>0)}function Bo(s=[]){return xt(s).map((i,l)=>{var p;return{key:i.key||i.areaCode||`town-${l}`,areaCode:String(i.areaCode||"").trim(),name:String(i.name||"").trim(),count:st((p=i.value)!=null?p:i.count),cow:st(i.cow),bull:st(i.bull),calf:st(i.calf),breedingCow:st(i.breedingCow),overageCow:st(i.overageCow)}}).filter(i=>i.name&&i.count>0).sort((i,l)=>l.count-i.count)}function ls(s=[]){return xt(s).map((i,l)=>({key:i.key||`structure-top-${l}`,zh:String(i.zh||i.name||"").trim(),value:Number(i.value),unit:String(i.unit||"").trim()})).filter(i=>i.zh&&Number.isFinite(i.value))}function Eo(s=[]){return xt(s).map(i=>{var p,y,w,N,_,E,W,H;const l=Number((p=i.sourceYear)!=null?p:i.source_year);return{key:String(l),label:`${l}年`,shortLabel:String(l),sourceYear:l,sourceRowCount:Number((y=i.sourceRowCount)!=null?y:i.source_row_count),monthCount:Number((w=i.monthCount)!=null?w:i.month_count),townCount:Number((N=i.townCount)!=null?N:i.town_count),latestTime:(_=i.latestTime)!=null?_:i.latest_time,latestTotal:Number((E=i.latestTotal)!=null?E:i.latest_total),latestGrowthValue:Number((W=i.latestGrowthValue)!=null?W:i.latest_growth_value),latestChange:yt((H=i.latestChange)!=null?H:i.latest_change)}}).filter(i=>Number.isInteger(i.sourceYear)).sort((i,l)=>i.sourceYear-l.sourceYear)}function $o(s={}){var i,l,p,y,w,N,_,E,W,H,ye;return{sourceYear:Number((i=s.sourceYear)!=null?i: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((W=s.previousTotal)!=null?W: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((i,l)=>{var p;return{key:i.time||i.month||`forecast-month-${l}`,month:String(i.month||i.time||"").trim(),time:String(i.time||"").slice(0,10),count:Number(i.value),growthValue:Number((p=i.growthValue)!=null?p:i.growth_value),change:yt(i.change)}}).filter(i=>i.month&&Number.isFinite(i.count)&&Number.isFinite(i.growthValue))}function Do(s=[]){return xt(s).map((i,l)=>{var y,w;const p=Number(i.value);return{key:i.id||i.areaCode||i.area_code||`forecast-town-${l}`,areaCode:String(i.areaCode||i.area_code||"").trim(),name:String(i.name||i.areaName||i.area_name||"").trim(),time:String(i.time||"").slice(0,10),value:p,count:p,forecast:p,growthRate:Number((y=i.growthRate)!=null?y:i.growth_rate),previousValue:yt((w=i.previousValue)!=null?w:i.previous_value),change:yt(i.change)}}).filter(i=>i.name&&Number.isFinite(i.value)&&Number.isFinite(i.growthRate)).sort((i,l)=>l.value-i.value||i.areaCode.localeCompare(l.areaCode))}function Oo(s=[]){return xt(s).map(i=>{var l,p,y,w,N;return{sourceYear:Number((l=i.sourceYear)!=null?l:i.source_year),latestTime:(p=i.latestTime)!=null?p:i.latest_time,latestTotal:Number((y=i.latestTotal)!=null?y:i.latest_total),latestGrowthValue:Number((w=i.latestGrowthValue)!=null?w:i.latest_growth_value),latestChange:yt((N=i.latestChange)!=null?N:i.latest_change)}}).filter(i=>Number.isInteger(i.sourceYear)&&Number.isFinite(i.latestTotal)).sort((i,l)=>i.sourceYear-l.sourceYear)}function yt(s){if(s==null||s==="")return null;const i=Number(s);return Number.isFinite(i)?i:null}function xt(s){if(Array.isArray(s))return s;if(s&&typeof s.value=="string")try{const i=JSON.parse(s.value);return Array.isArray(i)?i:[]}catch(i){return[]}return[]}function st(s){const i=Number(String(s!=null?s:"").replace(/,/g,"").replace(/%/g,""));return Number.isFinite(i)&&i>0?Math.round(i):0}function zo(s,i){const l=String((s==null?void 0:s.message)||s||"");return/未登录|401|HTTP_401/.test(l)?"结构数据未就绪":/超时|timeout/i.test(l)?"结构数据加载超时":i}function Wo(s){const i=String((s==null?void 0:s.message)||s||"");return/未登录|401|HTTP_401/.test(i)?"预测数据未就绪":/超时|timeout/i.test(i)?"预测数据加载超时":/暂无牦牛预测数据|预测数据暂无数据/.test(i)?i:"预测数据接口异常"}function V(s){const i=Number(s);return Number.isFinite(i)?i.toLocaleString("zh-CN",{maximumFractionDigits:Number.isInteger(i)?0:2}):"--"}function oe(s){const i=Number(s);return Number.isFinite(i)?Math.abs(i)>=1e4?`${(i/1e4).toFixed(Math.abs(i)>=1e5?0:1)}万`:Math.round(i).toLocaleString("zh-CN"):"--"}function ea(s){const i=Number(s);return Number.isFinite(i)?`${Number.isInteger(i)?i:i.toFixed(1)}%`:"--"}function Vt(s,i,l,p){const y=p*Math.PI/180;return{x:Number((s+l*Math.cos(y)).toFixed(2)),y:Number((i+l*Math.sin(y)).toFixed(2))}}function Yo(s,i,l,p,y,w){const N=Vt(s,i,p,y),_=Vt(s,i,p,w),E=Vt(s,i,l,w),W=Vt(s,i,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 ${W.x} ${W.y}`,"Z"].join(" ")}function jo(s=[]){const i=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/i*100}})}function Ho(s=[]){const i=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||""))),W=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:W,percent:Number.isFinite(H)&&H>0?H:W/i*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 i=N=>{var _;return Number(((_=s.find(E=>E.key===N))==null?void 0:_.percent)||0)},l=i("fertile-cow"),p=i("young"),y=i("overage-cow"),w=i("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 i=Number((s==null?void 0:s.count)||0);return Math.max(8,Math.min(100,i/ir.value*100))}function ba(s){if(s==null||s==="")return"--";const i=Number(s);return Number.isFinite(i)?`${i>=0?"+":"-"}${V(Math.abs(i))}`:"--"}return(s,i)=>(b(),T("div",wu,[et((b(),pe(bu,{key:Js.value,ref_key:"mapSceneRef",ref:Fe,class:"yak-map-scene","active-layer":xr.value,"map-ranking":_r.value,"tile-url-template":Ji.value,"use-satellite-base":yi.value,"satellite-max-zoom":21,"admin-boundary-line-scale":1.35,onLayerStatus:rs,onTileStatus:os},null,8,["active-layer","map-ranking","tile-url-template","use-satellite-base"])),[[tl,!Qe.value]]),Qe.value?(b(),pe(Al,{key:qi.value,ref_key:"yakOlMapRef",ref:pa,class:"yak-ol-map-layer",active:a.active&&Qe.value,"tile-url-template":Ji.value,center:Nr.value,"initial-zoom":$h,"minimum-zoom-distance":1,"county-view-target-offset":Y(ee),"admin-boundary-line-scale":1.65,"auto-apply-layer-map-view":!1,"max-zoom":21,"map-ranking":kn.value,"overlay-layer":Tn.value,onReady:Co,onLayerStatus:rs,onTileStatus:os},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(),T("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(),T(K,{key:1},[i[24]||(i[24]=h("span",null,"其余业务数据仍可查看,您可以重新加载地图。",-1)),h("button",{type:"button",onClick:Qr},"重新加载地图")],64)):(b(),T("span",Lu,"正在准备地图资源,请稍候"))],2)):fe("",!0),h("div",Tu,[D.value==="trade"&&fn.value.length?(b(),T("div",ku,[i[25]||(i[25]=h("span",null,"交易年份",-1)),(b(!0),T(K,null,le(fn.value,l=>(b(),T("button",{key:l,type:"button",class:ze({active:Number(l)===Number($e.value)}),onClick:p=>To(l)},S(l),11,Su))),128))])):fe("",!0),D.value==="epidemic"&&v.value.length?(b(),T("div",Mu,[i[26]||(i[26]=h("span",null,"防疫年份",-1)),(b(!0),T(K,null,le(v.value,l=>(b(),T("button",{key:l,type:"button",class:ze({active:Number(l)===Number(F.value)}),onClick:p=>ko(l)},S(l),11,Pu))),128))])):fe("",!0),D.value==="forecast"&&Re.value.length?(b(),T("div",Cu,[i[27]||(i[27]=h("span",null,"预测年份",-1)),(b(!0),T(K,null,le(Re.value,l=>(b(),T("button",{key:l.key,type:"button",class:ze({active:l.key===_e.value}),onClick:p=>Fn(l.key)},S(l.shortLabel),11,Fu))),128))])):fe("",!0),h("div",Nu,[h("div",xu,[D.value==="structure"?(b(),T(K,{key:0},[J(ne,{class:"yak-side-card left-card",title:"繁殖基础评估",width:Y(r),height:u.value},{default:ae(()=>[Ge.value?(b(),T("div",_u,"结构数据加载中")):k.value?(b(),T("div",Ru,S(k.value),1)):wi.value.length?(b(),T("div",Gu,[h("div",Au,[h("strong",null,S(tn.value.title)+","+S(tn.value.summary),1)]),h("div",Bu,[(b(!0),T(K,null,le(wi.value,l=>(b(),T("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),i[28]||(i[28]=h("i",null,[h("b")],-1)),h("em",null,S(l.desc),1)],4))),128))])])):(b(),T("div",Iu,"繁殖结构暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"畜群结构占比",width:Y(r),height:u.value},{default:ae(()=>[h("div",Eu,[h("div",$u,[h("div",Vu,[(b(),T("svg",Du,[h("g",Ou,[(b(!0),T(K,null,le(nr.value,l=>(b(),T("path",{key:l.key,class:ze(["structure-rose-segment",{"is-active":l.index===Li.value}]),d:l.path,fill:l.color,stroke:l.color},null,10,zu))),128))]),i[29]||(i[29]=h("circle",{class:"structure-rose-glow",cx:"75",cy:"75",r:"24"},null,-1)),i[30]||(i[30]=h("circle",{class:"structure-rose-hole",cx:"75",cy:"75",r:"16"},null,-1)),i[31]||(i[31]=h("text",{class:"structure-rose-center",x:"75",y:"72","text-anchor":"middle"},"结构",-1)),i[32]||(i[32]=h("text",{class:"structure-rose-center is-sub",x:"75",y:"83","text-anchor":"middle"},"占比",-1))]))]),h("div",Wu,[(b(!0),T(K,null,le(ya.value,(l,p)=>(b(),T("div",{key:l.key||l.name,class:ze(["structure-ratio-row",{"is-active":p===Li.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),i[33]||(i[33]=h("em",null,"头",-1))],6))),128))])]),Ge.value?(b(),T("div",Yu,"结构数据加载中")):k.value?(b(),T("div",ju,S(k.value),1)):fe("",!0)])]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"母牛/公牛年龄结构",width:Y(r),height:u.value},{default:ae(()=>[Ge.value?(b(),T("div",Hu,"结构数据加载中")):k.value?(b(),T("div",qu,S(k.value),1)):Da.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Gr.value,autoresize:!0},null,8,["option"])):(b(),T("div",Uu,"年龄结构暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"牦牛乡镇分布",width:Y(r),height:u.value},{default:ae(()=>[Ge.value?(b(),T("div",Ku,"结构数据加载中")):k.value?(b(),T("div",Zu,S(k.value),1)):Nt.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Ar.value,autoresize:!0},null,8,["option"])):(b(),T("div",Xu,"乡镇结构暂无数据"))]),_:1},8,["width","height"])],64)):D.value==="forecast"?(b(),T(K,{key:1},[J(ne,{class:"yak-side-card left-card",title:"预测数据概览",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",Ju,"预测数据加载中")):ie.value?(b(),T("div",Qu,S(ie.value),1)):vi.value?(b(),T("div",tc,[h("div",ac,[h("span",null,S(mi.value.label)+"真实源数据",1),h("strong",{class:ze({positive:gi.value>0,negative:gi.value<0})},[Wt(" 环比 "+S(ba(gi.value)),1),i[34]||(i[34]=h("em",null,"头",-1))],2)]),h("div",ic,[(b(!0),T(K,null,le(Qs.value,l=>(b(),T("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),i[35]||(i[35]=h("i",null,[h("b")],-1)),h("strong",null,S(l.display),1)],6))),128))])])):(b(),T("div",ec,"预测数据暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"月度预测趋势",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",nc,"预测数据加载中")):ie.value?(b(),T("div",sc,S(ie.value),1)):Xt.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Vr.value,autoresize:!0},null,8,["option"])):(b(),T("div",rc,"月度预测暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"月度数量与增长值",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",oc,"预测数据加载中")):ie.value?(b(),T("div",lc,S(ie.value),1)):Xt.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Dr.value,autoresize:!0},null,8,["option"])):(b(),T("div",uc,"月度预测暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"数据覆盖与口径",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",cc,"预测数据加载中")):ie.value?(b(),T("div",dc,S(ie.value),1)):Qi.value.length?(b(),T("div",pc,[(b(!0),T(K,null,le(Qi.value,l=>(b(),T("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),i[36]||(i[36]=h("i",null,[h("b")],-1)),h("strong",null,S(l.display),1)],4))),128))])):(b(),T("div",hc,"数据覆盖信息暂无数据"))]),_:1},8,["width","height"])],64)):D.value==="epidemic"?(b(),T(K,{key:2},[J(ne,{class:"yak-side-card left-card",title:"防疫统计",width:Y(r),height:u.value},{default:ae(()=>[ce.value?(b(),T("div",fc,"防疫数据加载中")):ue.value?(b(),T("div",mc,S(ue.value),1)):un.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:qr.value,autoresize:!0},null,8,["option"])):(b(),T("div",yc,"防疫统计暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"养殖户防疫排行",width:Y(r),height:u.value},{default:ae(()=>[ce.value?(b(),T("div",gc,"防疫数据加载中")):ue.value?(b(),T("div",vc,S(ue.value),1)):sn.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Ur.value,autoresize:!0},null,8,["option"])):(b(),T("div",bc,"养殖户防疫排行暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"防疫作业趋势",width:Y(r),height:u.value},{default:ae(()=>[ce.value?(b(),T("div",wc,"防疫数据加载中")):ue.value?(b(),T("div",Lc,S(ue.value),1)):an.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Hr.value,autoresize:!0},null,8,["option"])):(b(),T("div",Tc,"防疫作业趋势暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"疫苗类型分布",width:Y(r),height:u.value},{default:ae(()=>[ce.value?(b(),T("div",kc,"防疫数据加载中")):ue.value?(b(),T("div",Sc,S(ue.value),1)):Oa.value.length?(b(),T("div",Mc,[h("div",Pc,[(b(),pe(vl,{key:rr.value,data:Oa.value,delay:3e3,colors:Se,opacity:.62,class:"epidemic-three-pie"},{default:ae(({data:l})=>[h("div",Cc,[h("strong",null,S(oe((l==null?void 0:l.count)||rn.value)),1),h("span",null,S((l==null?void 0:l.name)||"疫苗类型"),1)])]),_:1},8,["data"]))]),h("div",Fc,[(b(!0),T(K,null,le(Oa.value,(l,p)=>(b(),T("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(),T("div",Nc,"暂无疫苗类型数据"))]),_:1},8,["width","height"])],64)):D.value==="trade"?(b(),T(K,{key:3},[J(ne,{class:"yak-side-card left-card",title:"交易流通要点",width:Y(r),height:u.value},{default:ae(()=>[h("div",xc,[Je.value?(b(),T("div",_c,"交易数据加载中")):be.value?(b(),T("div",Rc,S(be.value),1)):wn.value.length?(b(),T(K,{key:3},[h("div",Gc,[h("span",null,S($e.value)+"年真实台账汇总",1),h("strong",null,S(wr.value),1)]),h("div",Ac,[(b(!0),T(K,null,le(wn.value,l=>(b(),T("div",{key:l.key,class:"trade-risk-row",style:bt({"--risk-color":l.color})},[i[37]||(i[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(),T("div",Ic,S(de.value.emptyMessage||"暂无交易流通数据"),1))])]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"交易流通趋势",width:Y(r),height:u.value},{default:ae(()=>[Je.value?(b(),T("div",Bc,"交易数据加载中")):be.value?(b(),T("div",Ec,S(be.value),1)):mn.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Kr.value,autoresize:!0},null,8,["option"])):(b(),T("div",$c,"暂无月度交易数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"来源乡镇分布",width:Y(r),height:u.value},{default:ae(()=>[Je.value?(b(),T("div",Vc,"交易数据加载中")):be.value?(b(),T("div",Dc,S(be.value),1)):za.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Zr.value,autoresize:!0},null,8,["option"])):(b(),T("div",Oc,"暂无来源乡镇数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card left-card",title:"用途结构统计",width:Y(r),height:u.value},{default:ae(()=>[Je.value?(b(),T("div",zc,"交易数据加载中")):be.value?(b(),T("div",Wc,S(be.value),1)):ki.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Xr.value,autoresize:!0},null,8,["option"])):(b(),T("div",Yc,"暂无交易用途数据"))]),_:1},8,["width","height"])],64)):fe("",!0)])]),h("div",jc,[h("div",Hc,[D.value==="structure"?(b(),T(K,{key:0},[J(ne,{class:"yak-side-card right-card",title:"乡镇存栏排行",width:Y(r),height:u.value},{default:ae(()=>[Ge.value?(b(),T("div",qc,"结构数据加载中")):k.value?(b(),T("div",Uc,S(k.value),1)):Nt.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Br.value,autoresize:!0},null,8,["option"])):(b(),T("div",Kc,"乡镇结构暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card",title:"能繁母牛与犊牛分布",width:Y(r),height:u.value},{default:ae(()=>[Ge.value?(b(),T("div",Zc,"结构数据加载中")):k.value?(b(),T("div",Xc,S(k.value),1)):Ln.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Er.value,autoresize:!0},null,8,["option"])):(b(),T("div",Jc,"母牛与犊牛明细暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card",title:"年度交易流通",width:Y(r),height:u.value},{default:ae(()=>[Je.value?(b(),T("div",Qc,"交易数据加载中")):be.value?(b(),T("div",ed,S(be.value),1)):yn.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:$r.value,autoresize:!0},null,8,["option"])):(b(),T("div",td,"暂无年度交易数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card",title:"性别与生产阶段汇总",width:Y(r),height:u.value},{default:ae(()=>[h("div",ad,[ya.value.length?(b(),T("div",id,[(b(!0),T(K,null,le(en.value,l=>(b(),T("div",{key:l.key||l.name,class:"structure-summary-row",style:bt({"--structure-color":l.color,"--structure-width":`${Uo(l)}%`})},[h("span",null,[i[38]||(i[38]=h("i",null,null,-1)),Wt(S(l.name),1)]),i[40]||(i[40]=h("b",null,[h("em")],-1)),h("strong",null,[Wt(S(oe(l.count)),1),i[39]||(i[39]=h("em",null,"头",-1))]),h("small",null,S(ea(l.percent)),1)],4))),128))])):fe("",!0),Ge.value?(b(),T("div",nd,"结构数据加载中")):k.value?(b(),T("div",sd,S(k.value),1)):fe("",!0)])]),_:1},8,["width","height"])],64)):D.value==="forecast"?(b(),T(K,{key:1},[J(ne,{class:"yak-side-card right-card",title:"最新月乡镇预测排行",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",rd,"预测数据加载中")):ie.value?(b(),T("div",od,S(ie.value),1)):Jt.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Or.value,autoresize:!0},null,8,["option"])):(b(),T("div",ld,"乡镇预测暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card",title:"最新月乡镇占比",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",ud,"预测数据加载中")):ie.value?(b(),T("div",cd,S(ie.value),1)):Jt.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:zr.value,autoresize:!0},null,8,["option"])):(b(),T("div",dd,"乡镇预测暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card",title:"各年度最新月对比",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",hd,"预测数据加载中")):ie.value?(b(),T("div",pd,S(ie.value),1)):Ve.value.length?(b(),pe(Y(ke),{key:3,class:"yak-chart",option:Wr.value,autoresize:!0},null,8,["option"])):(b(),T("div",fd,"年度对比暂无数据"))]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card",title:"乡镇环比变化",width:Y(r),height:u.value},{default:ae(()=>[Le.value?(b(),T("div",md,"预测数据加载中")):ie.value?(b(),T("div",yd,S(ie.value),1)):Sn.value.length?(b(),T("div",vd,[(b(!0),T(K,null,le(Sn.value,l=>(b(),T("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),i[41]||(i[41]=h("b",null,[h("i")],-1)),h("strong",null,S(ba(l.change)),1)],14,bd))),128))])):(b(),T("div",gd,"乡镇环比暂无数据"))]),_:1},8,["width","height"])],64)):D.value==="epidemic"?(b(),pe(ne,{key:2,class:"yak-side-card right-card epidemic-ledger-card",title:"防疫记录台账",width:Y(r),height:c.value},{default:ae(()=>[h("div",wd,[h("div",Ld,[h("span",null,S(F.value)+"年 共 "+S(V(U.value))+" 条",1),h("div",null,[et(h("input",{"onUpdate:modelValue":i[0]||(i[0]=l=>Me.value=l),type:"search",placeholder:"耳标/养殖户/疫苗",onKeyup:Xa(Zn,["enter"])},null,544),[[ta,Me.value]]),h("button",{type:"button",onClick:Zn},"搜索"),h("button",{type:"button",class:"is-more",onClick:i[1]||(i[1]=l=>Jn())},"查看更多")])]),i[42]||(i[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",Td,[(b(!0),T(K,null,le(lr.value,l=>(b(),T("button",{key:l.epidemicId||l.earTag,type:"button",onClick:p=>Jn(l)},[h("span",null,S(X(l.earTag)),1),h("span",null,S(X(l.owner)),1),h("span",null,S(X(l.town)),1),h("strong",null,S(X(l.medicine)),1),h("span",null,S($t(l.operateTime)),1)],8,kd))),128)),$.value.length?fe("",!0):(b(),T("div",Sd,S(ce.value?"防疫台账读取中":Te.value||ue.value||"暂无防疫记录"),1))]),h("div",Md,[h("span",null,"第 "+S(te.value)+" / "+S(Ti.value)+" 页",1),h("button",{type:"button",disabled:te.value<=1,onClick:i[2]||(i[2]=l=>Xn(te.value-1))},"上一页",8,Pd),h("button",{type:"button",disabled:te.value>=Ti.value,onClick:i[3]||(i[3]=l=>Xn(te.value+1))},"下一页",8,Cd)])])]),_:1},8,["width","height"])):D.value==="trade"?(b(),T(K,{key:3},[J(ne,{class:"yak-side-card right-card",title:"出证结构统计",width:Y(r),height:u.value},{default:ae(()=>[h("div",Fd,[Je.value?(b(),T("div",Nd,"交易数据加载中")):be.value?(b(),T("div",xd,S(be.value),1)):hr.value.length?(b(),T(K,{key:3},[h("div",Rd,[h("span",null,[i[44]||(i[44]=h("em",null,"省外流通 A证",-1)),h("strong",null,[Wt(S(V(mt("outProvinceHeads","aCertHeads"))),1),i[43]||(i[43]=h("b",null,"头",-1))]),h("small",null,S(V(mt("outProvinceCount","aCertCount")))+"条记录",1)]),h("span",null,[i[46]||(i[46]=h("em",null,"省内流通 B证",-1)),h("strong",null,[Wt(S(V(mt("inProvinceHeads","bCertHeads"))),1),i[45]||(i[45]=h("b",null,"头",-1))]),h("small",null,S(V(mt("inProvinceCount","bCertCount")))+"条记录",1)])]),J(Y(ke),{class:"trade-cert-chart",option:Jr.value,autoresize:!0},null,8,["option"])],64)):(b(),T("div",_d,"暂无出证结构数据"))])]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card trade-source-card",title:"出栏来源排行",width:Y(r),height:d.value},{default:ae(()=>[h("div",Id,[(b(!0),T(K,null,le(Wa.value,(l,p)=>(b(),T("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(),T("div",Gd,S(Je.value?"交易数据读取中":be.value||"暂无出栏来源数据"),1))])]),_:1},8,["width","height"]),J(ne,{class:"yak-side-card right-card trade-ledger-card",title:"交易出证台账",width:Y(r),height:m.value},{default:ae(()=>[h("div",Ad,[h("div",Bd,[h("span",null,"共 "+S(V(Gt.value))+" 条",1),h("div",null,[et(h("input",{"onUpdate:modelValue":i[4]||(i[4]=l=>Ia.value=l),type:"search",placeholder:"货主/车辆/检疫号/地区",onKeyup:Xa(On,["enter"])},null,544),[[ta,Ia.value]]),h("button",{type:"button",onClick:On},"搜索"),h("button",{type:"button",class:"is-more",onClick:i[5]||(i[5]=l=>Wn())},"查看更多")])]),i[47]||(i[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",Ed,[(b(!0),T(K,null,le(bn.value,l=>(b(),T("button",{key:l.certId,type:"button",onClick:p=>Wn(l)},[h("span",null,S(X(l.ownerName)),1),h("span",null,S(X(l.transportNumber)),1),h("strong",null,S(V(l.amount))+"头",1),h("span",null,S(X(l.startTown)),1),h("span",null,S(X(l.usageTypeName)),1),h("span",null,S($t(l.issueTime)),1)],8,$d))),128)),bn.value.length?fe("",!0):(b(),T("div",Vd,S(Je.value?"交易台账读取中":Ra.value||be.value||"暂无交易记录"),1))]),h("div",Dd,[h("span",null,"第 "+S(ht.value)+" / "+S(Si.value)+" 页",1),h("button",{type:"button",disabled:ht.value<=1,onClick:i[6]||(i[6]=l=>zn(ht.value-1))},"上一页",8,Od),h("button",{type:"button",disabled:ht.value>=Si.value,onClick:i[7]||(i[7]=l=>zn(ht.value+1))},"下一页",8,zd)])])]),_:1},8,["width","height"])],64)):fe("",!0)])]),h("div",Wd,[J(Rl,{"model-value":D.value,topics:je,"onUpdate:modelValue":i[8]||(i[8]=l=>D.value=l)},null,8,["model-value"])]),Qe.value?(b(),T("div",Yd,[J(Il,{modelValue:He.value,"onUpdate:modelValue":i[9]||(i[9]=l=>He.value=l),"topic-key":"yak-management",layers:Sr.value,legends:Pr.value,multiple:"",compact:"",width:248,height:Cr.value},null,8,["modelValue","layers","legends","height"])])):fe("",!0)]),Ze.value?(b(),T("div",{key:2,class:"epidemic-ledger-modal",onClick:Ja(Qn,["self"])},[h("div",jd,[h("div",Hd,[h("div",null,[i[48]||(i[48]=h("span",null,"牦牛防疫台账",-1)),h("strong",null,S(F.value)+"年 "+S(V(De.value))+" 条记录",1)]),h("button",{type:"button",onClick:Qn},"关闭")]),h("div",qd,[et(h("input",{"onUpdate:modelValue":i[10]||(i[10]=l=>Ee.value.keyword=l),type:"search",placeholder:"耳标 / 养殖户 / 药品","aria-label":"耳标 / 养殖户 / 药品",onKeyup:Xa(es,["enter"])},null,544),[[ta,Ee.value.keyword]]),et(h("select",{"onUpdate:modelValue":i[11]||(i[11]=l=>Ee.value.town=l)},[i[49]||(i[49]=h("option",{value:""},"全部镇/乡",-1)),(b(!0),T(K,null,le(cr.value,l=>(b(),T("option",{key:l,value:l},S(l),9,Ud))),128))],512),[[Ma,Ee.value.town]]),et(h("select",{"onUpdate:modelValue":i[12]||(i[12]=l=>Ee.value.medicine=l)},[i[50]||(i[50]=h("option",{value:""},"全部疫苗",-1)),(b(!0),T(K,null,le(dr.value,l=>(b(),T("option",{key:l,value:l},S(l),9,Kd))),128))],512),[[Ma,Ee.value.medicine]]),et(h("input",{"onUpdate:modelValue":i[13]||(i[13]=l=>Ee.value.startDate=l),type:"date"},null,512),[[ta,Ee.value.startDate]]),et(h("input",{"onUpdate:modelValue":i[14]||(i[14]=l=>Ee.value.endDate=l),type:"date"},null,512),[[ta,Ee.value.endDate]]),h("button",{type:"button",onClick:es},"检索"),h("button",{type:"button",class:"is-ghost",onClick:Po},"重置")]),h("div",Zd,[h("div",Xd,[i[51]||(i[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),T(K,null,le(Ae.value,l=>{var p,y;return b(),T("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=>as(l)},[h("span",null,S(X(l.earTag)),1),h("span",null,S(X(l.owner)),1),h("span",null,S(X(l.town)),1),h("span",null,S(X(l.village)),1),h("strong",null,S(X(l.medicine)),1),h("span",null,S($t(l.operateTime)),1),h("span",null,S(Ii(l).length?`${Ii(l).length}张`:"无"),1)],10,Jd)}),128)),Ae.value.length?fe("",!0):(b(),T("div",Qd,S(nt.value?"台账读取中":St.value||"暂无匹配记录"),1))]),h("div",eh,[h("div",th,[h("div",null,[h("span",null,S(X(Bt.value.earTag)),1),h("em",null,S(X(Bt.value.medicine||Bt.value.preventionType)),1)]),h("strong",null,S(Pt.value?"加载中":$t(Bt.value.operateTime)),1)]),h("div",ah,[(b(!0),T(K,null,le(ur.value,l=>(b(),T("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))]),dn.value.length?(b(),T("div",ih,[i[52]||(i[52]=h("div",{class:"epidemic-detail-photo-title"},"现场照片",-1)),h("div",nh,[(b(!0),T(K,null,le(dn.value.slice(0,6),l=>(b(),T("button",{key:l,type:"button",class:"epidemic-modal-photo-thumb",onClick:Ja(p=>yo(l),["stop"])},[h("img",{src:Bn(l),alt:"防疫照片"},null,8,rh)],8,sh))),128))])])):fe("",!0)])]),h("div",oh,[h("span",null,"第 "+S(Ce.value)+" / "+S(cn.value)+" 页",1),h("button",{type:"button",disabled:Ce.value<=1,onClick:i[15]||(i[15]=l=>ts(Ce.value-1))},"上一页",8,lh),h("button",{type:"button",disabled:Ce.value>=cn.value,onClick:i[16]||(i[16]=l=>ts(Ce.value+1))},"下一页",8,uh)])])])):fe("",!0),ci.value?(b(),T("div",{key:3,class:"epidemic-ledger-modal trade-ledger-modal",onClick:Ja(Yn,["self"])},[h("div",ch,[h("div",dh,[h("div",null,[i[53]||(i[53]=h("span",null,"牦牛交易出证台账",-1)),h("strong",null,S($e.value)+"年 "+S(V(da.value))+" 条记录",1)]),h("button",{type:"button",onClick:Yn},"关闭")]),h("div",hh,[et(h("input",{"onUpdate:modelValue":i[17]||(i[17]=l=>pt.value.keyword=l),type:"search",placeholder:"货主 / 车辆 / 检疫号 / 地区",onKeyup:Xa(jn,["enter"])},null,544),[[ta,pt.value.keyword]]),et(h("select",{"onUpdate:modelValue":i[18]||(i[18]=l=>pt.value.startTown=l)},[i[54]||(i[54]=h("option",{value:""},"全部来源乡镇",-1)),(b(!0),T(K,null,le(yr.value,l=>(b(),T("option",{key:l,value:l},S(l),9,ph))),128))],512),[[Ma,pt.value.startTown]]),et(h("select",{"onUpdate:modelValue":i[19]||(i[19]=l=>pt.value.usageType=l)},[i[55]||(i[55]=h("option",{value:""},"全部用途",-1)),(b(!0),T(K,null,le(gr.value,l=>(b(),T("option",{key:l,value:l},S(l),9,fh))),128))],512),[[Ma,pt.value.usageType]]),et(h("select",{"onUpdate:modelValue":i[20]||(i[20]=l=>pt.value.certType=l)},[i[56]||(i[56]=h("option",{value:""},"全部证书",-1)),(b(!0),T(K,null,le(vr.value,l=>(b(),T("option",{key:l.value,value:l.value},S(l.label),9,mh))),128))],512),[[Ma,pt.value.certType]]),h("button",{type:"button",onClick:jn},"检索"),h("button",{type:"button",class:"is-ghost",onClick:So},"重置")]),h("div",yh,[h("div",gh,[i[57]||(i[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),T(K,null,le(Ct.value,l=>(b(),T("button",{key:l.certId||l.factoryCode,type:"button",class:ze({active:mr.value===(l.certId||l.factoryCode)}),onClick:p=>qn(l)},[h("span",null,S(X(l.ownerName)),1),h("span",null,S(X(l.certType||l.certScopeName)),1),h("span",null,S(X(l.transportNumber)),1),h("strong",null,S(V(l.amount))+"头",1),h("span",null,S(X(l.startTown)),1),h("span",null,S(X(l.usageTypeName)),1),h("span",null,S($t(l.issueTime)),1),h("span",null,S(X(l.statusName)),1)],10,vh))),128)),Ct.value.length?fe("",!0):(b(),T("div",bh,S(di.value?"交易台账读取中":hi.value||"暂无匹配记录"),1))]),h("div",wh,[h("div",Lh,[h("div",null,[h("span",null,S(X(he.value.factoryCode||he.value.certId)),1),h("em",null,S($n(he.value)),1)]),h("strong",null,S($t(he.value.issueTime)),1)]),h("div",Th,[h("span",kh,[i[58]||(i[58]=h("em",null,"货主",-1)),h("strong",null,S(X(he.value.ownerName)),1)]),h("span",null,[i[59]||(i[59]=h("em",null,"联系方式",-1)),h("strong",null,S(En(he.value.ownerPhone)),1)]),h("span",null,[i[60]||(i[60]=h("em",null,"证书类型",-1)),h("strong",null,S($n(he.value)),1)]),h("span",null,[i[61]||(i[61]=h("em",null,"车牌号",-1)),h("strong",null,S(X(he.value.transportNumber)),1)]),h("span",null,[i[62]||(i[62]=h("em",null,"牦牛数量",-1)),h("strong",null,S(V(he.value.amount))+"头",1)]),h("span",null,[i[63]||(i[63]=h("em",null,"用途",-1)),h("strong",null,S(X(he.value.usageTypeName)),1)]),h("span",null,[i[64]||(i[64]=h("em",null,"来源乡镇",-1)),h("strong",null,S(X(he.value.startTown)),1)]),h("span",null,[i[65]||(i[65]=h("em",null,"目的省份",-1)),h("strong",null,S(X(he.value.destProvince)),1)]),h("span",null,[i[66]||(i[66]=h("em",null,"检疫员",-1)),h("strong",null,S(X(he.value.quarantineOfficerName)),1)]),h("span",Sh,[i[67]||(i[67]=h("em",null,"状态",-1)),h("strong",null,S(X(he.value.statusName)),1)]),h("span",Mh,[i[68]||(i[68]=h("em",null,"来源地区",-1)),h("strong",null,S(X(he.value.startRegionFullName)),1)]),h("span",Ph,[i[69]||(i[69]=h("em",null,"目的地",-1)),h("strong",null,S(X(he.value.destRegionFullName)),1)])]),h("button",{type:"button",class:"trade-detail-locate",disabled:!he.value.startTown,onClick:i[21]||(i[21]=l=>Mo(he.value))}," 查看乡镇位置 ",8,Ch)])]),h("div",Fh,[h("span",null,"第 "+S(At.value)+" / "+S(Mi.value)+" 页",1),h("button",{type:"button",disabled:At.value<=1,onClick:i[22]||(i[22]=l=>Hn(At.value-1))},"上一页",8,Nh),h("button",{type:"button",disabled:At.value>=Mi.value,onClick:i[23]||(i[23]=l=>Hn(At.value+1))},"下一页",8,xh)])])])):fe("",!0),Kt.value?(b(),T("div",{key:4,class:"epidemic-image-preview-modal",onClick:Ja(Gi,["self"])},[h("div",_h,[h("div",Rh,[h("div",null,[i[70]||(i[70]=h("span",null,"防疫照片",-1)),h("strong",null,S(X(Bt.value.earTag)),1)]),h("button",{type:"button",onClick:Gi},"关闭")]),h("div",Ih,[h("div",Gh,[h("img",{src:li.value,alt:"防疫照片预览"},null,8,Ah)])])])])):fe("",!0)]))}};export{ip as default};