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

2 lines
88 KiB

var Tr=Object.defineProperty,xr=Object.defineProperties;var Nr=Object.getOwnPropertyDescriptors;var Pn=Object.getOwnPropertySymbols;var Cr=Object.prototype.hasOwnProperty,Er=Object.prototype.propertyIsEnumerable;var Fn=(m,n,r)=>n in m?Tr(m,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):m[n]=r,oe=(m,n)=>{for(var r in n||(n={}))Cr.call(n,r)&&Fn(m,r,n[r]);if(Pn)for(var r of Pn(n))Er.call(n,r)&&Fn(m,r,n[r]);return m},Ce=(m,n)=>xr(m,Nr(n));var ge=(m,n,r)=>new Promise((u,h)=>{var c=b=>{try{p(r.next(b))}catch(_){h(_)}},g=b=>{try{p(r.throw(b))}catch(_){h(_)}},p=b=>b.done?u(b.value):Promise.resolve(b.value).then(c,g);p((r=r.apply(m,n)).next())});import{l as Pr,p as Fr,H as V,m as Ir,q as Tt,h as In}from"./townshipBoundaries-8867fad4-1785726778446.js";import{_ as Mr,g as kr,q as Rr,h as vr,w as tt,A as Mn,o as Lr,c as Ar,a as Or,d as kn,L as Br}from"./index-1785726778446.js";class ye{constructor(n,r){this.next=null,this.key=n,this.data=r,this.left=null,this.right=null}}function Dr(m,n){return m>n?1:m<n?-1:0}function me(m,n,r){const u=new ye(null,null);let h=u,c=u;for(;;){const g=r(m,n.key);if(g<0){if(n.left===null)break;if(r(m,n.left.key)<0){const p=n.left;if(n.left=p.right,p.right=n,n=p,n.left===null)break}c.left=n,c=n,n=n.left}else if(g>0){if(n.right===null)break;if(r(m,n.right.key)>0){const p=n.right;if(n.right=p.left,p.left=n,n=p,n.right===null)break}h.right=n,h=n,n=n.right}else break}return h.right=n.left,c.left=n.right,n.left=u.right,n.right=u.left,n}function xt(m,n,r,u){const h=new ye(m,n);if(r===null)return h.left=h.right=null,h;r=me(m,r,u);const c=u(m,r.key);return c<0?(h.left=r.left,h.right=r,r.left=null):c>=0&&(h.right=r.right,h.left=r,r.right=null),h}function Rn(m,n,r){let u=null,h=null;if(n){n=me(m,n,r);const c=r(n.key,m);c===0?(u=n.left,h=n.right):c<0?(h=n.right,n.right=null,u=n):(u=n.left,n.left=null,h=n)}return{left:u,right:h}}function Hr(m,n,r){return n===null?m:(m===null||(n=me(m.key,n,r),n.left=m),n)}function Ct(m,n,r,u,h){if(m){u(`${n}${r?"└── ":"├── "}${h(m)}
`);const c=n+(r?" ":"│ ");m.left&&Ct(m.left,c,!1,u,h),m.right&&Ct(m.right,c,!0,u,h)}}class Mt{constructor(n=Dr){this._root=null,this._size=0,this._comparator=n}insert(n,r){return this._size++,this._root=xt(n,r,this._root,this._comparator)}add(n,r){const u=new ye(n,r);this._root===null&&(u.left=u.right=null,this._size++,this._root=u);const h=this._comparator,c=me(n,this._root,h),g=h(n,c.key);return g===0?this._root=c:(g<0?(u.left=c.left,u.right=c,c.left=null):g>0&&(u.right=c.right,u.left=c,c.right=null),this._size++,this._root=u),this._root}remove(n){this._root=this._remove(n,this._root,this._comparator)}_remove(n,r,u){let h;return r===null?null:(r=me(n,r,u),u(n,r.key)===0?(r.left===null?h=r.right:(h=me(n,r.left,u),h.right=r.right),this._size--,h):r)}pop(){let n=this._root;if(n){for(;n.left;)n=n.left;return this._root=me(n.key,this._root,this._comparator),this._root=this._remove(n.key,this._root,this._comparator),{key:n.key,data:n.data}}return null}findStatic(n){let r=this._root;const u=this._comparator;for(;r;){const h=u(n,r.key);if(h===0)return r;h<0?r=r.left:r=r.right}return null}find(n){return this._root&&(this._root=me(n,this._root,this._comparator),this._comparator(n,this._root.key)!==0)?null:this._root}contains(n){let r=this._root;const u=this._comparator;for(;r;){const h=u(n,r.key);if(h===0)return!0;h<0?r=r.left:r=r.right}return!1}forEach(n,r){let u=this._root;const h=[];let c=!1;for(;!c;)u!==null?(h.push(u),u=u.left):h.length!==0?(u=h.pop(),n.call(r,u),u=u.right):c=!0;return this}range(n,r,u,h){const c=[],g=this._comparator;let p=this._root,b;for(;c.length!==0||p;)if(p)c.push(p),p=p.left;else{if(p=c.pop(),b=g(p.key,r),b>0)break;if(g(p.key,n)>=0&&u.call(h,p))return this;p=p.right}return this}keys(){const n=[];return this.forEach(({key:r})=>{n.push(r)}),n}values(){const n=[];return this.forEach(({data:r})=>{n.push(r)}),n}min(){return this._root?this.minNode(this._root).key:null}max(){return this._root?this.maxNode(this._root).key:null}minNode(n=this._root){if(n)for(;n.left;)n=n.left;return n}maxNode(n=this._root){if(n)for(;n.right;)n=n.right;return n}at(n){let r=this._root,u=!1,h=0;const c=[];for(;!u;)if(r)c.push(r),r=r.left;else if(c.length>0){if(r=c.pop(),h===n)return r;h++,r=r.right}else u=!0;return null}next(n){let r=this._root,u=null;if(n.right){for(u=n.right;u.left;)u=u.left;return u}const h=this._comparator;for(;r;){const c=h(n.key,r.key);if(c===0)break;c<0?(u=r,r=r.left):r=r.right}return u}prev(n){let r=this._root,u=null;if(n.left!==null){for(u=n.left;u.right;)u=u.right;return u}const h=this._comparator;for(;r;){const c=h(n.key,r.key);if(c===0)break;c<0?r=r.left:(u=r,r=r.right)}return u}clear(){return this._root=null,this._size=0,this}toList(){return Gr(this._root)}load(n,r=[],u=!1){let h=n.length;const c=this._comparator;if(u&&Ft(n,r,0,h-1,c),this._root===null)this._root=Et(n,r,0,h),this._size=h;else{const g=zr(this.toList(),Wr(n,r),c);h=this._size+h,this._root=Pt({head:g},0,h)}return this}isEmpty(){return this._root===null}get size(){return this._size}get root(){return this._root}toString(n=r=>String(r.key)){const r=[];return Ct(this._root,"",!0,u=>r.push(u),n),r.join("")}update(n,r,u){const h=this._comparator;let{left:c,right:g}=Rn(n,this._root,h);h(n,r)<0?g=xt(r,u,g,h):c=xt(r,u,c,h),this._root=Hr(c,g,h)}split(n){return Rn(n,this._root,this._comparator)}*[Symbol.iterator](){let n=this._root;const r=[];let u=!1;for(;!u;)n!==null?(r.push(n),n=n.left):r.length!==0?(n=r.pop(),yield n,n=n.right):u=!0}}function Et(m,n,r,u){const h=u-r;if(h>0){const c=r+Math.floor(h/2),g=m[c],p=n[c],b=new ye(g,p);return b.left=Et(m,n,r,c),b.right=Et(m,n,c+1,u),b}return null}function Wr(m,n){const r=new ye(null,null);let u=r;for(let h=0;h<m.length;h++)u=u.next=new ye(m[h],n[h]);return u.next=null,r.next}function Gr(m){let n=m;const r=[];let u=!1;const h=new ye(null,null);let c=h;for(;!u;)n?(r.push(n),n=n.left):r.length>0?(n=c=c.next=r.pop(),n=n.right):u=!0;return c.next=null,h.next}function Pt(m,n,r){const u=r-n;if(u>0){const h=n+Math.floor(u/2),c=Pt(m,n,h),g=m.head;return g.left=c,m.head=m.head.next,g.right=Pt(m,h+1,r),g}return null}function zr(m,n,r){const u=new ye(null,null);let h=u,c=m,g=n;for(;c!==null&&g!==null;)r(c.key,g.key)<0?(h.next=c,c=c.next):(h.next=g,g=g.next),h=h.next;return c!==null?h.next=c:g!==null&&(h.next=g),u.next}function Ft(m,n,r,u,h){if(r>=u)return;const c=m[r+u>>1];let g=r-1,p=u+1;for(;;){do g++;while(h(m[g],c)<0);do p--;while(h(m[p],c)>0);if(g>=p)break;let b=m[g];m[g]=m[p],m[p]=b,b=n[g],n[g]=n[p],n[p]=b}Ft(m,n,r,p,h),Ft(m,n,p+1,u,h)}const ce=11102230246251565e-32,K=134217729,Vr=(3+8*ce)*ce;function Nt(m,n,r,u,h){let c,g,p,b,_=n[0],C=u[0],s=0,w=0;C>_==C>-_?(c=_,_=n[++s]):(c=C,C=u[++w]);let T=0;if(s<m&&w<r)for(C>_==C>-_?(g=_+c,p=c-(g-_),_=n[++s]):(g=C+c,p=c-(g-C),C=u[++w]),c=g,p!==0&&(h[T++]=p);s<m&&w<r;)C>_==C>-_?(g=c+_,b=g-c,p=c-(g-b)+(_-b),_=n[++s]):(g=c+C,b=g-c,p=c-(g-b)+(C-b),C=u[++w]),c=g,p!==0&&(h[T++]=p);for(;s<m;)g=c+_,b=g-c,p=c-(g-b)+(_-b),_=n[++s],c=g,p!==0&&(h[T++]=p);for(;w<r;)g=c+C,b=g-c,p=c-(g-b)+(C-b),C=u[++w],c=g,p!==0&&(h[T++]=p);return(c!==0||T===0)&&(h[T++]=c),T}function $r(m,n){let r=n[0];for(let u=1;u<m;u++)r+=n[u];return r}function Ge(m){return new Float64Array(m)}const Ur=(3+16*ce)*ce,Yr=(2+12*ce)*ce,jr=(9+64*ce)*ce*ce,Pe=Ge(4),vn=Ge(8),Ln=Ge(12),An=Ge(16),ee=Ge(4);function qr(m,n,r,u,h,c,g){let p,b,_,C,s,w,T,P,E,k,M,F,B,R,A,O,Y,H;const X=m-h,$=r-h,J=n-c,G=u-c;R=X*G,w=K*X,T=w-(w-X),P=X-T,w=K*G,E=w-(w-G),k=G-E,A=P*k-(R-T*E-P*E-T*k),O=J*$,w=K*J,T=w-(w-J),P=J-T,w=K*$,E=w-(w-$),k=$-E,Y=P*k-(O-T*E-P*E-T*k),M=A-Y,s=A-M,Pe[0]=A-(M+s)+(s-Y),F=R+M,s=F-R,B=R-(F-s)+(M-s),M=B-O,s=B-M,Pe[1]=B-(M+s)+(s-O),H=F+M,s=H-F,Pe[2]=F-(H-s)+(M-s),Pe[3]=H;let j=$r(4,Pe),re=Yr*g;if(j>=re||-j>=re||(s=m-X,p=m-(X+s)+(s-h),s=r-$,_=r-($+s)+(s-h),s=n-J,b=n-(J+s)+(s-c),s=u-G,C=u-(G+s)+(s-c),p===0&&b===0&&_===0&&C===0)||(re=jr*g+Vr*Math.abs(j),j+=X*C+G*p-(J*_+$*b),j>=re||-j>=re))return j;R=p*G,w=K*p,T=w-(w-p),P=p-T,w=K*G,E=w-(w-G),k=G-E,A=P*k-(R-T*E-P*E-T*k),O=b*$,w=K*b,T=w-(w-b),P=b-T,w=K*$,E=w-(w-$),k=$-E,Y=P*k-(O-T*E-P*E-T*k),M=A-Y,s=A-M,ee[0]=A-(M+s)+(s-Y),F=R+M,s=F-R,B=R-(F-s)+(M-s),M=B-O,s=B-M,ee[1]=B-(M+s)+(s-O),H=F+M,s=H-F,ee[2]=F-(H-s)+(M-s),ee[3]=H;const be=Nt(4,Pe,4,ee,vn);R=X*C,w=K*X,T=w-(w-X),P=X-T,w=K*C,E=w-(w-C),k=C-E,A=P*k-(R-T*E-P*E-T*k),O=J*_,w=K*J,T=w-(w-J),P=J-T,w=K*_,E=w-(w-_),k=_-E,Y=P*k-(O-T*E-P*E-T*k),M=A-Y,s=A-M,ee[0]=A-(M+s)+(s-Y),F=R+M,s=F-R,B=R-(F-s)+(M-s),M=B-O,s=B-M,ee[1]=B-(M+s)+(s-O),H=F+M,s=H-F,ee[2]=F-(H-s)+(M-s),ee[3]=H;const we=Nt(be,vn,4,ee,Ln);R=p*C,w=K*p,T=w-(w-p),P=p-T,w=K*C,E=w-(w-C),k=C-E,A=P*k-(R-T*E-P*E-T*k),O=b*_,w=K*b,T=w-(w-b),P=b-T,w=K*_,E=w-(w-_),k=_-E,Y=P*k-(O-T*E-P*E-T*k),M=A-Y,s=A-M,ee[0]=A-(M+s)+(s-Y),F=R+M,s=F-R,B=R-(F-s)+(M-s),M=B-O,s=B-M,ee[1]=B-(M+s)+(s-O),H=F+M,s=H-F,ee[2]=F-(H-s)+(M-s),ee[3]=H;const he=Nt(we,Ln,4,ee,An);return An[he-1]}function Zr(m,n,r,u,h,c){const g=(n-c)*(r-h),p=(m-h)*(u-c),b=g-p,_=Math.abs(g+p);return Math.abs(b)>=Ur*_?b:-qr(m,n,r,u,h,c,_)}const He=(m,n)=>m.ll.x<=n.x&&n.x<=m.ur.x&&m.ll.y<=n.y&&n.y<=m.ur.y,It=(m,n)=>{if(n.ur.x<m.ll.x||m.ur.x<n.ll.x||n.ur.y<m.ll.y||m.ur.y<n.ll.y)return null;const r=m.ll.x<n.ll.x?n.ll.x:m.ll.x,u=m.ur.x<n.ur.x?m.ur.x:n.ur.x,h=m.ll.y<n.ll.y?n.ll.y:m.ll.y,c=m.ur.y<n.ur.y?m.ur.y:n.ur.y;return{ll:{x:r,y:h},ur:{x:u,y:c}}};let pe=Number.EPSILON;pe===void 0&&(pe=Math.pow(2,-52));const Xr=pe*pe,On=(m,n)=>{if(-pe<m&&m<pe&&-pe<n&&n<pe)return 0;const r=m-n;return r*r<Xr*m*n?0:m<n?-1:1};class Jr{constructor(){this.reset()}reset(){this.xRounder=new Bn,this.yRounder=new Bn}round(n,r){return{x:this.xRounder.round(n),y:this.yRounder.round(r)}}}class Bn{constructor(){this.tree=new Mt,this.round(0)}round(n){const r=this.tree.add(n),u=this.tree.prev(r);if(u!==null&&On(r.key,u.key)===0)return this.tree.remove(n),u.key;const h=this.tree.next(r);return h!==null&&On(r.key,h.key)===0?(this.tree.remove(n),h.key):n}}const We=new Jr,it=(m,n)=>m.x*n.y-m.y*n.x,Zn=(m,n)=>m.x*n.x+m.y*n.y,Dn=(m,n,r)=>{const u=Zr(m.x,m.y,n.x,n.y,r.x,r.y);return u>0?-1:u<0?1:0},rt=m=>Math.sqrt(Zn(m,m)),Kr=(m,n,r)=>{const u={x:n.x-m.x,y:n.y-m.y},h={x:r.x-m.x,y:r.y-m.y};return it(h,u)/rt(h)/rt(u)},Qr=(m,n,r)=>{const u={x:n.x-m.x,y:n.y-m.y},h={x:r.x-m.x,y:r.y-m.y};return Zn(h,u)/rt(h)/rt(u)},Hn=(m,n,r)=>n.y===0?null:{x:m.x+n.x/n.y*(r-m.y),y:r},Wn=(m,n,r)=>n.x===0?null:{x:r,y:m.y+n.y/n.x*(r-m.x)},eo=(m,n,r,u)=>{if(n.x===0)return Wn(r,u,m.x);if(u.x===0)return Wn(m,n,r.x);if(n.y===0)return Hn(r,u,m.y);if(u.y===0)return Hn(m,n,r.y);const h=it(n,u);if(h==0)return null;const c={x:r.x-m.x,y:r.y-m.y},g=it(c,n)/h,p=it(c,u)/h,b=m.x+p*n.x,_=r.x+g*u.x,C=m.y+p*n.y,s=r.y+g*u.y,w=(b+_)/2,T=(C+s)/2;return{x:w,y:T}};class ie{static compare(n,r){const u=ie.comparePoints(n.point,r.point);return u!==0?u:(n.point!==r.point&&n.link(r),n.isLeft!==r.isLeft?n.isLeft?1:-1:de.compare(n.segment,r.segment))}static comparePoints(n,r){return n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0}constructor(n,r){n.events===void 0?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=r}link(n){if(n.point===this.point)throw new Error("Tried to link already linked events");const r=n.point.events;for(let u=0,h=r.length;u<h;u++){const c=r[u];this.point.events.push(c),c.point=this.point}this.checkForConsuming()}checkForConsuming(){const n=this.point.events.length;for(let r=0;r<n;r++){const u=this.point.events[r];if(u.segment.consumedBy===void 0)for(let h=r+1;h<n;h++){const c=this.point.events[h];c.consumedBy===void 0&&u.otherSE.point.events===c.otherSE.point.events&&u.segment.consume(c.segment)}}}getAvailableLinkedEvents(){const n=[];for(let r=0,u=this.point.events.length;r<u;r++){const h=this.point.events[r];h!==this&&!h.segment.ringOut&&h.segment.isInResult()&&n.push(h)}return n}getLeftmostComparator(n){const r=new Map,u=h=>{const c=h.otherSE;r.set(h,{sine:Kr(this.point,n.point,c.point),cosine:Qr(this.point,n.point,c.point)})};return(h,c)=>{r.has(h)||u(h),r.has(c)||u(c);const{sine:g,cosine:p}=r.get(h),{sine:b,cosine:_}=r.get(c);return g>=0&&b>=0?p<_?1:p>_?-1:0:g<0&&b<0?p<_?-1:p>_?1:0:b<g?-1:b>g?1:0}}}let to=0;class de{static compare(n,r){const u=n.leftSE.point.x,h=r.leftSE.point.x,c=n.rightSE.point.x,g=r.rightSE.point.x;if(g<u)return 1;if(c<h)return-1;const p=n.leftSE.point.y,b=r.leftSE.point.y,_=n.rightSE.point.y,C=r.rightSE.point.y;if(u<h){if(b<p&&b<_)return 1;if(b>p&&b>_)return-1;const s=n.comparePoint(r.leftSE.point);if(s<0)return 1;if(s>0)return-1;const w=r.comparePoint(n.rightSE.point);return w!==0?w:-1}if(u>h){if(p<b&&p<C)return-1;if(p>b&&p>C)return 1;const s=r.comparePoint(n.leftSE.point);if(s!==0)return s;const w=n.comparePoint(r.rightSE.point);return w<0?1:w>0?-1:1}if(p<b)return-1;if(p>b)return 1;if(c<g){const s=r.comparePoint(n.rightSE.point);if(s!==0)return s}if(c>g){const s=n.comparePoint(r.rightSE.point);if(s<0)return 1;if(s>0)return-1}if(c!==g){const s=_-p,w=c-u,T=C-b,P=g-h;if(s>w&&T<P)return 1;if(s<w&&T>P)return-1}return c>g?1:c<g||_<C?-1:_>C?1:n.id<r.id?-1:n.id>r.id?1:0}constructor(n,r,u,h){this.id=++to,this.leftSE=n,n.segment=this,n.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=n,this.rings=u,this.windings=h}static fromRing(n,r,u){let h,c,g;const p=ie.comparePoints(n,r);if(p<0)h=n,c=r,g=1;else if(p>0)h=r,c=n,g=-1;else throw new Error(`Tried to create degenerate segment at [${n.x}, ${n.y}]`);const b=new ie(h,!0),_=new ie(c,!1);return new de(b,_,[u],[g])}replaceRightSE(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const n=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:n<r?n:r},ur:{x:this.rightSE.point.x,y:n>r?n:r}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(n){return n.x===this.leftSE.point.x&&n.y===this.leftSE.point.y||n.x===this.rightSE.point.x&&n.y===this.rightSE.point.y}comparePoint(n){if(this.isAnEndpoint(n))return 0;const r=this.leftSE.point,u=this.rightSE.point,h=this.vector();if(r.x===u.x)return n.x===r.x?0:n.x<r.x?1:-1;const c=(n.y-r.y)/h.y,g=r.x+c*h.x;if(n.x===g)return 0;const p=(n.x-r.x)/h.x,b=r.y+p*h.y;return n.y===b?0:n.y<b?-1:1}getIntersection(n){const r=this.bbox(),u=n.bbox(),h=It(r,u);if(h===null)return null;const c=this.leftSE.point,g=this.rightSE.point,p=n.leftSE.point,b=n.rightSE.point,_=He(r,p)&&this.comparePoint(p)===0,C=He(u,c)&&n.comparePoint(c)===0,s=He(r,b)&&this.comparePoint(b)===0,w=He(u,g)&&n.comparePoint(g)===0;if(C&&_)return w&&!s?g:!w&&s?b:null;if(C)return s&&c.x===b.x&&c.y===b.y?null:c;if(_)return w&&g.x===p.x&&g.y===p.y?null:p;if(w&&s)return null;if(w)return g;if(s)return b;const T=eo(c,this.vector(),p,n.vector());return T===null||!He(h,T)?null:We.round(T.x,T.y)}split(n){const r=[],u=n.events!==void 0,h=new ie(n,!0),c=new ie(n,!1),g=this.rightSE;this.replaceRightSE(c),r.push(c),r.push(h);const p=new de(h,g,this.rings.slice(),this.windings.slice());return ie.comparePoints(p.leftSE.point,p.rightSE.point)>0&&p.swapEvents(),ie.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),u&&(h.checkForConsuming(),c.checkForConsuming()),r}swapEvents(){const n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,u=this.windings.length;r<u;r++)this.windings[r]*=-1}consume(n){let r=this,u=n;for(;r.consumedBy;)r=r.consumedBy;for(;u.consumedBy;)u=u.consumedBy;const h=de.compare(r,u);if(h!==0){if(h>0){const c=r;r=u,u=c}if(r.prev===u){const c=r;r=u,u=c}for(let c=0,g=u.rings.length;c<g;c++){const p=u.rings[c],b=u.windings[c],_=r.rings.indexOf(p);_===-1?(r.rings.push(p),r.windings.push(b)):r.windings[_]+=b}u.rings=null,u.windings=null,u.consumedBy=r,u.leftSE.consumedBy=r.leftSE,u.rightSE.consumedBy=r.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const n=this.prev.consumedBy||this.prev;this._beforeState=n.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const n=this.beforeState();this._afterState={rings:n.rings.slice(0),windings:n.windings.slice(0),multiPolys:[]};const r=this._afterState.rings,u=this._afterState.windings,h=this._afterState.multiPolys;for(let p=0,b=this.rings.length;p<b;p++){const _=this.rings[p],C=this.windings[p],s=r.indexOf(_);s===-1?(r.push(_),u.push(C)):u[s]+=C}const c=[],g=[];for(let p=0,b=r.length;p<b;p++){if(u[p]===0)continue;const _=r[p],C=_.poly;if(g.indexOf(C)===-1)if(_.isExterior)c.push(C);else{g.indexOf(C)===-1&&g.push(C);const s=c.indexOf(_.poly);s!==-1&&c.splice(s,1)}}for(let p=0,b=c.length;p<b;p++){const _=c[p].multiPoly;h.indexOf(_)===-1&&h.push(_)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const n=this.beforeState().multiPolys,r=this.afterState().multiPolys;switch(se.type){case"union":{const u=n.length===0,h=r.length===0;this._isInResult=u!==h;break}case"intersection":{let u,h;n.length<r.length?(u=n.length,h=r.length):(u=r.length,h=n.length),this._isInResult=h===se.numMultiPolys&&u<h;break}case"xor":{const u=Math.abs(n.length-r.length);this._isInResult=u%2===1;break}case"difference":{const u=h=>h.length===1&&h[0].isSubject;this._isInResult=u(n)!==u(r);break}default:throw new Error(`Unrecognized operation type found ${se.type}`)}return this._isInResult}}class Gn{constructor(n,r,u){if(!Array.isArray(n)||n.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=u,this.segments=[],typeof n[0][0]!="number"||typeof n[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const h=We.round(n[0][0],n[0][1]);this.bbox={ll:{x:h.x,y:h.y},ur:{x:h.x,y:h.y}};let c=h;for(let g=1,p=n.length;g<p;g++){if(typeof n[g][0]!="number"||typeof n[g][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let b=We.round(n[g][0],n[g][1]);b.x===c.x&&b.y===c.y||(this.segments.push(de.fromRing(c,b,this)),b.x<this.bbox.ll.x&&(this.bbox.ll.x=b.x),b.y<this.bbox.ll.y&&(this.bbox.ll.y=b.y),b.x>this.bbox.ur.x&&(this.bbox.ur.x=b.x),b.y>this.bbox.ur.y&&(this.bbox.ur.y=b.y),c=b)}(h.x!==c.x||h.y!==c.y)&&this.segments.push(de.fromRing(c,h,this))}getSweepEvents(){const n=[];for(let r=0,u=this.segments.length;r<u;r++){const h=this.segments[r];n.push(h.leftSE),n.push(h.rightSE)}return n}}class no{constructor(n,r){if(!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Gn(n[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let u=1,h=n.length;u<h;u++){const c=new Gn(n[u],this,!1);c.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=c.bbox.ll.x),c.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=c.bbox.ll.y),c.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=c.bbox.ur.x),c.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=c.bbox.ur.y),this.interiorRings.push(c)}this.multiPoly=r}getSweepEvents(){const n=this.exteriorRing.getSweepEvents();for(let r=0,u=this.interiorRings.length;r<u;r++){const h=this.interiorRings[r].getSweepEvents();for(let c=0,g=h.length;c<g;c++)n.push(h[c])}return n}}class zn{constructor(n,r){if(!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof n[0][0][0]=="number"&&(n=[n])}catch(u){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let u=0,h=n.length;u<h;u++){const c=new no(n[u],this);c.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=c.bbox.ll.x),c.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=c.bbox.ll.y),c.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=c.bbox.ur.x),c.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=c.bbox.ur.y),this.polys.push(c)}this.isSubject=r}getSweepEvents(){const n=[];for(let r=0,u=this.polys.length;r<u;r++){const h=this.polys[r].getSweepEvents();for(let c=0,g=h.length;c<g;c++)n.push(h[c])}return n}}class ot{static factory(n){const r=[];for(let u=0,h=n.length;u<h;u++){const c=n[u];if(!c.isInResult()||c.ringOut)continue;let g=null,p=c.leftSE,b=c.rightSE;const _=[p],C=p.point,s=[];for(;g=p,p=b,_.push(p),p.point!==C;)for(;;){const w=p.getAvailableLinkedEvents();if(w.length===0){const E=_[0].point,k=_[_.length-1].point;throw new Error(`Unable to complete output ring starting at [${E.x}, ${E.y}]. Last matching segment found ends at [${k.x}, ${k.y}].`)}if(w.length===1){b=w[0].otherSE;break}let T=null;for(let E=0,k=s.length;E<k;E++)if(s[E].point===p.point){T=E;break}if(T!==null){const E=s.splice(T)[0],k=_.splice(E.index);k.unshift(k[0].otherSE),r.push(new ot(k.reverse()));continue}s.push({index:_.length,point:p.point});const P=p.getLeftmostComparator(g);b=w.sort(P)[0].otherSE;break}r.push(new ot(_))}return r}constructor(n){this.events=n;for(let r=0,u=n.length;r<u;r++)n[r].segment.ringOut=this;this.poly=null}getGeom(){let n=this.events[0].point;const r=[n];for(let _=1,C=this.events.length-1;_<C;_++){const s=this.events[_].point,w=this.events[_+1].point;Dn(s,n,w)!==0&&(r.push(s),n=s)}if(r.length===1)return null;const u=r[0],h=r[1];Dn(u,n,h)===0&&r.shift(),r.push(r[0]);const c=this.isExteriorRing()?1:-1,g=this.isExteriorRing()?0:r.length-1,p=this.isExteriorRing()?r.length:-1,b=[];for(let _=g;_!=p;_+=c)b.push([r[_].x,r[_].y]);return b}isExteriorRing(){if(this._isExteriorRing===void 0){const n=this.enclosingRing();this._isExteriorRing=n?!n.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let n=this.events[0];for(let h=1,c=this.events.length;h<c;h++){const g=this.events[h];ie.compare(n,g)>0&&(n=g)}let r=n.segment.prevInResult(),u=r?r.prevInResult():null;for(;;){if(!r)return null;if(!u)return r.ringOut;if(u.ringOut!==r.ringOut)return u.ringOut.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut.enclosingRing();r=u.prevInResult(),u=r?r.prevInResult():null}}}class Vn{constructor(n){this.exteriorRing=n,n.poly=this,this.interiorRings=[]}addInterior(n){this.interiorRings.push(n),n.poly=this}getGeom(){const n=[this.exteriorRing.getGeom()];if(n[0]===null)return null;for(let r=0,u=this.interiorRings.length;r<u;r++){const h=this.interiorRings[r].getGeom();h!==null&&n.push(h)}return n}}class io{constructor(n){this.rings=n,this.polys=this._composePolys(n)}getGeom(){const n=[];for(let r=0,u=this.polys.length;r<u;r++){const h=this.polys[r].getGeom();h!==null&&n.push(h)}return n}_composePolys(n){const r=[];for(let u=0,h=n.length;u<h;u++){const c=n[u];if(!c.poly)if(c.isExteriorRing())r.push(new Vn(c));else{const g=c.enclosingRing();g.poly||r.push(new Vn(g)),g.poly.addInterior(c)}}return r}}class ro{constructor(n){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:de.compare;this.queue=n,this.tree=new Mt(r),this.segments=[]}process(n){const r=n.segment,u=[];if(n.consumedBy)return n.isLeft?this.queue.remove(n.otherSE):this.tree.remove(r),u;const h=n.isLeft?this.tree.add(r):this.tree.find(r);if(!h)throw new Error(`Unable to find segment #${r.id} [${r.leftSE.point.x}, ${r.leftSE.point.y}] -> [${r.rightSE.point.x}, ${r.rightSE.point.y}] in SweepLine tree.`);let c=h,g=h,p,b;for(;p===void 0;)c=this.tree.prev(c),c===null?p=null:c.key.consumedBy===void 0&&(p=c.key);for(;b===void 0;)g=this.tree.next(g),g===null?b=null:g.key.consumedBy===void 0&&(b=g.key);if(n.isLeft){let _=null;if(p){const s=p.getIntersection(r);if(s!==null&&(r.isAnEndpoint(s)||(_=s),!p.isAnEndpoint(s))){const w=this._splitSafely(p,s);for(let T=0,P=w.length;T<P;T++)u.push(w[T])}}let C=null;if(b){const s=b.getIntersection(r);if(s!==null&&(r.isAnEndpoint(s)||(C=s),!b.isAnEndpoint(s))){const w=this._splitSafely(b,s);for(let T=0,P=w.length;T<P;T++)u.push(w[T])}}if(_!==null||C!==null){let s=null;_===null?s=C:C===null?s=_:s=ie.comparePoints(_,C)<=0?_:C,this.queue.remove(r.rightSE),u.push(r.rightSE);const w=r.split(s);for(let T=0,P=w.length;T<P;T++)u.push(w[T])}u.length>0?(this.tree.remove(r),u.push(n)):(this.segments.push(r),r.prev=p)}else{if(p&&b){const _=p.getIntersection(b);if(_!==null){if(!p.isAnEndpoint(_)){const C=this._splitSafely(p,_);for(let s=0,w=C.length;s<w;s++)u.push(C[s])}if(!b.isAnEndpoint(_)){const C=this._splitSafely(b,_);for(let s=0,w=C.length;s<w;s++)u.push(C[s])}}}this.tree.remove(r)}return u}_splitSafely(n,r){this.tree.remove(n);const u=n.rightSE;this.queue.remove(u);const h=n.split(r);return h.push(u),n.consumedBy===void 0&&this.tree.add(n),h}}const $n=typeof process!="undefined"&&{}.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,oo=typeof process!="undefined"&&{}.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class so{run(n,r,u){se.type=n,We.reset();const h=[new zn(r,!0)];for(let s=0,w=u.length;s<w;s++)h.push(new zn(u[s],!1));if(se.numMultiPolys=h.length,se.type==="difference"){const s=h[0];let w=1;for(;w<h.length;)It(h[w].bbox,s.bbox)!==null?w++:h.splice(w,1)}if(se.type==="intersection")for(let s=0,w=h.length;s<w;s++){const T=h[s];for(let P=s+1,E=h.length;P<E;P++)if(It(T.bbox,h[P].bbox)===null)return[]}const c=new Mt(ie.compare);for(let s=0,w=h.length;s<w;s++){const T=h[s].getSweepEvents();for(let P=0,E=T.length;P<E;P++)if(c.insert(T[P]),c.size>$n)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const g=new ro(c);let p=c.size,b=c.pop();for(;b;){const s=b.key;if(c.size===p){const T=s.segment;throw new Error(`Unable to pop() ${s.isLeft?"left":"right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${T.id} [${T.leftSE.point.x}, ${T.leftSE.point.y}] -> [${T.rightSE.point.x}, ${T.rightSE.point.y}] from queue.`)}if(c.size>$n)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(g.segments.length>oo)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const w=g.process(s);for(let T=0,P=w.length;T<P;T++){const E=w[T];E.consumedBy===void 0&&c.insert(E)}p=c.size,b=c.pop()}We.reset();const _=ot.factory(g.segments);return new io(_).getGeom()}}const se=new so,lo=function(m){for(var n=arguments.length,r=new Array(n>1?n-1:0),u=1;u<n;u++)r[u-1]=arguments[u];return se.run("union",m,r)},ao=function(m){for(var n=arguments.length,r=new Array(n>1?n-1:0),u=1;u<n;u++)r[u-1]=arguments[u];return se.run("intersection",m,r)},uo=function(m){for(var n=arguments.length,r=new Array(n>1?n-1:0),u=1;u<n;u++)r[u-1]=arguments[u];return se.run("xor",m,r)},co=function(m){for(var n=arguments.length,r=new Array(n>1?n-1:0),u=1;u<n;u++)r[u-1]=arguments[u];return se.run("difference",m,r)};var nt={union:lo,intersection:ao,xor:uo,difference:co};const Eo="datas/geojsons/hongyuan-townships-screen.geojson",ho="assets/json/hongyuan-county-outline.json",Po="assets/json/中华人民共和国.json";function fo(m){return`./${m}`}const go=21,mo=-18,po=-50,Un=-18,Yn=-58,jn=4.2,qn=3.2,yo=2200,bo=0,wo=2600,So=0,_o={__name:"index",props:{active:{type:Boolean,default:!0},activeLayer:{type:Object,default:null},mapRanking:{type:Object,default:null},overlayLayer:{type:Object,default:null},overlayLayers:{type:Array,default:()=>[]},tileUrlTemplate:{type:String,default:"https://qkl-map.oss-cn-chengdu.aliyuncs.com/hy-result/{z}/{x}/{y}.png"},referenceTileUrlTemplate:{type:String,default:"https://map.shuxitech.com/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}"},terrainUrl:{type:String,default:""},center:{type:Array,default:()=>[...Pr]},initialZoom:{type:Number,default:Fr},minimumZoomDistance:{type:Number,default:1},countyViewTargetOffset:{type:Object,default:null},autoApplyLayerMapView:{type:Boolean,default:!0},maxZoom:{type:Number,default:21},adminBoundaryLineScale:{type:Number,default:1},showNationalBackdrop:{type:Boolean,default:!0},enableImageryFeaturePick:{type:Boolean,default:!0},enableTownPolygonPick:{type:Boolean,default:!0},emitEmptyFeatureInfoOnMiss:{type:Boolean,default:!0},hideTownLabelStats:{type:Boolean,default:!1}},emits:["ready","scene-mounted","feature-loading","feature-info","layer-status","tile-status","map-click","draw-boundary","view-change"],setup(m,{expose:n,emit:r}){let u=[],h=null;const c=m,g=r,p=kn(null),b=kn(null),_=Br(null),C=kr(()=>c.activeLayer?[c.activeLayer,...Array.isArray(c.activeLayer.overlayLayers)?c.activeLayer.overlayLayers:[]].filter(Boolean):c.overlayLayers.length?c.overlayLayers.filter(Boolean):c.overlayLayer?[c.overlayLayer]:[]);let s=null,w=null,T=null,P=null,E=null,k=!1,M=0,F=null,B=!1,R=[],A=null,O=[],Y=[],H=[],X=[],$=[],J=[],G=null,j=[],re=[];const be=new Map;let we=null,he=[],Xn=[];const st=new Map,lt=new Map;Rr(()=>{g("scene-mounted"),c.active&&ze()}),vr(()=>Le()),tt(C,()=>Ht(),{deep:!0}),tt(()=>c.mapRanking,()=>ht(),{deep:!0}),tt(()=>c.hideTownLabelStats,()=>ht()),tt(()=>c.active,e=>ge(this,null,function*(){if(!e){Le();return}yield Mn(),ze()}));function ze(){var S,y,x,N;if(s||!b.value)return!!s;const e=window.Cesium;if(!e)return g("layer-status",{type:"error",text:"Cesium 运行资源加载失败"}),!1;k=!1;const t=Jn(e),i=Rt(c.tileUrlTemplate),l=Rt(c.referenceTileUrlTemplate),a=Kn(i),o=l&&l!==i?kt(e,l,{maximumLevel:c.maxZoom}):null,f=i?kt(e,i,{maximumLevel:a?Math.min(c.maxZoom,go):c.maxZoom,rectangle:a?Qn(e):null}):null;if(s=new e.Viewer(b.value,{animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!1,navigationHelpButton:!1,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,scene3DOnly:!0,imageryProvider:!1,terrainProvider:t,useBrowserRecommendedResolution:!1,requestRenderMode:!0,maximumRenderTimeChange:1/0,contextOptions:{webgl:{alpha:!0,antialias:!0}}}),Bt(!1),o){const I=s.imageryLayers.addImageryProvider(o);I.alpha=1,I.brightness=.68,I.contrast=1.08,I.saturation=.48,I.gamma=.9}f&&(A=s.imageryLayers.addImageryProvider(f),A.alpha=a?.88:1,A.brightness=a?.96:.9,A.contrast=a?1.12:1.1,A.saturation=a?1.08:1.05,A.gamma=a?.98:.96),s.scene.globe.terrainExaggeration=c.terrainUrl?1.5:1,s.scene.globe.depthTestAgainstTerrain=!1,s.scene.globe.baseColor=e.Color.fromCssColorString("#061821"),s.scene.backgroundColor=e.Color.fromCssColorString("#020b12"),s.scene.skyAtmosphere.show=!1,s.scene.skyBox&&(s.scene.skyBox.show=!1),s.scene.fog.enabled=!0,s.scene.fog.density=18e-5,s.resolutionScale=Math.min(Math.max(window.devicePixelRatio||1,1),1.5),s.scene.fxaa=!1,s.scene.postProcessStages.fxaa.enabled=!1,s.scene.screenSpaceCameraController.enableCollisionDetection=!0,s.scene.screenSpaceCameraController.minimumZoomDistance=Math.max(1,Number(c.minimumZoomDistance)||1),s.scene.screenSpaceCameraController.maximumZoomDistance=56e4,(S=s.cesiumWidget)!=null&&S.creditContainer&&(s.cesiumWidget.creditContainer.style.display="none"),(y=s._cesiumWidget)!=null&&y._creditContainer&&(s._cesiumWidget._creditContainer.style.display="none"),ii(t,e),vt().then(()=>{var I;!s||(I=s.isDestroyed)!=null&&I.call(s)||(Hi(),ut())}).catch(I=>{console.warn("[cesium-map] county outline load failed",I),g("layer-status",{type:"error",text:"红原县边界加载失败"})}),Ai(),Ui(),gi(),mi(),pi(),ut(),Ht(),ht();const d={viewer:s,clearSelectedFeature:te,focusProject:sn,focusPasture:cn,focusTownByName:on,focusYakIndustryPoint:ln,focusVectorFeature:an,getVectorFeatureAnchorScreen:un,getVectorFeaturesAnchorScreen:Je,getVectorFeatureScreen:Me,getYakIndustryPointScreen:pt,destroy:Le};return _.value=d,(N=(x=f==null?void 0:f.errorEvent)==null?void 0:x.addEventListener)==null||N.call(x,()=>{g("tile-status",{type:"warning",text:"牧场影像底图部分瓦片加载失败"})}),g("tile-status",{type:"success",text:"牧场影像底图已加载"}),window.setTimeout(()=>{var I;s&&!((I=s.isDestroyed)!=null&&I.call(s))&&g("ready")},0),Mn(Ve),!0}function Jn(e){if(!c.terrainUrl)return new e.EllipsoidTerrainProvider;try{return new e.CesiumTerrainProvider({url:c.terrainUrl,requestVertexNormals:!0,requestWaterMask:!1})}catch(t){return k=!0,new e.EllipsoidTerrainProvider}}function kt(e,t,i={}){return t?new e.UrlTemplateImageryProvider({url:t,minimumLevel:i.minimumLevel||3,maximumLevel:i.maximumLevel||c.maxZoom,rectangle:i.rectangle||void 0,tilingScheme:new e.WebMercatorTilingScheme,credit:""}):null}function Rt(e){return String(e||"").trim()}function Kn(e){return/hy-result|qkl-map/i.test(String(e||""))}function Qn(e){return e.Rectangle.fromDegrees(V.west-.035,V.south-.035,V.east+.035,V.north+.035)}function ei(e,t="feature"){const i=[];if(((e==null?void 0:e.features)||[]).forEach(l=>{const a=W(l==null?void 0:l.geometry);jt(a).forEach(o=>{const f=ti(o);f&&i.push(f)})}),!i.length)return[];try{return nt.union(...i)}catch(l){return console.warn(`[cesium-map] ${t} union boundary failed`,l),i.map(a=>a)}}function vt(){return ge(this,null,function*(){return u.length?u:(h||(h=Ue(ho).then(e=>{const t=ei(e,"county outline");return u=t,t}).catch(e=>{throw h=null,e})),h)})}function ti(e){if(!Array.isArray(e))return null;const t=e.map(i=>ni((i||[]).map(q).filter(Boolean))).filter(i=>i.length>=4);return t.length?t:null}function ni(e=[]){if(!e.length)return[];const t=e[0],i=e[e.length-1];return qt(t,i)?e:[...e,t]}function ii(e,t){var l,a,o,f;const i=()=>{!s||k||(k=!0,s.terrainProvider=new t.EllipsoidTerrainProvider,s.scene.globe.terrainExaggeration=1,s.scene.requestRender(),g("layer-status",{type:"warning",text:"CXPT 地形服务暂不可用,已保留三维影像地图"}))};(a=(l=e==null?void 0:e.errorEvent)==null?void 0:l.addEventListener)==null||a.call(l,i),(f=(o=e==null?void 0:e.readyPromise)==null?void 0:o.catch)==null||f.call(o,i)}function ri(){return ze()}function oi(){var e;return!!(s&&!((e=s.isDestroyed)!=null&&e.call(s)))}function si(){Lt()}function Lt(){if(!s){ze();return}s.useDefaultRenderLoop=!0,Ve()}function li(){Le()}function Ve(){var e;!s||(e=s.isDestroyed)!=null&&e.call(s)||(s.resize(),s.scene.requestRender())}function At(){if(!(s!=null&&s.camera)||!window.Cesium)return null;const e=window.Cesium,t=s.camera;return{position:e.Cartesian3.clone(t.positionWC||t.position),direction:e.Cartesian3.clone(t.directionWC||t.direction),up:e.Cartesian3.clone(t.upWC||t.up)}}function $e(e){var i,l,a,o,f,d;if(!(s!=null&&s.camera)||!e||!window.Cesium)return;const t=window.Cesium;(l=(i=s.camera).cancelFlight)==null||l.call(i),(o=(a=s.camera).lookAtTransform)==null||o.call(a,t.Matrix4.IDENTITY),s.camera.setView({destination:t.Cartesian3.clone(e.position),orientation:{direction:t.Cartesian3.clone(e.direction),up:t.Cartesian3.clone(e.up)}}),(d=(f=s.scene)==null?void 0:f.requestRender)==null||d.call(f)}function Ot(e){var t,i;!e||typeof window=="undefined"||((t=window.requestAnimationFrame)==null||t.call(window,()=>$e(e)),(i=window.setTimeout)==null||i.call(window,()=>$e(e),80))}function ai(){te(),Bt(!0)}function ui(e=C.value.find(t=>(t==null?void 0:t.mapView)||(t==null?void 0:t.cameraPosition))){return!s||!e?!1:(mn(e),!0)}function Bt(e=!0){if(!s)return;const t=window.Cesium,i=fi(),l=Dt(c.initialZoom),a=ci(),o=t.Cartesian3.fromDegrees(i[0]+a.lng,i[1]+a.lat,hi()),f=new t.HeadingPitchRange(t.Math.toRadians(mo),t.Math.toRadians(po),l);e?s.camera.flyToBoundingSphere(new t.BoundingSphere(o,1),{offset:f,duration:.9}):(s.camera.lookAt(o,f),s.camera.lookAtTransform(t.Matrix4.IDENTITY)),s.scene.requestRender()}function ci(){var l,a;const e=c.countyViewTargetOffset,t=Number((l=e==null?void 0:e.lng)!=null?l:e==null?void 0:e[0]),i=Number((a=e==null?void 0:e.lat)!=null?a:e==null?void 0:e[1]);return{lng:Number.isFinite(t)?t:0,lat:Number.isFinite(i)?i:Ir.lat}}function hi(){return c.terrainUrl?yo:bo}function at(){return c.terrainUrl?wo:So}function Dt(e){const t=Number.isFinite(Number(e))?Number(e):9;return Math.max(9e3,Math.min(58e4,365e3/Math.pow(1.62,t-9)))}function fi(){const e=q(c.center);return e||[(V.west+V.east)/2,(V.south+V.north)/2]}function gi(){!p.value||!window.ResizeObserver||(T=new ResizeObserver(()=>Ve()),T.observe(p.value))}function mi(){!s||P||(P=s.camera.moveEnd.addEventListener(ut))}function pi(){!s||E||(E=s.scene.postRender.addEventListener(()=>{g("view-change")}))}function ut(){var l,a;if(!s||(l=s.isDestroyed)!=null&&l.call(s))return;const e=Number((a=s.camera.positionCartographic)==null?void 0:a.height)||32e4,t=Math.max(0,Math.min(1,(36e4-e)/3e5)),i={township:1.1+t*.35,countyOutline:1.9+t*.35,countyHalo:4.2+t*.65};Y.forEach(o=>{o!=null&&o.polyline&&o.__hyBoundaryRole==="township"&&(o.polyline.width=i.township)}),he.forEach(o=>{o!=null&&o.polyline&&o.__hyBoundaryRole==="county-outline"&&(o.polyline.width=i.countyOutline),o!=null&&o.polyline&&o.__hyBoundaryRole==="county-halo"&&(o.polyline.width=i.countyHalo)}),s.scene.requestRender()}function Ht(){return ge(this,null,function*(){var i,l;if(!s)return;const e=++M;Cn();const t=C.value;if(!t.length){g("layer-status",{type:"idle",text:"未选择专题图层"}),s.scene.requestRender();return}g("layer-status",{type:"loading",text:"正在加载三维专题图层"});try{if(yield vt(),e!==M||!s)return;for(const a of t){if(e!==M)return;yield di(a,e)}if(e!==M)return;c.autoApplyLayerMapView&&mn(t.find(a=>(a==null?void 0:a.mapView)||(a==null?void 0:a.cameraPosition))),g("layer-status",{type:"success",text:`${t.map(a=>a.name).filter(Boolean).join("、")}已加载`})}catch(a){if(e!==M)return;console.warn("[cesium-map] topic layer failed",a),g("layer-status",{type:"error",text:"三维专题图层加载失败"})}finally{(l=(i=s==null?void 0:s.scene)==null?void 0:i.requestRender)==null||l.call(i)}})}function di(e,t){return ge(this,null,function*(){const i=String((e==null?void 0:e.sourceType)||"wms").toLowerCase();if(i!=="analysis"){if(["geojson","wkt-api","wfs"].includes(i)){const l=yield Si(e);if(t!==M||!l)return;Ni(l,e,H);return}if(i==="wmts"){yi(e);return}wi(e)}})}function yi(e){const t=window.Cesium,i=e.tileMatrixSetID||e.tileMatrixSet||"EPSG:900913",l=Number.isFinite(Number(e.maximumLevel))?Number(e.maximumLevel):21,a=new t.WebMapTileServiceImageryProvider({url:e.url||"/geoserver/gwc/service/wmts",layer:e.layerName,style:e.style||e.styles||"",format:e.format||"image/png",tileMatrixSetID:i,tileMatrixLabels:e.tileMatrixLabels||bi(i,l),tilingScheme:/4326/i.test(i)?new t.GeographicTilingScheme:new t.WebMercatorTilingScheme,maximumLevel:l,credit:e.credit||""}),o=s.imageryLayers.addImageryProvider(a),f=String(e.layerName||"").includes("daping_yak_marks");o.alpha=f?xe(e.opacity,.94):xe(e.opacity,.86),f&&Wt(o,e),o.__hyLayer=e,O.push(o)}function bi(e,t=21){return Array.from({length:t+1},(i,l)=>`${e}:${l}`)}function wi(e){const t=window.Cesium,i={service:"WMS",transparent:!0,format:"image/png",version:"1.1.1",styles:e.styles||""};e.cqlFilter&&(i.cql_filter=e.cqlFilter),e.sldBody&&(i.sld_body=e.sldBody);const l=new t.WebMapServiceImageryProvider({url:e.url||"/geoserver/ne/wms",layers:e.layerName,parameters:i,getFeatureInfoParameters:Ce(oe({},i),{info_format:"application/json",feature_count:10})}),a=s.imageryLayers.addImageryProvider(l),o=String(e.layerName||"").includes("daping_yak_marks");a.alpha=o?xe(e.opacity,.94):xe(e.opacity,.86),o&&Wt(a,e),a.__hyLayer=e,O.push(a)}function Wt(e,t={}){e.brightness=Number.isFinite(Number(t.brightness))?Number(t.brightness):1.08,e.contrast=Number.isFinite(Number(t.contrast))?Number(t.contrast):1.18,e.saturation=Number.isFinite(Number(t.saturation))?Number(t.saturation):1.42,e.gamma=Number.isFinite(Number(t.gamma))?Number(t.gamma):.95}function Si(e){return ge(this,null,function*(){if(e.sourceType==="wkt-api")try{const t=yield fetch(e.apiUrl,{credentials:"same-origin"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return xi(yield t.json())}catch(t){if(!e.fallbackPath)throw t;return Ue(e.fallbackPath)}if(e.sourceType==="wfs"){const t=_i(e);return Ue(t)}return Ue(e.dataPath||e.fallbackPath)})}function Ue(e){return ge(this,null,function*(){if(!e)return null;const t=/^(https?:)?\/\//.test(e)||e.startsWith("/")?e:fo(e),i=yield fetch(t,{credentials:"same-origin"});if(!i.ok)throw new Error(`HTTP ${i.status}`);return i.json()})}function _i(e){const t=new URLSearchParams({service:"WFS",version:"1.1.0",request:"GetFeature",typeName:e.layerName,outputFormat:"application/json",srsName:"EPSG:4326"});return e.cqlFilter&&t.set("cql_filter",e.cqlFilter),e.maxFeatures&&t.set("maxFeatures",String(e.maxFeatures)),Array.isArray(e.propertyName)&&e.propertyName.length?t.set("propertyName",e.propertyName.join(",")):e.propertyName&&t.set("propertyName",e.propertyName),`${e.url||"/geoserver/ne/wfs"}?${t.toString()}`}function Ti(e,t={},i=null,l=null){var S,y,x;const a=((S=e==null?void 0:e.data)==null?void 0:S.type)==="Feature"?e.data:((x=(y=e==null?void 0:e.data)==null?void 0:y.features)==null?void 0:x[0])||(e==null?void 0:e.feature)||null,o=(a==null?void 0:a.properties)||t||{},f=W((a==null?void 0:a.geometry)||o.geometry||o.geom||o.the_geom||o.theGeom||o.wkt||o.shape),d=(a==null?void 0:a.id)||o.id||o.gid||o.objectid||o.OBJECTID||(e==null?void 0:e.name);return{type:"Feature",id:d,properties:o,feature:{type:"Feature",id:d,properties:o,geometry:f},geometry:f,layer:i,lngLat:l}}function xi(e){var l;const t=(l=e==null?void 0:e.data)!=null?l:e;return{type:"FeatureCollection",features:(Array.isArray(t)?t:(t==null?void 0:t.rows)||(t==null?void 0:t.list)||(t==null?void 0:t.records)||(t==null?void 0:t.data)||[]).map((a,o)=>{var f;return{type:"Feature",id:(f=a==null?void 0:a.id)!=null?f:o,properties:oe({},a),geometry:W(a==null?void 0:a.geometry)||bt(Gt(a))}}).filter(a=>a.geometry)}}function Gt(e={}){return e.wkt||e.WKT||e.geom||e.the_geom||e.theGeom||e.shape||e.Shape}function Ni(e,t,i){((e==null?void 0:e.type)==="FeatureCollection"?e.features:(e==null?void 0:e.type)==="Feature"?[e]:[]).filter(a=>a==null?void 0:a.geometry).filter(a=>Li(a.properties||{},t)).map(a=>Ci(a,t)).filter(Boolean).forEach(a=>Se(a,t,i))}function Ci(e,t){const i=W(e==null?void 0:e.geometry),l=(t==null?void 0:t.clipToHongyuanBoundary)===!0,a=Ei(t);if(!i||!["Polygon","MultiPolygon"].includes(i.type)||!l&&!a)return e;let o=i.type==="Polygon"?[i.coordinates]:i.coordinates;try{l&&u.length&&(o=nt.intersection(o,u)),a&&o.length&&(o=nt.intersection(o,[Pi(a)]))}catch(f){return console.warn("[cesium-map] vector layer clipping failed",t==null?void 0:t.key,f),e}return o.length?Ce(oe({},e),{geometry:{type:"MultiPolygon",coordinates:o}}):null}function Ei(e){if(!(e!=null&&e.clipBounds)||e.clipToLayerBounds===!1)return null;const t=e.clipBounds,i=Math.max(Number(t.west),V.west),l=Math.max(Number(t.south),V.south),a=Math.min(Number(t.east),V.east),o=Math.min(Number(t.north),V.north);return![i,l,a,o].every(Number.isFinite)||i>=a||l>=o?null:{west:i,south:l,east:a,north:o}}function Pi(e){return[[[e.west,e.south],[e.east,e.south],[e.east,e.north],[e.west,e.north],[e.west,e.south]]]}function Se(e,t,i,l={}){const a=W(e.geometry);if(!a)return[];const o=ki(t,e.properties||{},l),f=Ye(a,e,t,o);return i.push(...f),f}function Ye(e,t,i,l){const a=window.Cesium,o=[],f=d=>{const S=s.entities.add(d);return S.__hyFeature=t,S.__hyLayer=i,o.push(S),S};if(e.type==="Point"){const d=q(e.coordinates);if(!d||i.hidePointFeatures||i.hidePointMarkers)return o;const S=Vt(i),y=S?Mi(i):10,x=S?a.HeightReference.NONE:a.HeightReference.CLAMP_TO_GROUND;if(l.pointImage){const N={image:l.pointImage,width:l.pointWidth,height:l.pointHeight,scale:1,verticalOrigin:a.VerticalOrigin.BOTTOM,horizontalOrigin:a.HorizontalOrigin.CENTER,heightReference:x,disableDepthTestDistance:Number.POSITIVE_INFINITY,scaleByDistance:new a.NearFarScalar(15e3,.98,24e4,.72)};return i.showPointAtAllDistances||(N.distanceDisplayCondition=new a.DistanceDisplayCondition(0,36e4)),f({position:a.Cartesian3.fromDegrees(d[0],d[1],y),billboard:N,point:Ii(i),label:i.showPointLabels?$t(t):void 0}),o}return f({position:a.Cartesian3.fromDegrees(d[0],d[1],S?y:8),point:{pixelSize:l.pointSize,color:l.fill,outlineColor:l.stroke,outlineWidth:2,heightReference:x,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:i.showPointLabels?$t(t):void 0}),o}if(e.type==="MultiPoint")return e.coordinates.forEach(d=>o.push(...Ye({type:"Point",coordinates:d},t,i,l))),o;if(e.type==="LineString"){const d=ue(e.coordinates);return d.length<2||f({polyline:{positions:d,width:l.lineWidth,material:new a.PolylineGlowMaterialProperty({glowPower:.16,color:l.stroke}),clampToGround:!0}}),o}if(e.type==="MultiLineString")return e.coordinates.forEach(d=>o.push(...Ye({type:"LineString",coordinates:d},t,i,l))),o;if(e.type==="Polygon"){const d=zt(i),S=d>0,y=(i==null?void 0:i.polygonClampToGround)!==!1&&!S,x=Fe(e.coordinates,S?d:8);if(!x)return o;const N={hierarchy:x,height:S?d:0,heightReference:y?a.HeightReference.CLAMP_TO_GROUND:a.HeightReference.NONE,perPositionHeight:!1,material:l.fill,outline:!1};return(i==null?void 0:i.classificationType)!==!1&&(N.classificationType=a.ClassificationType.BOTH),f({polygon:N}),Fi(e.coordinates,t,i,l,o),o}return e.type==="MultiPolygon"&&e.coordinates.forEach(d=>o.push(...Ye({type:"Polygon",coordinates:d},t,i,l))),o}function Fi(e,t,i,l,a){const o=zt(i),f=o>0&&(i==null?void 0:i.polygonClampToGround)===!1;e.forEach(d=>{const S=ue(d,f?o+2:8);if(S.length<2)return;const y=s.entities.add({polyline:{positions:S,width:l.lineWidth,material:l.stroke,depthFailMaterial:l.stroke,clampToGround:!f}});y.__hyFeature=t,y.__hyLayer=i,a.push(y)})}function zt(e){const t=Number(e==null?void 0:e.polygonHeight);return Number.isFinite(t)&&t>0?t:0}function Fe(e=[],t=8){const i=window.Cesium,l=ue(e[0]||[],t);if(l.length<3)return null;const a=e.slice(1).map(o=>{const f=ue(o,t);return f.length>=3?new i.PolygonHierarchy(f):null}).filter(Boolean);return new i.PolygonHierarchy(l,a)}function Ii(e={}){const t=window.Cesium,i=Number(e.pointHitSize||(e.key==="yak-industry-points"?44:0));if(!(!Number.isFinite(i)||i<=0))return{pixelSize:i,color:t.Color.WHITE.withAlpha(.01),outlineColor:t.Color.WHITE.withAlpha(0),outlineWidth:0,heightReference:Vt(e)?t.HeightReference.NONE:t.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}function Vt(e={}){return e.floatPointMarkers===!0||e.key==="yak-industry-points"}function Mi(e={}){const t=Number(e.pointHeightMeters);return Number.isFinite(t)&&t>0?t:120}function $t(e,t){const i=window.Cesium,l=e.properties||{},a=l.name||l.project_name||l.title||"";if(a)return{text:String(a),font:"600 14px PingFang SC, Microsoft YaHei, sans-serif",fillColor:i.Color.WHITE,outlineColor:i.Color.fromCssColorString("#03121e"),outlineWidth:3,style:i.LabelStyle.FILL_AND_OUTLINE,pixelOffset:new i.Cartesian2(0,-22),heightReference:i.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,distanceDisplayCondition:new i.DistanceDisplayCondition(0,15e4)}}function ki(e,t,i={}){var N,I,v,L,D,z,Q,le,ne;const l=window.Cesium,a=vi(e,t),o=xe(e.opacity,.84),f=i.fillColor||(a==null?void 0:a.fillColor)||e.fillColor||e.color||"#24F6C4",d=i.strokeColor||(a==null?void 0:a.strokeColor)||e.strokeColor||e.color||"#B7FFF2",S=(v=(I=(N=i.fillAlpha)!=null?N:a==null?void 0:a.fillAlpha)!=null?I:e.fillAlpha)!=null?v:Math.min(.34,o*.34),y=(z=(D=(L=i.strokeAlpha)!=null?L:a==null?void 0:a.strokeAlpha)!=null?D:e.strokeAlpha)!=null?z:Math.max(.72,o),x=(ne=(le=(Q=i.lineWidth)!=null?Q:a==null?void 0:a.lineWidth)!=null?le:e.lineWidth)!=null?ne:Math.max(1.6,1.8*Number(c.adminBoundaryLineScale||1));return{fill:ct(l,f,S),stroke:ct(l,d,y),lineWidth:x,pointSize:i.pointSize||12,pointImage:Ri((a==null?void 0:a.iconType)||e.pointIconType||e.pointIcon,f,d),pointWidth:26,pointHeight:34}}function ct(e,t,i){try{return e.Color.fromCssColorString(String(t||"#24F6C4")).withAlpha(xe(i,1))}catch(l){return e.Color.CYAN.withAlpha(xe(i,1))}}function Ri(e,t="#30DCFF",i="#C9FBFF"){const l=String(e||"").trim();if(!l||typeof document=="undefined")return null;const a=`${l}|${t}|${i}`;if(lt.has(a))return lt.get(a);const o=document.createElement("canvas"),f=Math.max(1,Math.min(window.devicePixelRatio||1,2)),d=32,S=42;o.width=d*f,o.height=S*f,o.style.width=`${d}px`,o.style.height=`${S}px`;const y=o.getContext("2d");if(!y)return null;y.scale(f,f),y.clearRect(0,0,d,S),y.save(),y.shadowColor=t,y.shadowBlur=12,y.fillStyle="rgba(3, 28, 40, 0.94)",y.beginPath(),y.arc(16,16,12,0,Math.PI*2),y.fill(),y.restore();const x=y.createLinearGradient(5,5,27,31);x.addColorStop(0,i),x.addColorStop(.52,t),x.addColorStop(1,"rgba(3, 30, 42, 0.82)"),y.save(),y.fillStyle=x,y.strokeStyle=i,y.lineWidth=1.5,y.beginPath(),y.arc(16,16,11,0,Math.PI*2),y.fill(),y.stroke(),y.beginPath(),y.moveTo(11,26),y.lineTo(16,38),y.lineTo(21,26),y.closePath(),y.fill(),y.stroke(),y.restore(),y.save(),y.translate(16,16),y.strokeStyle="#062130",y.fillStyle="#062130",y.lineWidth=2,y.lineCap="round",y.lineJoin="round",Ut(y,l),y.restore(),y.save(),y.translate(16,16),y.strokeStyle="rgba(255, 255, 255, 0.92)",y.fillStyle="rgba(255, 255, 255, 0.92)",y.lineWidth=1.25,y.lineCap="round",y.lineJoin="round",Ut(y,l),y.restore();const N=o.toDataURL("image/png");return lt.set(a,N),N}function Ut(e,t){if(t==="grass"){e.beginPath(),e.moveTo(-6,5),e.quadraticCurveTo(-4,-4,0,-8),e.moveTo(0,6),e.quadraticCurveTo(0,-5,5,-10),e.moveTo(5,5),e.quadraticCurveTo(4,-2,8,-6),e.stroke();return}if(t==="storage"){e.strokeRect(-7,-4,14,10),e.beginPath(),e.moveTo(-8,-4),e.lineTo(0,-9),e.lineTo(8,-4),e.moveTo(-3,6),e.lineTo(-3,1),e.lineTo(3,1),e.lineTo(3,6),e.stroke();return}if(t==="milk"){e.beginPath(),e.moveTo(0,-10),e.bezierCurveTo(7,-3,8,2,4,6),e.bezierCurveTo(1,9,-5,8,-7,4),e.bezierCurveTo(-9,0,-5,-5,0,-10),e.fill();return}if(t==="factory"){e.beginPath(),e.rect(-8,-1,15,8),e.rect(4,-8,4,15),e.moveTo(-8,-1),e.lineTo(-4,-5),e.lineTo(0,-1),e.lineTo(4,-5),e.lineTo(7,-1),e.stroke();return}if(t==="trade"){e.beginPath(),e.moveTo(-8,-4),e.lineTo(5,-4),e.lineTo(2,-7),e.moveTo(5,-4),e.lineTo(2,-1),e.moveTo(8,4),e.lineTo(-5,4),e.lineTo(-2,1),e.moveTo(-5,4),e.lineTo(-2,7),e.stroke();return}if(t==="service"){e.beginPath(),e.arc(0,0,7,0,Math.PI*2),e.moveTo(0,-4),e.lineTo(0,4),e.moveTo(-4,0),e.lineTo(4,0),e.stroke();return}if(t==="gene"){e.beginPath(),e.moveTo(-5,-9),e.bezierCurveTo(6,-5,6,4,-5,8),e.moveTo(5,-9),e.bezierCurveTo(-6,-5,-6,4,5,8),e.moveTo(-3,-4),e.lineTo(3,-4),e.moveTo(-3,2),e.lineTo(3,2),e.stroke();return}if(t==="breeding"){e.beginPath(),e.moveTo(-7,-5),e.quadraticCurveTo(-5,-10,-1,-6),e.moveTo(7,-5),e.quadraticCurveTo(5,-10,1,-6),typeof e.roundRect=="function"?e.roundRect(-7,-5,14,11,4):e.rect(-7,-5,14,11),e.moveTo(-3,1),e.lineTo(3,1),e.stroke();return}e.beginPath(),e.moveTo(-8,5),e.lineTo(-8,-3),e.lineTo(0,-9),e.lineTo(8,-3),e.lineTo(8,5),e.closePath(),e.moveTo(-3,5),e.lineTo(-3,0),e.lineTo(3,0),e.lineTo(3,5),e.stroke()}function vi(e,t){var i;return e!=null&&e.activeLegend?e.activeLegend:Array.isArray(e==null?void 0:e.activeLegends)&&e.activeLegends.length?e.activeLegends.find(l=>je(t,l))||e.activeLegends[0]:((e==null?void 0:e.legends)||[]).find(l=>je(t,l))||((i=e==null?void 0:e.legends)==null?void 0:i[0])}function Li(e,t){const i=Array.isArray(t==null?void 0:t.activeLegends)?t.activeLegends.filter(Boolean):[];if(i.length)return i.some(a=>je(e,a));const l=t==null?void 0:t.activeLegend;return l?je(e,l):!0}function je(e,t={}){return t.match?Yt(e,t.match):Array.isArray(t.matches)?t.matches.some(i=>Yt(e,i)):!0}function Yt(e,t={}){var i,l;return String((i=e==null?void 0:e[t.field])!=null?i:"")===String((l=t.value)!=null?l:"")}function Ai(){if(!s)return;U(Y);const e=window.Cesium,t={stroke:e.Color.fromCssColorString("#B8FFF8").withAlpha(.82),fill:e.Color.TRANSPARENT,lineWidth:1.2,pointSize:0};Oi(Tt.features||[]).forEach(i=>{var o;const l=ue(i.points);if(l.length<2)return;const a=s.entities.add({polyline:{positions:l,width:t.lineWidth,material:t.stroke,depthFailMaterial:t.stroke,clampToGround:!0,zIndex:7}});a.__hyBoundaryRole="township",a.__hyTownName=((o=i.townNames)==null?void 0:o[0])||"",Y.push(a)}),s.scene.requestRender()}function Oi(e=[]){const t=new Map;e.forEach(l=>{var f;const a=String(((f=l==null?void 0:l.properties)==null?void 0:f.name)||"").trim(),o=W(l==null?void 0:l.geometry);jt(o).forEach(d=>{const S=((d==null?void 0:d[0])||[]).map(q).filter(Boolean);for(let y=0;y<S.length-1;y+=1){const x=S[y],N=S[y+1];if(!x||!N||qt(x,N))continue;const I=Bi(x,N),v=t.get(I)||{points:[x,N],count:0,townNames:new Set};v.count+=1,a&&v.townNames.add(a),t.set(I,v)}})});const i=Array.from(t.values()).map(l=>Ce(oe({},l),{townNames:Array.from(l.townNames)})).filter(l=>l.count>1&&l.townNames.length>1);return Di(i)}function jt(e){return e!=null&&e.coordinates?e.type==="Polygon"?[e.coordinates]:e.type==="MultiPolygon"?e.coordinates:[]:[]}function Bi(e,t){const i=Ie(e),l=Ie(t);return i<l?`${i}|${l}`:`${l}|${i}`}function Ie(e){return`${Number(e[0]).toFixed(5)},${Number(e[1]).toFixed(5)}`}function qt(e,t){return Math.abs(Number(e[0])-Number(t[0]))<1e-10&&Math.abs(Number(e[1])-Number(t[1]))<1e-10}function Di(e=[]){const t=new Map;e.forEach((a,o)=>{a.points.forEach(f=>{const d=Ie(f),S=t.get(d)||[];S.push(o),t.set(d,S)})});const i=new Set,l=[];return e.forEach((a,o)=>{if(i.has(o))return;i.add(o);const f=[a.points[0],a.points[1]];Zt(f,t,e,i,!0),Zt(f,t,e,i,!1),l.push({points:f,townNames:a.townNames})}),l}function Zt(e,t,i,l,a){for(;e.length;){const o=a?e[0]:e[e.length-1],f=Ie(o),d=(t.get(f)||[]).filter(v=>!l.has(v));if(d.length!==1)return;const S=d[0],y=i[S];l.add(S);const[x,N]=y.points,I=Ie(x)===f?N:x;a?e.unshift(I):e.push(I)}}function Hi(){if(!s||!u.length)return;U(he);const e=window.Cesium;Wi(e),u.forEach(t=>{const l=(Array.isArray(t==null?void 0:t[0])?t[0]:[]).map(q).filter(Boolean);if(l.length<3)return;const a=Fe(t);if(a){const d=s.entities.add({polygon:{hierarchy:a,material:e.Color.fromCssColorString("#20EAF2").withAlpha(.026),outline:!1,perPositionHeight:!1,heightReference:e.HeightReference.CLAMP_TO_GROUND,classificationType:e.ClassificationType.BOTH}});he.push(d)}const o=s.entities.add({polyline:{positions:ue(l),width:4.8,material:new e.PolylineGlowMaterialProperty({glowPower:.16,color:e.Color.fromCssColorString("#78FFF7").withAlpha(.48)}),depthFailMaterial:e.Color.fromCssColorString("#78FFF7").withAlpha(.32),clampToGround:!0,zIndex:8}});o.__hyBoundaryRole="county-halo";const f=s.entities.add({polyline:{positions:ue(l),width:1.9,material:e.Color.fromCssColorString("#F2FFFB").withAlpha(.98),depthFailMaterial:e.Color.fromCssColorString("#F2FFFB").withAlpha(.9),clampToGround:!0,zIndex:9}});f.__hyBoundaryRole="county-outline",he.push(o,f)}),s.scene.requestRender()}function Wi(e){const t=Gi();let i=[];try{i=nt.difference([t],u)}catch(l){console.warn("[cesium-map] county outside mask failed",l),i=[t]}i.forEach(l=>{const a=Fe(l);if(!a)return;const o=s.entities.add({polygon:{hierarchy:a,material:e.Color.fromCssColorString("#020A10").withAlpha(.52),outline:!1,perPositionHeight:!1,heightReference:e.HeightReference.CLAMP_TO_GROUND,classificationType:e.ClassificationType.BOTH,zIndex:1}});he.push(o)})}function Gi(){const e=V.west-jn,t=V.south-qn,i=V.east+jn,l=V.north+qn;return[[[e,t],[i,t],[i,l],[e,l],[e,t]]]}function zi(e,t=!1){const i=(Array.isArray(e)?e:[e]).map(Be=>String(Be||"").trim()).filter(Boolean).slice(0,2),l=`v15-centered-map-badge:${t?"h":"n"}:${i.join("|")}`;if(st.has(l))return st.get(l);const a=document.createElement("canvas"),o=a.getContext("2d");if(!o)return{image:"",width:1,height:1};const f=Math.min(4,Math.max(3,window.devicePixelRatio||2)),d="700 14px Microsoft YaHei, PingFang SC, sans-serif",S="700 9px Microsoft YaHei, PingFang SC, sans-serif",y="800 14px Microsoft YaHei, PingFang SC, sans-serif",x="600 9px Microsoft YaHei, PingFang SC, sans-serif",N=$i(i[1]);o.font=d;const I=Math.ceil(o.measureText(i[0]||"").width);let v=0;N&&(o.font=S,v+=Math.ceil(o.measureText(N.metric).width),o.font=y,v+=Math.ceil(o.measureText(N.value).width),o.font=x,v+=Math.ceil(o.measureText(N.unit).width),v+=N.metric?5:0,v+=N.unit?4:0);const L=Math.min(118,Math.max(N?96:62,I+20,v+20)),D=N?40:25,z=N?5:0,Q=6,le=L+Q*2,ne=D+z+Q*2;a.width=Math.ceil(le*f),a.height=Math.ceil(ne*f),a.style.width=`${le}px`,a.style.height=`${ne}px`,o.scale(f,f),o.clearRect(0,0,le,ne);const ae=Q,Z=Q,Ae=Z+D,Ee=o.createLinearGradient(ae,Z,ae,Ae);Ee.addColorStop(0,t?"rgba(8, 58, 70, 0.9)":"rgba(6, 45, 57, 0.78)"),Ee.addColorStop(.55,t?"rgba(4, 34, 46, 0.88)":"rgba(3, 29, 41, 0.76)"),Ee.addColorStop(1,t?"rgba(2, 22, 32, 0.88)":"rgba(2, 18, 29, 0.78)"),o.save(),o.shadowColor="rgba(48, 220, 255, 0.13)",o.shadowBlur=6,o.fillStyle=Ee,Xt(o,ae,Z,L,D),o.fill(),o.restore(),o.save(),o.globalCompositeOperation="lighter";const Ne=o.createLinearGradient(ae,Z,ae+L,Z);Ne.addColorStop(0,"rgba(42, 210, 255, 0)"),Ne.addColorStop(.5,t?"rgba(98, 246, 255, 0.34)":"rgba(98, 246, 255, 0.26)"),Ne.addColorStop(1,"rgba(42, 210, 255, 0)"),o.strokeStyle=Ne,o.lineWidth=1,o.beginPath(),o.moveTo(ae+10,Z+2),o.lineTo(ae+L-10,Z+2),o.stroke(),o.restore(),o.save(),o.strokeStyle=t?"rgba(126, 251, 246, 0.58)":"rgba(126, 251, 246, 0.46)",o.lineWidth=.9,Xt(o,ae+.5,Z+.5,L-1,D-1),o.stroke(),o.restore();const Oe=ae+L/2;z>0&&(o.save(),o.shadowColor="rgba(48, 220, 255, 0.2)",o.shadowBlur=5,o.beginPath(),o.moveTo(Oe-5,Ae-1),o.lineTo(Oe+5,Ae-1),o.lineTo(Oe,Ae+z),o.closePath(),o.fillStyle=t?"rgba(4, 42, 52, 0.98)":"rgba(3, 31, 43, 0.96)",o.fill(),o.strokeStyle=t?"rgba(126, 251, 246, 0.48)":"rgba(126, 251, 246, 0.34)",o.lineWidth=.8,o.stroke(),o.restore()),o.save(),o.textAlign="center",o.textBaseline="alphabetic",o.fillStyle="rgba(255, 255, 255, 0.98)",o.strokeStyle="rgba(0, 8, 14, 0.98)",o.lineJoin="round",o.shadowColor="rgba(0, 8, 14, 0.72)",o.shadowBlur=0,o.font=d,o.lineWidth=1.6;const _r=Z+(N?12.5:D/2);if(qe(o,i[0]||"",Oe,_r),N){const Be=Z+29.5;let De=Oe-v/2;o.textAlign="left",o.shadowBlur=0,o.font=S,o.lineWidth=1.2,o.fillStyle="rgba(126, 251, 246, 0.9)",N.metric&&(qe(o,N.metric,De,Be,{stroke:!1}),o.font=S,De+=Math.ceil(o.measureText(N.metric).width)+5),o.font=y,o.lineWidth=1.4,o.fillStyle="#FFFFFF",o.shadowColor="rgba(0, 8, 14, 0.72)",o.shadowBlur=0,qe(o,N.value,De,Be),o.shadowBlur=0,De+=Math.ceil(o.measureText(N.value).width)+(N.unit?4:0),N.unit&&(o.font=x,o.fillStyle="rgba(232, 252, 255, 0.76)",qe(o,N.unit,De,Be+1,{stroke:!1}))}o.restore();const En={image:a.toDataURL("image/png"),width:le,height:ne};return st.set(l,En),En}function qe(e,t,i,l,a={}){const o=e.measureText(t),f=Vi(e.font),d=Number(o.actualBoundingBoxAscent)||f*.74,S=Number(o.actualBoundingBoxDescent)||f*.18,y=l+(d-S)/2;a.stroke!==!1&&e.lineWidth>0&&e.strokeText(t,i,y),e.fillText(t,i,y)}function Vi(e){const t=String(e||"").match(/(\d+(?:\.\d+)?)px/);return t?Number(t[1]):14}function $i(e){const t=String(e||"").trim();if(!t)return null;const i=t.match(/^(.+?)\s+([+-]?\d[\d,.]*)(.*)$/u);if(i)return{metric:i[1].trim(),value:i[2].trim(),unit:i[3].trim()};const l=t.match(/^(.*?)([+-]?\d[\d,.]*)([\u4e00-\u9fa5A-Za-z/%]+)?$/u);return l?{metric:l[1].trim(),value:l[2].trim(),unit:(l[3]||"").trim()}:{metric:"",value:t,unit:""}}function Xt(e,t,i,l,a){const o=Math.min(7,l*.12,a*.34);e.beginPath(),e.moveTo(t+o,i),e.lineTo(t+l-o,i),e.lineTo(t+l,i+o),e.lineTo(t+l,i+a-o),e.lineTo(t+l-o,i+a),e.lineTo(t+o,i+a),e.lineTo(t,i+a-o),e.lineTo(t,i+o),e.closePath()}function ht(){var f;if(!s)return;U(X);const e=window.Cesium,t=c.mapRanking||{},i=Array.isArray(t.rows)?t.rows:[],l=new Map(i.map(d=>[fe(d.name),d])),a=t.showTownNames!==!1&&t.hideTownNames!==!0,o=(f=t.hideTownLabelStats)!=null?f:c.hideTownLabelStats;a&&In.forEach(d=>{const S=l.get(fe(d.name)),y=[d.name];if(!o&&S&&t.showMapLabels!==!1){const L=t.metricLabel?`${t.metricLabel} `:"";y.push(`${L}${Sr(S.value)}${S.unit||t.unit||""}`)}const x=q(d.center);if(!x)return;const N=zi(y,!!S),I=!!(o||y.length===1),v=s.entities.add({position:e.Cartesian3.fromDegrees(x[0],x[1],18),billboard:{image:N.image,width:N.width,height:N.height,scale:1,verticalOrigin:I?e.VerticalOrigin.CENTER:e.VerticalOrigin.BOTTOM,horizontalOrigin:e.HorizontalOrigin.CENTER,pixelOffset:I?new e.Cartesian2(0,0):new e.Cartesian2(0,-4),heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,scaleByDistance:new e.NearFarScalar(2e4,.94,36e4,.8),distanceDisplayCondition:new e.DistanceDisplayCondition(0,42e4)}});v.__hyTownName=d.name,v.__hyRankingRow=S||null,X.push(v)}),i.filter(d=>Te(d)).forEach(d=>{const S=Te(d),y=s.entities.add({position:e.Cartesian3.fromDegrees(S[0],S[1],16),point:{pixelSize:9,color:e.Color.fromCssColorString("#35F3FF"),outlineColor:e.Color.WHITE,outlineWidth:2,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:t.showPointMarkers===!1?void 0:{text:String(d.name||""),font:"600 12px PingFang SC, Microsoft YaHei, sans-serif",fillColor:e.Color.WHITE,outlineColor:e.Color.fromCssColorString("#03121e"),outlineWidth:3,style:e.LabelStyle.FILL_AND_OUTLINE,pixelOffset:new e.Cartesian2(0,-18),heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}});y.__hyTownName=d.name,y.__hyRankingRow=d,X.push(y)}),s.scene.requestRender()}function Ui(){if(!s)return;const e=window.Cesium;w=new e.ScreenSpaceEventHandler(s.scene.canvas),w.setInputAction(t=>ge(this,null,function*(){var N,I,v;const i=Yi(t.position),l=Jt(i),a=s.scene.pick(i),o=a==null?void 0:a.id,f=o!=null&&o.__hyFeature?o:null;if(f!=null&&f.__hyFeature){const L=qi(f)||null;Ze(f),g("feature-info",{feature:{id:f.__hyFeature.id,properties:f.__hyFeature.properties||{},feature:f.__hyFeature,geometry:f.__hyFeature.geometry||null,layer:f.__hyLayer,lngLat:L},screen:l});return}const d=ji(i);if(!d)return;const S=e.Cartographic.fromCartesian(d),y={lng:e.Math.toDegrees(S.longitude),lat:e.Math.toDegrees(S.latitude),height:S.height};if(B){er(y);return}const x=cr(y,l);if(x!=null&&x.__hyFeature){Ze(x),g("feature-info",{feature:{id:x.__hyFeature.id,properties:x.__hyFeature.properties||{},feature:x.__hyFeature,geometry:x.__hyFeature.geometry||null,layer:x.__hyLayer,lngLat:y},screen:l});return}if(!(c.enableTownPolygonPick&&(o!=null&&o.__hyTownName)&&mt(o.__hyTownName))){if(c.enableTownPolygonPick){const L=Ji(y);if(L&&mt((N=L.properties)==null?void 0:N.name))return}if(g("map-click",{lngLat:y,screen:l,overlayLayer:C.value[0]||null}),c.enableImageryFeaturePick&&O.length){g("feature-loading",!0);try{const L=s.camera.getPickRay(i),D=yield s.imageryLayers.pickImageryLayerFeatures(L,s.scene),z=D==null?void 0:D[0];if(z){const Q=O.find(Ee=>{var Ne;return Ee.imageryProvider===((Ne=z.imageryLayer)==null?void 0:Ne.imageryProvider)})||O[O.length-1],le=(Q==null?void 0:Q.__hyLayer)||C.value[0],ne=z.properties||((I=z.data)==null?void 0:I.properties)||z.data||{},Z=Ti(z,ne,le,y);nn(Z)||te(),g("feature-info",{feature:{id:Z.id||ne.id||ne.fid||z.name,properties:Z.properties||ne,feature:Z.feature||z,geometry:Z.geometry||((v=Z.feature)==null?void 0:v.geometry)||null,layer:le,lngLat:y},screen:l})}else te(),g("feature-info",{feature:null,screen:l})}catch(L){te(),g("feature-info",{feature:null,screen:l})}finally{g("feature-loading",!1)}return}te(),c.emitEmptyFeatureInfoOnMiss&&g("feature-info",{feature:null,screen:l})}}),e.ScreenSpaceEventType.LEFT_CLICK)}function Yi(e){var I,v,L,D;if(!e||!((I=s==null?void 0:s.scene)!=null&&I.canvas))return e;const t=window.Cesium,i=s.scene.canvas,l=(v=i.getBoundingClientRect)==null?void 0:v.call(i),a=Number(l==null?void 0:l.width)||0,o=Number(l==null?void 0:l.height)||0,f=Number(i.clientWidth||((L=p.value)==null?void 0:L.clientWidth))||a||1,d=Number(i.clientHeight||((D=p.value)==null?void 0:D.clientHeight))||o||1,S=Number(e.x),y=Number(e.y);if(!Number.isFinite(S)||!Number.isFinite(y)||!a||!o)return e;const x=f/a,N=d/o;return Math.abs(x-1)<.001&&Math.abs(N-1)<.001?e:new t.Cartesian2(S*x,y*N)}function Jt(e){var y,x,N,I;if(!e||!((y=s==null?void 0:s.scene)!=null&&y.canvas))return null;const t=s.scene.canvas,i=(x=t.getBoundingClientRect)==null?void 0:x.call(t),l=Number(i==null?void 0:i.width)||0,a=Number(i==null?void 0:i.height)||0,o=Number(t.clientWidth||((N=p.value)==null?void 0:N.clientWidth))||l||1,f=Number(t.clientHeight||((I=p.value)==null?void 0:I.clientHeight))||a||1,d=Number(e.x),S=Number(e.y);return!Number.isFinite(d)||!Number.isFinite(S)||!i?null:{x:(Number(i.left)||0)+d*(l/o),y:(Number(i.top)||0)+S*(a/f)}}function ji(e){if(!s)return null;const t=s.camera.getPickRay(e);return t?s.scene.globe.pick(t,s.scene):null}function qi(e){var a,o,f;if(!s||!e)return null;const t=window.Cesium,i=(o=(a=e.position)==null?void 0:a.getValue)==null?void 0:o.call(a,t.JulianDate.now());if(i){const d=t.Cartographic.fromCartesian(i);return{lng:t.Math.toDegrees(d.longitude),lat:t.Math.toDegrees(d.latitude),height:d.height}}const l=Nn(W((f=e.__hyFeature)==null?void 0:f.geometry));return l?{lng:l[0],lat:l[1],height:0}:null}function Ze(e){var t,i,l,a,o;te(),F=e,e.point&&(e.__hyOriginalPointSize=e.point.pixelSize,e.point.pixelSize=18),e.billboard&&(e.__hyOriginalBillboardScale=e.billboard.scale,e.billboard.scale=1.18),(t=e.__hyFeature)!=null&&t.geometry&&["Polygon","MultiPolygon","LineString","MultiLineString"].includes(e.__hyFeature.geometry.type)&&Xe(e.__hyFeature,{townName:e.__hyTownName||((l=(i=e.__hyFeature)==null?void 0:i.properties)==null?void 0:l.name),mode:"feature"}),(o=(a=s==null?void 0:s.scene)==null?void 0:a.requestRender)==null||o.call(a)}function te(){var e,t;F!=null&&F.point&&F.__hyOriginalPointSize&&(F.point.pixelSize=F.__hyOriginalPointSize),F!=null&&F.billboard&&F.__hyOriginalBillboardScale&&(F.billboard.scale=F.__hyOriginalBillboardScale),F=null,U(J),Kt(),(t=(e=s==null?void 0:s.scene)==null?void 0:e.requestRender)==null||t.call(e)}function Xe(e,t={}){var N,I,v,L;if(!s||!(e!=null&&e.geometry))return[];const i=Zi({append:t.append===!0});if(!i)return[];const l=window.Cesium,a=t.mode==="town",o=t.highlightTone==="white"||t.mode==="white",f=t.highlightTone==="v21",d=a?"#30DCFF":o?"#FFFFFF":f?"#FFD166":"#FF2D2D",S=a?"#F2FFFF":o?"#FFFFFF":f?"#FFF1B8":"#FF2D2D",y={fill:l.Color.fromCssColorString(d).withAlpha((N=t.fillAlpha)!=null?N:a?.16:o?.035:f?.2:.16),stroke:l.Color.fromCssColorString(S).withAlpha((I=t.strokeAlpha)!=null?I:o?.9:.98),lineWidth:(v=t.lineWidth)!=null?v:a?4.2:o?3.8:f?4.4:5.2,pointSize:a?0:(L=t.pointSize)!=null?L:14},x=en(e.geometry,e,i.entities,y);return x.forEach(D=>{var z;D.__hyFeature=null,D.__hyLayer=null,D.__hyTownName=t.townName||((z=e.properties)==null?void 0:z.name)||"",D.__hySelectedOverlay=!0}),J.push(...x),Qt(i),x}function Zi(e={}){return!s||!window.Cesium?null:(e.append&&G||(Kt(),G=new window.Cesium.CustomDataSource("selected-feature-overlay"),s.dataSources.add(G),Qt(G)),G)}function Kt(){var t,i;if(!(s!=null&&s.dataSources)){G=null;return}Array.from(new Set([G,...((i=(t=s.dataSources).getByName)==null?void 0:i.call(t,"selected-feature-overlay"))||[]].filter(Boolean))).forEach(l=>{try{s.dataSources.remove(l,!0)}catch(a){console.warn("[cesium-map] remove selected overlay failed",a)}}),G=null,J=[]}function Qt(e){var t,i;if(!(!(s!=null&&s.dataSources)||!e))try{if(s.dataSources.raiseToTop){s.dataSources.raiseToTop(e);return}for(;((i=(t=s.dataSources).indexOf)==null?void 0:i.call(t,e))<s.dataSources.length-1;)s.dataSources.raise(e)}catch(l){console.warn("[cesium-map] raise selected overlay failed",l)}}function en(e,t,i,l){const a=window.Cesium,o=[];if(!e||!i)return o;const f=d=>{const S=i.add(d);return S.__hyFeature=t,o.push(S),S};if(e.type==="Point"){const d=q(e.coordinates);return!d||l.pointSize<=0||f({position:a.Cartesian3.fromDegrees(d[0],d[1]),point:{show:!0,color:l.fill,pixelSize:l.pointSize,outlineColor:l.stroke,outlineWidth:3,heightReference:a.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),o}return e.type==="MultiPoint"?(e.coordinates.forEach(d=>{o.push(...en({type:"Point",coordinates:d},t,i,l))}),o):e.type==="LineString"?(ft(e.coordinates,t,i,l,o),o):e.type==="MultiLineString"?(e.coordinates.forEach(d=>{ft(d,t,i,l,o)}),o):e.type==="Polygon"?(tn(e.coordinates,t,i,l,o),o):(e.type==="MultiPolygon"&&e.coordinates.forEach(d=>{tn(d,t,i,l,o)}),o)}function tn(e,t,i,l,a){const o=window.Cesium,f=Fe(e);if(!f)return;const d=i.add({polygon:{hierarchy:f,height:0,heightReference:o.HeightReference.CLAMP_TO_GROUND,perPositionHeight:!1,clampToGround:!0,material:l.fill,outline:!1,classificationType:o.ClassificationType.BOTH,zIndex:999}});d.__hyFeature=t,a.push(d),e.forEach(S=>ft(S,t,i,l,a))}function ft(e,t,i,l,a){const o=window.Cesium,f=ue(e);if(f.length<2)return;const d=i.add({polyline:{positions:f,width:l.lineWidth,material:l.stroke,depthFailMaterial:l.stroke,heightReference:o.HeightReference.CLAMP_TO_GROUND,clampToGround:!0,classificationType:o.ClassificationType.BOTH,zIndex:1e3}});d.__hyFeature=t,a.push(d)}function nn(e,t={}){var o,f,d,S,y;if(!s||!e)return!1;const i=e.properties||((o=e.feature)==null?void 0:o.properties)||(typeof e=="object"?e:{}),l=W(e.geometry||((f=e.feature)==null?void 0:f.geometry)||i.geometry||i.geom||i.wkt||e);if(!l)return!1;te();const a={type:"Feature",id:e.id||((d=e.feature)==null?void 0:d.id)||i.id,properties:i,geometry:l};return Xe(a,oe({mode:"feature"},t)),(y=(S=s==null?void 0:s.scene)==null?void 0:S.requestRender)==null||y.call(S),J.length>0}function Xi(e){const t=fe(e);return t&&(Tt.features||[]).find(i=>{var l;return fe((l=i==null?void 0:i.properties)==null?void 0:l.name)===t})||null}function gt(){var e,t;return((e=c.mapRanking)==null?void 0:e.scope)==="town"&&Array.isArray((t=c.mapRanking)==null?void 0:t.rows)&&c.mapRanking.rows.length>0}function rn(e){var i;if(!gt())return!1;const t=fe(e);return(((i=c.mapRanking)==null?void 0:i.rows)||[]).some(l=>fe(l.name)===t)}function Ji(e){return gt()&&(Tt.features||[]).find(t=>{var l;const i=(l=t==null?void 0:t.properties)==null?void 0:l.name;return rn(i)&&yn(e,W(t==null?void 0:t.geometry))})||null}function mt(e,t={}){var l,a,o,f;if(!gt()||!rn(e))return!1;const i=Xi(e);return i?(te(),Xe(i,{mode:"town",townName:((l=i.properties)==null?void 0:l.name)||e}),t.emitFeatureInfo!==!1&&g("feature-info",{feature:null}),t.emitStatus!==!1&&g("layer-status",{type:"success",text:`已选中${((a=i.properties)==null?void 0:a.name)||e}`}),(f=(o=s==null?void 0:s.scene)==null?void 0:o.requestRender)==null||f.call(o),!0):!1}function on(e,t={}){const i=In.find(a=>fe(a.name)===fe(e)),l=q(i==null?void 0:i.center);return l?(t.select&&mt(e,{emitFeatureInfo:!1,emitStatus:!1}),gn(l,42e3),{screen:_e(l)}):null}function sn(e={}){var f,d;const t=fr(e),i=ur(S=>gr(S,t));if(!i.length)return null;const l=mr(i),a=pr(l);te(),F=i[0],F!=null&&F.point&&(F.__hyOriginalPointSize=F.point.pixelSize,F.point.pixelSize=18),F!=null&&F.billboard&&(F.__hyOriginalBillboardScale=F.billboard.scale,F.billboard.scale=1.18),a.forEach((S,y)=>{Xe(S,{mode:"feature",highlightTone:t.highlightTone,append:y>0})});const o=_t(l);return o?ke(o,.9):s.flyTo(i[0],{duration:.9,offset:Re(18e3)}),(d=(f=s==null?void 0:s.scene)==null?void 0:f.requestRender)==null||d.call(f),{entity:i[0],entities:i,feature:l[0]||i[0].__hyFeature,features:l,highlightFeatures:a,screen:Je(a.length?a:l)}}function ln(e={}){const t=Te(e);let i=yt(l=>Ke(l,e));return i?(Ze(i),s.flyTo(i,{duration:.9,offset:Re(16e3)})):t&&gn(t,16e3),{feature:(i==null?void 0:i.__hyFeature)||null,screen:pt(e)}}function an(e={}){const t=yt(i=>Ke(i,e));return t?(Ze(t),s.flyTo(t,{duration:.9,offset:Re(18e3)}),{feature:t.__hyFeature,screen:Me(t.__hyFeature)}):null}function Me(e){var i;const t=Nn(W((e==null?void 0:e.geometry)||((i=e==null?void 0:e.feature)==null?void 0:i.geometry)));return t?_e(t):null}function un(e){return Je([e])||Me(e)}function Je(e=[]){const t=[];if((Array.isArray(e)?e:[e]).forEach(a=>{var S,y;const o=(a==null?void 0:a.properties)||((S=a==null?void 0:a.feature)==null?void 0:S.properties)||{},f=W((a==null?void 0:a.geometry)||((y=a==null?void 0:a.feature)==null?void 0:y.geometry)||o.geometry||o.geom||o.wkt||o.geo||o.the_geom||o.geometryWkt||o.geometry_wkt||o.shape);if(!f){const x=Me(a);x&&t.push(x);return}const d=[];ve(f.coordinates,d),t.push(...d.map(_e).filter(Boolean))}),!t.length)return null;const i=t.map(a=>Number(a.x)).filter(Number.isFinite),l=t.map(a=>Number(a.y)).filter(Number.isFinite);return!i.length||!l.length?null:{x:(Math.min(...i)+Math.max(...i))/2,y:Math.min(...l)}}function pt(e={}){var a,o;const t=Te(e);if(t)return _e(t);const i=yt(f=>Ke(f,e)),l=(o=(a=i==null?void 0:i.position)==null?void 0:a.getValue)==null?void 0:o.call(a,window.Cesium.JulianDate.now());return l?toLogicalScreen(window.Cesium.SceneTransforms.wgs84ToWindowCoordinates(s.scene,l)):null}function cn(e={}){var f,d;hn();const t=dr(e.grasslands||e),i=e.highlightTone==="white",l=i?null:{fillColor:"#FF3B30",strokeColor:"#FF3B30",fillAlpha:.1,strokeAlpha:.68,lineWidth:12},a=i?{fillColor:"#F7FFFF",strokeColor:"#F7FFFF",fillAlpha:.025,strokeAlpha:.9,lineWidth:3.8}:{fillColor:"#FF2D2D",strokeColor:"#FFE1E1",fillAlpha:.3,strokeAlpha:1,lineWidth:6.2};e.locateOnly||(t.forEach(S=>{l&&Se(S,{key:"pasture-focus-glow",name:e.name||"牧场高亮"},$,l),Se(S,{key:"pasture-focus",name:e.name||"牧场高亮"},$,a)}),(Array.isArray(e.yakMarks)?e.yakMarks:[]).forEach((S,y)=>{const x=Te(S);x&&Se({type:"Feature",id:S.id||y,properties:oe({},S),geometry:{type:"Point",coordinates:x}},{key:"pasture-focus-yak",name:"牦牛识别"},$,{fillColor:"#FFCB45",strokeColor:"#FFF4B8",pointSize:11})}));const o=_t(t);return o&&ke(o,.9),(d=(f=s==null?void 0:s.scene)==null?void 0:f.requestRender)==null||d.call(f),!!t.length}function hn(){var e,t;U($),(t=(e=s==null?void 0:s.scene)==null?void 0:e.requestRender)==null||t.call(e)}function Ki(){te()}function Qi(e){B=!!e,B||(R=[]),dt(),g("draw-boundary",{status:B?"drawing":"clear",pointCount:R.length,points:R})}function er(e){R.push([e.lng,e.lat]),dt(),g("draw-boundary",{status:"drawing",pointCount:R.length,points:R})}function tr(){R.pop(),dt(),g("draw-boundary",{status:"drawing",pointCount:R.length,points:R})}function nr(){if(R.length<3)return null;const e=At(),t=[...R,R[0]],i={type:"Feature",properties:{source:"drawn"},geometry:{type:"Polygon",coordinates:[t]}};return B=!1,R=[],U(j),Se(i,{key:"analysis-boundary",name:"分析边界"},j,{fillColor:"#24F6C4",strokeColor:"#B7FFF2",fillAlpha:.12,strokeAlpha:1,lineWidth:3}),g("draw-boundary",{status:"complete",pointCount:0,points:[],feature:i}),$e(e),Ot(e),i}function ir(){var e,t;B=!1,R=[],U(j),U(re),g("draw-boundary",{status:"clear",pointCount:0,points:[]}),(t=(e=s==null?void 0:s.scene)==null?void 0:e.requestRender)==null||t.call(e)}function dt(){if(!s)return;const e=window.Cesium;U(j),R.forEach(t=>{j.push(s.entities.add({position:e.Cartesian3.fromDegrees(t[0],t[1],12),point:{pixelSize:10,color:e.Color.fromCssColorString("#24F6C4"),outlineColor:e.Color.WHITE,outlineWidth:2,heightReference:e.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}))}),R.length>1&&j.push(s.entities.add({polyline:{positions:ue(R),width:3,material:e.Color.fromCssColorString("#24F6C4"),clampToGround:!0}})),s.scene.requestRender()}function rr(e={}){var a,o,f,d,S,y,x;const t=((a=e.boundary)==null?void 0:a.type)==="Feature"||(o=e.boundary)!=null&&o.geometry?e.boundary:null,i=e.preserveView===!0||((f=t==null?void 0:t.properties)==null?void 0:f.source)==="drawn",l=i?At():null;if(i&&((S=(d=s==null?void 0:s.camera)==null?void 0:d.cancelFlight)==null||S.call(d)),U(re),t&&Se(t,{key:"analysis-result-boundary"},re,{fillColor:"#24F6C4",strokeColor:"#B7FFF2",fillAlpha:.1,lineWidth:3}),(Array.isArray(e.matches)?e.matches:[]).forEach(N=>{const I=(N==null?void 0:N.type)==="Feature"?N:(N==null?void 0:N.feature)||null;I&&Se(I,{key:"analysis-result-feature"},re,{fillColor:"#30DCFF",strokeColor:"#C9FBFF",fillAlpha:.1,lineWidth:2.6})}),i)$e(l),Ot(l);else{const N=[t,...e.matches||[]].filter(Boolean),I=_t(N);I&&ke(I,.9)}(x=(y=s==null?void 0:s.scene)==null?void 0:y.requestRender)==null||x.call(y)}function or(e={}){if(!s||!window.Cesium)return 0;const t=Array.isArray(e.features)?e.features:[];if(!t.length)return 0;const i=window.Cesium,l=String(e.key||"engineering-suitability"),a={key:`engineering-suitability-${l}`,name:e.name||"工程适宜实施区域",sourceType:"analysis"},o=ct(i,e.color||"#FFD43B",.52),f=[];if(ar(t),t.forEach(y=>{const x=W(y==null?void 0:y.geometry);((x==null?void 0:x.type)==="Polygon"?[x.coordinates]:(x==null?void 0:x.type)==="MultiPolygon"?x.coordinates:[]).forEach((I,v)=>{var D,z;const L=Fe(I);if(L)try{const Q=Ce(oe({},y),{id:y.id||`${l}-${f.length}`,properties:Ce(oe({},y.properties||{}),{engineering_type:((D=y.properties)==null?void 0:D.engineering_type)||l,engineering_name:((z=y.properties)==null?void 0:z.engineering_name)||e.name})});f.push(new i.GeometryInstance({id:{__hyFeature:Q,__hyLayer:a,__hyEngineeringType:l,__hyPolygonIndex:v},geometry:new i.PolygonGeometry({polygonHierarchy:L,vertexFormat:i.PerInstanceColorAppearance.VERTEX_FORMAT}),attributes:{color:i.ColorGeometryInstanceAttribute.fromColor(o)}}))}catch(Q){console.warn("[cesium-map] engineering suitability geometry skipped",y==null?void 0:y.id,Q)}})}),!f.length)return 0;const d=s.scene.primitives.add(new i.GroundPrimitive({geometryInstances:f,appearance:new i.PerInstanceColorAppearance({translucent:!0,closed:!0,flat:!0}),classificationType:i.ClassificationType.TERRAIN,allowPicking:!0,asynchronous:!0,releaseGeometryInstances:!0}));d.__hyEngineeringType=l,d.show=!0;const S=be.get(l)||[];return S.push(d),be.set(l,S),s.scene.requestRender(),f.length}function sr(e,t){var l,a;(be.get(String(e||""))||[]).forEach(o=>{o.show=t!==!1}),(a=(l=s==null?void 0:s.scene)==null?void 0:l.requestRender)==null||a.call(l)}function lr(){var e,t;we&&ke(we,.8),(t=(e=s==null?void 0:s.scene)==null?void 0:e.requestRender)==null||t.call(e)}function fn(){var e,t;te(),be.forEach(i=>{i.forEach(l=>{var a,o,f;return(f=(o=(a=s==null?void 0:s.scene)==null?void 0:a.primitives)==null?void 0:o.remove)==null?void 0:f.call(o,l)})}),be.clear(),we=null,(t=(e=s==null?void 0:s.scene)==null?void 0:e.requestRender)==null||t.call(e)}function ar(e=[]){const t=we||{west:1/0,south:1/0,east:-1/0,north:-1/0};e.forEach(i=>{const l=W(i==null?void 0:i.geometry);if(!l)return;const a=[];ve(l.coordinates,a),a.forEach(o=>{t.west=Math.min(t.west,Number(o[0])),t.south=Math.min(t.south,Number(o[1])),t.east=Math.max(t.east,Number(o[0])),t.north=Math.max(t.north,Number(o[1]))})}),[t.west,t.south,t.east,t.north].every(Number.isFinite)&&(we=t)}function gn(e,t=22e3,i=.9){if(!s||!e)return;const l=window.Cesium,a=l.Cartesian3.fromDegrees(e[0],e[1],at());s.camera.flyToBoundingSphere(new l.BoundingSphere(a,1),{offset:Re(t),duration:i})}function ke(e,t=.9){if(!s||!e)return;const i=window.Cesium,l=[(Number(e.west)+Number(e.east))/2,(Number(e.south)+Number(e.north))/2];if(!l.every(Number.isFinite))return;const a=Math.max(Math.abs(Number(e.east)-Number(e.west)),Math.abs(Number(e.north)-Number(e.south))),o=Math.max(18e3,Math.min(16e4,a*135e3)),f=i.Cartesian3.fromDegrees(l[0],l[1],at());s.camera.flyToBoundingSphere(new i.BoundingSphere(f,1),{offset:Re(o),duration:t})}function mn(e){if(!s||!e)return;const t=e.mapView||(e.cameraPosition?{cameraPosition:e.cameraPosition}:null);if(!t)return;const i=window.Cesium,l=Number.isFinite(Number(t.duration))?Number(t.duration):.9,a=q(t.targetLngLat);if(a){const o=Dt(c.initialZoom),f=Number.isFinite(Number(t.distanceScale))?Number(t.distanceScale):1,d=Math.max(18e3,Math.min(56e4,o*f)),S=Number.isFinite(Number(t.targetHeight))?Number(t.targetHeight):at(),y=Number.isFinite(Number(t.heading))?Number(t.heading):Un,x=Number.isFinite(Number(t.pitch))?Number(t.pitch):Yn,N=i.Cartesian3.fromDegrees(a[0],a[1],S);s.camera.flyToBoundingSphere(new i.BoundingSphere(N,1),{offset:new i.HeadingPitchRange(i.Math.toRadians(y),i.Math.toRadians(x),d),duration:l});return}t.bounds&&ke(t.bounds,l)}function Re(e){const t=window.Cesium;return new t.HeadingPitchRange(t.Math.toRadians(Un),t.Math.toRadians(Yn),e)}function _e(e){if(!s||!e)return null;const t=window.Cesium,i=t.Cartesian3.fromDegrees(e[0],e[1],16);return Jt(t.SceneTransforms.wgs84ToWindowCoordinates(s.scene,i))}function yt(e){return[...H,...$].find(t=>t.__hyFeature&&e(t.__hyFeature))||null}function ur(e){return[...H,...$].filter(t=>t.__hyFeature&&e(t.__hyFeature))}function cr(e,t){if(!Number.isFinite(e==null?void 0:e.lng)||!Number.isFinite(e==null?void 0:e.lat))return null;const i=pn(H),l=i.map(o=>{var f;return{entity:o,geometry:W((f=o.__hyFeature)==null?void 0:f.geometry)}}).filter(o=>o.geometry&&yn(e,o.geometry)).sort((o,f)=>bn(o.geometry)-bn(f.geometry));if(l.length)return l[0].entity;const a=i.map(o=>{var f;return{entity:o,distance:yr(W((f=o.__hyFeature)==null?void 0:f.geometry),t),tolerance:hr(o)}}).filter(o=>Number.isFinite(o.distance)).sort((o,f)=>o.distance-f.distance)[0];return(a==null?void 0:a.distance)<=((a==null?void 0:a.tolerance)||18)?a.entity:null}function hr(e){var i,l,a;const t=(l=W((i=e==null?void 0:e.__hyFeature)==null?void 0:i.geometry))==null?void 0:l.type;return["Point","MultiPoint"].includes(t)?((a=e==null?void 0:e.__hyLayer)==null?void 0:a.key)==="yak-industry-points"?36:28:18}function Ke(e,t={}){const i=(e==null?void 0:e.properties)||{},l=[t.id,t.key,t.featureId,t.projectId].filter(y=>y!=null&&y!=="").map(String),a=[e.id,i.id,i.key,i.feature_id,i.project_id].filter(y=>y!=null&&y!=="").map(String);if(l.some(y=>a.includes(y)))return!0;const o=[t.name,t.fullName,t.projectName].filter(Boolean).map(String),f=[i.name,i.fullName,i.project_name,i.projectName].filter(Boolean).map(String);if(o.some(y=>f.includes(y)))return!0;const d=Te(t),S=Te(Ce(oe({},i),{geometry:e.geometry}));return!!(d&&S&&Math.abs(d[0]-S[0])<2e-5&&Math.abs(d[1]-S[1])<2e-5)}function fr(e={}){return e&&typeof e=="object"?e:{name:e,projectName:e,project_name:e}}function gr(e,t={}){if(Ke(e,t))return!0;const i=(e==null?void 0:e.properties)||{},l=Qe([t.id,t.key,t.featureId,t.projectId,t.project_id]),a=Qe([e==null?void 0:e.id,i.id,i.key,i.feature_id,i.project_id,i.gid]);if(l.some(d=>a.includes(d)))return!0;const o=Qe([t.name,t.fullName,t.projectName,t.project_name,t.title]),f=Qe([i.name,i.fullName,i.project_name,i.projectName,i.title]);return o.some(d=>f.includes(d))}function Qe(e=[]){const t=[];return e.forEach(i=>{if(i==null||i==="")return;const l=String(i).trim();if(!l)return;t.push(l);const a=l.replace(/\s+/g,"");a&&a!==l&&t.push(a)}),Array.from(new Set(t))}function pn(e=[]){const t=new Set;return e.filter(i=>{const l=i==null?void 0:i.__hyFeature;return!l||t.has(l)?!1:(t.add(l),!0)})}function mr(e=[]){return pn(e).map(t=>t.__hyFeature).filter(Boolean)}function pr(e=[]){const t=e.filter(l=>{var o;const a=String(((o=W(l==null?void 0:l.geometry))==null?void 0:o.type)||"");return a.includes("Polygon")||a.includes("LineString")}),i=t.filter(l=>{var a;return((a=l==null?void 0:l.properties)==null?void 0:a.feature_role)==="工程范围"});return i.length?i:t}function dr(e){return(Array.isArray(e)?e:(e==null?void 0:e.grasslands)||(e==null?void 0:e.features)||(e==null?void 0:e.rows)||(e==null?void 0:e.list)||(e?[e]:[])).map((i,l)=>{var o,f;if((i==null?void 0:i.type)==="Feature")return i;const a=W(i==null?void 0:i.geometry)||bt(Gt(i));return a?{type:"Feature",id:(f=(o=i==null?void 0:i.id)!=null?o:i==null?void 0:i.grasslandId)!=null?f:l,properties:oe({},i),geometry:a}:null}).filter(Boolean)}function W(e){if(!e)return null;if(e.type==="Feature")return W(e.geometry);if(e.type&&Array.isArray(e.coordinates))return e;if(typeof e=="string"){const t=e.trim();if(!t)return null;if(t.startsWith("{")||t.startsWith("["))try{return W(JSON.parse(t))}catch(i){return null}return bt(t)}return null}function bt(e){const i=String(e||"").trim().replace(/^SRID=\d+;/i,"").match(/^([A-Z]+)(?:\s+[A-Z]+)?\s*(\(.+\))$/i);if(!i)return null;const l=i[1].toUpperCase(),a=i[2];return l==="POINT"?{type:"Point",coordinates:wt(a)}:l==="MULTIPOINT"?{type:"MultiPoint",coordinates:et(a).map(wt).filter(Boolean)}:l==="LINESTRING"?{type:"LineString",coordinates:St(a)}:l==="MULTILINESTRING"?{type:"MultiLineString",coordinates:et(a).map(St).filter(o=>o.length)}:l==="POLYGON"?{type:"Polygon",coordinates:dn(a)}:l==="MULTIPOLYGON"?{type:"MultiPolygon",coordinates:et(a).map(dn).filter(o=>o.length)}:null}function wt(e){const t=String(e||"").replace(/^\(+|\)+$/g,"").trim().split(/\s+/).slice(0,2).map(Number);return t.length===2&&t.every(Number.isFinite)?t:null}function St(e){return String(e||"").replace(/^\(+|\)+$/g,"").split(",").map(wt).filter(Boolean)}function dn(e){return et(e).map(St).filter(t=>t.length>=3)}function et(e){const t=String(e||"").trim(),i=t.startsWith("(")&&t.endsWith(")")?t.slice(1,-1):t,l=[];let a=0,o=-1;return Array.from(i).forEach((f,d)=>{f==="("?(a===0&&(o=d),a+=1):f===")"&&(a-=1,a===0&&o>=0&&(l.push(i.slice(o,d+1)),o=-1))}),l.length?l:[i]}function ue(e=[],t=8){const i=window.Cesium;return e.map(q).filter(Boolean).map(l=>i.Cartesian3.fromDegrees(l[0],l[1],t))}function q(e){if(!Array.isArray(e)||e.length<2)return null;const t=Number(e[0]),i=Number(e[1]);return Number.isFinite(t)&&Number.isFinite(i)?[t,i]:null}function Te(e={}){const t=W(e.geometry);return(t==null?void 0:t.type)==="Point"?q(t.coordinates):[[e.longitude,e.latitude],[e.lng,e.lat],[e.lon,e.lat],[e.x,e.y],e.point,e.center,e.centroid,e.coordinates].map(q).find(Boolean)||null}function yn(e,t){return!e||!(t!=null&&t.coordinates)?!1:t.type==="Polygon"?Tn(e,t.coordinates):t.type==="MultiPolygon"?t.coordinates.some(i=>Tn(e,i)):!1}function bn(e){return e!=null&&e.coordinates?e.type==="Polygon"?wn(e.coordinates):e.type==="MultiPolygon"?e.coordinates.reduce((t,i)=>t+wn(i),0):Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY}function wn(e=[]){const t=e[0]||[];if(t.length<3)return Number.POSITIVE_INFINITY;let i=0;for(let l=0;l<t.length;l+=1){const a=t[l],o=t[(l+1)%t.length];i+=Number((a==null?void 0:a[0])||0)*Number((o==null?void 0:o[1])||0)-Number((o==null?void 0:o[0])||0)*Number((a==null?void 0:a[1])||0)}return Math.abs(i)}function yr(e,t){return!(e!=null&&e.coordinates)||!t?Number.POSITIVE_INFINITY:e.type==="Point"?Sn(e.coordinates,t):e.type==="MultiPoint"?Math.min(...e.coordinates.map(i=>Sn(i,t))):e.type==="LineString"?_n(e.coordinates,t):e.type==="MultiLineString"?Math.min(...e.coordinates.map(i=>_n(i,t))):Number.POSITIVE_INFINITY}function Sn(e,t){const i=_e(q(e));return i?Math.hypot(Number(i.x)-Number(t.x),Number(i.y)-Number(t.y)):Number.POSITIVE_INFINITY}function _n(e=[],t){if(!Array.isArray(e)||e.length<2)return Number.POSITIVE_INFINITY;let i=Number.POSITIVE_INFINITY;for(let l=1;l<e.length;l+=1){const a=_e(q(e[l-1])),o=_e(q(e[l]));!a||!o||(i=Math.min(i,br(t,a,o)))}return i}function br(e,t,i){const l=Number(t.x),a=Number(t.y),o=Number(i.x)-l,f=Number(i.y)-a;if(![l,a,o,f].every(Number.isFinite))return Number.POSITIVE_INFINITY;if(!o&&!f)return Math.hypot(Number(e.x)-l,Number(e.y)-a);const d=Math.max(0,Math.min(1,((Number(e.x)-l)*o+(Number(e.y)-a)*f)/(o*o+f*f)));return Math.hypot(Number(e.x)-(l+d*o),Number(e.y)-(a+d*f))}function Tn(e,t=[]){return!t.length||!xn(e,t[0])?!1:!t.slice(1).some(i=>xn(e,i))}function xn(e,t=[]){if(t.length<3)return!1;const i=Number(e.lng),l=Number(e.lat);if(!Number.isFinite(i)||!Number.isFinite(l))return!1;let a=!1;for(let o=0,f=t.length-1;o<t.length;f=o++){const d=t[o],S=t[f],y=Number(d==null?void 0:d[0]),x=Number(d==null?void 0:d[1]),N=Number(S==null?void 0:S[0]),I=Number(S==null?void 0:S[1]);if(![y,x,N,I].every(Number.isFinite))continue;if(wr(i,l,y,x,N,I))return!0;x>l!=I>l&&i<(N-y)*(l-x)/(I-x)+y&&(a=!a)}return a}function wr(e,t,i,l,a,o){const f=(e-i)*(o-l)-(t-l)*(a-i);return Math.abs(f)>1e-10?!1:(e-i)*(e-a)+(t-l)*(t-o)<=1e-10}function Nn(e){if(!e)return null;if(e.type==="Point")return q(e.coordinates);const t=[];return ve(e.coordinates,t),t.length?[t.reduce((i,l)=>i+l[0],0)/t.length,t.reduce((i,l)=>i+l[1],0)/t.length]:null}function ve(e,t){const i=q(e);if(i&&!Array.isArray(e[0])){t.push(i);return}Array.isArray(e)&&e.forEach(l=>ve(l,t))}function _t(e=[]){const t=[];if(e.forEach(f=>{var S;const d=W((f==null?void 0:f.geometry)||((S=f==null?void 0:f.feature)==null?void 0:S.geometry)||f);d&&ve(d.coordinates,t)}),!t.length)return null;const i=t.map(f=>f[0]),l=t.map(f=>f[1]),a=Math.max(.006,(Math.max(...i)-Math.min(...i))*.18),o=Math.max(.006,(Math.max(...l)-Math.min(...l))*.18);return{west:Math.max(V.west,Math.min(...i)-a),south:Math.max(V.south,Math.min(...l)-o),east:Math.min(V.east,Math.max(...i)+a),north:Math.min(V.north,Math.max(...l)+o)}}function U(e){if(!s){e.length=0;return}e.splice(0).forEach(t=>s.entities.remove(t))}function Cn(){O.splice(0).forEach(e=>{var t,i;return(i=(t=s==null?void 0:s.imageryLayers)==null?void 0:t.remove)==null?void 0:i.call(t,e,!0)}),U(H),te()}function Le(){var e,t,i;M+=1,(e=T==null?void 0:T.disconnect)==null||e.call(T),T=null,P==null||P(),P=null,E==null||E(),E=null,(t=w==null?void 0:w.destroy)==null||t.call(w),w=null,Cn(),U(Xn),U(he),U(Y),U(X),U($),U(j),U(re),fn(),s&&!((i=s.isDestroyed)!=null&&i.call(s))&&s.destroy(),s=null,A=null,_.value=null,b.value&&b.value.replaceChildren()}function xe(e,t=1){const i=Number(e);return Number.isFinite(i)?Math.max(0,Math.min(1,i)):t}function fe(e){return String(e||"").trim().replace(/(镇|乡)$/,"")}function Sr(e){const t=Number(e);return Number.isFinite(t)?Number.isInteger(t)?String(t):String(Number(t.toFixed(2))):"--"}return n({loadMap:ri,hasMap:oi,play:si,resume:Lt,pause:li,refreshView:Ve,resetView:ai,focusLayerMapView:ui,destroyMap:Le,highlightFeature:nn,clearSelectedFeature:te,clearFloatingOverlays:Ki,focusProject:sn,focusPasture:cn,clearPastureFocus:hn,focusTown:on,focusYakIndustryPoint:ln,focusVectorFeature:an,getVectorFeatureAnchorScreen:un,getVectorFeaturesAnchorScreen:Je,getVectorFeatureScreen:Me,getYakIndustryPointScreen:pt,setBoundaryDrawing:Qi,finishBoundaryDrawing:nr,undoBoundaryPoint:tr,clearAnalysisBoundary:ir,showAnalysisResult:rr,addEngineeringSuitabilityBatch:or,setEngineeringSuitabilityVisibility:sr,completeEngineeringSuitability:lr,clearEngineeringSuitability:fn,canvasMap:_}),(e,t)=>(Lr(),Ar("div",{ref_key:"containerRef",ref:p,class:"cesium-map"},[Or("div",{ref_key:"viewerRef",ref:b,class:"cesium-map__viewer"},null,512)],512))}},Fo=Mr(_o,[["__scopeId","data-v-b391bc11"]]);export{Po as C,Eo as H,Fo as M,ho as a,fo as g};