var ll=Object.defineProperty,ul=Object.defineProperties;var cl=Object.getOwnPropertyDescriptors;var ja=Object.getOwnPropertySymbols;var er=Object.prototype.hasOwnProperty,tr=Object.prototype.propertyIsEnumerable;var pa=Math.pow,Qn=(b,e,t)=>e in b?ll(b,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):b[e]=t,N=(b,e)=>{for(var t in e||(e={}))er.call(e,t)&&Qn(b,t,e[t]);if(ja)for(var t of ja(e))tr.call(e,t)&&Qn(b,t,e[t]);return b},$=(b,e)=>ul(b,cl(e));var ar=(b,e)=>{var t={};for(var a in b)er.call(b,a)&&e.indexOf(a)<0&&(t[a]=b[a]);if(b!=null&&ja)for(var a of ja(b))e.indexOf(a)<0&&tr.call(b,a)&&(t[a]=b[a]);return t};var he=(b,e,t)=>new Promise((a,n)=>{var s=d=>{try{u(t.next(d))}catch(h){n(h)}},o=d=>{try{u(t.throw(d))}catch(h){n(h)}},u=d=>d.done?a(d.value):Promise.resolve(d.value).then(s,o);u((t=t.apply(b,e)).next())});import{q as Dr,h as Or,w as Ht,o as I,c as B,a as f,d as z,K as dl,A as Yt,g as k,L as Ae,s as tt,v as hl,C as Ha,j as ke,n as Oe,t as P,F as ne,y as pe,u as j,b as H,x as oe,J as Mt,B as Ot,e as qa,H as Zt,f as Ua,N as fa}from"./index-1784043664472.js";import{H as Pe}from"./index.esm.min-c54f6e6e-1784043664472.js";import{_ as le}from"./index-e3442fcf-1784043664472.js";import{t as qi,S as ia,u as ai,v as La,w as pl,V as re,F as fl,C as yt,G as Te,c as ml,d as gl,f as yl,g as zi,L as Xt,D as Re,a as ve,h as Ka,R as ut,A as Ie,N as ir,b as qe,P as It,o as Jt,n as Qt,x as bl,T as vl,B as wl,i as Ll,j as Tl,k as Sl,l as Ml,m as kl,y as Pl,z as ma,E as nr,H as rr,I as Cl,J as sr,q as or,r as Fl,s as lr,K as ga,U as Di,W as ur,M as xl}from"./screen2Standard-15e4461a-1784043664472.js";import{g as jt,M as Nl,h as Rl,L as Il,B as ya,a as ea,E as cr,G as Za,D as Gl,b as _l,l as Bl,P as dr,c as hr,d as Al,m as El,t as $l,k as ct,n as Vl,o as pr,p as zl,q as Dl,r as Oi,s as ba,u as fr,v as mr,f as Gt,w as gr,x as Ol,y as Wl,e as Yl,i as jl,j as Hl}from"./data-3d6664cd-1784043664472.js";import{g as ta}from"./index-e9f36657-1784043664472.js";import{h as ql,a as Wr,S as Ul,W as _t,H as q,j as Wi,k as Kl}from"./townshipBoundaries-1b068bef-1784043664472.js";import{b as Zl,g as yr,a as br,c as Xl}from"./geoserver-6574cb91-1784043664472.js";import{_ as Jl}from"./TopicSwitcher-f0c08774-1784043664472.js";import{A as Ql}from"./assets-93f7396b-1784043664472.js";import{M as eu}from"./index-0060e718-1784043664472.js";import{a as tu,b as au,c as iu,d as nu,g as vr,e as wr,f as ru,h as Yi,i as su,j as ou,k as lu}from"./yakApi-032bf70c-1784043664472.js";import{y as uu}from"./livestockData-36ec0ae2-1784043664472.js";import"./index-d0c7091a-1784043664472.js";const cu=ql.map(b=>N({},b)),Lr=Wr.map(b=>N({},b)),du=Wr.map(b=>{var e,t;return{name:b.name,value:b.value,lng:(e=b.center)==null?void 0:e[0],lat:(t=b.center)==null?void 0:t[1]}}),hu=[{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}],na=256,Ui="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",pu=900,fu=10,qt=new Map,ra={west:101.852492,south:31.851389,east:103.347518,north:33.319796};function ji(b,e,t){const a=pa(2,t),n=Math.sin(e*Math.PI/180);return{x:(b+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function Tr(b,e,t){const a=pa(2,t),n=b/a*360-180,s=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[n,o]}function Xa(b,e,t){return Math.max(e,Math.min(t,b))}function Yr(b,e,{centerLngLat:t,maxCols:a,maxRows:n}={}){const s=ji(b.west,b.north,e),o=ji(b.east,b.south,e),u=Math.floor(s.x),d=Math.floor(o.x),h=Math.floor(s.y),g=Math.floor(o.y);let m=u,L=d,S=h,C=g,x=Math.floor((u+d)/2),E=Math.floor((h+g)/2);if(t&&Number.isFinite(a)&&Number.isFinite(n)){const O=Xa(Number(t[0]),b.west,b.east),ee=Xa(Number(t[1]),b.south,b.north),se=ji(O,ee,e);x=Math.floor(se.x),E=Math.floor(se.y);const Z=Math.max(1,Math.min(Math.floor(a),d-u+1)),R=Math.max(1,Math.min(Math.floor(n),g-h+1));m=Xa(x-Math.floor(Z/2),u,d-Z+1),S=Xa(E-Math.floor(R/2),h,g-R+1),L=m+Z-1,C=S+R-1}return{zoom:e,minX:m,maxX:L,minY:S,maxY:C,centerX:x,centerY:E,cols:L-m+1,rows:C-S+1}}function mu({zoom:b=11,centerLngLat:e,maxCols:t,maxRows:a,bounds:n=ra}={}){return Yr(n,b,{centerLngLat:e,maxCols:t,maxRows:a})}function gu(b,e){const[t,a]=Tr(b.minX,b.minY,b.zoom),[n,s]=Tr(b.maxX+1,b.maxY+1,b.zoom),[o]=e([t,ra.south]),[u]=e([n,ra.south]),[,d]=e([ra.west,a]),[,h]=e([ra.west,s]);return{left:o,right:u,bottom:-h,top:-d}}function yu(b,e){const{width:t,height:a}=e;b.save(),b.globalCompositeOperation="multiply",b.fillStyle="rgba(5, 24, 34, 0.22)",b.fillRect(0,0,t,a),b.globalCompositeOperation="screen";const n=b.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)"),b.fillStyle=n,b.fillRect(0,0,t,a),b.restore()}function bu(b,e){const t=b.createLinearGradient(0,0,e.width,e.height);t.addColorStop(0,"#061927"),t.addColorStop(.5,"#0b2c3c"),t.addColorStop(1,"#07131f"),b.fillStyle=t,b.fillRect(0,0,e.width,e.height)}function vu(b){const e=qt.get(b);return e||new Promise(t=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>t(a),a.onerror=()=>{qt.delete(b),t(null)},a.src=b})}function wu(b){const e=qt.get(b);if(e)return e;const t=vu(b);for(qt.set(b,t);qt.size>pu;){const a=qt.keys().next().value;if(!a)break;qt.delete(a)}return t}function Lu(b,e,t,a=Ui){return String(a||Ui).replace(/\{x\}/g,b).replace(/\{y\}/g,e).replace(/\{z\}/g,t)}function Tu(u,d,h,g){return he(this,arguments,function*(b,e,t,a,{tileUrlTemplate:n,onTileStatus:s,applyTone:o=!0}={}){const m=[],L=a.cols*a.rows;let S=0,C=0;s==null||s({type:"loading",text:`正在加载${a.zoom}级影像底图`,loaded:S,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n}),b.save(),b.filter="brightness(0.92) contrast(1.22) saturate(1.06)";for(let Z=a.minX;Z<=a.maxX;Z+=1)for(let R=a.minY;R<=a.maxY;R+=1)m.push({x:Z,y:R});m.sort((Z,R)=>Math.abs(Z.x-a.centerX)+Math.abs(Z.y-a.centerY)-(Math.abs(R.x-a.centerX)+Math.abs(R.y-a.centerY)));let x=0;function E(){return he(this,null,function*(){for(;x0?S/L:0,ee=S===0?"error":O>=.75?"success":"warning",se=S===L?`${a.zoom}级影像底图已加载`:S>0?`${a.zoom}级影像底图已加载(${S}/${L}张有效瓦片)`:`${a.zoom}级影像底图加载失败`;s==null||s({type:ee,text:se,loaded:S,failed:C,total:L,zoom:a.zoom,tileRange:a,tileUrlTemplate:n})})}function Sr({geoProjectionCenter:b,geoProjectionScale:e,zoom:t=11,tileUrlTemplate:a=Ui,onTileStatus:n,centerLngLat:s,maxCols:o,maxRows:u,transparentBackground:d=!1,applyTone:h=!0}={}){const g=Yr(ra,t,{centerLngLat:s,maxCols:o,maxRows:u}),m=document.createElement("canvas");m.width=g.cols*na,m.height=g.rows*na;const L=m.getContext("2d");d?L.clearRect(0,0,m.width,m.height):bu(L,m);const S=new qi(m);S.colorSpace=ia,S.wrapS=ai,S.wrapT=ai,S.minFilter=La,S.magFilter=La,S.needsUpdate=!0;const C=jt().center(b).scale(e).translate([0,0]),x=gu(g,C);return Tu(L,m,S,g,{tileUrlTemplate:a,onTileStatus:n,applyTone:h}).catch(E=>{console.warn("load satellite tiles failed:",E),n==null||n({type:"error",text:`${g.zoom}级影像底图加载失败`,loaded:0,failed:g.cols*g.rows,total:g.cols*g.rows,zoom:g.zoom,tileRange:g,tileUrlTemplate:a})}),{texture:S,uvBounds:x,tileRange:g}}function Mr(b,e){const t=e.right-e.left,a=e.top-e.bottom;b.mapGroup.traverse(n=>{var u,d;const s=(d=(u=n.geometry)==null?void 0:u.attributes)==null?void 0:d.position;if(!n.isMesh||!s)return;const o=new Float32Array(s.count*2);for(let h=0;ht.value-e.value),b}function dt(b){return String(b||"").replace(/\s+/g,"").trim()}function ue(b,e=0){const t=Number(b);return Number.isFinite(t)?t:e}function Wt(b,e,t){const a=Number(b);return Number.isFinite(a)?Math.max(e,Math.min(t,a)):e}function Se(b){return String(b!=null?b:"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Nr(b){return(b==null?void 0:b.scope)==="village"||(b==null?void 0:b.labelMode)==="village"}function Rr(b){return(b==null?void 0:b.scope)==="trade-flow"||(b==null?void 0:b.labelMode)==="trade-flow"}function Gu(b){return(b==null?void 0:b.showFlowLines)!==!1}function Ir(b){return!!(b!=null&&b.hideTownNames||(b==null?void 0:b.showTownNames)===!1)}function va(b){return!!(b!=null&&b.hideMapLabels||(b==null?void 0:b.showMapLabels)===!1)}function _u(b){return(b==null?void 0:b.displayMode)==="callout"||(b==null?void 0:b.labelMode)==="callout"}function Qa(b){return["wkt-api","geojson","wfs"].includes(String((b==null?void 0:b.sourceType)||"").toLowerCase())}function Bu(b){return(b==null?void 0:b.interactive)===!1||(b==null?void 0:b.key)==="yak-recognition-layer"}function Gr(b){return String((b==null?void 0:b.sourceType)||"").toLowerCase()==="wmts"}function _r(b,e,t){const a=pa(2,t),n=Math.sin(e*Math.PI/180);return{x:(b+180)/360*a,y:(.5-Math.log((1+n)/(1-n))/(4*Math.PI))*a}}function Br(b,e,t){const a=pa(2,t),n=b/a*360-180,s=Math.PI-2*Math.PI*e/a,o=180/Math.PI*Math.atan(.5*(Math.exp(s)-Math.exp(-s)));return[n,o]}function Au(b,e){const t=_r(b.west,b.north,e),a=_r(b.east,b.south,e);return{minX:Math.floor(t.x),maxX:Math.floor(a.x),minY:Math.floor(t.y),maxY:Math.floor(a.y)}}function Eu(b,e,t,a){const[n,s]=Br(b,e,t),[o,u]=Br(b+1,e+1,t),d=q.east-q.west,h=q.north-q.south;return{x:(n-q.west)/d*a.width,y:(q.north-s)/h*a.height,width:(o-n)/d*a.width,height:(s-u)/h*a.height}}function $u(b){const e=aa.get(b);if(e)return e;const t=new Promise(a=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>a(n),n.onerror=()=>{aa.delete(b),a(null)},n.src=b});for(aa.set(b,t);aa.size>xu;){const a=aa.keys().next().value;if(!a)break;aa.delete(a)}return t}function Ar(b){return b?/^https?:\/\//.test(b)||b.startsWith("/")?b:`./${b}`:""}function Vu(b){if(!b)return null;if(typeof b=="string")try{return JSON.parse(b)}catch(e){return console.warn("地图 GeoJSON 解析失败",e),null}return b}function wa(b){const e=Vu(b);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 Er(b){var e,t,a;return b!=null&&b.coordinates?b.type==="Polygon"?Array.isArray((a=(t=(e=b.coordinates)==null?void 0:e[0])==null?void 0:t[0])==null?void 0:a[0])?b.coordinates:[b.coordinates]:b.type==="MultiPolygon"?b.coordinates:[]:[]}class zu extends Nl{constructor(e,t,a={}){var u,d,h,g;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 fl(466735,1,50),this.scene.background=new yt(466735),this.camera.instance.position.copy(ku),this.camera.instance.near=1,this.camera.instance.far=1e4,this.camera.instance.updateProjectionMatrix(),this.defaultMapCameraPosition=Su.clone(),this.defaultMapTarget=Mu.clone(),this.camera.controls.target.copy(this.defaultMapTarget),this.camera.controls.update(),this.activeMapViewTweens=[],this.sceneTweens=[],this.sceneTimers=[],this.interactionManager=new Rl(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(Ja,n):Ul;const s=Math.round(Number(a.satelliteMaxZoom)),o=Number.isFinite(s)&&s>0?Math.min(Ja,Math.max(this.satelliteTextureZoom,s)):Ja;this.adminBoundaryLineScale=this.normalizeAdminBoundaryLineScale(a.adminBoundaryLineScale),this.mapBoundaryEmphasisMaterial=null,this.dynamicSatelliteMaxZoom=o,this.dynamicSatelliteTileWindow=Pu,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(Lr.map(m=>[dt(m.name),m])),this.staticMapData={china:wa(this.assets.instance.getResource("china")),mapJson:wa(this.assets.instance.getResource("mapJson")),mapStroke:wa(this.assets.instance.getResource("mapStroke"))},this.handleCanvasBoundaryPointerDown=this.handleCanvasBoundaryPointerDown.bind(this),this.handleCanvasBoundaryDoubleClick=this.handleCanvasBoundaryDoubleClick.bind(this),(d=(u=this.canvas)==null?void 0:u.addEventListener)==null||d.call(u,"pointerdown",this.handleCanvasBoundaryPointerDown,!0),(g=(h=this.canvas)==null?void 0:h.addEventListener)==null||g.call(h,"dblclick",this.handleCanvasBoundaryDoubleClick,!0),this.initEnvironment(),this.init()}init(){this.labelGroup=new Te,this.label3d=new Il(this),this.labelGroup.rotation.x=-Math.PI/2,this.scene.add(this.labelGroup),this.flyLineFocusGroup=new Te,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=ta.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),va(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=!va(this.currentTownRanking)&&this.showTownRankingPointMarkers&&this.hasTownRankingRows(),this.setTradeNationalMapVisible(!1),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),va(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 s=a.element.querySelector(".other-label");e.to(s,{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 s=a.element.querySelector(".provinces-label-wrap"),o=a.element.querySelector(".number .value"),u={progress:0};e.to(s,{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:d},"bar");function d(){var g,m;const h=ue((m=(g=a.userData)==null?void 0:g.targetValue)!=null?m:o.dataset.targetValue);o.innerText=t.formatMapRankingValue(h*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 ml(13171711,4.2);this.scene.add(e);let t=new gl(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 yl(1924702,e.intensity,e.distance);t.position.set(e.x,e.y,e.z),this.scene.add(t)}createMap(){let e=new Te,t=new Te;this.mapGroup=e,this.focusMapGroup=t;let{china:a,chinaTopLine:n}=this.createChina(),{map:s,mapTop:o,mapLine:u,mapBoundaryEmphasis:d}=this.createProvince();this.createNationalBackdrop(),a.setParent(e),n.setParent(e),this.createDiffuse(),s.setParent(t),o.setParent(t),u.setParent(t),d==null||d.setParent(t),t.position.set(0,0,-.01),t.scale.set(1,1,0),e.add(t),this.createTopicLayer(),e.rotation.x=-Math.PI/2,e.position.set(0,.2,0),this.scene.add(e),this.createBar()}createChina(){let e={chinaBgMaterialColor:"#0d3349",lineColor:"#39c7ef"},t=this.staticMapData.china,a=new zi({color:new yt(e.chinaBgMaterialColor),transparent:!0,opacity:.72}),n=new ya(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,merge:!0,material:a,renderOrder:2}),s=new Xt({color:e.lineColor,transparent:!0,opacity:.58}),o=new ea(this,{data:t,geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,material:s,renderOrder:3});return o.lineGroup.position.z+=.01,{china:n,chinaTopLine:o}}createNationalBackdrop(){var h;if(!this.showNationalBackdrop||this.nationalBackdropGroup)return!1;let e=null;try{e=wa(this.assets.instance.getResource("chinaMap"))}catch(g){return console.warn("首页全国底图资源未加载",g),!1}if(!((h=e==null?void 0:e.features)!=null&&h.length))return!1;const t=this.geoProjectionCenter,a=120,n=new re(0,0,-.08),s=new zi({color:new yt("#152c47"),transparent:!0,opacity:.72,depthWrite:!1,fog:!1,side:Re}),o=new ya(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,merge:!0,position:n,material:s,renderOrder:0});o.mapGroup.name="home-national-backdrop-fill",o.setParent(this.mapGroup);const u=new Xt({color:new yt("#3f82cd"),transparent:!0,opacity:.46,depthWrite:!1,fog:!1}),d=new ea(this,{data:e,geoProjectionCenter:t,geoProjectionScale:a,position:new re(n.x,n.y,n.z+.01),material:u,renderOrder:1});return d.lineGroup.name="home-national-backdrop-line",d.setParent(this.mapGroup),this.nationalBackdropGroup=o.mapGroup,this.nationalBackdropLineGroup=d.lineGroup,!0}createTradeNationalMap(){var m;if(this.tradeNationalMapGroup)return!0;let e=null;try{e=wa(this.assets.instance.getResource("chinaMap"))}catch(L){return console.warn("牦牛交易全国地图资源未加载",L),!1}const t=e;if(!e||!((m=t==null?void 0:t.features)!=null&&m.length))return!1;const a=new Te;a.name="trade-national-map",a.visible=!1,a.rotation.x=-Math.PI/2,a.position.set(0,.04,0);const n=new ve({color:403001,transparent:!0,opacity:.14,side:Re,depthWrite:!1,fog:!1});new ya(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new re(.05,-.05,-.03),material:n,renderOrder:17}).setParent(a);const{topMaterial:o,sideMaterial:u}=this.createTradeNationalMaterials(),d=new cr(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,position:new re(0,0,0),depth:this.tradeNationalDepth,topFaceMaterial:o,sideMaterial:u,renderOrder:20,bevelThickness:.024,bevelSegments:1});d.mapGroup.traverse(L=>{L.isMesh&&(L.renderOrder=20)}),d.setParent(a);const h=new Xt({color:4777983,transparent:!0,opacity:.52,fog:!1,depthTest:!1}),g=new ea(this,{data:e,geoProjectionCenter:this.tradeGeoProjectionCenter,geoProjectionScale:this.tradeGeoProjectionScale,material:h,renderOrder:21});return g.lineGroup.position.z+=this.tradeNationalDepth+.055,g.setParent(a),this.scene.add(a),this.tradeNationalMapGroup=a,this.createTradeNationalLabels(t),!0}createTradeNationalMaterials(){const e=new Ka({color:16777215,transparent:!0,opacity:.54,roughness:.84,metalness:.08,side:Re,fog:!1});new Za(e,{uColor1:827317,uColor2:403515,size:6.8,dir:"x"});const t=this.assets.instance.getResource("side").clone();t.wrapS=ut,t.wrapT=ut,t.repeat.set(1,1.2),t.needsUpdate=!0;const a=new Ka({color:1485501,map:t,transparent:!0,opacity:.58,roughness:.78,metalness:.04,side:Re,fog:!1});return new Za(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 Te,this.tradeNationalLabelGroup.name="trade-national-label",this.tradeNationalLabelGroup.rotation.x=-Math.PI/2,this.tradeNationalLabelGroup.visible=!1,this.scene.add(this.tradeNationalLabelGroup),this.tradeNationalLabels=[];const t=new Set(["四川","青海","甘肃","陕西","重庆","云南","西藏","新疆"]);(e.features||[]).forEach(a=>{var d;const n=((d=a.properties)==null?void 0:d.name)||"",s=this.normalizeTradeProvinceName(n);if(!t.has(s))return;const o=this.getFeatureCenterLngLat(a);if(!o)return;const u=this.label3d.create("","trade-national-label",!0);u.init(`
${Se(s)}
`,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 s,o,u;const t=((s=e==null?void 0:e.properties)==null?void 0:s.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((d,h)=>({minLng:Math.min(d.minLng,Number(h[0])),maxLng:Math.max(d.maxLng,Number(h[0])),minLat:Math.min(d.minLat,Number(h[1])),maxLat:Math.max(d.maxLat,Number(h[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?Sr({geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,zoom:this.satelliteTextureZoom,tileUrlTemplate:this.tileUrlTemplate,onTileStatus:m=>{var L,S;return(S=(L=this.callbacks).onTileStatus)==null?void 0:S.call(L,m)}}):null;t!=null&&t.texture&&this.enhanceTexture(t.texture);let[a,n]=this.createProvinceMaterial();this.focusMapTopMaterial=a,this.focusMapSideMaterial=n;let s=new cr(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,.11),data:e,depth:this.depth,topFaceMaterial:a,sideMaterial:n,renderOrder:9}),o=new Ka({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 Za(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 yt("rgba(128,244,255,1)"),this.defaultLightMaterial.opacity=.9;let u=new ya(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,this.depth+.22),data:e,material:o,renderOrder:this.usesCustomSatelliteTiles?14:8});this.satelliteMapTop=u,this.satelliteMaterial=o,t!=null&&t.uvBounds&&Mr(u,t.uvBounds),u.mapGroup.children.map(m=>{m.children.map(L=>{L.type==="Mesh"&&this.eventElement.push(L)})}),this.mapLineMaterial=new Xt({color:12254463,opacity:0,transparent:!0,linewidth:this.adminBoundaryLineScale,fog:!1});let d=new ea(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapLineMaterial,renderOrder:this.isHomeTopicPresentation()?34:26});d.lineGroup.position.z+=this.depth+(this.isHomeTopicPresentation()?.315:.285);let h=null;const g=this.getAdminBoundaryEmphasisRadius();return g>0&&(this.mapBoundaryEmphasisMaterial=new ve({color:9632767,transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,fog:!1,blending:Ie}),h=new ea(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,data:e,material:this.mapBoundaryEmphasisMaterial,renderOrder:this.usesCustomSatelliteTiles?24:18,type:"Line3",tubeRadius:g}),h.lineGroup.position.z+=this.depth+.255),{map:s,mapTop:u,mapLine:d,mapBoundaryEmphasis:h}}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=_t.width,e.height=_t.height;const t=e.getContext("2d");t.clearRect(0,0,e.width,e.height);const a=new qi(e);a.colorSpace=ia,a.wrapS=ai,a.wrapT=ai,a.minFilter=La,a.magFilter=La,this.enhanceTexture(a),a.needsUpdate=!0;const n=new ve({map:a,transparent:!0,opacity:0,depthWrite:!1,depthTest:!this.isHomeTopicPresentation(),side:Re,fog:!1}),s=this.createLayerUvBounds(),o=new ya(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,this.depth+(this.isHomeTopicPresentation()?.272:.255)),data:this.mapJsonData,material:n,renderOrder:this.isHomeTopicPresentation()?24:18});Mr(o,s),o.setParent(this.focusMapGroup),this.topicLayerUvBounds=s,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=Er((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 Te,this.selectedFeatureGroup.name="selected-feature-highlight",this.selectedFeatureGroup.position.z=this.depth+.31,(e=this.focusMapGroup)==null||e.add(this.selectedFeatureGroup))}createLayerUvBounds(){const e=jt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),[t]=e([q.west,q.south]),[a]=e([q.east,q.south]),[,n]=e([q.west,q.north]),[,s]=e([q.west,q.south]);return{left:t,right:a,bottom:-s,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}`}),Qa(e)){this.loadVectorTopicLayer(e,t);return}this.loadTopicLayerImage(e).then(s=>{var o,u,d,h;if(t===this.topicLayerLoadId){if(!(s!=null&&s.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(s.image,s.layer||e),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(e),this.topicLayerMaterial.opacity=this.getTopicLayerMaterialOpacity(e,.84),(h=(d=this.callbacks).onLayerStatus)==null||h.call(d,{type:"success",text:"GeoServer 图层已加载"})}}).catch(()=>{var s,o;t===this.topicLayerLoadId&&(this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(s=this.callbacks).onLayerStatus)==null||o.call(s,{type:"error",text:"GeoServer 图层加载失败"}))})}setTopicLayers(e=[],t=e[0]){var s,o,u,d;if(!this.topicLayerContext||!this.topicLayerTexture)return;const a=e.filter(Boolean);if(!a.length){this.topicLayerLoadId+=1,this.visibleTopicLayers=[],this.currentTopicLayer=null,this.currentVectorFeatures=[],this.clearYakIndustryPointMarkers(),this.clearYakIndustryPointLabels(),this.clearSelectedFeature(),this.applyLayerMapView(null),this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),this.topicLayerTexture.needsUpdate=!0,this.topicLayerMaterial.opacity=0,(o=(s=this.callbacks).onLayerStatus)==null||o.call(s,{type:"success",text:"图层已关闭"});return}if(a.length===1){this.setTopicLayer(N(N({},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,(d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"loading",text:`正在加载 ${a.length} 个地图图层`}),Promise.all(a.map(h=>this.loadCompositeTopicLayerItem(h))).then(h=>{var L,S,C;if(n!==this.topicLayerLoadId)return;const g=h.filter(Boolean),m=g.find(x=>{var E,O;return x.type==="vector"&&((E=x.layer)==null?void 0:E.key)===((O=this.currentTopicLayer)==null?void 0:O.key)});this.currentVectorFeatures=((L=m==null?void 0:m.geojson)==null?void 0:L.features)||[],this.topicLayerContext.clearRect(0,0,this.topicLayerCanvas.width,this.topicLayerCanvas.height),g.forEach((x,E)=>{var O,ee;if(x.type==="image"){this.topicLayerContext.save();const se=E===g.length-1?Math.max(.78,(O=x.layer.opacity)!=null?O:.9):Math.min(.52,(ee=x.layer.opacity)!=null?ee:.52);this.topicLayerContext.globalAlpha=Math.min(1,Math.max(.28,se)),this.drawTopicRasterImage(x.image,x.layer),this.topicLayerContext.restore();return}this.drawVectorTopicLayer(x.layer,x.geojson.features||[],{clear:!1})}),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.updateYakIndustryPointLabels(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0,this.updateTopicLayerTextureSampling(this.currentTopicLayer),this.topicLayerMaterial.opacity=g.length?this.getTopicLayerMaterialOpacity(this.currentTopicLayer,1):0,(C=(S=this.callbacks).onLayerStatus)==null||C.call(S,{type:g.length?"success":"error",text:g.length?`已加载 ${g.length} 个地图图层`:"地图图层加载失败"})})}loadCompositeTopicLayerItem(e){return he(this,null,function*(){if(Qa(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?N({type:"image"},t):null)})}loadTopicLayerImage(e){return Gr(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=Zl(e)})}loadWmtsTopicLayerImage(e){return he(this,null,function*(){const t=document.createElement("canvas");t.width=_t.width,t.height=_t.height;const a=t.getContext("2d");if(!a)return null;a.clearRect(0,0,t.width,t.height);const n=this.getWmtsTopicZoom(e),s=Au(q,n),o=[];for(let g=s.minX;g<=s.maxX;g+=1)for(let m=s.minY;m<=s.maxY;m+=1)o.push({x:g,y:m});let u=0,d=0;const h=()=>he(this,null,function*(){for(;d0&&(a.save(),a.globalAlpha=.58,a.filter=`blur(${u}px)`,a.drawImage(n,0,0),a.restore()),o>0){const g=[[-o,0],[o,0],[0,-o],[0,o],[-o,-o],[o,-o],[-o,o],[o,o]];a.save(),a.globalAlpha=.72,g.forEach(([m,L])=>a.drawImage(n,m,L)),a.restore()}a.drawImage(n,0,0)}getWmtsTopicZoom(e={}){var o,u,d;const t=Math.round(Number(e.maximumLevel)),a=Number.isFinite(t)&&t>0?t:21,n=Number((d=(u=(o=e.homeWmtsZoom)!=null?o:e.wmtsZoom)!=null?u:e.tileZoom)!=null?d:this.satelliteTextureZoom),s=Number.isFinite(n)&&n>0?Math.round(n):11;return Wt(s,3,Math.min(a,Ja))}updateTopicLayerTextureSampling(e={}){if(!this.topicLayerTexture)return;const t=Gr(e)?ir:La;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 s=Math.min(1,Math.max(.08,Number(t.softMaskScale)||.18)),o=document.createElement("canvas");o.width=Math.max(96,Math.round(a.width*s)),o.height=Math.max(96,Math.round(a.height*s));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 d,h;if(!this.isHomeTopicPresentation())return;const a=this.topicLayerCanvas,n=this.topicLayerContext;if(!a||!n)return;const s=Wt((d=t.homeGlowOpacity)!=null?d:0,0,.8),o=Wt((h=t.homeGlowBlur)!=null?h:0,0,32);if(!s||!o)return;const u=t.homeGlowColor||"#E5FCFF";n.save(),n.globalAlpha=s,n.filter=`drop-shadow(0 0 ${o}px ${u})`,n.drawImage(e,0,0,a.width,a.height),n.restore()}applyLayerMapView(e,t={}){var d,h;if(!((d=this.camera)!=null&&d.instance)||!((h=this.camera)!=null&&h.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),s=n?this.getLayerMapViewTarget(n):this.defaultMapTarget.clone(),o=n?this.getLayerMapViewCameraPosition(n,s):this.defaultMapCameraPosition.clone(),u=n&&Number.isFinite(n.duration)?n.duration:.75;this.animateMapCamera(o,s,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 s=Number(e==null?void 0:e.homePresentationMaxOpacity),o=Number.isFinite(s)?s:.56;return Wt(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 s,o,u,d,h,g,m;const e=(d=(u=(o=(s=this.camera)==null?void 0:s.controls)==null?void 0:o.target)==null?void 0:u.clone)==null?void 0:d.call(u);if(!e)return[102.58,32.72];(g=(h=this.focusMapGroup)==null?void 0:h.updateWorldMatrix)==null||g.call(h,!0,!1);const t=this.focusMapGroup?this.focusMapGroup.worldToLocal(e):e,a=jt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]),n=((m=a.invert)==null?void 0:m.call(a,[t.x,-t.y]))||[102.58,32.72];return[Math.max(q.west,Math.min(q.east,Number(n[0])||102.58)),Math.max(q.south,Math.min(q.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{var d,h,g,m,L;if((g=(h=this.callbacks).onTileStatus)==null||g.call(h,$(N({},u),{text:((d=u.text)==null?void 0:d.replace("影像底图","高清影像底图"))||u.text})),u.type!=="loading"){if(s!==this.dynamicSatelliteRequestId){(L=(m=o==null?void 0:o.texture)==null?void 0:m.dispose)==null||L.call(m);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 ve({transparent:!0,opacity:0,depthWrite:!1,depthTest:!0,side:Re,fog:!1}),t=new qe(new It(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),s=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,s,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),va(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),s=t.clone().add(n);return e!=null&&e.cameraOffset&&s.add(this.toVector3(e.cameraOffset,new re(0,0,0))),s}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]),s=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(s))return this.defaultMapTarget.clone();const[o,u]=this.geoProjection([n,s]),d=new re(o,-u,Number(t)||0);return this.focusMapGroup?this.focusMapGroup.localToWorld(d):d}toVector3(e,t){if(Array.isArray(e)){const[o,u,d]=e.map(Number);return[o,u,d].every(Number.isFinite)?new re(o,u,d):t.clone()}const a=Number(e==null?void 0:e.x),n=Number(e==null?void 0:e.y),s=Number(e==null?void 0:e.z);return[a,n,s].every(Number.isFinite)?new re(a,n,s):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,s=()=>n.update();this.activeMapViewTweens.push(ta.to(this.camera.instance.position,{duration:a,x:e.x,y:e.y,z:e.z,ease:"power2.out",onUpdate:s}),ta.to(n.target,{duration:a,x:t.x,y:t.y,z:t.z,ease:"power2.out",onUpdate:s}))}addSceneTween(e){var t;return e&&(this.sceneTweens.push(e),this.scenePaused&&((t=e.pause)==null||t.call(e)),e)}addSceneTimer(e){return e&&this.sceneTimers.push(e),e}focusTownByName(e,t={}){var u,d,h;const a=this.townMetaByName.get(dt(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 s=this.lngLatToWorldPoint(a.center,(u=t.targetLocalZ)!=null?u:.82),o=this.getLayerMapViewCameraPosition({distanceScale:(d=t.distanceScale)!=null?d:.82,cameraOffset:t.cameraOffset||{x:0,y:1.2,z:0}},s);return this.animateMapCamera(o,s,(h=t.duration)!=null?h:.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,s,o,u,d,h,g,m,L;return[(s=(n=(a=e==null?void 0:e.target)==null?void 0:a.parent)==null?void 0:n.userData)==null?void 0:s.name,(u=(o=e==null?void 0:e.target)==null?void 0:o.userData)==null?void 0:u.name,(g=(h=(d=e==null?void 0:e.target)==null?void 0:d.parent)==null?void 0:h.userData)==null?void 0:g.townName,(L=(m=e==null?void 0:e.target)==null?void 0:m.userData)==null?void 0:L.townName].find(S=>String(S||"").trim())||""}findTownFeatureByName(e){var n,s,o,u;const t=dt(e);if(!t)return null;const a=(((n=this.mapJsonData)==null?void 0:n.features)||((o=(s=this.staticMapData)==null?void 0:s.mapJson)==null?void 0:o.features)||[]).find(d=>{const h=(d==null?void 0:d.properties)||{};return[h.name,h.fullName,h.full_name,h.townName].some(m=>dt(m)===t)});return a!=null&&a.geometry?{type:"Feature",properties:$(N({},a.properties||{}),{name:((u=a.properties)==null?void 0:u.name)||e,feature_role:"乡镇范围"}),geometry:a.geometry}:null}selectTownFeatureByName(e,t={}){var n,s,o,u,d;const a=this.findTownFeatureByName(e);return a?(this.showSelectedFeature(a,{mode:"town"}),t.silentStatus!==!0&&((d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"success",text:t.statusText||`已选中${((o=a.properties)==null?void 0:o.name)||e}`})),!0):(t.showMissingStatus!==!1&&((s=(n=this.callbacks).onLayerStatus)==null||s.call(n,{type:"warning",text:"未找到对应乡镇边界"})),!1)}handleTownRankingSelect(e,t={}){var u,d;if(!this.isNationalParkTownSelectionActive())return!1;const a=dt(e);if(!a||!this.getTownRankingRows(this.currentTownRanking,Number.POSITIVE_INFINITY,!1).some(h=>dt(h.name)===a))return!1;const o=this.focusTownByName(e,N({select:!0,preserveCamera:!0,statusText:`已选中${e}`},t));return o&&((d=(u=this.callbacks).onFeatureInfo)==null||d.call(u,{feature:null})),o}focusYakIndustryPoint(e={}){var s,o;const t=this.getYakIndustryPayloadCoordinate(e);if(!t)return(o=(s=this.callbacks).onLayerStatus)==null||o.call(s,{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 h,g;const t=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),a=String(e.id||e.key||""),n=String(e.fullName||e.name||"").trim(),s=t.find(m=>{const L=(m==null?void 0:m.properties)||{};return a&&String(L.id||"")===a||n&&String(L.name||L.plot_name||"").trim()===n});if(!s)return(g=(h=this.callbacks).onLayerStatus)==null||g.call(h,{type:"warning",text:"当前图斑尚未加载"}),{focused:!1,screen:null,feature:null};this.setSelectedVectorFeatures([s]);const o=this.getGeometryLngLatBounds(s.geometry);if(!o)return{focused:!1,screen:null,feature:s};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(s),feature:s}}getVectorFeatureScreen(e={}){let t=(e==null?void 0:e.feature)||e;if(!(t!=null&&t.geometry)){const s=this.getVisibleVectorFeatures(this.currentTopicLayer,this.currentVectorFeatures||[]),o=String((e==null?void 0:e.id)||(e==null?void 0:e.key)||"");t=s.find(u=>{var d;return String(((d=u==null?void 0:u.properties)==null?void 0:d.id)||"")===o})||null}const a=this.getGeometryLngLatBounds(t==null?void 0:t.geometry);if(!a)return null;const 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 s,o,u,d,h;const t=((s=e.geometry)==null?void 0:s.coordinates)||e.coordinates,a=Number((u=(o=e.longitude)!=null?o:e.lng)!=null?u:t==null?void 0:t[0]),n=Number((h=(d=e.latitude)!=null?d:e.lat)!=null?h: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||""),s=String(e.fullName||e.name||"").trim(),o=String(e.stageKey||""),u=t&&a.find(h=>{var m;if(((m=h==null?void 0:h.geometry)==null?void 0:m.type)!=="Point")return!1;const g=h.properties||{};return o&&String(g.stageKey||"")!==o?!1:this.getCoordinateDistance(h.geometry.coordinates,t)<=8e-4})||null;if(e.preferCoordinateMatch)return u;const d=a.find(h=>{const g=(h==null?void 0:h.properties)||{};return!!(n&&String(g.id||"")===n||s&&String(g.name||g.fullName||"").trim()===s)});return d||u}loadVectorTopicLayer(e,t){return he(this,null,function*(){var a,n,s,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=(s=this.callbacks).onLayerStatus)==null||o.call(s,{type:"error",text:"真实矢量图层加载失败"})}})}fetchVectorLayerGeojson(e){return he(this,null,function*(){var s,o;if(e.sourceType==="geojson"){if(((s=e.geojsonData)==null?void 0:s.type)==="FeatureCollection")return e.geojsonData;const u=yield fetch(Ar(e.dataPath),{credentials:"include"});if(!u.ok)throw new Error(`HTTP ${u.status}`);return yield u.json()}if(e.sourceType==="wfs"){const u=yield yr(e.layerName,{cqlFilter:e.cqlFilter,maxFeatures:e.maxFeatures||1200,timeout:e.timeout||18e3});return(u==null?void 0:u.type)==="FeatureCollection"?u:{type:"FeatureCollection",features:(u==null?void 0:u.features)||[]}}let t=[],a=null;try{const u=yield fetch(e.apiUrl,{credentials:"include"});if(!u.ok)throw new Error(`HTTP ${u.status}`);const d=yield u.json();t=Array.isArray(d==null?void 0:d.data)?d.data:Array.isArray((o=d==null?void 0:d.data)==null?void 0:o.rows)?d.data.rows:[]}catch(u){a=u}let n=this.buildWktLayerFeatures(t);if((!t.length||!n.length)&&e.fallbackPath){const u=yield fetch(Ar(e.fallbackPath),{credentials:"include"});if(!u.ok)throw a||new Error(`HTTP ${u.status}`);const d=yield u.json();t=Array.isArray(d==null?void 0:d.rows)?d.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 d;return!(e!=null&&e.hidePointFeatures)||((d=u==null?void 0:u.geometry)==null?void 0:d.type)!=="Point"}).sort((u,d)=>{var m,L;const h=this.getGeometryDrawRank((m=u.geometry)==null?void 0:m.type),g=this.getGeometryDrawRank((L=d.geometry)==null?void 0:L.type);return h-g});o.forEach(u=>{const d=this.getVectorFeatureStyle(e,u);this.drawVectorFeature(n,u.geometry,d)}),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 s=this.getVectorFeatureStyle(t,n);this.drawVectorFeature(e,n.geometry,$(N({},s),{fill:"#071A20",stroke:"#071A20",polygonAlpha:0,lineAlpha:.34,lineWidth:7,glow:!0})),this.drawVectorFeature(e,n.geometry,$(N({},s),{fill:"#E7FFF6",stroke:"#E7FFF6",polygonAlpha:0,lineAlpha:.68,lineWidth:2.1,glow:!1})),this.drawVectorFeature(e,n.geometry,$(N({},s),{fill:s.stroke,stroke:s.stroke,polygonAlpha:0,lineAlpha:.86,lineWidth:1.2,glow:!1}))})}drawSelectedVectorOverlay(e){const t=this.selectedVectorFeatures||[],a=this.analysisMatchedFeatures||[],n=this.analysisBoundaryFeature,s=this.boundaryDrawPoints||[];if(!t.length&&!a.length&&!n&&!s.length)return;const o=this.isEcologicalProjectLayer(this.currentTopicLayer),u={fill:kr,stroke:Ru,polygonAlpha:o?.2:.28,lineAlpha:o?.78:.98,lineWidth:o?6:12,pointRadius:11,glow:!o,halo:!o},d={fill:kr,stroke:Nu,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(h=>{var m;const g=(h==null?void 0:h.geometry)||((m=h==null?void 0:h.feature)==null?void 0:m.geometry);this.drawVectorFeature(e,g,u),this.drawVectorFeature(e,g,d)}),a.forEach(h=>{var m;const g=(h==null?void 0:h.geometry)||((m=h==null?void 0:h.feature)==null?void 0:m.geometry);this.drawVectorFeature(e,g,{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}),s.length){const h=s.map(m=>[m.lng,m.lat]),g={type:"LineString",coordinates:this.boundaryDrawingEnabled?h:[...h,h[0]].filter(Boolean)};this.drawVectorFeature(e,g,{fill:"#24F6C4",stroke:"#24F6C4",polygonAlpha:o?.08:.12,lineAlpha:1,lineWidth:o?3:4,pointRadius:6,glow:!o}),h.forEach(m=>{this.drawVectorFeature(e,{type:"Point",coordinates:m},{fill:"#FFFFFF",stroke:"#24F6C4",polygonAlpha:.2,lineAlpha:1,lineWidth:o?2.4:3,pointRadius:5.5,glow:!o})})}e.restore()}redrawVectorTopicLayer(){!this.topicLayerContext||!this.topicLayerTexture||!this.currentTopicLayer||!Qa(this.currentTopicLayer)||(this.drawVectorTopicLayer(this.currentTopicLayer,this.currentVectorFeatures||[]),this.updateYakIndustryPointMarkers(this.currentTopicLayer,this.currentVectorFeatures),this.topicLayerTexture.needsUpdate=!0)}featureMatchesLegend(e={},t={}){var s;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((s=e[n.field])!=null?s:"")===String(n.value):!0}getVisibleVectorFeatures(e,t){var u,d;const a=Array.isArray(e==null?void 0:e.activeLegends)?e.activeLegends.filter(h=>{var g,m;return((g=h==null?void 0:h.matches)==null?void 0:g.length)||((m=h==null?void 0:h.match)==null?void 0:m.field)}):[];if(a.length)return(t||[]).filter(h=>a.some(g=>this.featureMatchesLegend((h==null?void 0:h.properties)||{},g)));const n=e==null?void 0:e.activeLegend;if((u=n==null?void 0:n.matches)!=null&&u.length||(d=n==null?void 0:n.match)!=null&&d.field)return(t||[]).filter(h=>this.featureMatchesLegend((h==null?void 0:h.properties)||{},n));const o=String((e==null?void 0:e.cqlFilter)||"").trim().match(/^([a-zA-Z0-9_]+)\s*=\s*'((?:''|[^'])*)'$/);if(o){const[,h,g]=o,m=g.replace(/''/g,"'");return(t||[]).filter(L=>{var S,C;return String((C=(S=L==null?void 0:L.properties)==null?void 0:S[h])!=null?C:"")===m})}return[...t||[]]}updateYakIndustryPointLabels(e=this.currentTopicLayer,t=this.currentVectorFeatures){if(this.clearYakIndustryPointLabels(),(e==null?void 0:e.showPointLabels)===!1||e!=null&&e.hidePointFeatures||(e==null?void 0:e.key)!=="yak-industry-points"||!this.label3d)return;const a=this.getYakIndustryLabelFeatures(e,t);a.length&&(this.ensureYakIndustryPointLabelGroup(),a.forEach((n,s)=>{var u;let o=this.yakIndustryPointLabels[s];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,s)),o.visible=!0,(u=o.show)==null||u.call(o),o.userData={feature:n}}),this.yakIndustryPointLabels.slice(a.length).forEach(n=>{var s;n.visible=!1,(s=n.hide)==null||s.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 s;return((s=n==null?void 0:n.geometry)==null?void 0:s.type)==="Point"});a.length&&(this.ensureYakIndustryPointMarkerGroup(),a.forEach((n,s)=>{let o=this.yakIndustryPointMarkers[s];const u=this.getVectorFeatureStyle(e,n),d=this.getYakIndustryMarkerMaterial(u,n),h=this.lngLatToLayerLocalPoint(n.geometry.coordinates,this.depth+.36),g=Number(e==null?void 0:e.pointSpriteScale)||.34,m=this.getYakIndustryMarkerType(n);o||(o=new Jt(d),o.name="yak-industry-point-marker",o.renderOrder=42,this.bindYakIndustryPointMarkerEvents(o),this.interactionManager.add(o),this.yakIndustryPointMarkerGroup.add(o),this.yakIndustryPointMarkers.push(o)),o.material=d,o.center.set(.5,.5),o.position.copy(h),o.scale.set(g*.88,g*.88,1),o.visible=!0,o.userData={feature:n,layer:e,index:s,markerType:m}}),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 Te,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 s,o,u,d,h,g,m,L,S;if(this.clicked||!((s=this.yakIndustryPointMarkerGroup)!=null&&s.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=((d=a.geometry)==null?void 0:d.coordinates)||[];this.setSelectedVectorFeatures([a]),(S=(L=this.callbacks).onFeatureInfo)==null||S.call(L,{feature:{id:((h=a.properties)==null?void 0:h.id)||((g=a.properties)==null?void 0:g.feature_id)||((m=a.properties)==null?void 0:m.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}`,s=this.yakIndustryMarkerMaterialCache.get(n);if(s)return s;const o=this.createYakIndustryMarkerTexture(e.fill,e.stroke,a),u=new Qt({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 Fr[t]||"point"}createYakIndustryMarkerTexture(e="#24F6C4",t="#B7FFF2",a="point"){const n=document.createElement("canvas");n.width=112,n.height=112;const s=n.getContext("2d"),o=56,u=56;s.clearRect(0,0,n.width,n.height),s.beginPath(),s.arc(o,u,42,0,Math.PI*2),s.fillStyle=this.hexToRgba(e,.18),s.shadowColor=e,s.shadowBlur=20,s.fill(),this.drawYakIndustryMarkerFrame(s,a,o,u,e,t||e),s.save(),s.shadowBlur=0,s.beginPath(),s.arc(o,u,19,0,Math.PI*2),s.fillStyle="rgba(3, 23, 34, 0.64)",s.fill(),s.strokeStyle=this.hexToRgba("#FFFFFF",.32),s.lineWidth=2,s.stroke(),s.restore(),this.drawYakIndustryMarkerGlyph(s,a,o,u,"#FFFFFF");const d=new qi(n);return d.colorSpace=ia,d.needsUpdate=!0,d}drawYakIndustryMarkerFrame(e,t,a,n,s="#24F6C4",o="#B7FFF2"){if(e.save(),e.translate(a,n),e.fillStyle=this.hexToRgba(s,.92),e.strokeStyle=this.hexToRgba(o||s,.98),e.lineWidth=4,e.shadowColor=o||s,e.shadowBlur=14,t==="pasture")e.beginPath(),e.moveTo(-34,-9),e.lineTo(0,-38),e.lineTo(34,-9),e.lineTo(28,-9),e.lineTo(28,24),e.quadraticCurveTo(28,31,21,31),e.lineTo(-21,31),e.quadraticCurveTo(-28,31,-28,24),e.lineTo(-28,-9),e.closePath();else if(t==="grass")e.beginPath(),e.moveTo(0,-38),e.bezierCurveTo(31,-22,34,18,0,38),e.bezierCurveTo(-34,18,-31,-22,0,-38),e.closePath();else if(t==="breeding"){e.beginPath();for(let u=0;u<6;u+=1){const d=-Math.PI/2+Math.PI*2*u/6,h=Math.cos(d)*35,g=Math.sin(d)*35;u===0?e.moveTo(h,g):e.lineTo(h,g)}e.closePath()}else if(t==="storage")e.beginPath(),e.moveTo(-34,-25),e.lineTo(25,-25),e.lineTo(35,-13),e.lineTo(35,27),e.lineTo(-25,27),e.lineTo(-35,15),e.lineTo(-35,-25),e.closePath();else if(t==="processing"){e.beginPath();for(let u=0;u<10;u+=1){const d=-Math.PI/2+Math.PI*2*u/10,h=u%2===0?38:30,g=Math.cos(d)*h,m=Math.sin(d)*h;u===0?e.moveTo(g,m):e.lineTo(g,m)}e.closePath()}else if(t==="equipment"){e.beginPath();for(let u=0;u<16;u+=1){const d=-Math.PI/2+Math.PI*2*u/16,h=u%2===0?38:30,g=Math.cos(d)*h,m=Math.sin(d)*h;u===0?e.moveTo(g,m):e.lineTo(g,m)}e.closePath()}else t==="service"?(e.beginPath(),e.moveTo(0,-39),e.lineTo(31,-24),e.lineTo(25,14),e.quadraticCurveTo(0,39,-25,14),e.lineTo(-31,-24),e.closePath()):(e.beginPath(),e.arc(0,0,34,0,Math.PI*2));e.fill(),e.stroke(),e.restore()}drawYakIndustryMarkerGlyph(e,t,a,n,s="#24F6C4"){if(e.save(),e.translate(a,n),e.lineCap="round",e.lineJoin="round",e.shadowBlur=0,e.fillStyle=this.hexToRgba(s,.98),e.strokeStyle=this.hexToRgba(s,.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 Te,this.yakIndustryPointLabelGroup.name="yak-industry-point-labels",this.yakIndustryPointLabelGroup.rotation.x=-Math.PI/2,this.yakIndustryPointLabelGroup.visible=!1,this.scene.add(this.yakIndustryPointLabelGroup))}clearYakIndustryPointLabels(){var e;this.yakIndustryPointLabelGroup&&(this.yakIndustryPointLabelGroup.visible=!1),(e=this.yakIndustryPointLabels)==null||e.forEach(t=>{var a;t.visible=!1,(a=t.hide)==null||a.call(t)})}getYakIndustryLabelFeatures(e,t){const a=this.getVisibleVectorFeatures(e,t).filter(d=>{var h;return((h=d==null?void 0:d.geometry)==null?void 0:h.type)==="Point"}),n=Number(e==null?void 0:e.pointLabelLimit)||(a.length>36?12:Math.min(a.length,16)),s=a.map(d=>{var h;return{feature:d,score:this.getYakIndustryFeatureScore(d),town:dt((h=d.properties)==null?void 0:h.town)}}).sort((d,h)=>{var g,m;return h.score-d.score||String(((g=d.feature.properties)==null?void 0:g.name)||"").localeCompare(String(((m=h.feature.properties)==null?void 0:m.name)||""),"zh-CN")}),o=[],u=new Set;return s.forEach(d=>{o.length>=n||!d.town||u.has(d.town)||(o.push(d.feature),u.add(d.town))}),s.forEach(d=>{o.length>=n||o.includes(d.feature)||o.push(d.feature)}),o}getYakIndustryFeatureScore(e){const t=(e==null?void 0:e.properties)||{},a=[t.outputValue,t.capacity,t.value,t.count,t["年产值 (万元)"],t["年总产值 (万元)"],t["设计存栏量 (头)"],t["总库容 (吨)"]].map(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||"产业主体"),s=t.town||t.village||"红原县",o=this.getYakIndustryPointMetricText(t),u=this.getYakIndustryLabelColor(t);return`
${Se(n)}
${Se(a)}
${Se(s)} ${o?`${Se(o)}`:""}
`}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,s,o,u,d,h;const t=String(e.stageKey||""),a=(((n=this.currentTopicLayer)==null?void 0:n.legends)||[]).find(g=>{var m;return String(((m=g.match)==null?void 0:m.value)||"")===t})||(String(((u=(o=(s=this.currentTopicLayer)==null?void 0:s.activeLegend)==null?void 0:o.match)==null?void 0:u.value)||"")===t?this.currentTopicLayer.activeLegend:null);return(a==null?void 0:a.fillColor)||((h=(d=this.currentTopicLayer)==null?void 0:d.activeLegend)==null?void 0:h.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]),s=this.lngLatToLayerCanvasPoint([a.east,a.south]),o=Math.min(n.x,s.x),u=Math.min(n.y,s.y),d=Math.abs(s.x-n.x),h=Math.abs(s.y-n.y);!d||!h||(e.beginPath(),e.rect(o,u,d,h),e.clip())}clipContextToHongyuanBoundary(e){const t=this.hongyuanBoundaryPolygons||[];t.length&&(e.beginPath(),t.forEach(a=>{a.forEach(n=>{n.forEach((s,o)=>{const u=this.lngLatToLayerCanvasPoint(s);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),q.west),n=Math.max(Number(t.south),q.south),s=Math.min(Number(t.east),q.east),o=Math.min(Number(t.north),q.north);return![a,n,s,o].every(Number.isFinite)||a>=s||n>=o?null:{west:a,south:n,east:s,north:o}}getGeometryDrawRank(e){return String(e).includes("Polygon")?1:String(e).includes("LineString")?2:3}isEcologicalProjectLayer(e=this.currentTopicLayer){return["restoration-projects","engineering-analysis-projects"].includes(e==null?void 0:e.key)}getVectorFeatureStyle(e,t){var d,h,g;const a=t.properties||{},s=(e.legends||[]).find(m=>{var L,S;return(((L=m==null?void 0:m.matches)==null?void 0:L.length)||((S=m==null?void 0:m.match)==null?void 0:S.field))&&this.featureMatchesLegend(a,m)})||e.activeLegend||((d=e.legends)==null?void 0:d[0])||{},o=String(((h=t.geometry)==null?void 0:h.type)||"").includes("LineString"),u=((g=t.geometry)==null?void 0:g.type)==="Point";if(this.isEcologicalProjectLayer(e)){const m=o||String(a.feature_role||"")==="线性设施";return{fill:m||u?s.strokeColor||s.fillColor||"#D2EA78":s.fillColor||"#75AD49",stroke:s.strokeColor||s.fillColor||"#D2EA78",polygonAlpha:m?.08:.22,lineAlpha:m?.9:.82,lineWidth:m?3:1.85,pointRadius:u?3.8:4,glow:!1}}return(e==null?void 0:e.key)==="yak-epidemic-village-boundary"?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||"#C9FBFF",polygonAlpha:.16,lineAlpha:1,lineWidth:3.2,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="artificial-grassland-plots"?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||"#A7F8FF",polygonAlpha:.2,lineAlpha:.94,lineWidth:1.6,pointRadius:4.5,glow:!0}:(e==null?void 0:e.key)==="yak-industry-points"?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||s.fillColor||"#B7FFF2",polygonAlpha:.36,lineAlpha:.82,lineWidth:1.6,pointRadius:this.getVectorPointRadius(e,t),glow:!0,halo:!0,marker:!0,markerType:Fr[String(a.stageKey||"")]||"point"}:(e==null?void 0:e.key)==="national-park-zoning"?{fill:s.fillColor||"#30DCFF",stroke:s.strokeColor||"#F2FFFF",polygonAlpha:.38,lineAlpha:.96,lineWidth:2.7,pointRadius:4.5,glow:!1}:e!=null&&e.boundaryOnly?{fill:s.fillColor||"#24F6C4",stroke:s.strokeColor||s.fillColor||"#18F8FF",polygonAlpha:.04,lineAlpha:.96,lineWidth:10,pointRadius:4.5,glow:!0}:{fill:o||u?s.strokeColor||s.fillColor||"#30DCFF":s.fillColor||"#30DCFF",stroke:s.strokeColor||s.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,s;const a=Number(((n=t==null?void 0:t.properties)==null?void 0:n.count)||((s=t==null?void 0:t.properties)==null?void 0:s.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((s,o)=>{const u=this.lngLatToLayerCanvasPoint(s);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,s)=>{const o=this.lngLatToLayerCanvasPoint(n);s===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 s;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,(s=a.lineAlpha)!=null?s:.9),e.stroke()),e.restore()}drawMarkerPointPath(e,t,a){const n=this.lngLatToLayerCanvasPoint(t),s=a.pointRadius||6;e.save(),e.beginPath(),e.arc(n.x,n.y+s*.22,s*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+s*2.05),e.bezierCurveTo(n.x+s*1.46,n.y+s*.62,n.x+s*1.34,n.y-s*1.34,n.x,n.y-s*1.62),e.bezierCurveTo(n.x-s*1.34,n.y-s*1.34,n.x-s*1.46,n.y+s*.62,n.x,n.y+s*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-s*.34,s*.52,0,Math.PI*2),e.fillStyle=this.hexToRgba("#FFFFFF",.96),e.shadowBlur=0,e.fill(),e.beginPath(),e.arc(n.x,n.y-s*.34,s*.82,0,Math.PI*2),e.lineWidth=Math.max(1.2,s*.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-q.west)/(q.east-q.west)*this.topicLayerCanvas.width,y:(q.north-a)/(q.north-q.south)*this.topicLayerCanvas.height}}hexToRgba(e,t=1){const a=String(e||"#30DCFF").replace("#",""),n=a.length===3?a.split("").map(h=>h+h).join(""):a,s=Number.parseInt(n,16);if(!Number.isFinite(s))return`rgba(48, 220, 255, ${t})`;const o=s>>16&255,u=s>>8&255,d=s&255;return`rgba(${o}, ${u}, ${d}, ${t})`}parseWktGeometry(e){var o;const t=String(e||"").trim();if(!t)return null;const a=t.match(/^([A-Z]+)(?:\s+[A-Z]+)?\s*\(/i),n=(o=a==null?void 0:a[1])==null?void 0:o.toUpperCase();if(!n)return null;const s=t.slice(t.indexOf("("));return n==="POLYGON"?{type:"Polygon",coordinates:this.parseWktPolygonBody(s)}:n==="MULTIPOLYGON"?{type:"MultiPolygon",coordinates:this.parseWktMultiPolygonBody(s)}:n==="POINT"?{type:"Point",coordinates:this.parseWktPoint(s)}:n==="MULTIPOINT"?{type:"MultiPoint",coordinates:this.getWktChildGroups(s).map(u=>this.parseWktPoint(u)).filter(Boolean)}:n==="LINESTRING"?{type:"LineString",coordinates:this.parseWktRing(s)}:n==="MULTILINESTRING"?{type:"MultiLineString",coordinates:this.getWktChildGroups(s).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 s=0,o=-1;for(let u=0;u=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 zi({color:16777215,transparent:!0,opacity:0,depthWrite:!this.usesCustomSatelliteTiles,fog:!1,side:Re});t.onBeforeCompile=s=>{s.uniforms=$(N({},s.uniforms),{uColor1:{value:new yt(e?2780818:2152676)},uColor2:{value:new yt(e?1058614:475482)}}),s.vertexShader=s.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),s.fragmentShader=s.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; void main() { `),s.fragmentShader=s.fragmentShader.replace("#include ",` #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=ut,a.wrapT=ut,a.repeat.set(1,1.8),a.offset.y+=.065;let n=new Ka({color:2148829,map:a,fog:!1,opacity:0,side:Re,roughness:.58,metalness:.08});return this.time.on("tick",()=>{a.offset.y+=.005}),n.onBeforeCompile=s=>{s.uniforms=$(N({},s.uniforms),{uColor1:{value:new yt(1629410)},uColor2:{value:new yt(205365)}}),s.vertexShader=s.vertexShader.replace("void main() {",` attribute float alpha; varying vec3 vPosition; varying float vAlpha; void main() { vAlpha = alpha; vPosition = position; `),s.fragmentShader=s.fragmentShader.replace("void main() {",` varying vec3 vPosition; varying float vAlpha; uniform vec3 uColor1; uniform vec3 uColor2; void main() { `),s.fragmentShader=s.fragmentShader.replace("#include ",` #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:Lr.map(e=>({name:e.name,value:0,unit:""}))}}getTownRankingMeta(e=this.currentTownRanking){var n,s,o,u;const t=this.getDefaultTownRanking(),a=_u(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:Ir(e),hideMapLabels:va(e),hideTownLabelStats:(n=e==null?void 0:e.hideTownLabelStats)!=null?n:this.hideTownLabelStatsByDefault,calloutMode:a,showBars:(s=e==null?void 0:e.showBars)!=null?s:!1,showPointMarkers:(o=e==null?void 0:e.showPointMarkers)!=null?o:a,onlyRankedTownLabels:(u=e==null?void 0:e.onlyRankedTownLabels)!=null?u:!1,showMissingTownStats:(e==null?void 0:e.showMissingTownStats)===!0}}getTownRankingRows(e=this.currentTownRanking,t=7,a=!0){var d;const n=this.getDefaultTownRanking(),s=(d=e==null?void 0:e.rows)!=null&&d.length?e.rows:a?n.rows:[],o=this.getTownRankingMeta(e),u=s.map(h=>{const g=this.townMetaByName.get(dt(h.name));return g?$(N(N({},g),h),{name:g.name,enName:g.enName,center:g.center,centroid:g.centroid,value:ue(h.value),unit:h.unit||o.unit,metricTitle:o.title}):null}).filter(Boolean).sort((h,g)=>g.value-h.value).map((h,g)=>$(N({},h),{rank:g+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 h,g,m,L,S,C,x,E;const s=ue((h=a.lng)!=null?h:a.longitude,NaN),o=ue((g=a.lat)!=null?g:a.latitude,NaN);if(!Number.isFinite(s)||!Number.isFinite(o))return null;const u=ue((m=a.displayValue)!=null?m:a.value),d=ue((C=(S=(L=a.rawValue)!=null?L:a.earTagCount)!=null?S:a.ear_tag_count)!=null?C:a.value);return $(N({},a),{key:a.key||`${a.town||""}-${a.village||a.name||n}`,name:a.name||a.village||`村${n+1}`,town:a.town||"",lng:s,lat:o,value:u,rawValue:d,recordCount:ue((x=a.recordCount)!=null?x:a.record_count,0),imageRate:ue((E=a.imageRate)!=null?E: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)=>$(N({},a),{rank:n+1}))}getVillageRankingHtml(e,t){const a=t.hideTownNames?"":`${Se(e.town||"红原县")}`;return e.displayMode==="park-village"||t.displayMode==="park-village"?`
${Se(e.name)} ${a}
${Se(e.metricLabel||t.metricLabel||"")} ${this.formatMapRankingValue(e.value)} ${Se(e.unit||t.unit||"")}
`:`
${Se(e.name)} ${a}
${Se(e.metricLabel||"防疫")} ${this.formatMapRankingValue(e.value)} ${Se(e.unit||t.unit||"")}
台账 ${this.formatMapCompactValue(e.recordCount)}条 耳标 ${this.formatMapCompactValue(e.rawValue)}头
`}ensureVillageRankingGroup(){this.villageRankingGroup||(this.villageRankingGroup=new Te,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(s=>{s.visible=!1}),(t=this.allBar)==null||t.forEach(s=>{s.visible=!1,s.scale.set(1,1,0)}),(a=this.allBarMaterial)==null||a.forEach(s=>{s.opacity=0}),(n=this.allGuangquan)==null||n.forEach(s=>{s.visible=!1})}setTownNameLabelsVisible(e=!0){var t;(t=this.townNameLabels)==null||t.forEach(a=>{a.visible=e})}updateVillageRankingLabels(e=this.currentTownRanking){if(this.ensureVillageRankingGroup(),!Nr(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,s)=>{let o=this.villageRankingLabels[s];o||(o=this.label3d.create("","epidemic-village-label",!0),this.label3d.setLabelStyle(o,.0135,"x"),o.setParent(this.villageRankingGroup),this.villageRankingLabels.push(o));const[u,d]=this.geoProjection([n.lng,n.lat]),h=(s%3-1)*.06,g=Math.floor(s/3)%2*.04;o.init(this.getVillageRankingHtml(n,a),new re(u+h,-d+g,this.depth+1.55+Math.min(s,6)*.015)),o.visible=!0,o.userData=N({},n)}),this.villageRankingLabels.slice(t.length).forEach(n=>{n.visible=!1})}ensureTradeFlowGroup(){this.tradeFlowGroup||(this.tradeFlowGroup=new Te,this.tradeFlowGroup.name="yak-trade-flow",this.tradeFlowGroup.visible=!1,this.tradeFlowMeshGroup=new Te,this.tradeFlowMeshGroup.name="yak-trade-flow-mesh",this.tradeFlowMeshGroup.rotation.x=-Math.PI/2,this.tradeFlowLabelGroup=new Te,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 s,o,u,d;const t=(e==null?void 0:e.source)||{},a=ue((s=t.lng)!=null?s:t.longitude,NaN),n=ue((o=t.lat)!=null?o:t.latitude,NaN);return!Number.isFinite(a)||!Number.isFinite(n)?null:{name:t.name||"红原牦牛交易市场",lng:a,lat:n,total:ue((d=(u=t.total)!=null?u:t.headCount)!=null?d:t.value,NaN)}}getTradeFlowRows(e=this.currentTownRanking){const t=this.getTownRankingMeta(e);return((e==null?void 0:e.rows)||[]).map((a,n)=>{var L,S,C,x,E,O;const s=ue((L=a.lng)!=null?L:a.longitude,NaN),o=ue((S=a.lat)!=null?S:a.latitude,NaN),u=ue((E=(x=(C=a.headCount)!=null?C:a.head_count)!=null?x:a.rawValue)!=null?E:a.value),d=a.displayName||a.display_name||a.name,h=a.mapTownName||a.map_town_name||a.town||a.startTown||a.start_town||d,g=this.townMetaByName.get(dt(h)),m=Number.isFinite(s)&&Number.isFinite(o)?{lng:s,lat:o}:g!=null&&g.center?{lng:g.center[0],lat:g.center[1]}:null;return!m||!Number.isFinite(u)?null:$(N(N({},a),g),{key:a.key||`${(g==null?void 0:g.name)||d||h||"trade-source"}-${n}`,name:d||h||(g==null?void 0:g.name)||`来源${n+1}`,townName:(g==null?void 0:g.name)||h,lng:m.lng,lat:m.lat,labelSide:a.labelSide||a.label_side||this.getTradeSourceLabelSide(g,n),value:u,headCount:u,recordCount:ue((O=a.recordCount)!=null?O:a.record_count,0),unit:a.unit||t.unit||"头"})}).filter(Boolean).sort((a,n)=>n.value-a.value).map((a,n)=>$(N({},a),{rank:n+1}))}getTradeMarketHtml(e,t){const a=Number.isFinite(e.total)?e.total:t.reduce((n,s)=>n+ue(s.value),0);return`
${Se(e.name)}
${this.formatMapIntegerValue(a)}
`}getTradeFlowDisplayName(e=""){const t=String(e||"").replace(/^.*红原县/,"").replace(/\s+/g,"");return t.length>7?`${t.slice(0,7)}…`:t||"来源区域"}getTradeFlowLabelHtml(e){return`
${String(e.rank).padStart(2,"0")}${Se(this.getTradeFlowDisplayName(e.name))}
${this.formatMapIntegerValue(e.value)}${Se(e.unit||"头")}
`}getTradeFlowLabelOffset(e,t){return new re(0,0,0)}getTradeSourceLabelSide(e,t=0){var s,o;const a=Number((s=e==null?void 0:e.center)==null?void 0:s[0]),n=Number((o=e==null?void 0:e.center)==null?void 0:o[1]);return Number.isFinite(a)&&athis.geoProjectionCenter[0]+.2?"right":Number.isFinite(n)&&n>this.geoProjectionCenter[1]+.22?"top":Number.isFinite(n)&&n0&&(d.normalize().multiplyScalar((a%2===0?1:-1)*Math.min(.18,.05+u*.02)),o.add(d)),new bl([n,o,s])}tradeGeoProjection(e){return jt().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 re(0,11.4,16.2),new re(0,-.05,0),.65):!t&&this.mapAnimationComplete&&this.applyLayerMapView(this.currentTopicLayer,{force:!0})}}createTradeSourceMarker(e,t,a,n,s=!0){const o=new yt(t%3===1?16766828:t%3===2?2617536:3202303),u=this.getTradeFlowPoint(e,.72);if(n&&s){const x=this.getLocalTradeFlowCurve(e,n,t),E=new ve({color:o,transparent:!0,opacity:.42,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),O=.012+Math.min(.012,ue(e.value)/Math.max(a,1)*.01),ee=new qe(new vl(x,48,O,8,!1),E);ee.renderOrder=31,this.tradeFlowMeshGroup.add(ee),this.tradeFlowMaterials.push(E);const se=new Qt({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.92,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),Z=new Jt(se),R=.12+Math.min(.08,ue(e.value)/Math.max(a,1)*.06);Z.renderOrder=36,Z.scale.set(R,R,R),Z.userData={curve:x,phase:t*.13%1,speed:.16+Math.min(.16,ue(e.value)/Math.max(a,1)*.12)},Z.position.copy(x.getPointAt(Z.userData.phase)),this.tradeFlowPulseSprites.push(Z),this.tradeFlowMeshGroup.add(Z)}const d=new Qt({map:this.assets.instance.getResource("point"),color:o,transparent:!0,opacity:.95,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),h=new Jt(d),g=.22+Math.min(.34,ue(e.value)/Math.max(a,1)*.28);h.renderOrder=34,h.scale.set(g,g,g),h.position.copy(u),this.tradeFlowMeshGroup.add(h);const m=this.assets.instance.getResource("guangquan1"),L=new ve({map:m,alphaMap:m,color:o,transparent:!0,opacity:.52,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie,side:Re}),S=.38+Math.min(.36,ue(e.value)/Math.max(a,1)*.28),C=new qe(new It(S,S),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),s=new Qt({map:t,color:16773997,transparent:!0,opacity:1,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie}),o=new Jt(s);o.renderOrder=35,o.scale.set(.34,.34,.34),o.position.copy(n),this.tradeFlowMeshGroup.add(o);const u=new ve({map:a,alphaMap:a,color:16773997,transparent:!0,opacity:.72,depthWrite:!1,depthTest:!1,fog:!1,blending:Ie,side:Re}),d=new qe(new It(.58,.58),u);d.renderOrder=29,d.position.copy(this.getTradeLocalPoint(e.lng,e.lat,.58)),this.tradeFlowMeshGroup.add(d)}disposeObject3D(e){var t,a,n,s;(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)}):(s=(n=e.material)==null?void 0:n.dispose)==null||s.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 s=(u=n.userData)==null?void 0:u.curve;if(!s)return;const o=(ue(n.userData.phase)+ue(n.userData.speed,.16)*e)%1;n.userData.phase=o,n.position.copy(s.getPointAt(o))})}updateTradeFlowLayer(e=this.currentTownRanking){if(!Rr(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=Gu(e);this.createTradeMarketMarker(t);const s=Math.max(...a.map(d=>d.value),1);a.forEach((d,h)=>{this.createTradeSourceMarker(d,h,s,t,n)});const o=a.length+1;for(let d=this.tradeFlowLabels.length;d{const g=this.tradeFlowLabels[h+1];g.element.className="trade-flow-label",g.init(this.getTradeFlowLabelHtml(d),this.getTradeFlowPoint(d,.78).add(this.getTradeFlowLabelOffset(d,h))),g.visible=!0,g.userData=N({},d)}),this.tradeFlowLabels.slice(o).forEach(d=>{d.visible=!1})}hasTownRankingRows(e=this.currentTownRanking){return this.getTownRankingRows(e,Number.POSITIVE_INFINITY,!1).length>0}formatMapRankingValue(e){const t=ue(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=ue(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=ue(e);return Math.round(t).toLocaleString("zh-CN")}getBarHeight(e,t){return t?Math.max(2.8*.12,2.8*(ue(e)/t)):2.8*.25}createBarGeometry(e){const a=new wl(.06999999999999999,.06999999999999999,e);return a.translate(0,0,e/2),a}getProvinceLabelHtml(e,t,a){return`
${a.title}
${this.formatMapRankingValue(e.value)}${e.unit||a.unit}
${e.name}
${t+1}
`}updateBarItem(e,t,a,n,s=!0){var h,g;const o=this.getBarHeight(t.value,n),[u,d]=this.geoProjection(t.centroid);return e.visible=!0,(g=(h=e.geometry)==null?void 0:h.dispose)==null||g.call(h),e.geometry=this.createBarGeometry(o),e.position.set(u,-d,this.depth+.45),e.userData=$(N({},t),{targetValue:t.value,geoHeight:o}),e.children.forEach(m=>{var L,S,C,x;(S=(L=m.geometry)==null?void 0:L.dispose)==null||S.call(L),Array.isArray(m.material)?m.material.forEach(E=>{var O;return(O=E==null?void 0:E.dispose)==null?void 0:O.call(E)}):(x=(C=m.material)==null?void 0:C.dispose)==null||x.call(C)}),e.clear(),e.add(...this.createHUIGUANG(o,a>3?16776948:7863285)),s?ta.to(e.scale,{duration:.45,x:1,y:1,z:1,ease:"power2.out"}):this.mapAnimationComplete&&e.scale.set(1,1,1),{x:u,y:d,geoHeight:o}}updateProvinceLabel(e,t,a,n,s,o=!0){var C;const u=ue((C=e.userData)==null?void 0:C.targetValue,t.value);e.visible=!0,e.userData=$(N({},t),{targetValue:t.value}),e.position.copy(n);const d=e.element.querySelector(".label-title"),h=e.element.querySelector(".number .value"),g=e.element.querySelector(".number .unit"),m=e.element.querySelector(".name"),L=e.element.querySelector(".no");!d||!h||!g||!m||!L?e.element.innerHTML=this.getProvinceLabelHtml(t,a,s):(d.innerText=s.title,h.dataset.targetValue=String(t.value),h.innerText=this.formatMapRankingValue(t.value),g.innerText=t.unit||s.unit,m.innerText=t.name,L.innerText=a+1);const S=e.element.querySelector(".provinces-label-wrap");if(this.mapAnimationComplete&&(S.style.opacity="1",S.style.transform="translate(50%, 0)"),o&&this.mapAnimationComplete){const x=e.element.querySelector(".number .value"),O={value:u};ta.to(O,{value:t.value,duration:.45,ease:"power2.out",onUpdate:()=>{x.innerText=this.formatMapRankingValue(O.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"),s=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=""),s&&(s.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 g,m;const d=((g=u.userData)==null?void 0:g.townName)||((m=u.userData)==null?void 0:m.name),h=u.element.querySelector(".town-name");h&&(h.innerText=d||""),this.clearTownNameLabelStat(u),u.visible=!a.hideTownNames});return}const n=new Map(t.map(u=>[dt(u.name),u])),s=!!(a.showMissingTownStats&&e&&t.length&&(a.metricLabel||a.unit||a.title));this.townNameLabels.forEach(u=>{var ee,se;const d=((ee=u.userData)==null?void 0:ee.townName)||((se=u.userData)==null?void 0:se.name),h=n.get(dt(d));if(a.onlyRankedTownLabels&&!h){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="",u.visible=!1;return}const g=h||(s?{name:d,value:0,unit:a.unit,metricLabel:a.metricLabel,rank:null}:null);if(!g){this.clearTownNameLabelStat(u),u.element.style.pointerEvents="none",u.element.style.cursor="";return}const m=u.element.querySelector(".town-stat-label"),L=u.element.querySelector(".town-name"),S=u.element.querySelector(".town-stat-value"),C=u.element.querySelector(".town-stat-unit"),x=u.element.querySelector(".town-rank"),E=u.element.querySelector(".town-stat-metric");m==null||m.classList.add("has-stat"),L&&(L.innerText=d),E&&(E.innerText=g.metricLabel||a.metricLabel||""),S&&(S.innerText=this.formatMapRankingValue(g.value)),C&&(C.innerText=g.unit||a.unit||""),x&&(x.innerText=g.rank?`第${g.rank}名`:"");const O=this.isNationalParkTownSelectionActive()&&!!h;u.element.style.pointerEvents=O?"auto":"none",u.element.style.cursor=O?"pointer":"",u.userData=$(N(N({},u.userData),g),{townName:d,targetValue:g.value})})}getInfoPointHtml(e,t=this.getTownRankingMeta()){const a=String(e.metricLabel||t.metricLabel||t.title||"统计指标").replace(/排行$/,""),n=Number(e.rank),s=Number.isFinite(n)?String(n).padStart(2,"0"):"--";return`
${s} ${Se(e.name||"红原县")}
${Se(a)}
${this.formatMapRankingValue(e.value)} ${Se(e.unit||t.unit||"")}
`}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(d=>d.value),1);this.infoPointSprites.forEach((d,h)=>{const g=a[h],m=this.infoLabelElement[h];if(!g){d.visible=!1,d.scale.set(0,0,0),m&&(m.visible=!1);return}const[L,S]=this.geoProjection(g.centroid||g.center),C=[L,-S,this.depth+.72];d.userData=$(N(N({},d.userData),g),{position:C,value:g.value,unit:g.unit||t.unit,rank:g.rank,metricTitle:t.title,index:h}),d.position.set(...C),d.visible=this.showTownRankingPointMarkers;const x=.78+g.value/n*.44;if(d.scale.set(x,x,x),m){const E=(h%2===0?.22:-.18)+(h===0?.12:0),O=h%3===0?.08:-.04;m.position.set(L+E,-S+O,this.depth+1.88+Math.min(h,4)*.03),m.userData=$(N({},g),{index:h}),m.element.innerHTML=this.getInfoPointHtml(g,t)}});const s=this.infoLabelElement[this.infoPointIndex];s&&this.showTownRankingPointMarkers&&this.mapAnimationComplete&&(s.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 Te;this.barGroup=t;const a=Math.max(...e.map(n=>n.value),1);this.allBar=[],this.allBarMaterial=[],this.allGuangquan=[],this.allProvinceLabel=[],e.map((n,s)=>{const o=this.getBarHeight(n.value,a),u=new ve({color:16777215,transparent:!0,opacity:0,depthTest:!1,fog:!1});new Za(u,{uColor1:s>3?16506760:5291006,uColor2:s>3?16776948:7863285,size:o,dir:"y"});const d=new qe(this.createBarGeometry(o),u);d.renderOrder=5;const[h,g]=this.geoProjection(n.centroid);d.position.set(h,-g,this.depth+.45),d.scale.set(1,1,0),d.userData=$(N({},n),{targetValue:n.value,geoHeight:o});const m=this.createQuan(new re(h,this.depth+.44,g),s);d.add(...this.createHUIGUANG(o,s>3?16776948:7863285)),t.add(d),t.rotation.x=-Math.PI/2,this.allBar.push(d),this.allBarMaterial.push(u),this.allGuangquan.push(m)}),this.scene.add(t),this.updateTownNameLabelStats(this.currentTownRanking)}setTownRanking(e){var s,o,u,d,h,g,m,L,S,C,x,E,O,ee,se,Z;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(Rr(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),(s=this.allBar)!=null&&s.length&&(this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(o=this.allBarMaterial)==null||o.forEach(R=>{R.opacity=0}),(u=this.allProvinceLabel)==null||u.forEach(R=>{R.visible=!1}),(d=this.allGuangquan)==null||d.forEach(R=>{R.visible=!1})),this.updateTradeFlowLayer(e),(e!=null&&e.mapView||e!=null&&e.cameraPosition)&&this.applyLayerMapView(null);return}if(this.setTradeNationalMapVisible(!1),this.hideTradeFlowLayer(),this.mapGroup&&(this.mapGroup.visible=!0),this.labelGroup&&(this.labelGroup.visible=!0),this.flyLineGroup&&(this.flyLineGroup.visible=this.mapAnimationComplete),this.flyLineFocusGroup&&(this.flyLineFocusGroup.visible=this.mapAnimationComplete),this.scatterGroup&&(this.scatterGroup.visible=this.mapAnimationComplete),Nr(e)){this.updateTownNameLabelStats(null),this.setTownNameLabelsVisible(!Ir(e)),this.clearInfoPointStats(),this.updateVillageRankingLabels(e),(h=this.allBar)!=null&&h.length&&(this.allBar.forEach(R=>{R.visible=!1,R.scale.set(1,1,0)}),(g=this.allBarMaterial)==null||g.forEach(R=>{R.opacity=0}),(m=this.allProvinceLabel)==null||m.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),!((S=this.allBar)!=null&&S.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}),(E=this.allGuangquan)==null||E.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)}),(O=this.allProvinceLabel)==null||O.forEach(R=>{R.visible=!1}),(ee=this.allGuangquan)==null||ee.forEach(R=>{R.visible=!1}),this.clearInfoPointStats();return}this.InfoPointGroup&&(this.InfoPointGroup.visible=this.showTownRankingPointMarkers&&this.mapAnimationComplete),(se=this.infoPointSprites)==null||se.forEach(R=>{R.visible=this.showTownRankingPointMarkers});const n=Math.max(...a.map(R=>R.value),1);this.allBar.forEach((R,Fe)=>{const We=Fe{R.visible=!1}),this.allGuangquan.forEach((R,Fe)=>{R.visible=Fe{const We=this.allBar[Fe],at=this.allGuangquan[Fe];if(!We)return;const{x:bt,y:W}=this.updateBarItem(We,R,Fe,n,this.mapAnimationComplete);at&&(at.visible=!0,at.position.set(0,0,0),at.children.forEach(Ee=>{Ee.position.set(bt,this.depth+.44,W),this.mapAnimationComplete&&Ee.scale.set(1,1,1)}))}),this.updateInfoPointStats()}createEvent(){let e=[];const t=n=>{n.traverse(s=>{s.isMesh&&(s.material=this.defaultMaterial)})},a=n=>{n.traverse(s=>{s.isMesh&&(s.material=this.defaultLightMaterial)})};this.eventElement.map(n=>{this.interactionManager.add(n),n.addEventListener("mousedown",s=>{this.handleMapClick(s)}),n.addEventListener("mouseover",s=>{e.includes(s.target.parent)||e.push(s.target.parent),document.body.style.cursor="pointer",a(s.target.parent)}),n.addEventListener("mouseout",s=>{e=e.filter(o=>o.userData.name!==s.target.parent.userData.name),e.length>0&&e[e.length-1],t(s.target.parent),document.body.style.cursor="default"})})}createHUIGUANG(e,t){let a=new It(.35,e);a.translate(0,e/2,0);const n=this.assets.instance.getResource("huiguang");n.colorSpace=ia,n.wrapS=ut,n.wrapT=ut;let s=new ve({color:t,map:n,transparent:!0,opacity:.4,depthWrite:!1,side:Re,blending:Ie}),o=new qe(a,s);o.renderOrder=10,o.rotateX(Math.PI/2);let u=o.clone(),d=o.clone();return u.rotateY(Math.PI/180*60),d.rotateY(Math.PI/180*120),[o,u,d]}createQuan(e,t){const a=this.assets.instance.getResource("guangquan1"),n=this.assets.instance.getResource("guangquan2");let s=new It(.5,.5),o=new ve({color:16777215,map:a,alphaMap:a,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:Ie}),u=new ve({color:16777215,map:n,alphaMap:n,opacity:1,transparent:!0,depthTest:!1,fog:!1,blending:Ie}),d=new qe(s,o),h=new qe(s,u);return d.renderOrder=6,h.renderOrder=6,d.rotateX(-Math.PI/2),h.rotateX(-Math.PI/2),d.position.copy(e),h.position.copy(e),h.position.y-=.001,d.scale.set(0,0,0),h.scale.set(0,0,0),this.quanGroup=new Te,this.quanGroup.add(d,h),this.scene.add(this.quanGroup),this.time.on("tick",()=>{d.rotation.z+=.05}),this.quanGroup}createDiffuse(){let e=new It(200,200),t=new ve({color:0,depthWrite:!1,transparent:!0,blending:Ll});t.blendEquation=Tl,t.blendSrc=Sl,t.blendDst=Ml,new Gl({material:t,time:this.time,size:60,diffuseSpeed:8,diffuseColor:7442830,diffuseWidth:2,callback:n=>{const s=setTimeout(()=>{this.addSceneTween(ta.to(n.uniforms.uTime,{value:4,repeat:-1,duration:6,ease:"power1.easeIn"}))},3);this.addSceneTimer(s)}});let a=new qe(e,t);a.renderOrder=3,a.rotation.x=-Math.PI/2,a.position.set(0,.21,0),this.scene.add(a)}createGrid(){new _l(this,{gridSize:54,gridDivision:24,gridColor:1990543,shapeSize:.55,shapeColor:3309487,pointSize:.085,pointColor:1993891,pointBlending:Ie})}createBottomBg(){let e=new It(24,24);const t=this.assets.instance.getResource("ocean");t.colorSpace=ia,t.wrapS=ut,t.wrapT=ut,t.repeat.set(1,1);let a=new ve({map:t,opacity:.92,fog:!1}),n=new qe(e,a);n.rotation.x=-Math.PI/2,n.position.set(0,-.7,0),this.scene.add(n)}createChinaBlurLine(){let e=new It(154,154);const t=this.assets.instance.getResource("chinaBlurLine");t.colorSpace=ia,t.wrapS=ut,t.wrapT=ut,t.generateMipmaps=!1,t.minFilter=ir,t.repeat.set(1,1);let a=new ve({color:4162253,alphaMap:t,transparent:!0,opacity:.62}),n=new qe(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=[],s=[];cu.map(u=>{if(u.hide==!0)return!1;let d=o(u,a,t);n.push(d),s.push(d)}),this.otherLabel=n,this.townNameLabels=s;function o(u,d,h){let g=d.create("",`china-label ${u.blur?" blur":""}`,!0);const[m,L]=e.geoProjection(u.center);return g.init(`
${u.name}
`,new re(m,-L,e.depth+.85)),d.setLabelStyle(g,.018,"x"),g.setParent(h),g.userData=$(N({},u),{labelType:"town-label",baseScale:.018,townName:u.name}),g.element.addEventListener("pointerdown",S=>{e.handleTownRankingSelect(u.name,{preserveCamera:!0,statusText:`已选中${u.name}`})&&(S.preventDefault(),S.stopPropagation())}),g}}createRotateBorder(){let e=13.2,t=this.assets.instance.getResource("rotationBorder1"),a=this.assets.instance.getResource("rotationBorder2"),n=new dr(this,{width:e*1.178,needRotate:!0,rotateSpeed:.001,material:new ve({map:t,color:4763647,transparent:!0,opacity:.26,side:Re,depthWrite:!1,blending:Ie}),position:new re(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 s=new dr(this,{width:e*1.116,needRotate:!0,rotateSpeed:-.004,material:new ve({map:a,color:4763647,transparent:!0,opacity:.5,side:Re,depthWrite:!1,blending:Ie}),position:new re(0,.33,0)});s.instance.rotation.x=-Math.PI/2,s.instance.renderOrder=6,s.instance.scale.set(0,0,0),s.setParent(this.scene),this.rotateBorder1=n.instance,this.rotateBorder2=s.instance}createFlyLine(){this.flyLineGroup=new Te,this.flyLineGroup.visible=!1,this.scene.add(this.flyLineGroup)}createFocus(){this.flyLineFocusGroup.clear()}createParticles(){this.particles=new hr(this,{num:10,range:30,dir:"up",speed:.05,material:new kl({map:hr.createTexture(),size:1,color:61166,transparent:!0,opacity:1,depthTest:!1,depthWrite:!1,vertexColors:!0,blending:Ie,sizeAttenuation:!0})}),this.particleGroup=new Te,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 Te,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 Qt({map:e,color:16776948,fog:!1,transparent:!0,depthTest:!1});let a=xr(du),n=a[0].value;a.map(s=>{const o=new Jt(t);o.renderOrder=23;let u=.1+s.value/n*.2;o.scale.set(u,u,u);let[d,h]=this.geoProjection([s.lng,s.lat]);o.position.set(d,-h,this.depth+.45),o.userData.position=[d,-h,this.depth+.45],this.scatterGroup.add(o)})}createInfoPoint(){let e=this;this.InfoPointGroup=new Te,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],s=xr(hu),o=s[0].value;s.map((d,h)=>{const g=new Qt({map:a,color:n[h%n.length],fog:!1,transparent:!0,depthTest:!1}),m=new Jt(g);m.renderOrder=23;let L=.7+d.value/o*.4;m.scale.set(L,L,L);let[S,C]=this.geoProjection([d.lng,d.lat]),x=[S,-C,this.depth+.7];m.position.set(...x),m.userData.position=[...x],m.userData={position:[S,-C,this.depth+.7],name:d.name,value:d.value,level:d.level,index:h},this.InfoPointGroup.add(m);let E=u(d,t,this.InfoPointGroup,h);this.infoLabelElement.push(E),this.infoPointSprites.push(m),this.interactionManager.add(m),m.addEventListener("mousedown",O=>{var ee,se;if(this.clicked||!this.InfoPointGroup.visible)return!1;this.clicked=!0,this.infoPointIndex=O.target.userData.index,this.infoLabelElement.map(Z=>{Z.visible=!1}),E.visible=!0,this.handleTownRankingSelect(((ee=O.target.userData)==null?void 0:ee.name)||((se=O.target.userData)==null?void 0:se.townName)),this.createInfoPointLabelLoop()}),m.addEventListener("mouseup",O=>{this.clicked=!1}),m.addEventListener("mouseover",O=>{document.body.style.cursor="pointer"}),m.addEventListener("mouseout",O=>{document.body.style.cursor="default"})});function u(d,h,g,m){let L=h.create("","info-point",!0);const[S,C]=e.geoProjection([d.lng,d.lat]);return L.init(e.getInfoPointHtml($(N({},d),{value:0,rank:m+1,unit:""}),e.getTownRankingMeta()),new re(S,-C,e.depth+1.9)),h.setLabelStyle(L,.015,"x"),L.setParent(g),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=ut,t.repeat.set(2,1);let a=new ea(this,{geoProjectionCenter:this.geoProjectionCenter,geoProjectionScale:this.geoProjectionScale,position:new re(0,0,this.depth+.24),data:e,material:new ve({color:2868444,map:t,alphaMap:t,fog:!1,transparent:!0,opacity:1,blending:Ie}),type:"Line3",renderOrder:22,tubeRadius:.03});this.focusMapGroup.add(a.lineGroup),this.time.on("tick",()=>{t.offset.x+=.005})}handleMapClick(e){return he(this,null,function*(){var s,o,u,d,h,g,m,L,S,C,x,E,O,ee,se,Z,R,Fe,We,at,bt,W,Ee,kt,ht,Pt,Ut,vt,pt,Ye,Ue,ce,we,Ct,it,$e,nt,xe,je,rt,M;if(!this.currentTopicLayer)return;const t=this.getScreenPointFromEvent(e),a=this.getLngLatFromEvent(e);if(!a){this.clearSelectedFeature(),(o=(s=this.callbacks).onFeatureInfo)==null||o.call(s,{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(),(h=(d=this.callbacks).onFeatureInfo)==null||h.call(d,{feature:null}),(m=(g=this.callbacks).onLayerStatus)==null||m.call(g,{type:"success",text:"当前点击位置不在红原县边界内"});return}if(this.shouldClipLayerToLayerBounds(this.currentTopicLayer)&&!this.isLngLatInLayerClipBounds(a,this.currentTopicLayer)){this.clearSelectedFeature(),(S=(L=this.callbacks).onFeatureInfo)==null||S.call(L,{feature:null}),(x=(C=this.callbacks).onLayerStatus)==null||x.call(C,{type:"success",text:"当前点击位置不在图层显示范围内"});return}if(Bu(this.currentTopicLayer)){this.clearSelectedFeature(),(O=(E=this.callbacks).onFeatureInfo)==null||O.call(E,{feature:null});return}if(Qa(this.currentTopicLayer)){const v=this.pickVectorFeatureAtPoint(a,t),G=(v==null?void 0:v.feature)||v;let V=(v==null?void 0:v.screen)||t;if(G)this.shouldClipLayerToHongyuanBoundary(this.currentTopicLayer)?(this.clearSelectedGeometryGroup(),this.setSelectedVectorFeatures([G])):this.showSelectedFeature(G),((ee=this.currentTopicLayer)==null?void 0:ee.key)==="yak-industry-points"&&(this.setSelectedVectorFeatures([G]),V=this.getPointFeatureScreenPoint(G)||V),(We=(Fe=this.callbacks).onFeatureInfo)==null||We.call(Fe,{feature:{id:((se=G.properties)==null?void 0:se.id)||((Z=G.properties)==null?void 0:Z.feature_id)||((R=G.properties)==null?void 0:R.project_name),properties:G.properties||{},feature:G,layer:this.currentTopicLayer,lngLat:a},screen:V}),(bt=(at=this.callbacks).onLayerStatus)==null||bt.call(at,{type:"success",text:"真实矢量要素已选中"});else{const U=this.getTownNameFromMapEvent(e);if(this.handleTownRankingSelect(U))return;this.clearSelectedFeature(),(Ee=(W=this.callbacks).onFeatureInfo)==null||Ee.call(W,{feature:null}),(ht=(kt=this.callbacks).onLayerStatus)==null||ht.call(kt,{type:"success",text:"当前点击位置无生态保护要素"})}return}const n=this.lngLatToWmsPixel(a);(Ut=(Pt=this.callbacks).onFeatureInfo)==null||Ut.call(Pt,{feature:null}),(pt=(vt=this.callbacks).onFeatureLoading)==null||pt.call(vt,!0);try{const v=yield br(this.currentTopicLayer,n,{size:_t,buffer:10}),G=this.normalizeFeatureInfoAtPoint(v,a),V=G?null:yield this.queryFallbackFeatureInfo(a),U=G||(V==null?void 0:V.feature);if(U){const J=yield this.enrichFeatureInfo(U,n,a);this.showSelectedFeature(J.feature||J),(Ue=(Ye=this.callbacks).onFeatureInfo)==null||Ue.call(Ye,{feature:$(N({},J),{layer:(V==null?void 0:V.layer)||this.currentTopicLayer,lngLat:a}),screen:t})}else this.clearSelectedFeature(),(we=(ce=this.callbacks).onFeatureInfo)==null||we.call(ce,{feature:null});U||(it=(Ct=this.callbacks).onLayerStatus)==null||it.call(Ct,{type:"success",text:"当前点击位置无图斑"})}catch(v){this.clearSelectedFeature(),(nt=($e=this.callbacks).onFeatureInfo)==null||nt.call($e,{feature:null}),(je=(xe=this.callbacks).onLayerStatus)==null||je.call(xe,{type:"error",text:"图斑信息查询失败"})}finally{(M=(rt=this.callbacks).onFeatureLoading)==null||M.call(rt,!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,S,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=(S=this.interactionManager)==null?void 0:S.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()),h=jt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0]).invert([u.x,-u.y]);if(!h)return null;const g=Number(h[0]),m=Number(h[1]);return!Number.isFinite(g)||!Number.isFinite(m)?null:gq.east+.03||mq.north+.03?this.getFallbackLngLatFromPointer(e,t):{lng:g,lat:m}}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 s=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=q.west+(q.east-q.west)*s,d=q.north-(q.north-q.south)*o;return{lng:u,lat:d}}getRayMapPlaneIntersection(e){if(!(e!=null&&e.origin)||!(e!=null&&e.direction)||!this.focusMapGroup)return null;const t=this.focusMapGroup.worldToLocal(e.origin.clone()),n=this.focusMapGroup.worldToLocal(e.origin.clone().add(e.direction.clone())).sub(t),s=this.depth+.22;if(Math.abs(n.z)<1e-8)return null;const o=(s-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 he(this,null,function*(){const n=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(n))return e;const o=(Wi[n]||[]).find(m=>m.key===`${n}-distribution`),u=(this.visibleTopicLayers||[]).filter(m=>this.getLayerTopicKey(m)===n).slice(0,5),d=[o,this.currentTopicLayer,...u].filter(m=>m==null?void 0:m.layerName).filter((m,L,S)=>S.findIndex(C=>this.getLayerQueryKey(C)===this.getLayerQueryKey(m))===L);if(!d.length)return e;const h=yield Promise.allSettled([...d.filter(m=>this.getLayerQueryKey(m)!==this.getLayerQueryKey(this.currentTopicLayer)).map(m=>he(this,null,function*(){const L=yield br(m,t,{size:_t,buffer:10}),S=this.normalizeFeatureInfoAtPoint(L,a);return S?{layer:m,feature:S,source:"wms"}:null})),...d.map(m=>he(this,null,function*(){const L=yield this.queryLayerFeatureByPoint(m,a);return L?{layer:m,feature:L,source:"wfs"}:null}))]),g=N({},e.properties||{});return h.forEach(m=>{var L,S;m.status!=="fulfilled"||!((S=(L=m.value)==null?void 0:L.feature)!=null&&S.properties)||this.mergeBusinessProperties(g,m.value.feature.properties,m.value.layer)}),$(N({},e),{properties:g,relatedFeatures:h.filter(m=>{var L;return m.status==="fulfilled"&&((L=m.value)==null?void 0:L.feature)}).map(m=>m.value),feature:$(N({},e.feature||{}),{properties:g})})})}queryFallbackFeatureInfo(e){return he(this,null,function*(){const t=this.getLayerTopicKey(this.currentTopicLayer);if(!["grassland","wetland","woodland"].includes(t))return null;const n=[(Wi[t]||[]).find(s=>s.key===`${t}-distribution`),this.currentTopicLayer,...(this.visibleTopicLayers||[]).filter(s=>this.getLayerTopicKey(s)===t)].filter((s,o,u)=>(s==null?void 0:s.layerName)&&u.findIndex(d=>this.getLayerQueryKey(d)===this.getLayerQueryKey(s))===o);for(const s of n){const o=yield this.queryLayerFeatureByPoint(s,e,{requireContainment:!0});if(o)return{layer:s,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 s=n.properties||{};return{id:n.id||s.gid||s.objectid||s.OBJECTID,properties:s,feature:n}}queryLayerFeatureByPoint(n,s){return he(this,arguments,function*(e,t,a={}){var C,x,E;if(!(e!=null&&e.layerName)||!Number.isFinite(t==null?void 0:t.lng)||!Number.isFinite(t==null?void 0:t.lat))return null;const o=e.pointQueryTolerance||.0015,u=e.geometryField||"geom",d=t.lng-o,h=t.lat-o,g=t.lng+o,m=t.lat+o,L=yield yr(e.layerName,{cqlFilter:`BBOX(${u},${d},${h},${g},${m})`,maxFeatures:8,timeout:12e3}),S=this.pickFeatureAtPoint((L==null?void 0:L.features)||[],t,a);return S?{id:S.id||((C=S.properties)==null?void 0:C.gid)||((x=S.properties)==null?void 0:x.objectid)||((E=S.properties)==null?void 0:E.OBJECTID),properties:S.properties||{},feature:S}:null})}pickFeatureAtPoint(e,t,a={}){var s;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:((s=e.map(o=>({feature:o,distance:this.getGeometryDistanceScore(o.geometry,t)})).sort((o,u)=>o.distance-u.distance)[0])==null?void 0:s.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,s=e.lat;for(let o=0,u=t.length-1;os!=S>s&&n<(L-g)*(s-m)/(S-m)+g&&(a=!a)}return a}isPointOnSegment(e,t,a,n,s,o){const u=(e-a)*(o-n)-(t-n)*(s-a);return Math.abs(u)>1e-10?!1:(e-a)*(e-s)+(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({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,d)=>this.getGeometryAreaScore(u.geometry)-this.getGeometryAreaScore(d.geometry));if(n.length)return n[0];const s=a.find(u=>this.isPointOrLineNearLngLat(u.geometry,e));return s||null}pickPointFeatureAtScreenPoint(e,t){var s;if(!t||!((s=this.camera)!=null&&s.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 h=Number(e==null?void 0:e[0]),g=Number(e==null?void 0:e[1]);if(!Number.isFinite(h)||!Number.isFinite(g))return new re(0,0,Number(t)||0);const[m,L]=this.geoProjection([h,g]);return new re(m,-L,Number(t)||0)},n=this.topicLayerUvBounds;if(!n)return a();const s=this.lngLatToLayerCanvasPoint(e),o=this.topicLayerCanvas;if(!(o!=null&&o.width)||!(o!=null&&o.height))return a();const u=n.left+s.x/o.width*(n.right-n.left),d=n.bottom+(o.height-s.y)/o.height*(n.top-n.bottom);return new re(u,d,Number(t)||0)}lngLatToLayerScreenPoint(e,t=0){return this.localMapPointToScreenPoint(this.lngLatToLayerLocalPoint(e,t))}lngLatToScreenPoint(e,t=0){const a=Number(e==null?void 0:e[0]),n=Number(e==null?void 0:e[1]);if(!Number.isFinite(a)||!Number.isFinite(n))return null;const s=this.lngLatToWorldPoint([a,n],t);return this.worldPointToScreenPoint(s)}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,S,C,x;const t=String(e||"").trim();if(!t)return!1;const a=(this.currentVectorFeatures||[]).filter(E=>{var O;return String(((O=E==null?void 0:E.properties)==null?void 0:O.project_name)||"").trim()===t});if(!a.length)return(S=(L=this.callbacks).onLayerStatus)==null||S.call(L,{type:"success",text:"当前项目图斑尚未加载"}),!1;const n=this.getFeatureListLngLatBounds(a);if(!n)return!1;const s=this.getProjectHighlightFeatures(a);s.length?(this.showSelectedFeatures(s),this.setSelectedVectorFeatures(s)):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),d=Math.max(.22,Math.min(.55,u*1.25)),h=this.lngLatToWorldPoint(o,.72),g=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(d),m=h.clone().add(g);return this.animateMapCamera(m,h,.75),(x=(C=this.callbacks).onLayerStatus)==null||x.call(C,{type:"success",text:"已定位项目"}),!0}setBoundaryDrawing(e){var t,a,n,s;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:"请在地图上依次点击绘制分析边界"})):(s=(n=this.callbacks).onLayerStatus)==null||s.call(n,{type:"success",text:"已退出边界绘制"}),this.redrawVectorTopicLayer()}addBoundaryDrawPoint(e){var s,o,u,d;if(!Number.isFinite(e==null?void 0:e.lng)||!Number.isFinite(e==null?void 0:e.lat))return!1;const t=Date.now(),a=this.lastBoundaryDrawPoint;return a&&t-a.time<350&&Math.hypot(e.lng-a.lng,e.lat-a.lat)<8e-4?!1:(this.lastBoundaryDrawPoint={lng:e.lng,lat:e.lat,time:t},this.boundaryDrawPoints=[...this.boundaryDrawPoints||[],{lng:e.lng,lat:e.lat}],(o=(s=this.callbacks).onDrawBoundary)==null||o.call(s,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),(d=(u=this.callbacks).onLayerStatus)==null||d.call(u,{type:"success",text:`已添加边界点 ${this.boundaryDrawPoints.length} 个`}),this.redrawVectorTopicLayer(),!0)}undoBoundaryPoint(){var e,t,a;return(e=this.boundaryDrawPoints)!=null&&e.length?(this.boundaryDrawPoints=this.boundaryDrawPoints.slice(0,-1),(a=(t=this.callbacks).onDrawBoundary)==null||a.call(t,{status:"drawing",points:this.boundaryDrawPoints,pointCount:this.boundaryDrawPoints.length}),this.redrawVectorTopicLayer(),!0):!1}finishBoundaryDrawing(){var o,u,d,h,g,m;const e=this.boundaryDrawPoints||[];if(e.length<3)return(u=(o=this.callbacks).onLayerStatus)==null||u.call(o,{type:"error",text:"至少需要 3 个点才能形成分析边界"}),null;const t=e.map(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 s={type:"Feature",properties:{source:"draw",pointCount:e.length},geometry:{type:"Polygon",coordinates:[t]}};return this.boundaryDrawingEnabled=!1,this.boundaryDrawPoints=[],this.lastBoundaryDrawPoint=null,this.analysisBoundaryFeature=s,(h=(d=this.callbacks).onDrawBoundary)==null||h.call(d,{status:"complete",feature:s,points:e,pointCount:e.length}),(m=(g=this.callbacks).onLayerStatus)==null||m.call(g,{type:"success",text:"分析边界已生成"}),this.redrawVectorTopicLayer(),s}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 s;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):(s=this.analysisBoundaryFeature)!=null&&s.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,s;const a=[...this.normalizePastureGrasslandRows(e==null?void 0:e.grasslands),...this.normalizePastureGrasslandRows(e==null?void 0:e.wkt)].map((o,u)=>{const d=this.normalizePastureGrasslandGeometry(o);if(!d)return null;const h=this.normalizePastureGrasslandProperties(o);return{type:"Feature",properties:$(N({},h),{id:h.id||h.gid||`${(e==null?void 0:e.name)||"pasture"}-${u}`,pasture_name:(e==null?void 0:e.name)||h.pastureName||h.name}),geometry:d}}).filter(Boolean);if(a.length){const o=this.getFeatureListLngLatBounds(a);if(!o)return!1;this.showSelectedFeatures(a,{mode:"pasture"}),this.setSelectedVectorFeatures(a);const u=[(o.minLng+o.maxLng)/2,(o.minLat+o.maxLat)/2];return this.flyToLngLat(u,{span:Math.max(o.maxLng-o.minLng,o.maxLat-o.minLat),statusText:"已定位具体草场"}),!0}return(s=(n=this.callbacks).onLayerStatus)==null||s.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 m,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]),s=Number(a==null?void 0:a[1]);if(!Number.isFinite(n)||!Number.isFinite(s))return!1;const o=Number(t.span),u=Number.isFinite(o)?Math.max(.2,Math.min(.55,o*1.25)):.32,d=this.lngLatToWorldPoint([n,s],.72),h=this.defaultMapCameraPosition.clone().sub(this.defaultMapTarget).multiplyScalar(u),g=d.clone().add(h);return this.animateMapCamera(g,d,t.duration||.75),(L=(m=this.callbacks).onLayerStatus)==null||L.call(m,{type:"success",text:t.statusText||"已定位"}),!0}getProjectHighlightFeatures(e){const t=e.filter(n=>{var o;const s=String(((o=n==null?void 0:n.geometry)==null?void 0:o.type)||"");return s.includes("Polygon")||s.includes("LineString")}),a=t.filter(n=>{var s;return((s=n==null?void 0:n.properties)==null?void 0:s.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)}:N({},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 s=1;ss.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(([s,o])=>{o==null||o===""||(e[s]===void 0||e[s]===null||e[s]==="")&&(e[s]=o)}),n==="basic-grassland"){const s=(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);s!=null&&s!==""&&(e.basic_type_name=s)}if(n==="grassland-level"){const s=(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);s!=null&&s!==""&&(e.grassland_level=s)}if(n==="grassland-type"||n==="wetland-type"){const s=(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);s!=null&&s!==""&&(e.grass_min_type=s)}if(n==="grassland-yield"||n==="wetland-yield"){const s=(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);s!=null&&s!==""&&(e.fresh_grass_yield=s),o!=null&&o!==""&&(e.mu_yield=o)}if(n==="grassland-health"){const s=(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);s!=null&&s!==""&&(e.health_level=s),o!=null&&o!==""&&(e.ndvi=o);const u=(t==null?void 0:t.degradation_level)||(t==null?void 0:t.degradation_level_name)||(t==null?void 0:t.level)||(t==null?void 0:t.level_name);u!=null&&u!==""&&(e.degradation_level=u)}}getScreenPointFromEvent(e){var a;const t=((a=e==null?void 0:e.data)==null?void 0:a.originalEvent)||(e==null?void 0:e.originalEvent)||e;return(t==null?void 0:t.clientX)!==void 0&&(t==null?void 0:t.clientY)!==void 0?{x:t.clientX,y:t.clientY}:null}getLngLatFromEvent(e){var u,d,h;const a=(h=(((d=(u=this.interactionManager)==null?void 0:u.raycaster)==null?void 0:d.intersectObject(e.target,!1))||[])[0])==null?void 0:h.point;if(!a)return null;const n=this.focusMapGroup.worldToLocal(a.clone()),o=jt().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-q.west)/(q.east-q.west)*_t.width,n=(q.north-t)/(q.north-q.south)*_t.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 s;const n=(a==null?void 0:a.geometry)||((s=a==null?void 0:a.feature)==null?void 0:s.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:Pr,fillOpacity:t?.46:a?.24:.54,lineColor:Iu,lineOpacity:.98,glowColor:Cr,glowOpacity:t?.92:.96,renderOrderBase:t?42:a?40:35,boundary:t||a,boundaryColor:Pr,boundaryGlowColor:Cr,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),s=new ve({color:a.fillColor,transparent:!0,opacity:a.fillOpacity,side:Re,depthWrite:!1,fog:!1}),o=new Xt({color:a.lineColor,transparent:!0,opacity:a.lineOpacity,linewidth:2,depthTest:!1,depthWrite:!1,fog:!1}),u=new Xt({color:a.glowColor,transparent:!0,opacity:a.glowOpacity,linewidth:3,depthTest:!1,depthWrite:!1,fog:!1}),d=a.boundary?new ve({color:a.boundaryColor,transparent:!0,opacity:a.boundaryOpacity,side:Re,depthTest:!1,depthWrite:!1,fog:!1}):null,h=a.boundary?new ve({color:a.boundaryGlowColor,transparent:!0,opacity:a.boundaryGlowOpacity,side:Re,depthTest:!1,depthWrite:!1,fog:!1,blending:Ie}):null;n.length&&n.forEach(m=>{const L=this.createProjectedShape(m);if(!L)return;const S=new Pl(L),C=new qe(S,s);C.renderOrder=a.renderOrderBase,this.selectedFeatureGroup.add(C),m.forEach(x=>{const E=this.createProjectedRingPoints(x);if(E.length<3)return;a.boundary&&(this.addSelectedBoundaryBand(E,h,a.boundaryGlowWidth,a.renderOrderBase+1,!0),this.addSelectedBoundaryBand(E,d,a.boundaryWidth,a.renderOrderBase+4,!0));const O=new ma().setFromPoints(E),ee=new nr(O,o);ee.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(ee);const se=new ma().setFromPoints(E),Z=new nr(se,u);Z.renderOrder=a.renderOrderBase+3,Z.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(Z)})});const g=this.normalizeFeatureLineStrings(e);g.length&&g.forEach(m=>{const L=this.createProjectedRingPoints(m);if(L.length<2)return;a.boundary&&(this.addSelectedBoundaryBand(L,h,a.boundaryGlowWidth,a.renderOrderBase+1,!1),this.addSelectedBoundaryBand(L,d,a.boundaryWidth,a.renderOrderBase+4,!1));const S=new ma().setFromPoints(L),C=new rr(S,u);C.renderOrder=a.renderOrderBase+3,C.scale.set(1.004,1.004,1),this.selectedFeatureGroup.add(C);const x=new ma().setFromPoints(L),E=new rr(x,o);E.renderOrder=a.renderOrderBase+5,this.selectedFeatureGroup.add(E)})}addSelectedBoundaryBand(e,t,a,n,s=!0){if(!t||!this.selectedFeatureGroup)return;const o=this.createPathBandGeometry(e,a,s);if(!o)return;const u=new qe(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 s=Math.max(Number(t)||0,0)/2;if(!s)return null;const o=[],u=a?n.length:n.length-1;for(let h=0;hNumber.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],s=a[a.length-1];n.distanceToSquared(s)<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(s=>e.add(s)):e.add(n.material)}e.forEach(n=>{var s;return(s=n==null?void 0:n.dispose)==null?void 0:s.call(n)})}normalizeFeaturePolygons(e){return Er(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 s=this.clipRingToBounds(n==null?void 0:n[0],a);if(s.length<3)return null;const o=n.slice(1).map(u=>this.clipRingToBounds(u,a)).filter(u=>u.length>=3);return[s,...o]}).filter(Boolean):t}clipRingToBounds(e=[],t){let a=e.map(s=>[Number(s==null?void 0:s[0]),Number(s==null?void 0:s[1])]).filter(([s,o])=>Number.isFinite(s)&&Number.isFinite(o));return[{inside:([s])=>s>=t.west,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lng",t.west)},{inside:([s])=>s<=t.east,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lng",t.east)},{inside:([,s])=>s>=t.south,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lat",t.south)},{inside:([,s])=>s<=t.north,intersect:(s,o)=>this.getLngLatLineIntersection(s,o,"lat",t.north)}].forEach(s=>{const o=a;a=[],o.length&&o.forEach((u,d)=>{const h=o[(d+o.length-1)%o.length],g=s.inside(u),m=s.inside(h);g?(m||a.push(s.intersect(h,u)),a.push(u)):m&&a.push(s.intersect(h,u))})}),a}getLngLatLineIntersection(e,t,a,n){const s=a==="lng"?0:1,o=a==="lng"?1:0,u=t[s]-e[s];if(!u)return[...e];const d=(n-e[s])/u,h=[...e];return h[s]=n,h[o]=e[o]+(t[o]-e[o])*d,h}createProjectedShape(e){const t=e==null?void 0:e[0];if(!Array.isArray(t)||t.length<3)return null;const a=new sr;return this.createProjectedRingPoints(t).forEach((s,o)=>{o===0?a.moveTo(s.x,s.y):a.lineTo(s.x,s.y)}),e.slice(1).forEach(s=>{const o=this.createProjectedRingPoints(s);if(o.length<3)return;const u=new sr;o.forEach((d,h)=>{h===0?u.moveTo(d.x,d.y):u.lineTo(d.x,d.y)}),a.holes.push(u)}),a}createProjectedRingPoints(e){if(!Array.isArray(e))return[];const t=[];return e.forEach(a=>{if(!Array.isArray(a)||a.length<2)return;const n=Number(a[0]),s=Number(a[1]);if(!Number.isFinite(n)||!Number.isFinite(s))return;const[o,u]=this.geoProjection([n,s]);t.push(new re(o,-u,0))}),t}enhanceTexture(e){var a,n,s;const t=(n=(a=this.renderer)==null?void 0:a.instance)==null?void 0:n.capabilities;e.anisotropy=((s=t==null?void 0:t.getMaxAnisotropy)==null?void 0:s.call(t))||1,e.needsUpdate=!0}geoProjection(e){return jt().center(this.geoProjectionCenter).scale(this.geoProjectionScale).translate([0,0])(e)}updateTownLabelScale(){var u,d,h;const e=this.townNameLabels||this.otherLabel||[],t=(u=this.camera)==null?void 0:u.instance,a=(h=(d=this.camera)==null?void 0:d.controls)==null?void 0:h.target;if(!e.length||!t||!a)return;const n=t.position.distanceTo(a),s=Wt(n*72e-5,.011,.026),o=n>45?"0.76":n<22?"0.94":"1";e.forEach(g=>{var L,S,C;if(((L=g==null?void 0:g.userData)==null?void 0:L.labelType)!=="town-label")return;g.scale.set(s,s,s);const m=(C=(S=g.element)==null?void 0:S.querySelector)==null?void 0:C.call(S,".other-label");m&&(m.style.opacity=o)})}update(e){super.update(e),this.updateDynamicSatelliteTiles(),this.updateTownLabelScale(),this.updateTradeFlowPulses(e),this.interactionManager&&this.interactionManager.update()}pauseScene(){var e,t;this.scenePaused=!0,(t=(e=this.time)==null?void 0:e.pause)==null||t.call(e),this.sceneTweens.forEach(a=>{var 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(s=>clearTimeout(s)),this.sceneTimers=[],this.sceneTweens.forEach(s=>{var o;return(o=s==null?void 0:s.kill)==null?void 0:o.call(s)}),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 Du={class:"map"},Ou={__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(b,{expose:e,emit:t}){const a=b,n=t,s=z(null),o=dl(null);let u=null,d=null,h=null,g=null,m=null,L="",S="",C=!1;Dr(()=>{n("scene-mounted")}),Or(()=>{pt()});function x(M){return o.value?!0:s.value?(o.value=new zu(s.value,M,{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=xe(a.activeLayer),S=rt(a.mapRanking),o.value.setTopicLayers(je(a.activeLayer),a.activeLayer),o.value.setTownRanking(a.mapRanking),we(),ce(),!0):!1}function E(){return!!o.value}function O(){return he(this,null,function*(){var M,v,G,V,U,J;if(o.value&&(ee(),!o.value.mapAnimationComplete)){if(C){(v=(M=o.value.animateTl)==null?void 0:M.play)==null||v.call(M),Ye();return}C=!0,(V=(G=o.value.animateTl)==null?void 0:G.timeScale)==null||V.call(G,1),(J=(U=o.value.animateTl)==null?void 0:U.play)==null||J.call(U),Ye()}})}function ee(){var M,v;o.value&&(we(),ce(),window.requestAnimationFrame(()=>{var G,V,U,J,fe,Ge;(U=(V=(G=o.value)==null?void 0:G.label3d)==null?void 0:V.resize)==null||U.call(V),(Ge=(fe=(J=o.value)==null?void 0:J.label3d)==null?void 0:fe.update)==null||Ge.call(fe)}),(v=(M=o.value).resumeScene)==null||v.call(M),o.value.resumeScene||o.value.time.resume())}function se(){var M,v,G,V,U,J;o.value&&(Ue(),(v=(M=o.value.animateTl)==null?void 0:M.pause)==null||v.call(M),(V=(G=o.value).pauseScene)==null||V.call(G),o.value.pauseScene||(J=(U=o.value.time)==null?void 0:U.pause)==null||J.call(U),it())}function Z(){var M,v;(v=(M=o.value)==null?void 0:M.clearSelectedFeature)==null||v.call(M)}function R(M){var v,G;(G=(v=o.value)==null?void 0:v.focusProject)==null||G.call(v,M)}function Fe(M){var v,G;(G=(v=o.value)==null?void 0:v.focusPasture)==null||G.call(v,M)}function We(M,v){var G,V;return(V=(G=o.value)==null?void 0:G.focusTownByName)==null?void 0:V.call(G,M,v)}function at(M){var v,G;return(G=(v=o.value)==null?void 0:v.focusYakIndustryPoint)==null?void 0:G.call(v,M)}function bt(M){var v,G;return(G=(v=o.value)==null?void 0:v.focusVectorFeature)==null?void 0:G.call(v,M)}function W(M){var v,G;return(G=(v=o.value)==null?void 0:v.getVectorFeatureScreen)==null?void 0:G.call(v,M)}function Ee(M){var v,G;return(G=(v=o.value)==null?void 0:v.getYakIndustryPointScreen)==null?void 0:G.call(v,M)}function kt(M){var v,G;(G=(v=o.value)==null?void 0:v.setBoundaryDrawing)==null||G.call(v,M)}function ht(){var M,v;return(v=(M=o.value)==null?void 0:M.finishBoundaryDrawing)==null?void 0:v.call(M)}function Pt(){var M,v;(v=(M=o.value)==null?void 0:M.undoBoundaryPoint)==null||v.call(M)}function Ut(){var M,v;(v=(M=o.value)==null?void 0:M.clearAnalysisBoundary)==null||v.call(M)}function vt(M){var v,G;(G=(v=o.value)==null?void 0:v.showAnalysisResult)==null||G.call(v,M)}function pt(){var M,v;Ue(),it(),(v=(M=o.value)==null?void 0:M.destroy)==null||v.call(M),o.value=null}function Ye(){Ue(),m=window.setTimeout(()=>{var M,v;m=null,(v=(M=o.value)==null?void 0:M.ensureMapRevealed)==null||v.call(M)},5200)}function Ue(){m&&(window.clearTimeout(m),m=null)}function ce(){d&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{var M,v,G,V,U;d=null,(G=(v=(M=o.value)==null?void 0:M.sizes)==null?void 0:v.init)==null||G.call(v),(U=(V=o.value)==null?void 0:V.resize)==null||U.call(V)}),h&&window.clearTimeout(h),h=window.setTimeout(()=>{var M,v,G,V,U;h=null,(G=(v=(M=o.value)==null?void 0:M.sizes)==null?void 0:v.init)==null||G.call(v),(U=(V=o.value)==null?void 0:V.resize)==null||U.call(V)},180)}function we(){var v;it();const M=(v=s.value)==null?void 0:v.parentNode;M&&window.ResizeObserver&&(u=new ResizeObserver(()=>ce()),u.observe(M)),g=window.setInterval(Ct,1e3),Yt(ce)}function Ct(){var fe;if(!o.value||!s.value)return;const M=s.value.parentNode,v=(M==null?void 0:M.offsetWidth)||window.innerWidth||1,G=(M==null?void 0:M.offsetHeight)||window.innerHeight||1,V=((fe=o.value.sizes)==null?void 0:fe.pixelRatio)||1,U=Math.floor(v*V),J=Math.floor(G*V);(s.value.width!==U||s.value.height!==J)&&ce()}function it(){u&&(u.disconnect(),u=null),d&&(window.cancelAnimationFrame(d),d=null),h&&(window.clearTimeout(h),h=null),g&&(window.clearInterval(g),g=null)}function $e(){if(!o.value)return;we();const M=()=>{var v,G,V,U,J,fe,Ge,Ce,_e,Ke,Be,Ze,me,ge,te,He,st,ye,Bt,ot,Xe;o.value&&((G=(v=o.value)==null?void 0:v.resumeScene)==null||G.call(v),o.value.resumeScene||(U=(V=o.value.time)==null?void 0:V.resume)==null||U.call(V),(Ge=(fe=(J=o.value)==null?void 0:J.sizes)==null?void 0:fe.init)==null||Ge.call(fe),(_e=(Ce=o.value)==null?void 0:Ce.resize)==null||_e.call(Ce),(Ze=(Be=(Ke=o.value)==null?void 0:Ke.label3d)==null?void 0:Be.resize)==null||Ze.call(Be),(te=(ge=(me=o.value)==null?void 0:me.label3d)==null?void 0:ge.update)==null||te.call(ge),(st=(He=o.value)==null?void 0:He.setTopicLayers)==null||st.call(He,je(a.activeLayer),a.activeLayer),(Bt=(ye=o.value)==null?void 0:ye.setTownRanking)==null||Bt.call(ye,a.mapRanking),(Xe=(ot=o.value)==null?void 0:ot.ensureMapRevealed)==null||Xe.call(ot))};ce(),window.requestAnimationFrame(M),window.setTimeout(()=>{M()},80),window.setTimeout(()=>{M()},220)}function nt(){if(!o.value)return;we();const M=()=>{var G,V,U,J,fe,Ge,Ce,_e,Ke,Be,Ze,me,ge,te,He,st;const v=o.value;v&&((G=v.resumeScene)==null||G.call(v),v.resumeScene||(U=(V=v.time)==null?void 0:V.resume)==null||U.call(V),(fe=(J=v.sizes)==null?void 0:J.init)==null||fe.call(J),(Ge=v.resize)==null||Ge.call(v),(Ce=v.ensureMapRevealed)==null||Ce.call(v),(_e=v.setTradeNationalMapVisible)==null||_e.call(v,!1),(Ke=v.setTopicLayers)==null||Ke.call(v,je(a.activeLayer),a.activeLayer),(Be=v.setTownRanking)==null||Be.call(v,a.mapRanking),(Ze=v.applyLayerMapView)==null||Ze.call(v,v.currentTopicLayer||a.activeLayer||null,{force:!0}),(ge=(me=v.label3d)==null?void 0:me.resize)==null||ge.call(me),(He=(te=v.label3d)==null?void 0:te.update)==null||He.call(te),(st=v.updateDynamicSatelliteTiles)==null||st.call(v,!0))};ce(),window.requestAnimationFrame(M),window.setTimeout(M,100),window.setTimeout(M,260)}Ht(()=>a.activeLayer,M=>{const v=xe(M);v!==L&&(L=v,o.value&&o.value.setTopicLayers(je(M),M))},{deep:!0}),Ht(()=>a.mapRanking,M=>{const v=rt(M);v!==S&&(S=v,o.value&&o.value.setTownRanking(M))},{deep:!0}),e({loadMap:x,hasMap:E,play:O,resume:ee,pause:se,clearSelectedFeature:Z,focusProject:R,focusPasture:Fe,focusTown:We,focusYakIndustryPoint:at,focusVectorFeature:bt,getVectorFeatureScreen:W,getYakIndustryPointScreen:Ee,setBoundaryDrawing:kt,finishBoundaryDrawing:ht,undoBoundaryPoint:Pt,clearAnalysisBoundary:Ut,showAnalysisResult:vt,refreshView:$e,resetView:nt,destroyMap:pt,canvasMap:o});function xe(M){return M?je(M).map(v=>{var G,V;return[v.key||"",v.layerName||"",v.styles||"",v.sldBody||"",v.cqlFilter||"",((G=v.activeLegend)==null?void 0:G.key)||"",Array.isArray(v.activeLegends)?v.activeLegends.map(U=>(U==null?void 0:U.key)||"").join(","):"",v.timelineDate||"",((V=v.timelineItem)==null?void 0:V.key)||"",v.sourceType||"",v.dataPath||"",v.fallbackPath||""].join("|")}).join("||"):""}function je(M){if(!M)return[];const v=Array.isArray(M.overlayLayers)?M.overlayLayers.filter(Boolean):[];return[M,...v]}function rt(M){var v,G,V,U,J,fe,Ge,Ce,_e,Ke;return M?[M.status||"",M.topicKey||"",M.layerKey||"",M.title||"",M.metricLabel||"",M.scope||"",M.displayMode||"",(v=M.showPointMarkers)!=null?v:"",(G=M.showBars)!=null?G:"",(V=M.showTownNames)!=null?V:"",(U=M.showMapLabels)!=null?U:"",(J=M.hideTownLabelStats)!=null?J:"",(fe=M.showFlowLines)!=null?fe:"",(Ge=M.onlyRankedTownLabels)!=null?Ge:"",(Ce=M.showMissingTownStats)!=null?Ce:"",((_e=M.rows)==null?void 0:_e.length)||0,((Ke=M.rows)==null?void 0:Ke.map(Be=>{var Ze;return`${Be.key||Be.name||""}:${(Ze=Be.value)!=null?Ze:""}`}).join(","))||""].join("|"):""}return(M,v)=>(I(),B("div",Du,[f("canvas",{ref_key:"canvasRef",ref:s},null,512)]))}};const Wu={class:"yak-management"},Yu={key:1,class:"yak-map-loading"},ju={class:"yak-management-ui"},Hu={key:0,class:"trade-year-switcher","aria-label":"交易年份切换"},qu=["onClick"],Uu={key:1,class:"epidemic-year-switcher","aria-label":"防疫年份切换"},Ku=["onClick"],Zu={key:2,class:"forecast-year-switcher","aria-label":"预测年份切换"},Xu=["onClick"],Ju={class:"yak-left"},Qu={class:"yak-side-stack is-left"},ec={class:"breeding-health-card"},tc={class:"breeding-health-head"},ac={class:"breeding-health-grid"},ic={class:"structure-chart-card"},nc={class:"structure-ratio-card"},rc={class:"structure-ratio-chart"},sc={viewBox:"0 0 150 150",preserveAspectRatio:"xMidYMid meet","aria-hidden":"true"},oc={class:"structure-rose-segments"},lc=["d","fill","stroke"],uc={class:"structure-ratio-list"},cc={key:0,class:"yak-data-status"},dc={key:1,class:"yak-data-status is-warning"},hc={class:"forecast-waterfall-card"},pc={class:"forecast-waterfall-head"},fc={class:"forecast-waterfall-list"},mc={class:"forecast-trend-card"},gc={class:"forecast-density-switcher","aria-label":"预测粒度切换"},yc=["onClick"],bc={key:0,class:"epidemic-three-pie-card"},vc={class:"epidemic-three-pie-visual"},wc={class:"epidemic-three-pie-center"},Lc={class:"epidemic-three-pie-legend"},Tc={key:1,class:"epidemic-empty"},Sc={class:"trade-risk-card"},Mc={class:"trade-risk-head"},kc={class:"trade-risk-list"},Pc={class:"yak-right"},Cc={class:"yak-side-stack is-right"},Fc={class:"structure-chart-card"},xc={class:"structure-summary-card"},Nc={key:0,class:"yak-data-status"},Rc={key:1,class:"yak-data-status is-warning"},Ic={class:"forecast-heat-list"},Gc=["title"],_c={class:"epidemic-record-table is-full"},Bc={class:"epidemic-record-toolbar"},Ac={class:"epidemic-record-rows"},Ec=["onClick"],$c={key:0,class:"epidemic-empty"},Vc={class:"epidemic-record-pager"},zc=["disabled"],Dc=["disabled"],Oc={class:"trade-cert-card"},Wc={class:"trade-cert-main"},Yc={class:"trade-dest-list"},jc={key:0,class:"epidemic-empty"},Hc={class:"trade-ledger-table"},qc={class:"trade-ledger-toolbar"},Uc={class:"trade-ledger-rows"},Kc=["onClick"],Zc={key:0,class:"epidemic-empty"},Xc={class:"trade-ledger-pager"},Jc=["disabled"],Qc=["disabled"],ed={class:"yak-bottom-topic"},td={class:"epidemic-ledger-dialog"},ad={class:"epidemic-ledger-dialog-head"},id={class:"epidemic-ledger-filters"},nd=["value"],rd=["value"],sd={class:"epidemic-ledger-workspace"},od={class:"epidemic-ledger-list"},ld=["onClick"],ud={key:0,class:"epidemic-empty"},cd={class:"epidemic-ledger-detail trade-ledger-detail epidemic-ledger-record-detail"},dd={class:"epidemic-detail-head trade-detail-head"},hd={class:"epidemic-detail-grid is-modal trade-detail-grid epidemic-detail-flat-grid"},pd={key:0,class:"epidemic-detail-photos"},fd={class:"epidemic-modal-photo-strip"},md=["onClick"],gd=["src"],yd={class:"epidemic-ledger-pager"},bd=["disabled"],vd=["disabled"],wd={class:"epidemic-ledger-dialog trade-ledger-dialog"},Ld={class:"epidemic-ledger-dialog-head"},Td={class:"epidemic-ledger-filters trade-ledger-filters"},Sd=["value"],Md=["value"],kd=["value"],Pd={class:"epidemic-ledger-workspace trade-ledger-workspace"},Cd={class:"epidemic-ledger-list trade-ledger-modal-list"},Fd=["onClick"],xd={key:0,class:"epidemic-empty"},Nd={class:"epidemic-ledger-detail trade-ledger-detail"},Rd={class:"epidemic-detail-head trade-detail-head"},Id={class:"epidemic-detail-grid is-modal trade-detail-grid"},Gd={class:"is-wide"},_d={class:"is-wide"},Bd={class:"is-wide"},Ad={class:"is-wide"},Ed=["disabled"],$d={class:"epidemic-ledger-pager"},Vd=["disabled"],zd=["disabled"],Dd={class:"epidemic-image-preview-dialog"},Od={class:"epidemic-image-preview-head"},Wd={class:"epidemic-image-preview-body"},Yd={class:"epidemic-image-preview-frame"},jd=["src"],Hd="https://qkl-hy.oss-cn-chengdu.aliyuncs.com/yak-vaccine-images",qd="https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png",Ud=8.85,Kd="oss-satellite-dynamic-zoom21-v5",ei=8,$r=14,Hi=12,Vr=14,Zd=5e3,ti=6,Xd=4200,zr="#FFE600",ph={__name:"index",props:{active:{type:Boolean,default:!0},viewKey:{type:String,default:"structure"}},emits:["module-stats","view-change"],setup(b,{expose:e,emit:t}){const a=b,n=t,s=or.sideCardWidth;or.sideCardGap;const o=z(typeof window=="undefined"?1080:window.innerHeight),u=k(()=>Fl(o.value)),d=k(()=>lr(u.value,2)),h=k(()=>u.value),g=k(()=>lr(u.value,2)),m=ga.textPrimary,L=ga.textStrong,S=ga.textSecondary,C=ga.textMuted,x=ga.chartGridLine,E=[102.58,32.72],O=E,ee=E,se={lng:0,lat:0},Z={targetLngLat:[102.6,32.59],targetLocalZ:.72,distanceScale:1.05,duration:.75},R=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],Fe=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff"],We=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff"],at={name:"红原牦牛交易市场",lng:102.562157,lat:32.820484},bt=[{key:"structure",name:"畜群结构",color:"#30dcff"},{key:"forecast",name:"畜群预测",color:"#8bf7ff"},{key:"epidemic",name:"牦牛防疫",color:"#8bf7ff"},{key:"trade",name:"牦牛交易",color:"#63d7ff"}],W=z(Vi(a.viewKey)),Ee=z("2027"),kt=z("month"),ht=z(0),Pt=z([]),Ut=z([]),vt=z([]),pt=z(!1),Ye=z(""),Ue=[2025,2026],ce=z(2026),we=z({metrics:{}}),Ct=z({rows:[],year:null}),it=z({rows:[]}),$e=z([]),nt=z(0),xe=z(1),je=z(""),rt=z(""),M=z(!1),v=z(""),G=z(!1),V=z([]),U=z(0),J=z(1),fe=z(!1),Ge=z(""),Ce=z(null),_e=z(null),Ke=z(!1),Be=z(!1),Ze=z(""),me=z($a()),ge=z({years:[],latestYear:null}),te=z({metrics:{},hasData:!1}),He=z([]),st=z(0),ye=z(null),Bt=z(!1),ot=z(""),Xe=z(1),Ta=z(""),ii=z(""),ni=z(!1),At=z([]),Sa=z(0),Et=z(1),ri=z(!1),si=z(""),Ma=z(null),ft=z({keyword:"",startTown:"",usageType:"",certType:""}),Ve=z(null),sa=z(null),$t=z(!1),oa=z(!1),Ki=z(0),Zi=z(0),la=z({type:"idle",text:""}),ua=z({type:"idle",text:""});let oi=null,li=!1,wt=!1,Lt=null,ca=!1,ka=null,Pa=null,Ca=0;const ui=[{key:"day",label:"日",unit:"日",stepDays:1},{key:"week",label:"周",unit:"周",stepDays:7},{key:"month",label:"月",unit:"月",stepDays:30}],Je=k(()=>Al(Ee.value)),jr=new Set(["epidemic","trade"]),ci=k(()=>!jr.has(W.value)),Xi=k(()=>ci.value?qd:""),Hr=k(()=>ci.value?"oss-satellite":"solid-3d"),qr=k(()=>`yak-management-map-${Hr.value}-${Kd}-${Ki.value}`),Ur=k(()=>El+$l),di=k(()=>Je.value.stock-ct),Kr=k(()=>sl(Je.value)),Fa=k(()=>Zo(vt.value,ba)),Zr=k(()=>Fa.value.reduce((i,r)=>i+Number(r.count||0),0));k(()=>{const i=Zr.value||1;return Fa.value.map((r,l)=>{const c=Number(r.count||0),p=Number(r.ratio);return $(N({},r),{count:c,color:R[l%R.length],percent:Number.isFinite(p)?p:c/i*100})})});const Xr=k(()=>Kn(Fa.value,ba)),xa=k(()=>Xr.value),Ji=k(()=>tl(xa.value)),Qi=k(()=>al(Fa.value,ba)),en=k(()=>nl(Qi.value)),Jr=k(()=>Math.max(...Ji.value.map(i=>Number(i.count||0)),1)),hi=k(()=>xa.value.length?0:-1),Qr=k(()=>{const i=xa.value,r=i.length;if(!r)return[];const l=Math.max(...i.map(y=>Number(y.count||0)),1),c=360/r,p=Math.min(8,c*.16);return i.map((y,w)=>{const T=Number(y.count||0),F=w===hi.value,_=36+Math.sqrt(T/l)*31+(F?5:0),A=17,Y=-90+w*c+p/2,X=-90+(w+1)*c-p/2,D=(Y+X)/2,Q=Dt(75,75,_+3,D),Ne=Dt(75,75,_+15,D),lt=Dt(75,75,_+20,D);return{key:y.key||y.name||w,index:w,item:y,color:y.color||R[w%R.length],path:el(75,75,A,_,Y,X),lineStart:Q,lineEnd:Ne,label:lt,anchor:Math.cos(D*Math.PI/180)>=0?"start":"end"}})}),tn=k(()=>qn(["fertileCow","overageCow"])),an=k(()=>qn(["femaleCalf","maleCalf"])),Ft=k(()=>Vl(lo(Pt.value.length?Pt.value:pr,pr),ct)),pi=k(()=>uu),fi=k(()=>zl(Je.value)),es=k(()=>Dl(Je.value)),mi=k(()=>{var i;return((i=we.value)==null?void 0:i.metrics)||{}}),gi=k(()=>{var i;return St((i=we.value)==null?void 0:i.dateTrend).sort(bo)}),Na=k(()=>{var i;return St((i=we.value)==null?void 0:i.medicineCounts)}),Ra=k(()=>Na.value.filter(i=>i.value>0).map((i,r)=>$(N({},i),{key:i.key||`${i.name}-${r}`,unit:"条"}))),ts=k(()=>Ra.value.map(i=>`${i.name}:${i.value}`).join("|")||"epidemic-medicine-empty"),as=k(()=>{var i;return St((i=we.value)==null?void 0:i.ownerRanks).slice(0,8)}),xt=k(()=>fn(we.value)),is=k(()=>{var i;return((i=Na.value.find(r=>r.name&&r.name!=="未填写"))==null?void 0:i.name)||"-"}),mt=k(()=>za(mi.value,["total","vaccine"]));k(()=>za(mi.value,["owners"]));const ns=k(()=>Number(ce.value)===2026?10:za(mi.value,["villages"])),yi=k(()=>Vt.value.length),rs=k(()=>{var i;return((i=Vt.value[0])==null?void 0:i.name)||"-"}),nn=k(()=>{const i=$e.value.map(r=>r.operateTime).filter(Boolean).sort();return i.length?Rt(i[i.length-1]):"-"}),bi=k(()=>{const i=Math.max(...Na.value.map(r=>Number(r.value||0)),0);return i>0?i:Math.round(mt.value/xt.value)}),vi=k(()=>{var r;const i=ho((r=Ct.value)==null?void 0:r.rows);return i.length?i:Vt.value.map(l=>({name:l.name,recordCount:Number(l.recordCount||0),earTagCount:Number(l.earTagCount||0),ratio:l.ratio,source:"ledger"}))}),rn=k(()=>{var r;const i=new Set;return Gi((r=it.value)==null?void 0:r.rows).filter(l=>Number.isFinite(l.lng)&&Number.isFinite(l.lat)).map((l,c)=>{const p=`${l.lng.toFixed(4)},${l.lat.toFixed(4)}`,y=i.has(p)?(c%3-1)*.012:0;return i.add(p),$(N({},l),{name:l.village,value:l.earTagCount,unit:"万头",lng:l.lng+y,lat:l.lat-y*.65,displayValue:Number((l.earTagCount/1e4).toFixed(2)),displayUnit:"万头",rankLabel:`第${c+1}名`})})}),Vt=k(()=>{var r;const i=new Map;return St((r=we.value)==null?void 0:r.townCounts).forEach(l=>{const c=Qe(l.name);c&&i.set(c,Number(i.get(c)||0)+Number(l.value||0))}),[...i.entries()].map(([l,c])=>{const p=Math.round(c/xt.value),y=mt.value?c/mt.value*100:0;return{name:l,recordCount:c,earTagCount:p,ratio:y}}).sort((l,c)=>Number(c.recordCount||0)-Number(l.recordCount||0))}),ss=k(()=>Math.max(Ft.value.length,yi.value)),os=k(()=>new Set(Vt.value.map(i=>Qe(i.name)).filter(Boolean))),Nt=k(()=>{const i=os.value;return Ft.value.map(r=>Qe(r.name)).filter(r=>r&&!i.has(r))}),ls=k(()=>{const i=ss.value||yi.value||1;return yi.value/i*100});k(()=>bi.value/ct*100);const Ia=k(()=>wo());k(()=>mt.value?Nt.value.length?Nt.value.length:Ia.value.name&&Ia.value.name!=="暂无"?1:0:0);const us=k(()=>Lo()),cs=k(()=>To()),ds=k(()=>So());k(()=>Mo());const hs=k(()=>ko());k(()=>hs.value.slice(0,3)),k(()=>mt.value?Nt.value.length?"年度免疫进度需核查":Ia.value.desc:"年度计划待核查");const wi=k(()=>Math.max(Math.ceil(nt.value/ei),1)),ps=k(()=>$e.value.slice(0,ei)),sn=k(()=>Math.max(Math.ceil(U.value/$r),1)),zt=k(()=>_e.value||Ce.value||{}),on=k(()=>Bi(zt.value)),fs=k(()=>{const i=zt.value||{};return[Me("台账编号",i.epidemicId,{wide:!0}),Me("养殖户",i.owner,{wide:!0}),Me("联系电话",Sn(i.phone)),Me("证件类型",i.idType),Me("证件号码",xo(i.idNo)),Me("镇/乡",i.town),Me("村",i.village),Me("详细地址",i.location,{wide:!0}),Me("畜种",i.livestockType),Me("性别",i.sex),Me("畜龄",i.age),Me("体重",No(i.weight)),Me("疫苗/药品",i.medicine),Me("防疫类型",i.preventionType),Me("免疫方式",i.method),Me("剂量",Ro(i.dose)),Me("免疫时间",Rt(i.operateTime)),Me("操作员",i.operator)].filter(Boolean)}),ms=k(()=>{var i;return St((i=we.value)==null?void 0:i.townCounts).map(r=>r.name)}),gs=k(()=>Na.value.map(i=>i.name).filter(i=>i&&i!=="未填写")),ln=k(()=>{var i;return((i=te.value)==null?void 0:i.metrics)||{}}),un=k(()=>{var i,r,l,c,p,y,w,T;return mn((i=ge.value)==null?void 0:i.years,(r=te.value)==null?void 0:r.availableYears,(l=te.value)==null?void 0:l.available_years,(c=te.value)==null?void 0:c.yearSummary,(p=te.value)==null?void 0:p.year_summary,(y=te.value)==null?void 0:y.latestYear,(w=te.value)==null?void 0:w.latest_year,(T=te.value)==null?void 0:T.year)}),ys=k(()=>{var i,r;return Va(((i=te.value)==null?void 0:i.monthTrend)||((r=te.value)==null?void 0:r.month_trend),"name")});k(()=>{var i,r;return uo(((i=te.value)==null?void 0:i.yearSummary)||((r=te.value)==null?void 0:r.year_summary))});const Ga=k(()=>{var i,r;return Va(((i=te.value)==null?void 0:i.startTownCounts)||((r=te.value)==null?void 0:r.start_town_counts),"name")}),Li=k(()=>{var i,r;return Va(((i=te.value)==null?void 0:i.usageCounts)||((r=te.value)==null?void 0:r.usage_counts),"name")}),bs=k(()=>{var i,r,l,c,p,y;return Va(((i=te.value)==null?void 0:i.transportNumberCounts)||((r=te.value)==null?void 0:r.transport_number_counts)||((l=te.value)==null?void 0:l.vehicleCounts)||((c=te.value)==null?void 0:c.vehicle_counts)||((p=te.value)==null?void 0:p.transportCounts)||((y=te.value)==null?void 0:y.transport_counts),"transportNumber")}),_a=k(()=>{const i=Ga.value.map(l=>{const c=String(l.name||"").trim(),p=Qe(c),y=Fi(p||c);return $(N({},l),{rawName:c,name:y,displayName:y,town:p,mapTownName:p})}).filter(l=>l.name&&l.name!=="未填写").slice(0,10),r=Math.max(...i.map(l=>l.headCount),1);return i.map((l,c)=>$(N({},l),{key:l.key||`${l.mapTownName||l.name}-${c}`,value:l.headCount,unit:"头",ratio:Math.max(8,Math.round(l.headCount/r*100))}))}),cn=k(()=>He.value.slice(0,Hi)),Ti=k(()=>Math.max(Math.ceil(st.value/Hi),1)),Si=k(()=>Math.max(Math.ceil(Sa.value/Vr),1)),be=k(()=>Ma.value||{}),vs=k(()=>be.value.certId||be.value.factoryCode||""),ws=k(()=>{var r,l;const i=Ri(((r=ge.value)==null?void 0:r.startTowns)||((l=ge.value)==null?void 0:l.start_towns));return i.length?i:Ii(Ga.value.map(c=>c.name))}),Ls=k(()=>{var r,l;const i=Ri(((r=ge.value)==null?void 0:r.usageTypes)||((l=ge.value)==null?void 0:l.usage_types));return i.length?i:Ii(Li.value.map(c=>c.name))}),Ts=k(()=>{var r,l,c,p;const i=co(((r=ge.value)==null?void 0:r.certTypeOptions)||((l=ge.value)==null?void 0:l.cert_type_options));return i.length?i:Ri(((c=ge.value)==null?void 0:c.certTypes)||((p=ge.value)==null?void 0:p.cert_types)).map(y=>({value:y,label:y}))}),Ss=k(()=>_a.value.map((i,r)=>({key:i.key||`${i.name}-${r}`,name:i.displayName||i.name,displayName:i.displayName||i.name,rawName:i.rawName,town:i.mapTownName||i.town||Qe(i.name),mapTownName:i.mapTownName||i.town||Qe(i.name),value:i.headCount,headCount:i.headCount,recordCount:i.recordCount,ratio:i.ratio,unit:"头"}))),dn=k(()=>Po()),Ms=k(()=>{const i=dn.value.filter(r=>r.level==="high");return i.length>=2?`${i.length}项重点`:i.length===1?`重点:${i[0].name}`:"整体平稳"}),ks=k(()=>Ft.value.map(i=>$(N({},i),{breedingCowRatio:tn.value,calfRatio:an.value,breedingCow:Math.round(i.count*tn.value/100),calf:Math.round(i.count*an.value/100)}))),Ba=k(()=>{const i=ks.value,r=i.length,l=Math.max(Math.ceil(r/ti),1),c=ht.value%l,p=c*ti,y=Math.min(p+ti,r);return{page:c,pageCount:l,start:p,end:y,total:r,rows:i.slice(p,y)}}),Ps=k(()=>W.value==="forecast"?fi.value:Ft.value),Cs=k(()=>W.value==="forecast"?"forecast":"count"),Fs=k(()=>qo(Ps.value,Cs.value)),xs=k(()=>({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:zr,glowColor:"rgba(255, 230, 0, 0.42)",lineWidth:1.4,mapView:{targetLngLat:E,distanceScale:.82,targetLocalZ:.76,duration:.85},legends:[{key:"yak-marks",name:"牦牛",fillColor:zr,strokeColor:"#FFF58A",selectable:!1}]})),Ns=k(()=>{var l;const r=Gi((l=it.value)==null?void 0:l.rows).map(c=>mo(c.town,c.village)).filter(Boolean);return{key:"yak-epidemic-village-boundary",sourceType:"wfs",layerName:"ne:t_pastures_map",styles:"牧场样式",name:"防疫村边界",opacity:.86,queryBuffer:8,cqlFilter:r.length?r.join(" OR "):"EXCLUDE",legends:[{key:"yak-epidemic-village-boundary",name:"防疫村边界",fillColor:"#30DCFF",strokeColor:"#C9FBFF",selectable:!1}]}}),hn=k(()=>W.value==="epidemic"?Ns.value:W.value==="trade"?null:xs.value),Tt=k(()=>W.value==="structure"||W.value==="forecast"),Rs=k(()=>W.value==="forecast"?ee:O),Is=k(()=>Tt.value?null:hn.value),Gs=k(()=>Tt.value?null:As.value),_s=k(()=>Tt.value?!oa.value:!$t.value),Bs=k(()=>"3D地图加载中"),As=k(()=>W.value==="trade"?{scope:"trade-flow",title:`${ye.value||""}出栏来源`,metricLabel:"来源",unit:"头",source:$(N({},at),{total:ze("headCount")}),rows:Ss.value,showFlowLines:!1,mapView:Z}:{scope:W.value==="epidemic"?"village":"town",hideTownNames:W.value==="epidemic",title:W.value==="forecast"?`${Je.value.shortLabel}预测存栏`:W.value==="epidemic"?`${ce.value}年村级防疫信息`:"乡镇估算存栏",metricLabel:W.value==="forecast"?"预测":W.value==="epidemic"?"防疫":"存栏",unit:"万头",rows:W.value==="epidemic"?rn.value:Fs.value.map(i=>({name:i.name,value:Number((i.value/1e4).toFixed(2)),unit:"万头"}))}),Es=k(()=>({color:["#8bf7ff","#30dcff"],tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(i){const r=i.map(l=>`${l.marker}${l.seriesName}:${K(Math.abs(l.value))}头`);return`${i[0].name}
${r.join("
")}`}}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:11}},grid:{left:22,right:22,top:32,bottom:12,containLabel:!0},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:i=>ie(Math.abs(i))},splitLine:{lineStyle:{color:x,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",data:Oi.map(i=>i.age),axisLabel:{color:m,fontSize:11,fontWeight:700},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"母牛",type:"bar",stack:"gender",barWidth:12,data:Oi.map(i=>-i.cow),itemStyle:{borderRadius:[7,0,0,7]}},{name:"公牛",type:"bar",stack:"gender",barWidth:12,data:Oi.map(i=>i.bull),itemStyle:{borderRadius:[0,7,7,0]}}]})),$s=k(()=>{const i=Ft.value,r=i.map(l=>l.count);return{color:R,tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(l){const c=l.map(p=>`${p.marker}${p.seriesName}:${K(p.value)}头`);return`${l[0].name}
${c.join("
")}
估算存栏:${K(r[l[0].dataIndex])}头
结构依据:畜群结构比例表`}}),legend:{top:-2,right:0,itemWidth:8,itemHeight:6,itemGap:6,textStyle:{color:S,fontSize:10}},grid:{left:54,right:30,top:22,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:x,type:"dashed"}},axisLine:{show:!1},axisTick:{show:!1}},yAxis:{type:"category",inverse:!0,data:i.map(l=>l.name),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:ba.map(l=>({name:l.name,type:"bar",stack:"town",barWidth:i.length>8?6:11,data:i.map(c=>Math.round(c.count*l.ratio/100))}))}}),Vs=k(()=>$i(Ft.value,"count","头",{style:"ladder",tooltipFormatter(i){const r=Ft.value[i.dataIndex];return`${r.name}
估算存栏:${K(r.count)}头
来源:无人机识别`}})),zs=k(()=>{const i=Ba.value,r=i.rows,l=Math.max(...r.map(c=>c.breedingCow+c.calf),1);return{color:["#30dcff","#8bf7ff"],animationDurationUpdate:700,animationEasingUpdate:"cubicOut",tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(c){const p=r[c[0].dataIndex],y=c.filter(w=>["能繁母牛","犊牛合计"].includes(w.seriesName)).map(w=>`${w.marker}${w.seriesName}:${K(w.value)}头`);return`${p.name}
母犊合计:${K(p.breedingCow+p.calf)}头
${y.join("
")}
依据:无人机识别 + 畜群结构比例表`}}),legend:{data:["能繁母牛","犊牛合计"],top:2,left:2,itemWidth:10,itemHeight:7,itemGap:9,textStyle:{color:S,fontSize:10}},graphic:i.total>ti?{type:"text",right:4,top:3,silent:!0,style:{text:`${i.start+1}-${i.end} / ${i.total}`,fill:C,fontSize:10,fontWeight:600}}:void 0,grid:{left:18,right:18,top:42,bottom:44,containLabel:!1},xAxis:{type:"category",data:r.map(c=>c.name),axisLabel:{color:C,fontSize:10,lineHeight:12,interval:0,margin:8,formatter:yo},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:r.map(c=>c.breedingCow+c.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:r.map(c=>c.breedingCow),itemStyle:{borderRadius:[1,1,0,0],color:new Ae(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:r.map(c=>c.calf),itemStyle:{borderRadius:[8,8,1,1],color:new Ae(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:1,color:"rgba(139, 247, 255, 0.2)"}])},label:{show:!0,position:"top",formatter:({dataIndex:c})=>ie(r[c].breedingCow+r[c].calf),color:"#ffffff",fontSize:10,fontWeight:700}}]}}),Ds=k(()=>{const i=fr.slice().sort((c,p)=>p.value-c.value),r=fr.reduce((c,p)=>c+p.value,0),l=i.map(c=>c.yoy||0);return{color:i.map(c=>c.color),tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(c){const p=i[c[0].dataIndex];return`${p.label}
数量:${K(p.value)}头
占比:${et(p.value/r*100)}
同比:${p.yoy>0?"+":""}${p.yoy}%`}}),grid:{left:36,right:30,top:20,bottom:34},xAxis:{type:"category",data:i.map(c=>c.label),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0,margin:10},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.24)"}},axisTick:{show:!1}},yAxis:[{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",min:Math.min(-2,Math.floor(Math.min(...l)-1)),max:Math.max(8,Math.ceil(Math.max(...l)+1)),axisLabel:{color:S,fontSize:10,formatter:"{value}%"},splitLine:{show:!1},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:16,data:i.map((c,p)=>({value:c.value,itemStyle:{borderRadius:[8,8,2,2],color:new Ae(0,0,0,1,[{offset:0,color:c.color},{offset:.72,color:`${c.color}cc`},{offset:1,color:`${c.color}18`}]),shadowBlur:p===0?4:2,shadowColor:"rgba(48, 220, 255, 0.16)"},label:{show:!0,position:"top",color:L,fontSize:10,fontFamily:Di.number,fontWeight:700,formatter:({value:y})=>ie(y)}}))},{name:"同比",type:"line",yAxisIndex:1,smooth:!0,symbol:"circle",symbolSize:6,data:l,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:c})=>`${c>0?"+":""}${c}%`}}]}}),Os=k(()=>{const i=Oo(kt.value),r=Wo(Je.value,i.key),l=Ho(r),c=Yo(l.length,i.key);return{color:["#30dcff","#8bf7ff","#48cfff"],tooltip:$(N({},Le()),{trigger:"axis",triggerOn:"mousemove|click",axisPointer:{type:"cross",crossStyle:{color:"rgba(126, 251, 246, 0.42)"},label:{color:"#eaffff",backgroundColor:"rgba(5, 31, 51, 0.96)"}},formatter(p){var _,A,Y;const y=Array.isArray(p)?p:[p],w=y.find(X=>X.seriesType==="candlestick"),T=(w==null?void 0:w.data)||l[(Y=(A=w==null?void 0:w.dataIndex)!=null?A:(_=y[0])==null?void 0:_.dataIndex)!=null?Y:0];if(!T)return"";const F=T.close-T.open;return[`${T.label}|${i.unit}度预测`,`预测存栏:${K(T.close)}头`,`较上期:${Ya(F)}头`,`新生牛犊:${K(T.birth)}头`,`出栏扣减:${K(T.outflow)}头`].join("
")}}),legend:{top:4,right:8,data:["预测存栏","新生牛犊","出栏扣减"],itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:44,right:40,top:34,bottom:28},xAxis:{type:"category",boundaryGap:!0,data:r.labels,axisLabel:{color:C,fontSize:10,interval:c},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},axisTick:{show:!1}},yAxis:[{type:"value",scale:!0,axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:S,fontSize:10,formatter:ie},splitLine:{show:!1}}],series:[{name:"预测存栏",type:"candlestick",yAxisIndex:0,barWidth:jo(l.length,i.key),data:l,itemStyle:{color:"rgba(48, 220, 255, 0.82)",color0:"rgba(72, 207, 255, 0.82)",borderColor:"#30dcff",borderColor0:"#48cfff",borderWidth:1.4}},{name:"预测存栏线",type:"line",yAxisIndex:0,smooth:!0,symbol:"circle",symbolSize:4,data:l.map(p=>p.close),lineStyle:{width:1.8,color:"rgba(48, 220, 255, 0.86)"},itemStyle:{color:"#30dcff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:1},tooltip:{show:!1}},jn("新生牛犊",r.births,"#8bf7ff",1),jn("出栏扣减",r.outflow,"#48cfff",1)]}}),Ws=k(()=>({color:["#30dcff","#8bf7ff"],tooltip:$(N({},Le()),{trigger:"axis"}),legend:{top:4,right:12,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:52,right:42,top:34,bottom:28},xAxis:{type:"category",data:pi.value.map(i=>i.month||i.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:i=>{const r=Number(i);return Number.isFinite(r)?Math.abs(r)>=1e4?`${Number((r/1e4).toFixed(1))}万`:`${r}`:i}},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:S,fontSize:10},splitLine:{show:!1}}],series:[{name:"数量",type:"bar",barWidth:12,data:pi.value.map(i=>i.count||i.value),itemStyle:{borderRadius:[8,8,0,0],color:new Ae(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:pi.value.map(i=>i.speed||i.growthRate||0),lineStyle:{width:2.4,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff"}}]})),Ys=k(()=>({tooltip:Le(),radar:{center:["50%","54%"],radius:"68%",splitNumber:4,indicator:mr.map(i=>({name:i.name,max:100})),axisName:{color:"rgba(223, 250, 255, 0.76)",fontSize:11},splitLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},splitArea:{areaStyle:{color:["rgba(48, 220, 255, 0.04)","rgba(139, 247, 255, 0.018)"]}},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.18)"}}},series:[{type:"radar",data:[{name:"预测因子",value:mr.map(i=>i.value),areaStyle:{color:"rgba(48, 220, 255, 0.22)"},lineStyle:{color:"#30dcff",width:2},itemStyle:{color:"#8bf7ff"}}]}]})),js=k(()=>$i(fi.value,"forecast","头")),Hs=k(()=>{const i=es.value,r=i.reduce((l,c,p)=>{const y=c.color||R[p%R.length];return l[`name${p}`]={color:y,fontSize:10,fontWeight:800},l[`percent${p}`]={color:y,fontSize:10,fontFamily:"D-DIN, Arial, sans-serif",fontWeight:800},l},{});return{color:R,tooltip:Le(l=>{var p;const c=i.find(y=>y.name===l.name);return`${l.name}
预测占比:${et((p=c==null?void 0:c.ratio)!=null?p:l.percent)}
预测数量:${K((c==null?void 0:c.count)||0)}头`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,formatter(l){const c=i.findIndex(y=>y.name===l),p=i[c];return p?`{name${c}|${l}} {percent${c}|${et(p.ratio)}}`:l},textStyle:{color:S,fontSize:10,rich:r}},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:i.map(l=>({name:l.name,value:l.count}))}]}}),qs=k(()=>({color:["#8bf7ff","#48cfff","#48cfff"],tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"}}),legend:{top:4,right:8,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:44,right:26,top:34,bottom:28},xAxis:{type:"category",data:Gt.map(i=>i.shortLabel),axisLabel:{color:m,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:i=>Wa(i,1)},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"新生牛犊",type:"bar",barWidth:12,data:Gt.map(i=>i.births),itemStyle:{borderRadius:[7,7,0,0]}},{name:"出栏流出",type:"bar",barWidth:12,data:Gt.map(i=>-i.outflow),itemStyle:{borderRadius:[0,0,7,7]}},{name:"稳态校正",type:"line",smooth:!0,symbolSize:6,data:Gt.map(i=>i.correction),lineStyle:{width:2.4}}]})),Us=k(()=>{const i=fi.value,r=Math.max(...i.map(l=>Math.abs(l.change)),1);return i.map(l=>$(N({},l),{width:Math.max(8,Math.round(Math.abs(l.change)/r*100))}))});function Ks(i){const r=Number((i==null?void 0:i.change)||0)>=0;return{"--heat-width":`${i.width}%`,"--heat-color":r?"#30dcff":"#8bf7ff","--heat-color-soft":r?"rgba(48, 220, 255, 0.24)":"rgba(139, 247, 255, 0.22)","--heat-color-dim":r?"rgba(48, 220, 255, 0.07)":"rgba(139, 247, 255, 0.07)"}}function Zs(i){return`${i.name}:${Ya(i.change)}头`}const Xs=k(()=>{const i=gi.value,r=i.map(c=>c.value),l=Math.max(...r,1);return{color:["#30dcff","#8bf7ff"],tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"line",lineStyle:{color:"rgba(48, 220, 255, 0.28)"}},formatter(c){const p=c[0];return`${p.name}
防疫记录:${K(p.value)}条`}}),grid:{left:42,right:24,top:20,bottom:28},xAxis:{type:"category",data:i.map(c=>c.name),axisLabel:{color:C,fontSize:10,interval:Math.max(Math.floor(i.length/7),0)},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},axisTick:{show:!1}},yAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"防疫记录",type:"bar",barMaxWidth:12,data:r,itemStyle:{borderRadius:[7,7,0,0],color:new Ae(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:c})=>c>=l*.42?ie(c):""}},{name:"作业趋势",type:"line",smooth:!0,showSymbol:!1,data:r,lineStyle:{width:2.4,color:"#8bf7ff"}}]}});k(()=>{const i=gi.value.length?gi.value.slice(-6):[{name:"待开展",value:0}],r=i.map(w=>Number(w.value||0)),l=us.value,c=l.map(w=>Number(w.value||0)),p=Math.max(...r,1),y=w=>String(w||"").replace(/(镇|乡|村)$/,"");return{color:["#30dcff","#8bf7ff"],title:[{text:"作业节奏",left:4,top:0,textStyle:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,fontWeight:800}},{text:"补免关注",left:"55%",top:0,textStyle:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,fontWeight:800}}],tooltip:$(N({},Le()),{trigger:"axis",formatter(w){const T=Array.isArray(w)?w[0]:w;if((T==null?void 0:T.axisIndex)===1){const _=l[T.dataIndex]||{};return`${_.name}
补免关注:${_.label||T.value}`}const F=i[T.dataIndex]||{};return`${F.name}
防疫记录:${K(F.value)}条`}}),grid:[{left:6,right:"52%",top:26,bottom:15},{left:"56%",right:12,top:26,bottom:15}],xAxis:[{type:"category",gridIndex:0,data:i.map(w=>w.name),axisLabel:{color:"rgba(226, 252, 255, 0.56)",fontSize:9,interval:0,formatter:w=>String(w||"").replace(/^(\d{1,2})\D+(\d{1,2}).*$/,"$1/$2")},axisLine:{lineStyle:{color:"rgba(48, 220, 255, 0.22)"}},axisTick:{show:!1}},{type:"value",gridIndex:1,min:0,max:Math.max(...c,100),show:!1}],yAxis:[{type:"value",gridIndex:0,show:!1},{type:"category",gridIndex:1,inverse:!0,data:l.map(w=>w.name),axisLabel:{color:"rgba(226, 252, 255, 0.68)",fontSize:9,formatter:w=>y(w)},axisLine:{show:!1},axisTick:{show:!1}}],series:[{name:"防疫记录",type:"bar",xAxisIndex:0,yAxisIndex:0,barMaxWidth:9,data:r,itemStyle:{borderRadius:[6,6,0,0],color:new Ae(0,0,0,1,[{offset:0,color:"#8bf7ff"},{offset:.45,color:"#30dcff"},{offset:1,color:"rgba(48, 220, 255, 0.1)"}])},label:{show:!0,position:"top",color:"rgba(230, 255, 249, 0.86)",fontSize:8,formatter:({value:w})=>w>=p*.55?ie(w):""}},{name:"节奏线",type:"line",xAxisIndex:0,yAxisIndex:0,smooth:!0,showSymbol:!1,data:r,lineStyle:{width:1.8,color:"#8bf7ff"},tooltip:{show:!1}},{name:"补免关注",type:"bar",xAxisIndex:1,yAxisIndex:1,barWidth:8,data:c,itemStyle:{borderRadius:[0,7,7,0],color:new Ae(0,0,1,0,[{offset:0,color:"rgba(139, 247, 255, 0.24)"},{offset:1,color:"#8bf7ff"}])},label:{show:!0,position:"right",color:"rgba(201, 251, 255, 0.9)",fontSize:8,formatter:({dataIndex:w})=>{var T;return((T=l[w])==null?void 0:T.label)||""}}}]}}),k(()=>{const i=cs.value,r=i.map(y=>Number(y.value||0)),l=Math.max(...r,1),c=r.filter(Boolean).reduce((y,w)=>y+w,0)/Math.max(r.filter(Boolean).length,1),p=Math.ceil(l*1.18);return{color:["#30dcff","#8bf7ff"],tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(y){var T;const w=i[(T=y[0])==null?void 0:T.dataIndex]||{};return w.isMissing?`${w.name}
年度防疫:待补强`:`${w.name}
覆盖量:${K(w.value)}头
防疫记录:${K(w.recordCount)}条`}}),grid:{left:56,right:46,top:16,bottom:12},xAxis:{type:"value",min:0,max:p,show:!1},yAxis:{type:"category",inverse:!0,data:i.map(y=>y.name),axisLabel:{color:"rgba(226, 252, 255, 0.82)",fontSize:11,interval:0,formatter:y=>String(y||"").replace(/(镇|乡)$/,"")},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"均衡参照",type:"bar",barWidth:11,silent:!0,barGap:"-100%",data:i.map(()=>p),itemStyle:{borderRadius:[0,8,8,0],borderColor:"rgba(48, 220, 255, 0.12)",borderWidth:1,color:"rgba(48, 220, 255, 0.045)"}},{name:"覆盖量",type:"bar",barWidth:11,barGap:"-100%",z:3,data:i.map(y=>{const w=Number(y.value||0);return{value:w>0?w:Math.max(p*.035,1),rawValue:w,itemStyle:{borderRadius:[0,8,8,0],color:new Ae(0,0,1,0,[{offset:0,color:y.isMissing?"rgba(72, 207, 255, 0.2)":"rgba(48, 220, 255, 0.14)"},{offset:.72,color:y.isMissing?"#48cfff":"#30dcff"},{offset:1,color:y.isMissing?"#8bf7ff":"#9efcff"}]),shadowBlur:y.isMissing?4:5,shadowColor:y.isMissing?"rgba(72, 207, 255, 0.18)":"rgba(48, 220, 255, 0.16)"}}}),label:{show:!0,position:"right",color:"rgba(239, 255, 255, 0.92)",fontSize:11,fontWeight:800,formatter:({dataIndex:y})=>{const w=i[y]||{};return w.isMissing?"待补强":`${ie(w.value)}头`}},markLine:c>0?{symbol:"none",silent:!0,lineStyle:{color:"rgba(139, 247, 255, 0.46)",type:"dashed",width:1},label:{color:"rgba(201, 251, 255, 0.8)",fontSize:10,formatter:"均衡线"},data:[{xAxis:c}]}:void 0}]}}),k(()=>{const i=ds.value,r=["#30dcff","#8bf7ff","#58d9ff","#28e8d6","#7bdfff","#9efcff","#48cfff","#40b8ff","#8bf7ff"],l=i.length?i.map((c,p)=>({name:String(c.name||"").replace(/(村|社区|牧委会)$/,""),value:Math.max(Number(c.value||0),1),rawValue:Number(c.value||0),town:c.town||"",itemStyle:{color:new Ae(0,0,1,1,[{offset:0,color:r[p%r.length]},{offset:1,color:"rgba(17, 70, 92, 0.38)"}])}})):[{name:"待形成",value:1,rawValue:0,town:"",itemStyle:{color:"rgba(48, 220, 255, 0.14)"}}];return{tooltip:$(N({},Le()),{formatter(c){const p=c.data||{};return p.rawValue?`${p.town?`${p.town} `:""}${p.name}
覆盖量:${K(p.rawValue)}头`:`${p.name}
暂无村级覆盖量`}}),series:[{type:"treemap",roam:!1,nodeClick:!1,breadcrumb:{show:!1},left:6,right:6,top:7,bottom:5,visibleMin:1,data:l,label:{show:!0,color:"rgba(235, 254, 255, 0.9)",fontSize:10,fontWeight:800,lineHeight:14,formatter(c){var y;const p=Number(((y=c.data)==null?void 0:y.rawValue)||0);return p?`${c.name} ${ie(p)}头`:c.name}},upperLabel:{show:!1},itemStyle:{borderColor:"rgba(4, 24, 36, 0.88)",borderWidth:2,gapWidth:2},emphasis:{label:{color:"#ffffff"},itemStyle:{shadowBlur:6,shadowColor:"rgba(48, 220, 255, 0.18)"}},levels:[{itemStyle:{borderColor:"rgba(14, 75, 98, 0.72)",borderWidth:1,gapWidth:2}}]}]}});const Js=k(()=>{const i=vi.value,r=i.length>8?10:12,l=r+8,c=i.map(_=>Number(_.recordCount||0)),p=i.map(_=>Number(_.earTagCount||0)),y=Math.max(...c,1),w=i.map(()=>Math.ceil(y*1.08)),T=new Ae(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)"}]),F=new Ae(0,0,0,1,[{offset:0,color:"#31f7ff"},{offset:.36,color:"#1cbcff"},{offset:1,color:"#266dff"}]);return{color:["#31f7ff","#8bf7ff"],title:{text:`台账总量:{value|${ie(mt.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:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(_){const A=i[_[0].dataIndex];return[`${A.name}`,`防疫记录:${K(A.recordCount)}条`,`耳标数量:${K(A.earTagCount)}头`,"数据来源:防疫台账"].join("
")}}),legend:[{data:["防疫记录"],top:0,left:0,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:m,fontSize:11},selectedMode:!1},{data:["耳标数"],top:0,left:82,itemWidth:10,itemHeight:10,icon:"circle",textStyle:{color:m,fontSize:11},selectedMode:!1}],grid:{left:42,right:12,top:46,bottom:68},xAxis:{type:"category",data:i.map(_=>_.name),axisLabel:{color:m,fontSize:10,interval:0,lineHeight:11,margin:8,formatter:go},axisLine:{show:!1},axisTick:{show:!1},splitLine:{show:!1}},yAxis:{type:"value",name:"数量/条",max:Math.ceil(y*1.2),nameTextStyle:{color:C,fontSize:10,align:"left"},axisLabel:{color:C,fontSize:10,formatter:ie},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},series:[{name:"统计底柱",type:"bar",barWidth:l,barGap:"-100%",data:w,tooltip:{show:!1},silent:!0,z:1,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(48, 220, 255, 0.22)",borderWidth:1,color:T}},{name:"防疫记录",type:"bar",barGap:"-100%",barWidth:r,barMinHeight:2,z:3,data:c.map(_=>({value:_,itemStyle:{borderRadius:[8,8,1,1],borderColor:"rgba(200, 252, 255, 0.22)",borderWidth:1,color:F,shadowBlur:10,shadowColor:"rgba(49, 247, 255, 0.28)"}}))},{name:"顶部高光",type:"pictorialBar",symbol:"diamond",symbolSize:[r+7,5],symbolOffset:[0,-3],symbolPosition:"end",z:8,tooltip:{show:!1},data:c.map(_=>({value:_,itemStyle:{color:"rgba(207, 252, 255, 0.88)",shadowBlur:8,shadowColor:"rgba(49, 247, 255, 0.72)"}}))},{name:"底座光影",type:"pictorialBar",symbol:"diamond",symbolSize:[l+3,5],symbolOffset:[0,3],z:2,tooltip:{show:!1},data:c,itemStyle:{color:"rgba(48, 220, 255, 0.24)",shadowBlur:10,shadowColor:"rgba(48, 220, 255, 0.45)"}},{name:"耳标数",type:"line",smooth:!0,showSymbol:!1,z:9,data:p,lineStyle:{width:1.6,color:"#8bf7ff",shadowBlur:0,shadowColor:"transparent"},itemStyle:{color:"#8bf7ff"}}]}}),Qs=k(()=>{const i=as.value;return{tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(r){const l=i[r[0].dataIndex];return`${l.name}
防疫记录:${K(l.value)}条`}}),grid:{left:74,right:42,top:12,bottom:8},xAxis:{type:"value",axisLabel:{color:C,fontSize:10,formatter:ie},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:i.map(r=>r.name),axisLabel:{color:m,fontSize:10,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{name:"记录",type:"bar",barWidth:9,data:i.map((r,l)=>({value:r.value,itemStyle:{borderRadius:[0,8,8,0],color:new Ae(0,0,1,0,[{offset:0,color:"rgba(48, 220, 255, 0.12)"},{offset:.62,color:["#30dcff","#8bf7ff","#58d9ff"][l%3]},{offset:1,color:"#ffffff"}])}})),label:{show:!0,position:"right",color:"#eaffff",fontSize:10,formatter:({value:r})=>ie(r)}},{type:"scatter",symbolSize:7,data:i.map(r=>r.value),itemStyle:{color:"#8bf7ff",shadowBlur:2,shadowColor:"rgba(139, 247, 255, 0.16)"}}]}}),eo=k(()=>{const i=ys.value;return{color:["#30dcff","#8bf7ff"],tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(r){const l=r.find(p=>p.seriesName==="流通头数"),c=r.find(p=>p.seriesName==="出证记录");return`${(l==null?void 0:l.axisValue)||""}
流通头数:${K((l==null?void 0:l.value)||0)}头
出证记录:${K((c==null?void 0:c.value)||0)}条`}}),legend:{top:4,right:10,itemWidth:12,itemHeight:8,textStyle:{color:S,fontSize:10}},grid:{left:42,right:38,top:34,bottom:28},xAxis:{type:"category",data:i.map(r=>r.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:ie},splitLine:{lineStyle:{color:x,type:"dashed"}}},{type:"value",axisLabel:{color:S,fontSize:10,formatter:ie},splitLine:{show:!1}}],series:[{name:"流通头数",type:"bar",barMaxWidth:13,data:i.map(r=>r.headCount),itemStyle:{borderRadius:[7,7,0,0],color:new Ae(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:i.map(r=>r.recordCount),lineStyle:{width:2.2,color:"#8bf7ff"},itemStyle:{color:"#8bf7ff",borderColor:"rgba(3, 18, 28, 0.9)",borderWidth:2}}]}}),to=k(()=>$i(Ga.value.slice(0,10),"headCount","头",{colors:We,style:"ladder",axisTextColor:"rgba(255, 255, 255, 0.88)",dimAxisTextColor:"rgba(255, 255, 255, 0.74)",tooltipFormatter(i){const r=Ga.value[i.dataIndex];return`${r.name}
流通头数:${K(r.headCount)}头
出证记录:${K(r.recordCount)}条`}})),ao=k(()=>{const i=Li.value;return{color:We,tooltip:Le(r=>{const l=i.find(c=>c.name===r.name);return`${r.name}
占比:${r.percent}%
流通头数:${K(r.value)}头
出证记录:${K((l==null?void 0:l.recordCount)||0)}条`}),legend:{orient:"vertical",right:4,top:"middle",itemWidth:8,itemHeight:8,itemGap:6,textStyle:{color:S,fontSize:10},formatter(r){const l=i.find(c=>c.name===r);return l?`${r} ${ie(l.headCount)}头`:r}},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:i.map(r=>({name:r.name,value:r.headCount}))}]}}),io=k(()=>{const i=[{name:"省外A证",value:ze("outProvinceHeads","aCertHeads")},{name:"省内B证",value:ze("inProvinceHeads","bCertHeads")}];return{color:["#8bf7ff","#30dcff"],tooltip:Le(r=>`${r.name}
流通头数:${K(r.value)}头
占比:${r.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:i}]}});function Mi(){o.value=typeof window=="undefined"?1080:window.innerHeight}function pn(){var i,r,l,c,p,y;if(Tt.value){(r=(i=sa.value)==null?void 0:i.refreshView)==null||r.call(i);return}(c=(l=Ve.value)==null?void 0:l.resume)==null||c.call(l),(y=(p=Ve.value)==null?void 0:p.refreshView)==null||y.call(p)}function ki(){Lt&&(window.clearTimeout(Lt),Lt=null)}function no(){var i,r,l,c,p,y;if(la.value={type:"loading",text:"地图正在复位"},ua.value={type:"idle",text:""},Tt.value){(r=(i=sa.value)==null?void 0:i.hasMap)!=null&&r.call(i)?(oa.value=!0,(c=(l=sa.value)==null?void 0:l.resetView)==null||c.call(l)):(oa.value=!1,Zi.value+=1,Yt(()=>{window.setTimeout(()=>{var w,T;return(T=(w=sa.value)==null?void 0:w.refreshView)==null?void 0:T.call(w)},160)}));return}if((y=(p=Ve.value)==null?void 0:p.hasMap)!=null&&y.call(p)){$t.value=!0,pn();return}ki(),$t.value=!1,wt=!1,Ki.value+=1,Yt(()=>{da()})}e({refreshMapView:pn,resetMap:no,setActiveView(i){W.value=Vi(i)}}),Dr(()=>{Mi(),window.addEventListener("resize",Mi),$o(),Io(),Gn(),kn(),Aa(),Ea()}),Or(()=>{var i,r;ca=!0,window.removeEventListener("resize",Mi),Lt&&window.clearTimeout(Lt),Pi(),Ci(),(r=(i=Ve.value)==null?void 0:i.destroyMap)==null||r.call(i)}),Ht([W,Je,Ft,bi,mt,ce,ye,ln],()=>{zo()},{immediate:!0}),Ht(W,(i,r)=>{n("view-change",i);const l=i==="structure"||i==="forecast",c=r==="structure"||r==="forecast",p=!l&&!c&&(i==="trade"||r==="trade");l&&!c&&(oa.value=!1,la.value={type:"idle",text:""},ua.value={type:"idle",text:""}),!l&&c&&(ki(),$t.value=!1,wt=!1,la.value={type:"idle",text:""},ua.value={type:"idle",text:""},Yt(()=>{var y,w,T,F;da(),(w=(y=Ve.value)==null?void 0:y.resume)==null||w.call(y),(F=(T=Ve.value)==null?void 0:T.refreshView)==null||F.call(T),window.setTimeout(()=>{var _,A;return(A=(_=Ve.value)==null?void 0:_.refreshView)==null?void 0:A.call(_)},180)})),p&&(ki(),$t.value=!1,wt=!1,la.value={type:"idle",text:""},ua.value={type:"idle",text:""},Yt(()=>{da()})),Aa(),Ea()}),Ht(()=>a.viewKey,i=>{const r=Vi(i);r!==W.value&&(W.value=r)}),Ht(()=>a.active,i=>{var r,l,c,p;i?(da(),(l=(r=Ve.value)==null?void 0:r.resume)==null||l.call(r),Aa(),Ea()):((p=(c=Ve.value)==null?void 0:c.pause)==null||p.call(c),Pi(),Ci())}),Ht(Ba,i=>{ht.value>=i.pageCount&&(ht.value=0),Ea()});function ro(i){i!==Ee.value&&(Ee.value=i,Aa())}function Aa(){Pi(),!(!a.active||W.value!=="forecast"||ca)&&(ka=window.setInterval(so,Zd))}function so(){const i=Gt.findIndex(l=>l.key===Ee.value),r=i>=0?(i+1)%Gt.length:0;Ee.value=Gt[r].key}function Pi(){ka&&(window.clearInterval(ka),ka=null)}function Ea(){Ci(),!(!a.active||W.value!=="structure"||ca||Ba.value.pageCount<=1)&&(Pa=window.setInterval(oo,Xd))}function oo(){const i=Ba.value.pageCount;i<=1||(ht.value=(ht.value+1)%i)}function Ci(){Pa&&(window.clearInterval(Pa),Pa=null)}function lo(i=[],r=[]){const l=new Map;return r.forEach(c=>{const p=Fi(c.name);p&&l.set(p,$(N({},c),{name:p,count:Number(c.count||0)}))}),i.forEach(c=>{const p=Fi(c.name);if(!p)return;const y=l.get(p)||{};l.set(p,$(N(N({},y),c),{name:p,count:Number.isFinite(Number(c.count))?Number(c.count):Number(y.count||0)}))}),[...l.values()].sort((c,p)=>Number(p.count||0)-Number(c.count||0))}function Fi(i){return gr(i||"")}function Qe(i){return String(i||"").trim()}function xi(i){const r=Number(i);return Number.isFinite(r)&&Ue.includes(r)?r:Ue[Ue.length-1]}function Ni(i=ce.value){const r=xi(i);return{startDate:`${r}-01-01`,endDate:`${r}-12-31`}}function $a(){return{keyword:"",town:"",medicine:"",startDate:"",endDate:""}}function St(i=[]){return Array.isArray(i)?i.map((r,l)=>{var c,p,y;return{key:r.key||r.id||`${r.name||r.label||"item"}-${l}`,name:String(r.name||r.label||r.town||r.village||"未填写"),value:Number((y=(p=(c=r.value)!=null?c:r.count)!=null?p:r.total)!=null?y:0)}}).filter(r=>r.name&&Number.isFinite(r.value)):[]}function fn(i={}){const r=St(i==null?void 0:i.medicineCounts);return Math.max(r.filter(l=>l.name!=="未填写").length,1)}function mn(...i){const r=i.flatMap(l=>Array.isArray(l)?l:[l]).map(l=>{var c,p,y;return l&&typeof l=="object"?(y=(p=(c=l.year)!=null?c:l.value)!=null?p:l.latestYear)!=null?y:l.latest_year:l}).map(Number).filter(l=>Number.isFinite(l)&&l>0);return[...new Set(r)].sort((l,c)=>l-c)}function Va(i=[],r="name"){return Array.isArray(i)?i.map((l,c)=>{var p,y,w,T,F,_,A,Y,X,D,Q,Ne,lt,Kt,de,De,ha;return{key:l.key||l.id||`${l[r]||l.name||l.label||"trade"}-${c}`,name:String(l[r]||l.name||l.label||l.town||"未填写"),recordCount:Number((w=(y=(p=l.recordCount)!=null?p:l.record_count)!=null?y:l.count)!=null?w:0),headCount:Number((A=(_=(F=(T=l.headCount)!=null?T:l.head_count)!=null?F:l.amount)!=null?_:l.value)!=null?A:0),lng:gt((Ne=(Q=(D=(X=(Y=l.lng)!=null?Y:l.longitude)!=null?X:l.destLng)!=null?D:l.dest_lng)!=null?Q:l.destLongitude)!=null?Ne:l.dest_longitude),lat:gt((ha=(De=(de=(Kt=(lt=l.lat)!=null?lt:l.latitude)!=null?Kt:l.destLat)!=null?de:l.dest_lat)!=null?De:l.destLatitude)!=null?ha:l.dest_latitude)}}).filter(l=>l.name&&Number.isFinite(l.headCount)):[]}function uo(i=[]){return Array.isArray(i)?i.map(r=>{var l,c,p,y,w,T;return{year:Number(r.year),recordCount:Number((c=(l=r.recordCount)!=null?l:r.record_count)!=null?c:0),headCount:Number((T=(w=(y=(p=r.headCount)!=null?p:r.head_count)!=null?y:r.amount)!=null?w:r.value)!=null?T:0)}}).filter(r=>Number.isFinite(r.year)&&Number.isFinite(r.headCount)):[]}function Ri(i=[]){return Array.isArray(i)?Ii(i.map(r=>{var l,c,p;return r&&typeof r=="object"?(p=(c=(l=r.value)!=null?l:r.label)!=null?c:r.name)!=null?p:"":r})):[]}function co(i=[]){return Array.isArray(i)?i.map(r=>{var l,c,p,y,w,T;if(r&&typeof r=="object"){const F=(p=(c=(l=r.value)!=null?l:r.name)!=null?c:r.label)!=null?p:"",_=(T=(w=(y=r.label)!=null?y:r.name)!=null?w:r.value)!=null?T:F;return F?{value:String(F),label:String(_||F)}:null}return r?{value:String(r),label:String(r)}:null}).filter(Boolean):[]}function Ii(i=[]){return[...new Set(i.map(r=>String(r||"").trim()).filter(Boolean))]}function ho(i=[]){if(!Array.isArray(i))return[];const r=new Map;i.forEach((c,p)=>{var _,A,Y,X,D,Q;const y=Qe(c.name||c.areaName||c.area_name||c.town||c.label||"");if(!y)return;const w=gt((Y=(A=(_=c.value)!=null?_:c.number)!=null?A:c.count)!=null?Y:c.total);if(!Number.isFinite(w))return;const T=r.get(y)||{key:c.areaCode||c.area_code||`${y}-${p}`,name:y,recordCount:0,earTagCount:0,source:"stats"};T.recordCount+=w;const F=gt((Q=(D=(X=c.earTagCount)!=null?X:c.ear_tag_count)!=null?D:c.headCount)!=null?Q:c.head_count);T.earTagCount+=Number.isFinite(F)?F:0,r.set(y,T)});const l=[...r.values()].reduce((c,p)=>c+Number(p.recordCount||0),0);return[...r.values()].map(c=>$(N({},c),{earTagCount:c.earTagCount||Math.round(Number(c.recordCount||0)/xt.value),ratio:l?Number(c.recordCount||0)/l*100:0})).sort((c,p)=>Number(p.recordCount||0)-Number(c.recordCount||0))}function po(i={}){var p,y;const r=Array.isArray(i)?{rows:i}:i||{},l=r.result||{};return{rows:r.rows||r.data||r.list||r.records||[],year:(y=(p=r.year)!=null?p:l.year)!=null?y:null}}function Gi(i=[]){return Array.isArray(i)?i.map((r,l)=>{var Y,X,D,Q,Ne,lt,Kt,de,De,ha,Xn,Jn;const c=Qe(r.town||r.townName||r.town_name||""),p=String(r.village||r.villageName||r.village_name||r.name||"").trim(),y=gt((D=(X=(Y=r.recordCount)!=null?Y:r.record_count)!=null?X:r.records)!=null?D:r.total),w=gt((Kt=(lt=(Ne=(Q=r.earTagCount)!=null?Q:r.ear_tag_count)!=null?Ne:r.headCount)!=null?lt:r.head_count)!=null?Kt:r.value),T=gt((De=(de=r.imageCount)!=null?de:r.image_count)!=null?De:r.images),F=gt((ha=r.imageRate)!=null?ha:r.image_rate),_=gt((Xn=r.lng)!=null?Xn:r.longitude),A=gt((Jn=r.lat)!=null?Jn:r.latitude);return{key:r.key||r.id||`${c}-${p}-${l}`,town:c,village:p,recordCount:Number.isFinite(y)?y:0,earTagCount:Number.isFinite(w)?w:0,imageCount:Number.isFinite(T)?T:0,imageRate:Number.isFinite(F)?F:0,lng:_,lat:A}}).filter(r=>r.town&&r.village&&Number.isFinite(r.earTagCount)).sort((r,l)=>Number(l.earTagCount||0)-Number(r.earTagCount||0)):[]}function fo(i={},r={}){const l=Array.isArray(r)?{rows:r}:r||{},c=l.result||{},p=Gi(l.rows||l.data||l.list||l.records||c.rows||[]),y=new Map;p.forEach(A=>{gn(A.village).forEach(Y=>{y.has(Y)||y.set(Y,A)})});const w=St(i==null?void 0:i.townCounts),T=w.length===1?Qe(w[0].name):"",F=fn(i),_=St(i==null?void 0:i.villageCounts).map((A,Y)=>{const X=String(A.name||"").trim(),D=gn(X).map(Ne=>y.get(Ne)).find(Boolean)||{},Q=Number(A.value||0);return{key:D.key||`${D.town||T||"防疫"}-${X}-${Y}`,town:D.town||T,village:X,recordCount:Q,earTagCount:Math.round(Q/F),imageCount:D.imageCount||0,imageRate:D.imageRate||0,lng:D.lng,lat:D.lat}}).filter(A=>A.village&&A.recordCount>0);return $(N({},l),{rows:_})}function gn(i){const r=String(i||"").trim(),l=r.replace(/(村|社区|牧委会)$/,"");return[...new Set([r,l].filter(Boolean))]}function gt(i){if(i==null||i==="")return NaN;const r=Number(String(i).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(r)?r:NaN}function yn(i){return String(i||"").replace(/'/g,"''").replace(/%/g,"\\%").replace(/_/g,"\\_")}function mo(i,r){const l=Qe(i),c=String(r||"").trim();if(!l||!c)return"";const p=`${l}${c}`,y=yn(p),w=yn(c);return`(full_name LIKE '%${y}%' OR name = '${y}' OR name = '${w}')`}function go(i){const r=String(i||"").trim().replace(/\s+/g,"");return r?Array.from(r).join(` `):""}function yo(i){const r=String(i||"").trim();if(!r)return"";const l=r.match(/^(.+)(镇|乡|村)$/);return l?`${l[1]} ${l[2]}`:r}function bo(i,r){return bn(i.name)-bn(r.name)}function bn(i){const r=String(i||"").match(/(\d{1,2})\D+(\d{1,2})/);return r?Number(r[1])*100+Number(r[2]):Number.MAX_SAFE_INTEGER}function _i(i=[]){return Array.isArray(i)?i.map(vn).filter(Boolean):[]}function vn(i){return i?{epidemicId:i.epidemicId||i.epidemic_id||i.id||"",earTag:i.earTag||i.ear_tag||"",owner:i.owner||"",idType:i.idType||i.id_type||"",idNo:i.idNo||i.id_no||"",phone:i.phone||"",town:i.town||"",village:i.village||"",location:i.location||"",livestockType:i.livestockType||i.livestock_type||"",age:i.age||"",sex:i.sex||"",weight:i.weight||i.weightKg||i.weight_kg||"",preventionType:i.preventionType||i.prevention_type||"",method:i.method||"",medicine:i.medicine||"",dose:i.dose||"",operator:i.operator||"",operateTime:i.operateTime||i.operate_time||"",imagePaths:i.imagePaths||i.image_paths||""}:null}function wn(i=[]){return Array.isArray(i)?i.map(vo).filter(Boolean):[]}function vo(i){var r,l,c,p;return i?{certId:i.certId||i.cert_id||i.id||"",certType:i.certType||i.cert_type||"",certScopeName:i.certScopeName||i.cert_scope_name||"",factoryCode:i.factoryCode||i.factory_code||"",ownerName:i.ownerName||i.owner_name||"",ownerPhone:i.ownerPhone||i.owner_phone||"",transportNumber:i.transportNumber||i.transport_number||"",amount:Number((p=(c=(l=(r=i.amount)!=null?r:i.headCount)!=null?l:i.head_count)!=null?c:i.value)!=null?p:0),unitName:i.unitName||i.unit_name||"头",animalTypeName:i.animalTypeName||i.animal_type_name||"",usageTypeName:i.usageTypeName||i.usage_type_name||"",startTown:i.startTown||i.start_town||"",startRegionFullName:i.startRegionFullName||i.start_region_full_name||"",destProvince:i.destProvince||i.dest_province||"",destRegionFullName:i.destRegionFullName||i.dest_region_full_name||"",quarantineOfficerName:i.quarantineOfficerName||i.quarantine_officer_name||"",issueTime:i.issueTime||i.issue_time||"",statusName:i.statusName||i.status_name||""}:null}function za(i,r){for(const l of r){const c=Number(i==null?void 0:i[l]);if(Number.isFinite(c))return c}return 0}function ze(...i){return za(ln.value,i)}function Ln(i=[],r=2){const l=[...new Set(i.map(c=>String(c||"").trim()).filter(Boolean))];return l.length?l.length<=r?l.join("、"):`${l.slice(0,r).join("、")}等${l.length}个乡镇`:"暂无"}function wo(){const i=Nt.value;if(i.length)return{name:Ln(i,1),desc:"年度防疫覆盖需补强",level:"watch"};const r=Vt.value.filter(c=>Number(c.earTagCount||c.recordCount||0)>0).sort((c,p)=>Number(c.earTagCount||c.recordCount||0)-Number(p.earTagCount||p.recordCount||0)),l=r[0];return l?{name:l.name,desc:`${ie(l.earTagCount||l.recordCount)}头,建议补免回访`,level:r.length>=2?"watch":"normal"}:{name:"暂无",desc:"等待年度防疫记录形成",level:"normal"}}function Lo(){const i=Nt.value;if(i.length)return i.slice(0,4).map((c,p)=>({key:`missing-${c}`,name:c,value:Math.max(25,100-p*12),label:"待补免",level:"watch"}));const r=Vt.value.filter(c=>Number(c.earTagCount||c.recordCount||0)>0);if(!r.length)return[{key:"empty",name:"暂无",value:0,label:"待开展",level:"watch"}];const l=r.reduce((c,p)=>c+Number(p.earTagCount||0),0)/r.length||1;return[...r].sort((c,p)=>Number(c.earTagCount||0)-Number(p.earTagCount||0)).slice(0,4).map(c=>{const p=Number(c.earTagCount||c.recordCount||0),y=Math.max(8,Math.round((l-p)/l*100));return{key:`weak-${c.name}`,name:c.name,value:Math.min(100,y),label:`${ie(p)}头`,level:y>=35?"watch":"normal"}})}function To(){const r=(vi.value.length?vi.value:Vt.value).map((p,y)=>{const w=Qe(p.name),T=Number(p.earTagCount||0),F=Number(p.recordCount||p.value||0),_=T||Math.round(F/xt.value);return{key:p.key||`${w}-${y}`,name:w,value:_,recordCount:F,isMissing:!1}}).filter(p=>p.name&&Number.isFinite(p.value)),c=[...Nt.value.map((p,y)=>({key:`missing-${p}-${y}`,name:p,value:0,recordCount:0,isMissing:!0})),...r];return c.length?c.sort((p,y)=>p.isMissing!==y.isMissing?p.isMissing?-1:1:Number(p.value||0)-Number(y.value||0)).slice(0,7):[{key:"empty",name:"待开展",value:0,recordCount:0,isMissing:!0}]}function So(){var r;const i=rn.value.map((l,c)=>({key:l.key||`${l.town}-${l.village}-${c}`,name:l.village||l.name,town:l.town,value:Number(l.earTagCount||l.value||0)})).filter(l=>l.name&&Number.isFinite(l.value)&&l.value>0);return i.length?i.sort((l,c)=>c.value-l.value).slice(0,9):St((r=we.value)==null?void 0:r.villageCounts).map((l,c)=>({key:l.key||`${l.name}-${c}`,name:l.name,town:"",value:Math.round(Number(l.value||0)/xt.value)})).filter(l=>l.name&&Number.isFinite(l.value)&&l.value>0).sort((l,c)=>c.value-l.value).slice(0,9)}function Mo(){if(!mt.value)return{level:"watch",title:"年度待开展",desc:"年度免疫记录暂未形成",advice:"建议先核查年度免疫计划与乡镇推进节奏。"};const i=ls.value,r=Ia.value;return Nt.value.length?{level:"watch",title:"补免待核查",desc:`乡镇覆盖${et(i)},${r.name}需补强`,advice:`优先核查${Ln(Nt.value,1)}免疫进度。`}:i>=90&&xt.value>=4?{level:"stable",title:"运行平稳",desc:`乡镇覆盖${et(i)},疫苗谱较完整`,advice:"建议保持当前免疫节奏,持续跟踪补免回访。"}:{level:"normal",title:"均衡回访",desc:`${r.name}相对偏低,适合继续跟进`,advice:`关注${r.name}补免回访,保持覆盖均衡。`}}function ko(){return[{key:"latest",name:"最近免疫",value:nn.value,desc:"最后作业时间",level:nn.value==="-"?"watch":"stable",color:"#8bf7ff"},{key:"top-town",name:"高频乡镇",value:rs.value,desc:"年度作业集中区",level:"normal",color:"#30dcff"},{key:"vaccine",name:"主用疫苗",value:is.value,desc:`${xt.value}类疫苗`,level:"normal",color:"#8bf7ff"}]}function Po(){const i=ze("headCount","totalHeads","total_heads"),r=_a.value,l=r.reduce((de,De)=>de+Number(De.headCount||0),0)||i||1,c=r[0],p=c?Number(c.headCount||0)/l*100:0,y=Li.value.filter(de=>de.name&&de.name!=="未填写").sort((de,De)=>Number(De.headCount||0)-Number(de.headCount||0)),w=y.reduce((de,De)=>de+Number(De.headCount||0),0)||i||1,T=y[0],F=T?Number(T.headCount||0)/w*100:0,A=bs.value.filter(de=>de.name&&de.name!=="未填写").sort((de,De)=>Number(De.headCount||De.recordCount||0)-Number(de.headCount||de.recordCount||0))[0],Y=ze("vehicleCount","vehicle_count","transportVehicleCount","transport_vehicle_count"),X=Y>0?i/Y:0,D=ze("outProvinceHeads","out_province_heads","aCertHeads","a_cert_heads"),Q=ze("inProvinceHeads","in_province_heads","bCertHeads","b_cert_heads"),Ne=D+Q||i||1,lt=D?D/Ne*100:0;return[{key:"town",name:"高频出栏乡镇",value:(c==null?void 0:c.displayName)||(c==null?void 0:c.name)||"暂无",desc:c?`${ie(c.headCount)}头,占${et(p)}`:"等待来源乡镇数据",level:p>=35?"high":p>=24?"watch":"normal",color:"#63d7ff"},{key:"usage",name:"交易用途集中度",value:(T==null?void 0:T.name)||"暂无",desc:T?`占${et(F)}`:"等待用途结构数据",level:F>=60?"high":F>=45?"watch":"normal",color:"#30dcff"},{key:"vehicle",name:A?"运输车辆高频":"车辆周转强度",value:A?`${ie(A.headCount||A.recordCount)}${A.headCount?"头":"条"}`:Y?`车均${K(X)}头`:"--",desc:A?"已接入车辆聚合,明细在台账核查":Y?`${K(Y)}辆参与流通`:"等待车辆聚合数据",level:A||X>=260?"watch":"normal",color:"#48cfff"},{key:"cert-dest",name:"证照/去向线索",value:D?et(lt):"--",desc:D?`省外流通${ie(D)}头`:"等待证照去向数据",level:lt>=55?"high":lt>=35?"watch":"normal",color:"#48cfff"}].map(de=>$(N({},de),{badge:de.level==="high"?"重点":de.level==="watch"?"关注":"平稳"}))}function Bi(i={}){return String(i.imagePaths||"").split(";").map(r=>r.trim()).filter(Boolean)}function Tn(i){const l=String(i||"").replace(/^images\//,"").split("/").map(encodeURIComponent).join("/");return`${Hd}/${l}`}function Co(i){Ze.value=Tn(i),Be.value=!0}function Ai(){Be.value=!1,Ze.value=""}function ae(i){return i==null||i===""?"-":i}function Fo(i){const r=String(i!=null?i:"").trim();return!!(r&&r!=="-")}function Me(i,r,l={}){return Fo(r)?N({label:i,value:r},l):null}function Rt(i){return i?String(i).slice(0,10):"-"}function Sn(i){const r=String(i||"").trim();return r?r.length<7?r:`${r.slice(0,3)}****${r.slice(-4)}`:"-"}function xo(i){const r=String(i||"").trim();return r?r.length<=4?r:`****${r.slice(-4)}`:"-"}function No(i){const r=String(i!=null?i:"").trim();if(!r)return"-";if(/kg|公斤|千克/i.test(r))return r;const l=Number(r);return Number.isFinite(l)?`${K(l)}kg`:r}function Ro(i){return String(i!=null?i:"").trim()||"-"}function Mn(i={}){return i.certScopeName||i.certType||"-"}function Io(){return he(this,null,function*(){var c,p;pt.value=!0,Ye.value="";const[i,r,l]=yield Promise.allSettled([tu(),au(),iu()]);i.status==="fulfilled"&&((c=i.value)!=null&&c.length)&&(Pt.value=Ol(i.value.map(y=>({name:gr(y.name),count:Number(y.value)})).filter(y=>y.name&&Number.isFinite(y.count)))),r.status==="fulfilled"&&((p=r.value)!=null&&p.length)&&(Ut.value=r.value.map(y=>({month:y.name,count:Number(y.value),speed:Qo(y.extra)})).filter(y=>y.month&&Number.isFinite(y.count))),l.status==="fulfilled"?(vt.value=Ko(l.value),vt.value.length||(Ye.value="结构数据暂无数据")):(Ye.value=Jo(l.reason,"结构数据异常"),vt.value=[]),pt.value=!1})}function kn(){return he(this,arguments,function*(i=ye.value){var r,l,c,p,y,w;Bt.value=!0,ot.value="";try{(l=(r=ge.value)==null?void 0:r.years)!=null&&l.length||(ge.value=yield nu());const T=mn((c=ge.value)==null?void 0:c.years),F=Number(((p=ge.value)==null?void 0:p.latestYear)||((y=ge.value)==null?void 0:y.latest_year)||T[T.length-1]),_=Number(i||ye.value||F||T[T.length-1]);ye.value=_;let A=yield vr({year:_});const Y=(w=A==null?void 0:A.hasData)!=null?w:A==null?void 0:A.has_data,X=Number((A==null?void 0:A.latestYear)||(A==null?void 0:A.latest_year)||F);Y===!1&&X&&X!==_&&(ye.value=X,A=yield vr({year:X})),te.value=A||{metrics:{},hasData:!1},yield Ei(1)}catch(T){ot.value="交易数据接口异常",te.value={metrics:{},hasData:!1},He.value=[],st.value=0}finally{Bt.value=!1}})}function Ei(){return he(this,arguments,function*(i=Xe.value){var l,c;if(!ye.value)return;const r={year:ye.value,page:i,pageSize:Hi,keyword:ii.value};try{const p=yield wr(r);He.value=wn(p.rows),st.value=Number(((l=p.page)==null?void 0:l.totalCount)||p.totalCount||He.value.length||0),Xe.value=Number(((c=p.page)==null?void 0:c.page)||i||1)}catch(p){ot.value=ot.value||"交易台账接口异常",He.value=[],st.value=0}})}function Go(i){const r=Number(i);!Number.isFinite(r)||r===Number(ye.value)||(ye.value=r,Xe.value=1,Ta.value="",ii.value="",kn(r))}function _o(i){const r=xi(i);r!==Number(ce.value)&&(ce.value=r,xe.value=1,je.value="",rt.value="",J.value=1,me.value=$a(),Gn(r))}function Pn(){ii.value=Ta.value.trim(),Ei(1)}function Cn(i){const r=Math.min(Math.max(Number(i)||1,1),Ti.value);Ei(r)}function Fn(i=null){ni.value=!0,i&&(Ma.value=i),Da(i?Xe.value:1,i)}function xn(){ni.value=!1}function Nn(){Da(1)}function Bo(){ft.value={keyword:"",startTown:"",usageType:"",certType:""},Da(1)}function Rn(i){const r=Math.min(Math.max(Number(i)||1,1),Si.value);Da(r)}function Da(){return he(this,arguments,function*(i=Et.value,r=null){var p,y;if(!ye.value)return;ri.value=!0,si.value="";const l=ft.value,c={year:ye.value,page:i,pageSize:Vr,keyword:l.keyword.trim(),startTown:l.startTown,usageType:l.usageType,certType:l.certType};try{const w=yield wr(c);At.value=wn(w.rows),Sa.value=Number(((p=w.page)==null?void 0:p.totalCount)||w.totalCount||At.value.length||0),Et.value=Number(((y=w.page)==null?void 0:y.page)||i||1);const T=r?r.certId||r.factoryCode:"",F=T?At.value.find(_=>(_.certId||_.factoryCode)===T)||r:At.value[0]||null;In(F)}catch(w){si.value="交易台账接口异常",At.value=[],Sa.value=0,Ma.value=null}finally{ri.value=!1}})}function In(i){Ma.value=i||null}function Ao(i){i!=null&&i.startTown&&(W.value="trade",Yt(()=>{var r,l,c,p,y,w;(l=(r=Ve.value)==null?void 0:r.resume)==null||l.call(r),(p=(c=Ve.value)==null?void 0:c.refreshView)==null||p.call(c),(w=(y=Ve.value)==null?void 0:y.focusTown)==null||w.call(y,Qe(i.startTown),{distanceScale:.78,duration:.8})}))}function Gn(){return he(this,arguments,function*(i=ce.value){var T;const r=xi(i),l=Ni(r);ce.value=r,M.value=!0,v.value="";const[c,p,y,w]=yield Promise.allSettled([ru(l),Yi(N({page:xe.value,pageSize:ei,keyword:rt.value},l)),su({year:r}),ou()]);if(c.status==="fulfilled"?we.value=c.value||{metrics:{}}:(v.value="防疫统计接口异常",we.value={metrics:{}}),p.status==="fulfilled"){const F=p.value||{};$e.value=_i(F.rows),nt.value=Number(((T=F.page)==null?void 0:T.totalCount)||F.totalCount||$e.value.length||0)}else v.value=v.value||"防疫台账接口异常",$e.value=[],nt.value=0;y.status==="fulfilled"?Ct.value=po(y.value):Ct.value={rows:[],year:null},w.status==="fulfilled"?it.value=fo(we.value,w.value):it.value={rows:[]},M.value=!1})}function _n(){return he(this,arguments,function*(i=xe.value){var c,p;M.value=!0,v.value="";const r=Math.min(Math.max(Number(i)||1,1),wi.value),l=Ni(ce.value);try{const y=yield Yi(N({page:r,pageSize:ei,keyword:rt.value},l));$e.value=_i(y.rows),nt.value=Number(((c=y.page)==null?void 0:c.totalCount)||y.totalCount||$e.value.length||0),xe.value=Number(((p=y.page)==null?void 0:p.page)||r||1)}catch(y){v.value="防疫台账接口异常",$e.value=[],nt.value=0,xe.value=1}finally{M.value=!1}})}function Bn(){rt.value=je.value.trim(),me.value=$(N({},$a()),{keyword:rt.value}),_n(1)}function An(i){_n(i)}function En(i=null){G.value=!0,i&&(Ce.value=i,_e.value=null),Oa(1,i)}function $n(){G.value=!1,Ai()}function Vn(){Oa(1)}function Eo(){me.value=$a(),Oa(1)}function zn(i){Oa(i)}function Oa(){return he(this,arguments,function*(i=J.value,r=null){var y,w;fe.value=!0,Ge.value="";const l=me.value,c=Ni(ce.value),p={keyword:l.keyword.trim(),town:l.town,medicine:l.medicine,startDate:l.startDate||c.startDate,endDate:l.endDate||c.endDate,page:i,pageSize:$r};try{const T=yield Yi(p);V.value=_i(T.rows),U.value=Number(((y=T.page)==null?void 0:y.totalCount)||T.totalCount||V.value.length||0),J.value=Number(((w=T.page)==null?void 0:w.page)||i||1);const F=r||V.value[0]||null;F?Dn(F):(Ce.value=null,_e.value=null)}catch(T){Ge.value="台账接口异常",V.value=[],U.value=0}finally{fe.value=!1}})}function Dn(i){return he(this,null,function*(){if(Ce.value=i,_e.value=null,!(i!=null&&i.earTag)&&!(i!=null&&i.epidemicId))return;const r=++Ca;Ke.value=!0;try{const l=yield lu(i.earTag||i.epidemicId);r===Ca&&(_e.value=vn(l)||i)}catch(l){r===Ca&&(_e.value=i)}finally{r===Ca&&(Ke.value=!1)}})}function $o(){var i;oi=new Ql,li=!1,(i=oi.ready)==null||i.then(()=>{li=!0,da()}).catch(()=>{$t.value=!0})}function da(){ca||!a.active||!li||wt||(wt=!0,Lt&&window.clearTimeout(Lt),Lt=window.setTimeout(()=>{Lt=null,On()},600))}function On(i=0){return he(this,null,function*(){var l,c;if(ca)return;if(!a.active){wt=!1;return}if(yield Yt(),!a.active){wt=!1;return}const r=Ve.value;if((l=r==null?void 0:r.loadMap)==null||l.call(r,oi),r!=null&&r.canvasMap){wt=!1,$t.value=!0,(c=r.play)==null||c.call(r);return}if(i<24){window.setTimeout(()=>On(i+1),120);return}wt=!1})}function Wn(i={}){ua.value={type:i.type||"idle",text:i.text||""}}function Vo(){oa.value=!0}function Yn(i={}){la.value={type:i.type||"idle",text:i.text||"",loaded:i.loaded,failed:i.failed,total:i.total,zoom:i.zoom,tileUrlTemplate:i.tileUrlTemplate}}function zo(){if(W.value==="epidemic"){n("module-stats",{moduleKey:"yak-management",items:[{zh:"防疫记录",value:mt.value,unit:"条"},{zh:"防疫耳标",value:bi.value,unit:"头"},{zh:"疫苗类型",value:xt.value,unit:"类"},{zh:"涉及村数",value:ns.value,unit:"个"}]});return}if(W.value==="forecast"){const i=Je.value.stock-ct;n("module-stats",{moduleKey:"yak-management",items:[{zh:"预测期末存栏",value:Je.value.stock,unit:"头"},{zh:"新生牛犊",value:Je.value.births,unit:"头"},{zh:"出栏流出",value:Je.value.outflow,unit:"头"},{zh:"预测净变化",value:i,unit:"头"}]});return}if(W.value==="trade"){n("module-stats",{moduleKey:"yak-management",items:[{zh:"流通总量",value:ze("headCount"),unit:"头"},{zh:"出证记录",value:ze("recordCount"),unit:"条"},{zh:"运输车辆",value:ze("vehicleCount"),unit:"辆"}]});return}n("module-stats",{moduleKey:"yak-management",items:[{zh:"图像识别总数",value:Wl,unit:"头"},{zh:"模型修正总数",value:Ur.value,unit:"头"},{zh:"当前存栏数量",value:ct,unit:"头"}]})}function $i(i,r,l,c={}){const p=c.labelKey||"name",y=c.colors||R,w=Math.max(...i.map(D=>Number(D[r]||0)),1),T=i.length>8,F=c.style==="ladder",_=T?F?7:6:i.length>6?11:13,A=["#30dcff","#58d9ff","#8bf7ff","#48cfff","#16b6e8","#b9fbff"],Y=c.axisTextColor||m,X=c.dimAxisTextColor||C;return{tooltip:$(N({},Le()),{trigger:"axis",axisPointer:{type:"shadow"},formatter(D){if(c.tooltipFormatter)return c.tooltipFormatter(D[0]);const Q=i[D[0].dataIndex];return`${Q[p]}
数值:${K(Q[r])}${l}`}}),grid:{left:T?58:74,right:T?54:58,top:T?6:16,bottom:T?8:14},xAxis:{type:"value",axisLabel:{color:X,fontSize:10,formatter:l==="%"?"{value}%":ie},axisLine:{show:!1},axisTick:{show:!1},splitLine:{lineStyle:{color:x,type:"dashed"}}},yAxis:{type:"category",inverse:!0,data:i.map(D=>D[p]),axisLabel:{color:Y,fontSize:T?10:11,fontWeight:700,interval:0},axisLine:{show:!1},axisTick:{show:!1}},series:[{type:"bar",barWidth:_,barGap:"-100%",data:i.map((D,Q)=>({value:D[r],itemStyle:{borderRadius:F?[1,10,10,1]:[0,7,7,0],color:Do(F?A[Q%A.length]:y[Q%y.length],F),shadowBlur:F?3:0,shadowColor:F?"rgba(48, 220, 255, 0.16)":"transparent"}})),showBackground:!0,backgroundStyle:{color:F?"rgba(48, 220, 255, 0.05)":"rgba(48, 220, 255, 0.07)",borderRadius:F?[1,10,10,1]:[0,7,7,0]},label:{show:!0,position:"right",color:L,fontFamily:Di.number,fontSize:T?10:ur.chartLabel,fontWeight:700,formatter:({value:D})=>`${l==="%"?et(D):ie(D)}`},markLine:c.showAverage===!1?void 0:{silent:!0,symbol:"none",label:{show:!1},lineStyle:{color:"rgba(139, 247, 255, 0.22)",type:"dashed",width:1},data:[{xAxis:Math.round(w*.72)}]}},...F?[{type:"pictorialBar",symbol:"rect",symbolSize:[2,_+5],symbolOffset:[0,0],symbolPosition:"end",z:4,data:i.map((D,Q)=>({value:D[r],itemStyle:{color:L,opacity:Q<3?.82:.56,shadowBlur:2,shadowColor:"rgba(139, 247, 255, 0.16)"}}))}]:[]]}}function Do(i,r=!1){return new Ae(0,0,1,0,[{offset:0,color:r?`${i}22`:"rgba(48, 220, 255, 0.12)"},{offset:.64,color:r?i:`${i}cc`},{offset:1,color:i}])}function jn(i,r,l,c=0,p=!1){return{name:i,type:"line",yAxisIndex:c,smooth:!0,symbolSize:5,data:r,lineStyle:{width:2.5,color:l},itemStyle:{color:l},areaStyle:p?{color:new Ae(0,0,0,1,[{offset:0,color:`${l}44`},{offset:1,color:`${l}05`}])}:void 0}}function Oo(i){return ui.find(r=>r.key===i)||ui[2]}function Wo(i,r="month"){if(r==="month")return Yl(i);const l=jl(i),c=Math.max(1,Math.round(Math.max(1,l-1)*30)),p=r==="week"?7:1,y=Math.ceil(c/p)+1,w=Array.from({length:y},(A,Y)=>{const X=Math.min(c,Y*p);return Hl(X)}),T=w.map((A,Y)=>{const D=Math.min(c,Y*p)/c,Q=Math.sin(Y/(r==="week"?1.8:8.5))*Math.sin(Math.PI*D)*Math.min(360,i.months*18);return Math.round(ct+(i.stock-ct)*D+Q)}),F=w.map((A,Y)=>{const X=Math.min(c,Y*p)/c;return Math.round(i.births*X)}),_=w.map((A,Y)=>{const X=Math.min(c,Y*p)/c;return Math.round(i.outflow*X)});return{labels:w,stock:T,births:F,outflow:_}}function Yo(i,r){return r==="day"?Math.max(10,Math.ceil(i/6)):r==="week"?Math.max(2,Math.ceil(i/7)):i>24?4:i>14?2:1}function jo(i,r){return r==="day"?i>700?2:i>360?3:4:r==="week"?i>110?4:6:i>24?7:10}function Ho(i){return(i.labels||[]).map((r,l)=>{var A,Y,X,D,Q,Ne;const c=Number(((A=i.stock)==null?void 0:A[Math.max(l-1,0)])||0),p=Number(((Y=i.stock)==null?void 0:Y[l])||c),y=Math.max(0,Number(((X=i.births)==null?void 0:X[l])||0)-Number(((D=i.births)==null?void 0:D[Math.max(l-1,0)])||0)),w=Math.max(0,Number(((Q=i.outflow)==null?void 0:Q[l])||0)-Number(((Ne=i.outflow)==null?void 0:Ne[Math.max(l-1,0)])||0)),T=Math.max(120,Math.round((y+w)*.18)),F=Math.max(c,p)+Math.max(T,Math.round(y*.32)),_=Math.max(0,Math.min(c,p)-Math.max(T,Math.round(w*.32)));return{label:r,open:c,close:p,low:_,high:F,birth:y,outflow:w,value:[c,p,_,F]}})}function qo(i,r){const l=new Map;return i.forEach(c=>{const p=Uo(c.name);if(!p)return;const y=l.get(p)||{name:p,value:0};y.value+=Number(c[r]||0),l.set(p,y)}),[...l.values()].sort((c,p)=>p.value-c.value)}function Uo(i){return{色地镇:"色地镇",瓦切镇:"瓦切镇",安曲镇:"安曲镇",龙日镇:"龙日镇",邛溪镇:"邛溪镇",刷经寺镇:"刷经寺镇",阿木乡:"阿木乡",查尔玛乡:"查尔玛乡",江茸乡:"江茸乡",麦洼乡:"麦洼乡"}[i]||""}function Le(i){return{trigger:"item",backgroundColor:"rgba(5, 31, 51, 0.96)",borderColor:"rgba(0, 210, 255, 0.54)",borderWidth:1,padding:[7,10],textStyle:{color:m,fontFamily:Di.ui,fontSize:ur.tooltip,lineHeight:18},extraCssText:"box-shadow:0 0 10px rgba(0,210,255,.12);",formatter:i}}function Vi(i){return bt.some(r=>r.key===i)?i:"structure"}function Ko(i=[]){return i.map((r,l)=>{var y,w,T,F;const c=String(r.name||r.label||r.type||`结构${l+1}`).trim(),p=Hn((w=(y=r.value)!=null?y:r.count)!=null?w:r.number);return{key:r.key||r.id||`${c}-${l}`,name:c,count:p,ratio:Number((F=(T=r.ratio)!=null?T:r.percent)!=null?F:0),source:r.source||"结构统计"}}).filter(r=>r.name&&r.count>0)}function Zo(i=[],r=[]){const l=i.some(p=>Zn(p))?i:r,c=Kn(l,r).map((p,y)=>{var F,_;const w=String(p.name||p.label||`结构${y+1}`).trim(),T=Hn((_=(F=p.count)!=null?F:p.value)!=null?_:p.number);return $(N({},p),{key:p.key||`${w}-${y}`,name:w,count:T})}).filter(p=>p.name&&p.count>0);return Xo(c,ct)}function Xo(i=[],r=ct){const l=i.reduce((y,w)=>y+Number(w.count||0),0);if(!l||!r)return i;const c=i.map((y,w)=>{const T=Number.isFinite(Number(y.ratio))&&Number(y.ratio)>0?Number(y.ratio):Number(y.count||0)/l*100,F=r*T/100;return $(N({},y),{index:w,ratio:T,count:Math.floor(F),remainder:F-Math.floor(F)})});let p=r-c.reduce((y,w)=>y+w.count,0);return c.slice().sort((y,w)=>w.remainder-y.remainder||y.index-w.index).forEach(y=>{p<=0||(y.count+=1,p-=1)}),c.map(F=>{var _=F,{index:y,remainder:w}=_,T=ar(_,["index","remainder"]);return $(N({},T),{ratio:Number(T.ratio.toFixed(1))})})}function Hn(i){const r=Number(String(i!=null?i:"").replace(/,/g,"").replace(/%/g,""));return Number.isFinite(r)&&r>0?Math.round(r):0}function Jo(i,r){const l=String((i==null?void 0:i.message)||i||"");return/未登录|401|HTTP_401/.test(l)?"结构数据未就绪":/超时|timeout/i.test(l)?"结构数据加载超时":r}function Qo(i){const r=String(i||"").match(/-?\d+(?:\.\d+)?/);return r?Number(r[0]):0}function K(i){const r=Number(i);return Number.isFinite(r)?r.toLocaleString("zh-CN",{maximumFractionDigits:Number.isInteger(r)?0:2}):"--"}function ie(i){const r=Number(i);return Number.isFinite(r)?Math.abs(r)>=1e4?`${(r/1e4).toFixed(Math.abs(r)>=1e5?0:1)}万`:Math.round(r).toLocaleString("zh-CN"):"--"}function Wa(i,r=2){const l=Number(i);return Number.isFinite(l)?`${(l/1e4).toFixed(r)}万`:"--"}function et(i){const r=Number(i);return Number.isFinite(r)?`${Number.isInteger(r)?r:r.toFixed(1)}%`:"--"}function Dt(i,r,l,c){const p=c*Math.PI/180;return{x:Number((i+l*Math.cos(p)).toFixed(2)),y:Number((r+l*Math.sin(p)).toFixed(2))}}function el(i,r,l,c,p,y){const w=Dt(i,r,c,p),T=Dt(i,r,c,y),F=Dt(i,r,l,y),_=Dt(i,r,l,p),A=y-p>180?1:0;return[`M ${w.x} ${w.y}`,`A ${c} ${c} 0 ${A} 1 ${T.x} ${T.y}`,`L ${F.x} ${F.y}`,`A ${l} ${l} 0 ${A} 0 ${_.x} ${_.y}`,"Z"].join(" ")}function qn(i=[]){return i.reduce((r,l)=>{const c=ba.find(p=>p.key===l);return r+Number((c==null?void 0:c.ratio)||0)},0)}function Un(){return[{key:"fertileCow",name:"适龄能繁母牛",color:"#30dcff",matcher:(i,r)=>i==="fertileCow"||r.includes("适龄能繁母牛")},{key:"meatBull",name:"麦洼公牦牛",color:"#48cfff",matcher:(i,r)=>i==="meatBull"||r.includes("肉公牛")||r.includes("麦洼公牦牛")},{key:"breedingBull",name:"种公牛",color:"#58d9ff",matcher:(i,r)=>i==="breedingBull"||r.includes("种公牛")},{key:"femaleCalf",name:"母犊牛",color:"#30dcff",matcher:(i,r)=>i==="femaleCalf"||r.includes("母犊牛")},{key:"maleCalf",name:"公犊牛",color:"#8bf7ff",matcher:(i,r)=>i==="maleCalf"||r.includes("公犊牛")},{key:"overageCow",name:"过龄能繁母牛",color:"#48cfff",matcher:(i,r)=>i==="overageCow"||r.includes("过龄能繁母牛")}]}function tl(i=[]){const r=i.reduce((c,p)=>c+Number(p.count||0),0)||1;return[{key:"female",group:"性别",name:"母牛合计",color:"#8bf7ff",matcher:(c,p)=>["fertileCow","femaleCalf","overageCow"].includes(c)||p.includes("母")},{key:"male",group:"性别",name:"公牛合计",color:"#30dcff",matcher:(c,p)=>["meatBull","breedingBull","maleCalf"].includes(c)||p.includes("公")||p.includes("肉牛")},{key:"calf",group:"阶段",name:"犊牛合计",color:"#8bf7ff",matcher:(c,p)=>["femaleCalf","maleCalf"].includes(c)||p.includes("犊牛")},{key:"breeding-cow",group:"阶段",name:"能繁母牛",color:"#48cfff",matcher:(c,p)=>["fertileCow","overageCow"].includes(c)||p.includes("能繁母牛")}].map(c=>{const p=i.filter(y=>c.matcher(String(y.key||""),String(y.name||""))).reduce((y,w)=>y+Number(w.count||0),0);return{key:c.key,group:c.group,name:c.name,color:c.color,count:p,percent:p/r*100}})}function Kn(i=[],r=[]){const c=i.some(w=>Zn(w))?i:r,p=c.reduce((w,T)=>w+Number(T.count||0),0)||ct||1;return Un().map(w=>{const T=c.filter(A=>w.matcher(String(A.key||""),String(A.name||""))),F=T.reduce((A,Y)=>A+Number(Y.count||0),0),_=T.length===1?Number(T[0].ratio):Number.NaN;return{key:w.key,name:w.name,color:w.color,count:F,percent:Number.isFinite(_)&&_>0?_:F/p*100}}).filter(w=>w.count>0||w.percent>0)}function Zn(i={}){const r=String(i.key||""),l=String(i.name||"");return Un().some(c=>c.matcher(r,l))}function al(i=[],r=[]){const c=i.some(w=>il(w))?i:r,p=c.reduce((w,T)=>w+Number(T.count||0),0)||1,y=(w,T,F,_,A)=>{const Y=c.filter(Q=>_(String(Q.key||""),String(Q.name||""))),X=Y.reduce((Q,Ne)=>Q+Number(Ne.count||0),0),D=Y.length===1?Number(Y[0].ratio):Number.NaN;return{key:w,name:T,color:F,count:X,percent:Number.isFinite(D)&&D>0?D:X/p*100,desc:A}};return[y("fertile-cow","适龄能繁母牛","#30dcff",(w,T)=>w==="fertileCow"||T.includes("适龄能繁母牛"),"繁殖基础"),y("calf","犊牛合计","#8bf7ff",(w,T)=>["femaleCalf","maleCalf"].includes(w)||T.includes("犊牛"),"新生补充"),y("overage-cow","过龄能繁母牛","#30dcff",(w,T)=>w==="overageCow"||T.includes("过龄能繁母牛"),"更新压力"),y("breeding-bull","种公牛配比","#48cfff",(w,T)=>w==="breedingBull"||T.includes("种公牛"),"配种支撑")]}function il(i={}){const r=String(i.key||""),l=String(i.name||"");return["fertileCow","femaleCalf","maleCalf","overageCow","breedingBull"].includes(r)||l.includes("适龄能繁母牛")||l.includes("犊牛")||l.includes("过龄能繁母牛")||l.includes("种公牛")}function nl(i=[]){const r=w=>{var T;return Number(((T=i.find(F=>F.key===w))==null?void 0:T.percent)||0)},l=r("fertile-cow"),c=r("calf"),p=r("overage-cow"),y=r("breeding-bull");return l>=40&&c>=25&&y>=2&&y<=5&&p<=10?{label:"结构健康",title:"繁殖基础稳定",summary:"适龄母牛足,犊牛补充稳",note:"保持适龄能繁母牛、犊牛补充与种公牛配置稳定。"}:c<25?{label:"结构健康",title:"犊牛补充需关注",summary:"繁殖基础稳定,补充端可优化",note:"关注犊牛成活和季节性补栏,保持生产连续性。"}:y<2?{label:"结构健康",title:"繁殖基础总体稳定",summary:"适龄母牛基础较稳",note:"结合实际配种需求,平稳优化公牛配置。"}:{label:"结构健康",title:"生产阶段较均衡",summary:"繁殖群和犊牛补充连续支撑",note:"延续结构管理,优先保障适龄母牛与犊牛质量。"}}function rl(i){const r=Number((i==null?void 0:i.count)||0);return Math.max(8,Math.min(100,r/Jr.value*100))}function sl(i={}){const r=ct,l=[{key:"births",name:"新生牛犊",delta:Number(i.births||0),color:"#30dcff"},{key:"outflow",name:"出栏流出",delta:-Number(i.outflow||0),color:"#48cfff"},{key:"correction",name:"修正损耗",delta:Number(i.correction||0),color:"#8bf7ff"}];let c=r;const p=[{key:"current",name:"当前存栏",type:"anchor",value:r,magnitude:r,from:r,to:r,color:"#30dcff",display:`${Wa(r,2)}头`}];l.forEach(T=>{const F=c,_=c+T.delta;c=_,p.push($(N({},T),{name:`${T.delta>=0?"+":"-"}${T.name}`,type:"delta",from:F,to:_,value:T.delta,magnitude:Math.abs(T.delta),display:`${ol(T.delta)}头`}))});const y=Number(i.stock||c);p.push({key:"final",name:"=期末预测",type:"final",value:y,magnitude:y,from:y,to:y,color:"#48cfff",display:`${Wa(y,2)}头`});const w=Math.max(...p.map(T=>Number(T.magnitude)||0),1);return p.map(T=>{const F=(Number(T.magnitude)||0)/w*100;return $(N({},T),{left:0,width:Math.max(T.type==="delta"?5:10,Math.min(100,F))})})}function Ya(i){const r=Number(i);return Number.isFinite(r)?`${r>=0?"+":"-"}${K(Math.abs(r))}`:"--"}function ol(i){const r=Number(i);return Number.isFinite(r)?`${r>=0?"+":"-"}${Wa(Math.abs(r))}`:"--"}return(i,r)=>(I(),B("div",Wu,[tt((I(),Ha(Ou,{key:qr.value,ref_key:"mapSceneRef",ref:Ve,class:"yak-map-scene","active-layer":Is.value,"map-ranking":Gs.value,"tile-url-template":Xi.value,"use-satellite-base":ci.value,"satellite-max-zoom":21,"admin-boundary-line-scale":1.35,onLayerStatus:Wn,onTileStatus:Yn},null,8,["active-layer","map-ranking","tile-url-template","use-satellite-base"])),[[hl,!Tt.value]]),Tt.value?(I(),Ha(eu,{key:Zi.value,ref_key:"yakOlMapRef",ref:sa,class:"yak-ol-map-layer",active:a.active&&Tt.value,"tile-url-template":Xi.value,center:Rs.value,"initial-zoom":Ud,"county-view-target-offset":se,"auto-apply-layer-map-view":!1,"max-zoom":21,"overlay-layer":hn.value,onReady:Vo,onLayerStatus:Wn,onTileStatus:Yn},null,8,["active","tile-url-template","center","overlay-layer"])):ke("",!0),f("div",{class:Oe(["yak-map-scrim",{"is-ol-map":Tt.value}])},null,2),_s.value?(I(),B("div",Yu,P(Bs.value),1)):ke("",!0),f("div",ju,[W.value==="trade"&&un.value.length?(I(),B("div",Hu,[r[23]||(r[23]=f("span",null,"交易年份",-1)),(I(!0),B(ne,null,pe(un.value,l=>(I(),B("button",{key:l,type:"button",class:Oe({active:Number(l)===Number(ye.value)}),onClick:c=>Go(l)},P(l),11,qu))),128))])):ke("",!0),W.value==="epidemic"&&Ue.length?(I(),B("div",Uu,[r[24]||(r[24]=f("span",null,"防疫年份",-1)),(I(),B(ne,null,pe(Ue,l=>f("button",{key:l,type:"button",class:Oe({active:Number(l)===Number(ce.value)}),onClick:c=>_o(l)},P(l),11,Ku)),64))])):ke("",!0),W.value==="forecast"?(I(),B("div",Zu,[r[25]||(r[25]=f("span",null,"预测年份",-1)),(I(!0),B(ne,null,pe(j(Gt),l=>(I(),B("button",{key:l.key,type:"button",class:Oe({active:l.key===Ee.value}),onClick:c=>ro(l.key)},P(l.shortLabel),11,Xu))),128))])):ke("",!0),f("div",Ju,[f("div",Qu,[W.value==="structure"?(I(),B(ne,{key:0},[H(le,{class:"yak-side-card left-card",title:"繁殖基础评估",width:j(s),height:u.value},{default:oe(()=>[f("div",ec,[f("div",tc,[f("strong",null,P(en.value.title)+","+P(en.value.summary),1)]),f("div",ac,[(I(!0),B(ne,null,pe(Qi.value,l=>(I(),B("div",{key:l.key,class:"breeding-health-item",style:Mt({"--health-color":l.color,"--health-width":`${Math.max(5,Math.min(100,l.percent))}%`})},[f("span",null,P(l.name),1),f("strong",null,P(et(l.percent)),1),r[26]||(r[26]=f("i",null,[f("b")],-1)),f("em",null,P(l.desc),1)],4))),128))])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"畜群结构占比",width:j(s),height:u.value},{default:oe(()=>[f("div",ic,[f("div",nc,[f("div",rc,[(I(),B("svg",sc,[f("g",oc,[(I(!0),B(ne,null,pe(Qr.value,l=>(I(),B("path",{key:l.key,class:Oe(["structure-rose-segment",{"is-active":l.index===hi.value}]),d:l.path,fill:l.color,stroke:l.color},null,10,lc))),128))]),r[27]||(r[27]=f("circle",{class:"structure-rose-glow",cx:"75",cy:"75",r:"24"},null,-1)),r[28]||(r[28]=f("circle",{class:"structure-rose-hole",cx:"75",cy:"75",r:"16"},null,-1)),r[29]||(r[29]=f("text",{class:"structure-rose-center",x:"75",y:"72","text-anchor":"middle"},"结构",-1)),r[30]||(r[30]=f("text",{class:"structure-rose-center is-sub",x:"75",y:"83","text-anchor":"middle"},"占比",-1))]))]),f("div",uc,[(I(!0),B(ne,null,pe(xa.value,(l,c)=>(I(),B("div",{key:l.key||l.name,class:Oe(["structure-ratio-row",{"is-active":c===hi.value}]),style:Mt({"--row-color":l.color,"--row-percent":`${Math.max(4,l.percent)}%`})},[f("i",{style:Mt({background:l.color,color:l.color})},null,4),f("span",null,[Ot(P(l.name),1),f("small",null,P(et(l.percent)),1)]),f("strong",null,P(ie(l.count)),1),r[31]||(r[31]=f("em",null,"头",-1))],6))),128))])]),pt.value?(I(),B("div",cc,"结构数据加载中")):Ye.value?(I(),B("div",dc,P(Ye.value),1)):ke("",!0)])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"母牛/公牛年龄结构",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Es.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"牦牛乡镇分布",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:$s.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):W.value==="forecast"?(I(),B(ne,{key:1},[H(le,{class:"yak-side-card left-card",title:"存栏变化拆解",width:j(s),height:u.value},{default:oe(()=>[f("div",hc,[f("div",pc,[f("span",null,P(Je.value.label)+"变化路径",1),f("strong",{class:Oe({positive:di.value>0,negative:di.value<0})},[Ot(" 净变化 "+P(Ya(di.value)),1),r[32]||(r[32]=f("em",null,"头",-1))],2)]),f("div",fc,[(I(!0),B(ne,null,pe(Kr.value,l=>(I(),B("div",{key:l.key,class:Oe(["forecast-waterfall-row",[`is-${l.type}`,{positive:l.delta>0,negative:l.delta<0}]]),style:Mt({"--waterfall-left":`${l.left}%`,"--waterfall-width":`${l.width}%`,"--waterfall-color":l.color})},[f("span",null,P(l.name),1),r[33]||(r[33]=f("i",null,[f("b")],-1)),f("strong",null,P(l.display),1)],6))),128))])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"未来存栏趋势",width:j(s),height:u.value},{default:oe(()=>[f("div",mc,[f("div",gc,[(I(),B(ne,null,pe(ui,l=>f("button",{key:l.key,type:"button",class:Oe({active:l.key===kt.value}),onClick:c=>kt.value=l.key},P(l.label),11,yc)),64))]),H(j(Pe),{class:"yak-chart forecast-kline-chart",option:Os.value,autoresize:!0},null,8,["option"])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"月度数量预测",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Ws.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"预测因子雷达",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Ys.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):W.value==="epidemic"?(I(),B(ne,{key:2},[H(le,{class:"yak-side-card left-card",title:"防疫统计",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Js.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"养殖户防疫排行",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Qs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"防疫作业趋势",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Xs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"疫苗类型分布",width:j(s),height:u.value},{default:oe(()=>[Ra.value.length?(I(),B("div",bc,[f("div",vc,[(I(),Ha(xl,{key:ts.value,data:Ra.value,delay:3e3,colors:Fe,opacity:.62,class:"epidemic-three-pie"},{default:oe(({data:l})=>[f("div",wc,[f("strong",null,P(ie((l==null?void 0:l.count)||mt.value)),1),f("span",null,P((l==null?void 0:l.name)||"疫苗类型"),1)])]),_:1},8,["data"]))]),f("div",Lc,[(I(!0),B(ne,null,pe(Ra.value,(l,c)=>(I(),B("div",{key:l.key||l.name,class:"epidemic-three-pie-row"},[f("i",{style:Mt({borderColor:Fe[c%Fe.length]})},null,4),f("span",null,P(l.name),1),f("strong",null,P(ie(l.value)),1),f("em",null,P(l.unit),1)]))),128))])])):(I(),B("div",Tc,"暂无疫苗类型数据"))]),_:1},8,["width","height"])],64)):W.value==="trade"?(I(),B(ne,{key:3},[H(le,{class:"yak-side-card left-card",title:"交易异常关注",width:j(s),height:u.value},{default:oe(()=>[f("div",Sc,[f("div",Mc,[f("span",null,P(ye.value)+"年流通监管线索",1),f("strong",null,P(Ms.value),1)]),f("div",kc,[(I(!0),B(ne,null,pe(dn.value,l=>(I(),B("div",{key:l.key,class:Oe(["trade-risk-row",`is-${l.level}`]),style:Mt({"--risk-color":l.color})},[r[34]||(r[34]=f("i",null,null,-1)),f("span",null,[f("em",null,[f("b",null,P(l.badge),1),Ot(P(l.name),1)]),f("small",null,P(l.value)+"|"+P(l.desc),1)])],6))),128))])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"交易流通趋势",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:eo.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"来源乡镇分布",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:to.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card left-card",title:"用途结构统计",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:ao.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"])],64)):ke("",!0)])]),f("div",Pc,[f("div",Cc,[W.value==="structure"?(I(),B(ne,{key:0},[H(le,{class:"yak-side-card right-card",title:"乡镇存栏排行",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Vs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"能繁母牛与犊牛分布",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:zs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"出栏/交易影响",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Ds.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"性别与生产阶段汇总",width:j(s),height:u.value},{default:oe(()=>[f("div",Fc,[f("div",xc,[(I(!0),B(ne,null,pe(Ji.value,l=>(I(),B("div",{key:l.key||l.name,class:"structure-summary-row",style:Mt({"--structure-color":l.color,"--structure-width":`${rl(l)}%`})},[f("span",null,[r[35]||(r[35]=f("i",null,null,-1)),Ot(P(l.name),1)]),r[37]||(r[37]=f("b",null,[f("em")],-1)),f("strong",null,[Ot(P(ie(l.count)),1),r[36]||(r[36]=f("em",null,"头",-1))]),f("small",null,P(et(l.percent)),1)],4))),128))]),pt.value?(I(),B("div",Nc,"结构数据加载中")):Ye.value?(I(),B("div",Rc,P(Ye.value),1)):ke("",!0)])]),_:1},8,["width","height"])],64)):W.value==="forecast"?(I(),B(ne,{key:1},[H(le,{class:"yak-side-card right-card",title:"乡镇预测排行",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:js.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"期末结构预测",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:Hs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"补充/流出对比",width:j(s),height:u.value},{default:oe(()=>[H(j(Pe),{class:"yak-chart",option:qs.value,autoresize:!0},null,8,["option"])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card",title:"预测变化热力",width:j(s),height:u.value},{default:oe(()=>[f("div",Ic,[(I(!0),B(ne,null,pe(Us.value,l=>(I(),B("div",{key:l.name,class:Oe(["heat-row",{"is-negative":l.change<0}]),style:Mt(Ks(l)),title:Zs(l)},[f("span",null,P(l.name),1),r[38]||(r[38]=f("b",null,[f("i")],-1)),f("strong",null,P(Ya(l.change)),1)],14,Gc))),128))])]),_:1},8,["width","height"])],64)):W.value==="epidemic"?(I(),Ha(le,{key:2,class:"yak-side-card right-card epidemic-ledger-card",title:"防疫记录台账",width:j(s),height:d.value},{default:oe(()=>[f("div",_c,[f("div",Bc,[f("span",null,P(ce.value)+"年 共 "+P(K(nt.value))+" 条",1),f("div",null,[tt(f("input",{"onUpdate:modelValue":r[0]||(r[0]=l=>je.value=l),type:"search",placeholder:"耳标/养殖户/疫苗",onKeyup:qa(Bn,["enter"])},null,544),[[Zt,je.value]]),f("button",{type:"button",onClick:Bn},"搜索"),f("button",{type:"button",class:"is-more",onClick:r[1]||(r[1]=l=>En())},"查看更多")])]),r[39]||(r[39]=f("div",{class:"epidemic-record-header"},[f("span",null,"电子耳标"),f("span",null,"养殖户"),f("span",null,"镇/乡"),f("span",null,"疫苗"),f("span",null,"时间")],-1)),f("div",Ac,[(I(!0),B(ne,null,pe(ps.value,l=>(I(),B("button",{key:l.epidemicId||l.earTag,type:"button",onClick:c=>En(l)},[f("span",null,P(ae(l.earTag)),1),f("span",null,P(ae(l.owner)),1),f("span",null,P(ae(l.town)),1),f("strong",null,P(ae(l.medicine)),1),f("span",null,P(Rt(l.operateTime)),1)],8,Ec))),128)),$e.value.length?ke("",!0):(I(),B("div",$c,P(M.value?"防疫台账读取中":v.value||"暂无防疫记录"),1))]),f("div",Vc,[f("span",null,"第 "+P(xe.value)+" / "+P(wi.value)+" 页",1),f("button",{type:"button",disabled:xe.value<=1,onClick:r[2]||(r[2]=l=>An(xe.value-1))},"上一页",8,zc),f("button",{type:"button",disabled:xe.value>=wi.value,onClick:r[3]||(r[3]=l=>An(xe.value+1))},"下一页",8,Dc)])])]),_:1},8,["width","height"])):W.value==="trade"?(I(),B(ne,{key:3},[H(le,{class:"yak-side-card right-card",title:"出证结构统计",width:j(s),height:u.value},{default:oe(()=>[f("div",Oc,[f("div",Wc,[f("span",null,[r[41]||(r[41]=f("em",null,"省外流通 A证",-1)),f("strong",null,[Ot(P(K(ze("outProvinceHeads","aCertHeads"))),1),r[40]||(r[40]=f("b",null,"头",-1))]),f("small",null,P(K(ze("outProvinceCount","aCertCount")))+"条记录",1)]),f("span",null,[r[43]||(r[43]=f("em",null,"省内流通 B证",-1)),f("strong",null,[Ot(P(K(ze("inProvinceHeads","bCertHeads"))),1),r[42]||(r[42]=f("b",null,"头",-1))]),f("small",null,P(K(ze("inProvinceCount","bCertCount")))+"条记录",1)])]),H(j(Pe),{class:"trade-cert-chart",option:io.value,autoresize:!0},null,8,["option"])])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card trade-source-card",title:"出栏来源排行",width:j(s),height:h.value},{default:oe(()=>[f("div",Yc,[(I(!0),B(ne,null,pe(_a.value,(l,c)=>(I(),B("div",{key:l.name,class:"trade-dest-row",style:Mt({"--trade-ratio":`${l.ratio}%`})},[f("span",null,P(c+1),1),f("strong",null,P(l.name),1),f("em",null,P(ie(l.headCount))+"头",1)],4))),128)),_a.value.length?ke("",!0):(I(),B("div",jc,P(Bt.value?"交易数据读取中":ot.value||"暂无出栏来源数据"),1))])]),_:1},8,["width","height"]),H(le,{class:"yak-side-card right-card trade-ledger-card",title:"交易出证台账",width:j(s),height:g.value},{default:oe(()=>[f("div",Hc,[f("div",qc,[f("span",null,"共 "+P(K(st.value))+" 条",1),f("div",null,[tt(f("input",{"onUpdate:modelValue":r[4]||(r[4]=l=>Ta.value=l),type:"search",placeholder:"货主/车辆/检疫号/地区",onKeyup:qa(Pn,["enter"])},null,544),[[Zt,Ta.value]]),f("button",{type:"button",onClick:Pn},"搜索"),f("button",{type:"button",class:"is-more",onClick:r[5]||(r[5]=l=>Fn())},"查看更多")])]),r[44]||(r[44]=f("div",{class:"trade-ledger-header"},[f("span",null,"货主"),f("span",null,"车牌"),f("span",null,"数量"),f("span",null,"来源"),f("span",null,"用途"),f("span",null,"时间")],-1)),f("div",Uc,[(I(!0),B(ne,null,pe(cn.value,l=>(I(),B("button",{key:l.certId,type:"button",onClick:c=>Fn(l)},[f("span",null,P(ae(l.ownerName)),1),f("span",null,P(ae(l.transportNumber)),1),f("strong",null,P(K(l.amount))+"头",1),f("span",null,P(ae(l.startTown)),1),f("span",null,P(ae(l.usageTypeName)),1),f("span",null,P(Rt(l.issueTime)),1)],8,Kc))),128)),cn.value.length?ke("",!0):(I(),B("div",Zc,P(Bt.value?"交易台账读取中":ot.value||"暂无交易记录"),1))]),f("div",Xc,[f("span",null,"第 "+P(Xe.value)+" / "+P(Ti.value)+" 页",1),f("button",{type:"button",disabled:Xe.value<=1,onClick:r[6]||(r[6]=l=>Cn(Xe.value-1))},"上一页",8,Jc),f("button",{type:"button",disabled:Xe.value>=Ti.value,onClick:r[7]||(r[7]=l=>Cn(Xe.value+1))},"下一页",8,Qc)])])]),_:1},8,["width","height"])],64)):ke("",!0)])]),f("div",ed,[H(Jl,{"model-value":W.value,topics:bt,"onUpdate:modelValue":r[8]||(r[8]=l=>W.value=l)},null,8,["model-value"])])]),G.value?(I(),B("div",{key:2,class:"epidemic-ledger-modal",onClick:Ua($n,["self"])},[f("div",td,[f("div",ad,[f("div",null,[r[45]||(r[45]=f("span",null,"牦牛防疫台账",-1)),f("strong",null,P(ce.value)+"年 "+P(K(U.value))+" 条记录",1)]),f("button",{type:"button",onClick:$n},"关闭")]),f("div",id,[tt(f("input",{"onUpdate:modelValue":r[9]||(r[9]=l=>me.value.keyword=l),type:"search",placeholder:"耳标 / 养殖户 / 药品","aria-label":"耳标 / 养殖户 / 药品",onKeyup:qa(Vn,["enter"])},null,544),[[Zt,me.value.keyword]]),tt(f("select",{"onUpdate:modelValue":r[10]||(r[10]=l=>me.value.town=l)},[r[46]||(r[46]=f("option",{value:""},"全部镇/乡",-1)),(I(!0),B(ne,null,pe(ms.value,l=>(I(),B("option",{key:l,value:l},P(l),9,nd))),128))],512),[[fa,me.value.town]]),tt(f("select",{"onUpdate:modelValue":r[11]||(r[11]=l=>me.value.medicine=l)},[r[47]||(r[47]=f("option",{value:""},"全部疫苗",-1)),(I(!0),B(ne,null,pe(gs.value,l=>(I(),B("option",{key:l,value:l},P(l),9,rd))),128))],512),[[fa,me.value.medicine]]),tt(f("input",{"onUpdate:modelValue":r[12]||(r[12]=l=>me.value.startDate=l),type:"date"},null,512),[[Zt,me.value.startDate]]),tt(f("input",{"onUpdate:modelValue":r[13]||(r[13]=l=>me.value.endDate=l),type:"date"},null,512),[[Zt,me.value.endDate]]),f("button",{type:"button",onClick:Vn},"检索"),f("button",{type:"button",class:"is-ghost",onClick:Eo},"重置")]),f("div",sd,[f("div",od,[r[48]||(r[48]=f("div",{class:"epidemic-ledger-table-head"},[f("span",null,"电子耳标"),f("span",null,"养殖户"),f("span",null,"镇/乡"),f("span",null,"村"),f("span",null,"疫苗"),f("span",null,"免疫时间"),f("span",null,"图片")],-1)),(I(!0),B(ne,null,pe(V.value,l=>{var c,p;return I(),B("button",{key:l.epidemicId||l.earTag,type:"button",class:Oe({active:(((c=Ce.value)==null?void 0:c.epidemicId)||((p=Ce.value)==null?void 0:p.earTag))===(l.epidemicId||l.earTag)}),onClick:y=>Dn(l)},[f("span",null,P(ae(l.earTag)),1),f("span",null,P(ae(l.owner)),1),f("span",null,P(ae(l.town)),1),f("span",null,P(ae(l.village)),1),f("strong",null,P(ae(l.medicine)),1),f("span",null,P(Rt(l.operateTime)),1),f("span",null,P(Bi(l).length?`${Bi(l).length}张`:"无"),1)],10,ld)}),128)),V.value.length?ke("",!0):(I(),B("div",ud,P(fe.value?"台账读取中":Ge.value||"暂无匹配记录"),1))]),f("div",cd,[f("div",dd,[f("div",null,[f("span",null,P(ae(zt.value.earTag)),1),f("em",null,P(ae(zt.value.medicine||zt.value.preventionType)),1)]),f("strong",null,P(Ke.value?"加载中":Rt(zt.value.operateTime)),1)]),f("div",hd,[(I(!0),B(ne,null,pe(fs.value,l=>(I(),B("span",{key:l.label,class:Oe({"is-wide":l.wide})},[f("em",null,P(l.label),1),f("strong",null,P(l.value),1)],2))),128))]),on.value.length?(I(),B("div",pd,[r[49]||(r[49]=f("div",{class:"epidemic-detail-photo-title"},"现场照片",-1)),f("div",fd,[(I(!0),B(ne,null,pe(on.value.slice(0,6),l=>(I(),B("button",{key:l,type:"button",class:"epidemic-modal-photo-thumb",onClick:Ua(c=>Co(l),["stop"])},[f("img",{src:Tn(l),alt:"防疫照片"},null,8,gd)],8,md))),128))])])):ke("",!0)])]),f("div",yd,[f("span",null,"第 "+P(J.value)+" / "+P(sn.value)+" 页",1),f("button",{type:"button",disabled:J.value<=1,onClick:r[14]||(r[14]=l=>zn(J.value-1))},"上一页",8,bd),f("button",{type:"button",disabled:J.value>=sn.value,onClick:r[15]||(r[15]=l=>zn(J.value+1))},"下一页",8,vd)])])])):ke("",!0),ni.value?(I(),B("div",{key:3,class:"epidemic-ledger-modal trade-ledger-modal",onClick:Ua(xn,["self"])},[f("div",wd,[f("div",Ld,[f("div",null,[r[50]||(r[50]=f("span",null,"牦牛交易出证台账",-1)),f("strong",null,P(ye.value)+"年 "+P(K(Sa.value))+" 条记录",1)]),f("button",{type:"button",onClick:xn},"关闭")]),f("div",Td,[tt(f("input",{"onUpdate:modelValue":r[16]||(r[16]=l=>ft.value.keyword=l),type:"search",placeholder:"货主 / 车辆 / 检疫号 / 地区",onKeyup:qa(Nn,["enter"])},null,544),[[Zt,ft.value.keyword]]),tt(f("select",{"onUpdate:modelValue":r[17]||(r[17]=l=>ft.value.startTown=l)},[r[51]||(r[51]=f("option",{value:""},"全部来源乡镇",-1)),(I(!0),B(ne,null,pe(ws.value,l=>(I(),B("option",{key:l,value:l},P(l),9,Sd))),128))],512),[[fa,ft.value.startTown]]),tt(f("select",{"onUpdate:modelValue":r[18]||(r[18]=l=>ft.value.usageType=l)},[r[52]||(r[52]=f("option",{value:""},"全部用途",-1)),(I(!0),B(ne,null,pe(Ls.value,l=>(I(),B("option",{key:l,value:l},P(l),9,Md))),128))],512),[[fa,ft.value.usageType]]),tt(f("select",{"onUpdate:modelValue":r[19]||(r[19]=l=>ft.value.certType=l)},[r[53]||(r[53]=f("option",{value:""},"全部证书",-1)),(I(!0),B(ne,null,pe(Ts.value,l=>(I(),B("option",{key:l.value,value:l.value},P(l.label),9,kd))),128))],512),[[fa,ft.value.certType]]),f("button",{type:"button",onClick:Nn},"检索"),f("button",{type:"button",class:"is-ghost",onClick:Bo},"重置")]),f("div",Pd,[f("div",Cd,[r[54]||(r[54]=f("div",{class:"trade-ledger-modal-table-head"},[f("span",null,"货主"),f("span",null,"证书"),f("span",null,"车牌号"),f("span",null,"数量"),f("span",null,"来源"),f("span",null,"用途"),f("span",null,"出证时间"),f("span",null,"状态")],-1)),(I(!0),B(ne,null,pe(At.value,l=>(I(),B("button",{key:l.certId||l.factoryCode,type:"button",class:Oe({active:vs.value===(l.certId||l.factoryCode)}),onClick:c=>In(l)},[f("span",null,P(ae(l.ownerName)),1),f("span",null,P(ae(l.certType||l.certScopeName)),1),f("span",null,P(ae(l.transportNumber)),1),f("strong",null,P(K(l.amount))+"头",1),f("span",null,P(ae(l.startTown)),1),f("span",null,P(ae(l.usageTypeName)),1),f("span",null,P(Rt(l.issueTime)),1),f("span",null,P(ae(l.statusName)),1)],10,Fd))),128)),At.value.length?ke("",!0):(I(),B("div",xd,P(ri.value?"交易台账读取中":si.value||"暂无匹配记录"),1))]),f("div",Nd,[f("div",Rd,[f("div",null,[f("span",null,P(ae(be.value.factoryCode||be.value.certId)),1),f("em",null,P(Mn(be.value)),1)]),f("strong",null,P(Rt(be.value.issueTime)),1)]),f("div",Id,[f("span",Gd,[r[55]||(r[55]=f("em",null,"货主",-1)),f("strong",null,P(ae(be.value.ownerName)),1)]),f("span",null,[r[56]||(r[56]=f("em",null,"联系方式",-1)),f("strong",null,P(Sn(be.value.ownerPhone)),1)]),f("span",null,[r[57]||(r[57]=f("em",null,"证书类型",-1)),f("strong",null,P(Mn(be.value)),1)]),f("span",null,[r[58]||(r[58]=f("em",null,"车牌号",-1)),f("strong",null,P(ae(be.value.transportNumber)),1)]),f("span",null,[r[59]||(r[59]=f("em",null,"牦牛数量",-1)),f("strong",null,P(K(be.value.amount))+"头",1)]),f("span",null,[r[60]||(r[60]=f("em",null,"用途",-1)),f("strong",null,P(ae(be.value.usageTypeName)),1)]),f("span",null,[r[61]||(r[61]=f("em",null,"来源乡镇",-1)),f("strong",null,P(ae(be.value.startTown)),1)]),f("span",null,[r[62]||(r[62]=f("em",null,"目的省份",-1)),f("strong",null,P(ae(be.value.destProvince)),1)]),f("span",null,[r[63]||(r[63]=f("em",null,"检疫员",-1)),f("strong",null,P(ae(be.value.quarantineOfficerName)),1)]),f("span",_d,[r[64]||(r[64]=f("em",null,"状态",-1)),f("strong",null,P(ae(be.value.statusName)),1)]),f("span",Bd,[r[65]||(r[65]=f("em",null,"来源地区",-1)),f("strong",null,P(ae(be.value.startRegionFullName)),1)]),f("span",Ad,[r[66]||(r[66]=f("em",null,"目的地",-1)),f("strong",null,P(ae(be.value.destRegionFullName)),1)])]),f("button",{type:"button",class:"trade-detail-locate",disabled:!be.value.startTown,onClick:r[20]||(r[20]=l=>Ao(be.value))}," 查看乡镇位置 ",8,Ed)])]),f("div",$d,[f("span",null,"第 "+P(Et.value)+" / "+P(Si.value)+" 页",1),f("button",{type:"button",disabled:Et.value<=1,onClick:r[21]||(r[21]=l=>Rn(Et.value-1))},"上一页",8,Vd),f("button",{type:"button",disabled:Et.value>=Si.value,onClick:r[22]||(r[22]=l=>Rn(Et.value+1))},"下一页",8,zd)])])])):ke("",!0),Be.value?(I(),B("div",{key:4,class:"epidemic-image-preview-modal",onClick:Ua(Ai,["self"])},[f("div",Dd,[f("div",Od,[f("div",null,[r[67]||(r[67]=f("span",null,"防疫照片",-1)),f("strong",null,P(ae(zt.value.earTag)),1)]),f("button",{type:"button",onClick:Ai},"关闭")]),f("div",Wd,[f("div",Yd,[f("img",{src:Ze.value,alt:"防疫照片预览"},null,8,jd)])])])])):ke("",!0)]))}};export{ph as default};