var m=(n,e,r)=>new Promise((t,i)=>{var d=u=>{try{f(r.next(u))}catch(l){i(l)}},g=u=>{try{f(r.throw(u))}catch(l){i(l)}},f=u=>u.done?t(u.value):Promise.resolve(u.value).then(d,g);f((r=r.apply(n,e)).next())});import{r as k,n as h}from"./index-bb4d300c-1786515885761.js";const c="/openApi";function w(n,e){return/^https?:\/\//.test(e)?e:`${n}${e.startsWith("/")?e:`/${e}`}`}function A(n){if((n==null?void 0:n.success)===!1&&(n==null?void 0:n.code)!==void 0&&![0,200,"0","200"].includes(n.code))throw new Error((n==null?void 0:n.msg)||(n==null?void 0:n.message)||"接口请求失败");return h(n)}function o(n,e,r,t={}){return k(w(n,e),{params:r,timeout:t.timeout||18e3}).then(A)}function Y(){return o(c,"/screen2/yakManagement/herdStructure").then(n=>n||{})}function E(n){const e=n==null||n===""?void 0:{year:n};return o(c,"/screen2/yakManagement/forecast",e).then(r=>r||{})}function b(n){const e=n==null||n===""?void 0:{year:n};return o(c,"/screen2/yakManagement/tradeDashboard",e).then(r=>r||{})}function $(n={}){return o(c,"/yak/trade/records",n).then(e=>e||{})}function D(n){const e=n==null||n===""?void 0:{year:n};return o(c,"/screen2/yakManagement/epidemicOverview",e).then(r=>r||{})}function F(n={}){return o(c,"/yak/epidemic/records",n).then(e=>e||{})}function S(n){return o(c,"/yak/epidemic/detail",{earTag:n}).then(e=>e||null)}function M(){return m(this,null,function*(){const n=yield b();return y(n.usageRows).map((r,t)=>({key:a(r,["name","label"],`trade-${t}`),name:a(r,["name","label"],`类型${t+1}`),value:s(a(r,["headCount","head_count","amount","value","count"])),unit:"头",extra:N("记录",a(r,["recordCount","record_count"]))})).filter(r=>r.name&&Number.isFinite(r.value)).sort((r,t)=>t.value-r.value)})}function y(n){return Array.isArray(n)?n:Array.isArray(n==null?void 0:n.rows)?n.rows:Array.isArray(n==null?void 0:n.list)?n.list:Array.isArray(n==null?void 0:n.records)?n.records:Array.isArray(n==null?void 0:n.data)?n.data:[]}function a(n,e,r=""){for(const t of e){const i=n==null?void 0:n[t];if(i!=null&&i!=="")return i}return r}function N(n,e){const r=s(e);return Number.isFinite(r)?`${n}:${r.toLocaleString("zh-CN",{maximumFractionDigits:2})}`:""}function s(n){if(n==null||n==="")return NaN;const e=Number(String(n).replace(/,/g,"").replace(/%/g,""));return Number.isFinite(e)?e:NaN}export{E as a,b,$ as c,D as d,F as e,S as f,Y as g,M as h};