@chenpu17/cc-gw 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var ft=e=>{throw TypeError(e)};var Ie=(e,t,n)=>t.has(e)||ft("Cannot "+n);var h=(e,t,n)=>(Ie(e,t,"read from private field"),n?n.call(e):t.get(e)),P=(e,t,n)=>t.has(e)?ft("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),O=(e,t,n,s)=>(Ie(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),A=(e,t,n)=>(Ie(e,t,"access private method"),n);import{S as fn,p as dt,b as v,s as qe,c as be,n as He,i as ze,d as ht,t as dn,e as Ce,f as hn,h as pn,k as pt,l as kt,r as V,m as mn,o as yn,q as bn}from"./index-DSgvyziA.js";var k,g,we,U,ne,ce,Q,X,ge,ue,le,se,re,G,fe,R,ye,$e,Je,Qe,Ve,We,Ke,Xe,Bt,Dt,wn=(Dt=class extends fn{constructor(t,n){super();P(this,R);P(this,k);P(this,g);P(this,we);P(this,U);P(this,ne);P(this,ce);P(this,Q);P(this,X);P(this,ge);P(this,ue);P(this,le);P(this,se);P(this,re);P(this,G);P(this,fe,new Set);this.options=n,O(this,k,t),O(this,X,null),O(this,Q,dt()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(h(this,g).addObserver(this),mt(h(this,g),this.options)?A(this,R,ye).call(this):this.updateResult(),A(this,R,Ve).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ge(h(this,g),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ge(h(this,g),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,A(this,R,We).call(this),A(this,R,Ke).call(this),h(this,g).removeObserver(this)}setOptions(t){const n=this.options,s=h(this,g);if(this.options=h(this,k).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof v(this.options.enabled,h(this,g))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");A(this,R,Xe).call(this),h(this,g).setOptions(this.options),n._defaulted&&!qe(this.options,n)&&h(this,k).getQueryCache().notify({type:"observerOptionsUpdated",query:h(this,g),observer:this});const r=this.hasListeners();r&&yt(h(this,g),s,this.options,n)&&A(this,R,ye).call(this),this.updateResult(),r&&(h(this,g)!==s||v(this.options.enabled,h(this,g))!==v(n.enabled,h(this,g))||be(this.options.staleTime,h(this,g))!==be(n.staleTime,h(this,g)))&&A(this,R,$e).call(this);const o=A(this,R,Je).call(this);r&&(h(this,g)!==s||v(this.options.enabled,h(this,g))!==v(n.enabled,h(this,g))||o!==h(this,G))&&A(this,R,Qe).call(this,o)}getOptimisticResult(t){const n=h(this,k).getQueryCache().build(h(this,k),t),s=this.createResult(n,t);return En(this,s)&&(O(this,U,s),O(this,ce,this.options),O(this,ne,h(this,g).state)),s}getCurrentResult(){return h(this,U)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&!this.options.experimental_prefetchInRender&&h(this,Q).status==="pending"&&h(this,Q).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,r))})}trackProp(t){h(this,fe).add(t)}getCurrentQuery(){return h(this,g)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=h(this,k).defaultQueryOptions(t),s=h(this,k).getQueryCache().build(h(this,k),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return A(this,R,ye).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),h(this,U)))}createResult(t,n){var Z;const s=h(this,g),r=this.options,o=h(this,U),i=h(this,ne),c=h(this,ce),u=t!==s?t.state:h(this,we),{state:l}=t;let p={...l},E=!1,w;if(n._optimisticResults){const N=this.hasListeners(),Y=!N&&mt(t,n),M=N&&yt(t,s,n,r);(Y||M)&&(p={...p,...pn(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=p;w=p.data;let S=!1;if(n.placeholderData!==void 0&&w===void 0&&m==="pending"){let N;o!=null&&o.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(N=o.data,S=!0):N=typeof n.placeholderData=="function"?n.placeholderData((Z=h(this,le))==null?void 0:Z.state.data,h(this,le)):n.placeholderData,N!==void 0&&(m="success",w=pt(o==null?void 0:o.data,N,n),E=!0)}if(n.select&&w!==void 0&&!S)if(o&&w===(i==null?void 0:i.data)&&n.select===h(this,ge))w=h(this,ue);else try{O(this,ge,n.select),w=n.select(w),w=pt(o==null?void 0:o.data,w,n),O(this,ue,w),O(this,X,null)}catch(N){O(this,X,N)}h(this,X)&&(f=h(this,X),w=h(this,ue),y=Date.now(),m="error");const F=p.fetchStatus==="fetching",T=m==="pending",x=m==="error",L=T&&F,H=w!==void 0,D={status:m,fetchStatus:p.fetchStatus,isPending:T,isSuccess:m==="success",isError:x,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:p.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>u.dataUpdateCount||p.errorUpdateCount>u.errorUpdateCount,isFetching:F,isRefetching:F&&!T,isLoadingError:x&&!H,isPaused:p.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:x&&H,isStale:st(t,n),refetch:this.refetch,promise:h(this,Q),isEnabled:v(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=z=>{D.status==="error"?z.reject(D.error):D.data!==void 0&&z.resolve(D.data)},Y=()=>{const z=O(this,Q,D.promise=dt());N(z)},M=h(this,Q);switch(M.status){case"pending":t.queryHash===s.queryHash&&N(M);break;case"fulfilled":(D.status==="error"||D.data!==M.value)&&Y();break;case"rejected":(D.status!=="error"||D.error!==M.reason)&&Y();break}}return D}updateResult(){const t=h(this,U),n=this.createResult(h(this,g),this.options);if(O(this,ne,h(this,g).state),O(this,ce,this.options),h(this,ne).data!==void 0&&O(this,le,h(this,g)),qe(n,t))return;O(this,U,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!h(this,fe).size)return!0;const i=new Set(o??h(this,fe));return this.options.throwOnError&&i.add("error"),Object.keys(h(this,U)).some(c=>{const d=c;return h(this,U)[d]!==t[d]&&i.has(d)})};A(this,R,Bt).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&A(this,R,Ve).call(this)}},k=new WeakMap,g=new WeakMap,we=new WeakMap,U=new WeakMap,ne=new WeakMap,ce=new WeakMap,Q=new WeakMap,X=new WeakMap,ge=new WeakMap,ue=new WeakMap,le=new WeakMap,se=new WeakMap,re=new WeakMap,G=new WeakMap,fe=new WeakMap,R=new WeakSet,ye=function(t){A(this,R,Xe).call(this);let n=h(this,g).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(He)),n},$e=function(){A(this,R,We).call(this);const t=be(this.options.staleTime,h(this,g));if(ze||h(this,U).isStale||!ht(t))return;const s=dn(h(this,U).dataUpdatedAt,t)+1;O(this,se,Ce.setTimeout(()=>{h(this,U).isStale||this.updateResult()},s))},Je=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(h(this,g)):this.options.refetchInterval)??!1},Qe=function(t){A(this,R,Ke).call(this),O(this,G,t),!(ze||v(this.options.enabled,h(this,g))===!1||!ht(h(this,G))||h(this,G)===0)&&O(this,re,Ce.setInterval(()=>{(this.options.refetchIntervalInBackground||hn.isFocused())&&A(this,R,ye).call(this)},h(this,G)))},Ve=function(){A(this,R,$e).call(this),A(this,R,Qe).call(this,A(this,R,Je).call(this))},We=function(){h(this,se)&&(Ce.clearTimeout(h(this,se)),O(this,se,void 0))},Ke=function(){h(this,re)&&(Ce.clearInterval(h(this,re)),O(this,re,void 0))},Xe=function(){const t=h(this,k).getQueryCache().build(h(this,k),this.options);if(t===h(this,g))return;const n=h(this,g);O(this,g,t),O(this,we,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Bt=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(h(this,U))}),h(this,k).getQueryCache().notify({query:h(this,g),type:"observerResultsUpdated"})})},Dt);function gn(e,t){return v(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function mt(e,t){return gn(e,t)||e.state.data!==void 0&&Ge(e,t,t.refetchOnMount)}function Ge(e,t,n){if(v(t.enabled,e)!==!1&&be(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&st(e,t)}return!1}function yt(e,t,n,s){return(e!==t||v(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&st(e,n)}function st(e,t){return v(t.enabled,e)!==!1&&e.isStaleByTime(be(t.staleTime,e))}function En(e,t){return!qe(e.getCurrentResult(),t)}var It=V.createContext(!1),Rn=()=>V.useContext(It);It.Provider;function Sn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var On=V.createContext(Sn()),Tn=()=>V.useContext(On),Cn=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},An=e=>{V.useEffect(()=>{e.clearReset()},[e])},xn=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||mn(n,[e.error,s])),Pn=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Fn=(e,t)=>e.isLoading&&e.isFetching&&!t,_n=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Nn(e,t,n){var p,E,w,f,y;const s=Rn(),r=Tn(),o=yn(),i=o.defaultQueryOptions(e);(E=(p=o.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||E.call(p,i),i._optimisticResults=s?"isRestoring":"optimistic",Pn(i),Cn(i,r),An(r);const c=!o.getQueryCache().get(i.queryHash),[d]=V.useState(()=>new t(o,i)),u=d.getOptimisticResult(i),l=!s&&e.subscribed!==!1;if(V.useSyncExternalStore(V.useCallback(m=>{const S=l?d.subscribe(kt.batchCalls(m)):He;return d.updateResult(),S},[d,l]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),V.useEffect(()=>{d.setOptions(i)},[i,d]),_n(i,u))throw bt(i,d,r);if(xn({result:u,errorResetBoundary:r,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((f=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||f.call(w,i,u),i.experimental_prefetchInRender&&!ze&&Fn(u,s)){const m=c?bt(i,d,r):(y=o.getQueryCache().get(i.queryHash))==null?void 0:y.promise;m==null||m.catch(He).finally(()=>{d.updateResult()})}return i.notifyOnChangeProps?u:d.trackResult(u)}function Un(e,t){return Nn(e,wn)}function jt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ln}=Object.prototype,{getPrototypeOf:rt}=Object,{iterator:Ne,toStringTag:Mt}=Symbol,Ue=(e=>t=>{const n=Ln.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),q=e=>(e=e.toLowerCase(),t=>Ue(t)===e),Le=e=>t=>typeof t===e,{isArray:he}=Array,de=Le("undefined");function Ee(e){return e!==null&&!de(e)&&e.constructor!==null&&!de(e.constructor)&&B(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vt=q("ArrayBuffer");function Dn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&vt(e.buffer),t}const kn=Le("string"),B=Le("function"),qt=Le("number"),Re=e=>e!==null&&typeof e=="object",Bn=e=>e===!0||e===!1,xe=e=>{if(Ue(e)!=="object")return!1;const t=rt(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Mt in e)&&!(Ne in e)},In=e=>{if(!Re(e)||Ee(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jn=q("Date"),Mn=q("File"),vn=q("Blob"),qn=q("FileList"),Hn=e=>Re(e)&&B(e.pipe),zn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||B(e.append)&&((t=Ue(e))==="formdata"||t==="object"&&B(e.toString)&&e.toString()==="[object FormData]"))},$n=q("URLSearchParams"),[Jn,Qn,Vn,Wn]=["ReadableStream","Request","Response","Headers"].map(q),Kn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Se(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),he(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Ee(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(s=0;s<i;s++)c=o[s],t.call(null,e[c],c,e)}}function Ht(e,t){if(Ee(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,zt=e=>!de(e)&&e!==te;function Ze(){const{caseless:e,skipUndefined:t}=zt(this)&&this||{},n={},s=(r,o)=>{const i=e&&Ht(n,o)||o;xe(n[i])&&xe(r)?n[i]=Ze(n[i],r):xe(r)?n[i]=Ze({},r):he(r)?n[i]=r.slice():(!t||!de(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&Se(arguments[r],s);return n}const Xn=(e,t,n,{allOwnKeys:s}={})=>(Se(t,(r,o)=>{n&&B(r)?e[o]=jt(r,n):e[o]=r},{allOwnKeys:s}),e),Gn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Zn=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Yn=(e,t,n,s)=>{let r,o,i;const c={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&rt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},es=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},ts=e=>{if(!e)return null;if(he(e))return e;let t=e.length;if(!qt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},ns=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rt(Uint8Array)),ss=(e,t)=>{const s=(e&&e[Ne]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},rs=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},is=q("HTMLFormElement"),os=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),wt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),as=q("RegExp"),$t=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Se(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},cs=e=>{$t(e,(t,n)=>{if(B(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(B(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},us=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return he(e)?s(e):s(String(e).split(t)),n},ls=()=>{},fs=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ds(e){return!!(e&&B(e.append)&&e[Mt]==="FormData"&&e[Ne])}const hs=e=>{const t=new Array(10),n=(s,r)=>{if(Re(s)){if(t.indexOf(s)>=0)return;if(Ee(s))return s;if(!("toJSON"in s)){t[r]=s;const o=he(s)?[]:{};return Se(s,(i,c)=>{const d=n(i,r+1);!de(d)&&(o[c]=d)}),t[r]=void 0,o}}return s};return n(e,0)},ps=q("AsyncFunction"),ms=e=>e&&(Re(e)||B(e))&&B(e.then)&&B(e.catch),Jt=((e,t)=>e?setImmediate:t?((n,s)=>(te.addEventListener("message",({source:r,data:o})=>{r===te&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),te.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",B(te.postMessage)),ys=typeof queueMicrotask<"u"?queueMicrotask.bind(te):typeof process<"u"&&process.nextTick||Jt,bs=e=>e!=null&&B(e[Ne]),a={isArray:he,isArrayBuffer:vt,isBuffer:Ee,isFormData:zn,isArrayBufferView:Dn,isString:kn,isNumber:qt,isBoolean:Bn,isObject:Re,isPlainObject:xe,isEmptyObject:In,isReadableStream:Jn,isRequest:Qn,isResponse:Vn,isHeaders:Wn,isUndefined:de,isDate:jn,isFile:Mn,isBlob:vn,isRegExp:as,isFunction:B,isStream:Hn,isURLSearchParams:$n,isTypedArray:ns,isFileList:qn,forEach:Se,merge:Ze,extend:Xn,trim:Kn,stripBOM:Gn,inherits:Zn,toFlatObject:Yn,kindOf:Ue,kindOfTest:q,endsWith:es,toArray:ts,forEachEntry:ss,matchAll:rs,isHTMLForm:is,hasOwnProperty:wt,hasOwnProp:wt,reduceDescriptors:$t,freezeMethods:cs,toObjectSet:us,toCamelCase:os,noop:ls,toFiniteNumber:fs,findKey:Ht,global:te,isContextDefined:zt,isSpecCompliantForm:ds,toJSONObject:hs,isAsyncFn:ps,isThenable:ms,setImmediate:Jt,asap:ys,isIterable:bs};function b(e,t,n,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}a.inherits(b,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const Qt=b.prototype,Vt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Vt[e]={value:e}});Object.defineProperties(b,Vt);Object.defineProperty(Qt,"isAxiosError",{value:!0});b.from=(e,t,n,s,r,o)=>{const i=Object.create(Qt);a.toFlatObject(e,i,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return b.call(i,c,d,n,s,r),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const ws=null;function Ye(e){return a.isPlainObject(e)||a.isArray(e)}function Wt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function gt(e,t,n){return e?e.concat(t).map(function(r,o){return r=Wt(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function gs(e){return a.isArray(e)&&!e.some(Ye)}const Es=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function De(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,m){return!a.isUndefined(m[y])});const s=n.metaTokens,r=n.visitor||l,o=n.dots,i=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(r))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!d&&a.isBlob(f))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,y,m){let S=f;if(f&&!m&&typeof f=="object"){if(a.endsWith(y,"{}"))y=s?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&gs(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(S=a.toArray(f)))return y=Wt(y),S.forEach(function(T,x){!(a.isUndefined(T)||T===null)&&t.append(i===!0?gt([y],x,o):i===null?y:y+"[]",u(T))}),!1}return Ye(f)?!0:(t.append(gt(m,y,o),u(f)),!1)}const p=[],E=Object.assign(Es,{defaultVisitor:l,convertValue:u,isVisitable:Ye});function w(f,y){if(!a.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(f),a.forEach(f,function(S,F){(!(a.isUndefined(S)||S===null)&&r.call(t,S,a.isString(F)?F.trim():F,y,E))===!0&&w(S,y?y.concat(F):[F])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return w(e),t}function Et(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function it(e,t){this._pairs=[],e&&De(e,this,t)}const Kt=it.prototype;Kt.append=function(t,n){this._pairs.push([t,n])};Kt.toString=function(t){const n=t?function(s){return t.call(this,s,Et)}:Et;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Rs(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xt(e,t,n){if(!t)return e;const s=n&&n.encode||Rs;a.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(r?o=r(t,n):o=a.isURLSearchParams(t)?t.toString():new it(t,n).toString(s),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Rt{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Gt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ss=typeof URLSearchParams<"u"?URLSearchParams:it,Os=typeof FormData<"u"?FormData:null,Ts=typeof Blob<"u"?Blob:null,Cs={isBrowser:!0,classes:{URLSearchParams:Ss,FormData:Os,Blob:Ts},protocols:["http","https","file","blob","url","data"]},ot=typeof window<"u"&&typeof document<"u",et=typeof navigator=="object"&&navigator||void 0,As=ot&&(!et||["ReactNative","NativeScript","NS"].indexOf(et.product)<0),xs=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ps=ot&&window.location.href||"http://localhost",Fs=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ot,hasStandardBrowserEnv:As,hasStandardBrowserWebWorkerEnv:xs,navigator:et,origin:Ps},Symbol.toStringTag,{value:"Module"})),_={...Fs,...Cs};function _s(e,t){return De(e,new _.classes.URLSearchParams,{visitor:function(n,s,r,o){return _.isNode&&a.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Ns(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Us(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s<r;s++)o=n[s],t[o]=e[o];return t}function Zt(e){function t(n,s,r,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),d=o>=n.length;return i=!i&&a.isArray(r)?r.length:i,d?(a.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!c):((!r[i]||!a.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&a.isArray(r[i])&&(r[i]=Us(r[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(s,r)=>{t(Ns(s),r,n,0)}),n}return null}function Ls(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Oe={transitional:Gt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return r?JSON.stringify(Zt(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return _s(t,this.formSerializer).toString();if((c=a.isFileList(t))||s.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return De(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),Ls(t)):t}],transformResponse:[function(t){const n=this.transitional||Oe.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?b.from(c,b.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_.classes.FormData,Blob:_.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{Oe.headers[e]={}});const Ds=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ks=e=>{const t={};let n,s,r;return e&&e.split(`
1
+ var ft=e=>{throw TypeError(e)};var Ie=(e,t,n)=>t.has(e)||ft("Cannot "+n);var h=(e,t,n)=>(Ie(e,t,"read from private field"),n?n.call(e):t.get(e)),P=(e,t,n)=>t.has(e)?ft("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),O=(e,t,n,s)=>(Ie(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),A=(e,t,n)=>(Ie(e,t,"access private method"),n);import{S as fn,p as dt,b as v,s as qe,c as be,n as He,i as ze,d as ht,t as dn,e as Ce,f as hn,h as pn,k as pt,l as kt,r as V,m as mn,o as yn,q as bn}from"./index-B_Unl5wz.js";var k,g,we,U,ne,ce,Q,X,ge,ue,le,se,re,G,fe,R,ye,$e,Je,Qe,Ve,We,Ke,Xe,Bt,Dt,wn=(Dt=class extends fn{constructor(t,n){super();P(this,R);P(this,k);P(this,g);P(this,we);P(this,U);P(this,ne);P(this,ce);P(this,Q);P(this,X);P(this,ge);P(this,ue);P(this,le);P(this,se);P(this,re);P(this,G);P(this,fe,new Set);this.options=n,O(this,k,t),O(this,X,null),O(this,Q,dt()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(h(this,g).addObserver(this),mt(h(this,g),this.options)?A(this,R,ye).call(this):this.updateResult(),A(this,R,Ve).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ge(h(this,g),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ge(h(this,g),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,A(this,R,We).call(this),A(this,R,Ke).call(this),h(this,g).removeObserver(this)}setOptions(t){const n=this.options,s=h(this,g);if(this.options=h(this,k).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof v(this.options.enabled,h(this,g))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");A(this,R,Xe).call(this),h(this,g).setOptions(this.options),n._defaulted&&!qe(this.options,n)&&h(this,k).getQueryCache().notify({type:"observerOptionsUpdated",query:h(this,g),observer:this});const r=this.hasListeners();r&&yt(h(this,g),s,this.options,n)&&A(this,R,ye).call(this),this.updateResult(),r&&(h(this,g)!==s||v(this.options.enabled,h(this,g))!==v(n.enabled,h(this,g))||be(this.options.staleTime,h(this,g))!==be(n.staleTime,h(this,g)))&&A(this,R,$e).call(this);const o=A(this,R,Je).call(this);r&&(h(this,g)!==s||v(this.options.enabled,h(this,g))!==v(n.enabled,h(this,g))||o!==h(this,G))&&A(this,R,Qe).call(this,o)}getOptimisticResult(t){const n=h(this,k).getQueryCache().build(h(this,k),t),s=this.createResult(n,t);return En(this,s)&&(O(this,U,s),O(this,ce,this.options),O(this,ne,h(this,g).state)),s}getCurrentResult(){return h(this,U)}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n==null||n(r),r==="promise"&&!this.options.experimental_prefetchInRender&&h(this,Q).status==="pending"&&h(this,Q).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(s,r))})}trackProp(t){h(this,fe).add(t)}getCurrentQuery(){return h(this,g)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=h(this,k).defaultQueryOptions(t),s=h(this,k).getQueryCache().build(h(this,k),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return A(this,R,ye).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),h(this,U)))}createResult(t,n){var Z;const s=h(this,g),r=this.options,o=h(this,U),i=h(this,ne),c=h(this,ce),u=t!==s?t.state:h(this,we),{state:l}=t;let p={...l},E=!1,w;if(n._optimisticResults){const N=this.hasListeners(),Y=!N&&mt(t,n),M=N&&yt(t,s,n,r);(Y||M)&&(p={...p,...pn(l.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:f,errorUpdatedAt:y,status:m}=p;w=p.data;let S=!1;if(n.placeholderData!==void 0&&w===void 0&&m==="pending"){let N;o!=null&&o.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(N=o.data,S=!0):N=typeof n.placeholderData=="function"?n.placeholderData((Z=h(this,le))==null?void 0:Z.state.data,h(this,le)):n.placeholderData,N!==void 0&&(m="success",w=pt(o==null?void 0:o.data,N,n),E=!0)}if(n.select&&w!==void 0&&!S)if(o&&w===(i==null?void 0:i.data)&&n.select===h(this,ge))w=h(this,ue);else try{O(this,ge,n.select),w=n.select(w),w=pt(o==null?void 0:o.data,w,n),O(this,ue,w),O(this,X,null)}catch(N){O(this,X,N)}h(this,X)&&(f=h(this,X),w=h(this,ue),y=Date.now(),m="error");const F=p.fetchStatus==="fetching",T=m==="pending",x=m==="error",L=T&&F,H=w!==void 0,D={status:m,fetchStatus:p.fetchStatus,isPending:T,isSuccess:m==="success",isError:x,isInitialLoading:L,isLoading:L,data:w,dataUpdatedAt:p.dataUpdatedAt,error:f,errorUpdatedAt:y,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>u.dataUpdateCount||p.errorUpdateCount>u.errorUpdateCount,isFetching:F,isRefetching:F&&!T,isLoadingError:x&&!H,isPaused:p.fetchStatus==="paused",isPlaceholderData:E,isRefetchError:x&&H,isStale:st(t,n),refetch:this.refetch,promise:h(this,Q),isEnabled:v(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const N=z=>{D.status==="error"?z.reject(D.error):D.data!==void 0&&z.resolve(D.data)},Y=()=>{const z=O(this,Q,D.promise=dt());N(z)},M=h(this,Q);switch(M.status){case"pending":t.queryHash===s.queryHash&&N(M);break;case"fulfilled":(D.status==="error"||D.data!==M.value)&&Y();break;case"rejected":(D.status!=="error"||D.error!==M.reason)&&Y();break}}return D}updateResult(){const t=h(this,U),n=this.createResult(h(this,g),this.options);if(O(this,ne,h(this,g).state),O(this,ce,this.options),h(this,ne).data!==void 0&&O(this,le,h(this,g)),qe(n,t))return;O(this,U,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!h(this,fe).size)return!0;const i=new Set(o??h(this,fe));return this.options.throwOnError&&i.add("error"),Object.keys(h(this,U)).some(c=>{const d=c;return h(this,U)[d]!==t[d]&&i.has(d)})};A(this,R,Bt).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&A(this,R,Ve).call(this)}},k=new WeakMap,g=new WeakMap,we=new WeakMap,U=new WeakMap,ne=new WeakMap,ce=new WeakMap,Q=new WeakMap,X=new WeakMap,ge=new WeakMap,ue=new WeakMap,le=new WeakMap,se=new WeakMap,re=new WeakMap,G=new WeakMap,fe=new WeakMap,R=new WeakSet,ye=function(t){A(this,R,Xe).call(this);let n=h(this,g).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(He)),n},$e=function(){A(this,R,We).call(this);const t=be(this.options.staleTime,h(this,g));if(ze||h(this,U).isStale||!ht(t))return;const s=dn(h(this,U).dataUpdatedAt,t)+1;O(this,se,Ce.setTimeout(()=>{h(this,U).isStale||this.updateResult()},s))},Je=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(h(this,g)):this.options.refetchInterval)??!1},Qe=function(t){A(this,R,Ke).call(this),O(this,G,t),!(ze||v(this.options.enabled,h(this,g))===!1||!ht(h(this,G))||h(this,G)===0)&&O(this,re,Ce.setInterval(()=>{(this.options.refetchIntervalInBackground||hn.isFocused())&&A(this,R,ye).call(this)},h(this,G)))},Ve=function(){A(this,R,$e).call(this),A(this,R,Qe).call(this,A(this,R,Je).call(this))},We=function(){h(this,se)&&(Ce.clearTimeout(h(this,se)),O(this,se,void 0))},Ke=function(){h(this,re)&&(Ce.clearInterval(h(this,re)),O(this,re,void 0))},Xe=function(){const t=h(this,k).getQueryCache().build(h(this,k),this.options);if(t===h(this,g))return;const n=h(this,g);O(this,g,t),O(this,we,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Bt=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(h(this,U))}),h(this,k).getQueryCache().notify({query:h(this,g),type:"observerResultsUpdated"})})},Dt);function gn(e,t){return v(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function mt(e,t){return gn(e,t)||e.state.data!==void 0&&Ge(e,t,t.refetchOnMount)}function Ge(e,t,n){if(v(t.enabled,e)!==!1&&be(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&st(e,t)}return!1}function yt(e,t,n,s){return(e!==t||v(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&st(e,n)}function st(e,t){return v(t.enabled,e)!==!1&&e.isStaleByTime(be(t.staleTime,e))}function En(e,t){return!qe(e.getCurrentResult(),t)}var It=V.createContext(!1),Rn=()=>V.useContext(It);It.Provider;function Sn(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var On=V.createContext(Sn()),Tn=()=>V.useContext(On),Cn=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},An=e=>{V.useEffect(()=>{e.clearReset()},[e])},xn=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||mn(n,[e.error,s])),Pn=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),s=e.staleTime;e.staleTime=typeof s=="function"?(...r)=>n(s(...r)):n(s),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Fn=(e,t)=>e.isLoading&&e.isFetching&&!t,_n=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Nn(e,t,n){var p,E,w,f,y;const s=Rn(),r=Tn(),o=yn(),i=o.defaultQueryOptions(e);(E=(p=o.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||E.call(p,i),i._optimisticResults=s?"isRestoring":"optimistic",Pn(i),Cn(i,r),An(r);const c=!o.getQueryCache().get(i.queryHash),[d]=V.useState(()=>new t(o,i)),u=d.getOptimisticResult(i),l=!s&&e.subscribed!==!1;if(V.useSyncExternalStore(V.useCallback(m=>{const S=l?d.subscribe(kt.batchCalls(m)):He;return d.updateResult(),S},[d,l]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),V.useEffect(()=>{d.setOptions(i)},[i,d]),_n(i,u))throw bt(i,d,r);if(xn({result:u,errorResetBoundary:r,throwOnError:i.throwOnError,query:o.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw u.error;if((f=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||f.call(w,i,u),i.experimental_prefetchInRender&&!ze&&Fn(u,s)){const m=c?bt(i,d,r):(y=o.getQueryCache().get(i.queryHash))==null?void 0:y.promise;m==null||m.catch(He).finally(()=>{d.updateResult()})}return i.notifyOnChangeProps?u:d.trackResult(u)}function Un(e,t){return Nn(e,wn)}function jt(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ln}=Object.prototype,{getPrototypeOf:rt}=Object,{iterator:Ne,toStringTag:Mt}=Symbol,Ue=(e=>t=>{const n=Ln.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),q=e=>(e=e.toLowerCase(),t=>Ue(t)===e),Le=e=>t=>typeof t===e,{isArray:he}=Array,de=Le("undefined");function Ee(e){return e!==null&&!de(e)&&e.constructor!==null&&!de(e.constructor)&&B(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const vt=q("ArrayBuffer");function Dn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&vt(e.buffer),t}const kn=Le("string"),B=Le("function"),qt=Le("number"),Re=e=>e!==null&&typeof e=="object",Bn=e=>e===!0||e===!1,xe=e=>{if(Ue(e)!=="object")return!1;const t=rt(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Mt in e)&&!(Ne in e)},In=e=>{if(!Re(e)||Ee(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jn=q("Date"),Mn=q("File"),vn=q("Blob"),qn=q("FileList"),Hn=e=>Re(e)&&B(e.pipe),zn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||B(e.append)&&((t=Ue(e))==="formdata"||t==="object"&&B(e.toString)&&e.toString()==="[object FormData]"))},$n=q("URLSearchParams"),[Jn,Qn,Vn,Wn]=["ReadableStream","Request","Response","Headers"].map(q),Kn=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Se(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),he(e))for(s=0,r=e.length;s<r;s++)t.call(null,e[s],s,e);else{if(Ee(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(s=0;s<i;s++)c=o[s],t.call(null,e[c],c,e)}}function Ht(e,t){if(Ee(e))return null;t=t.toLowerCase();const n=Object.keys(e);let s=n.length,r;for(;s-- >0;)if(r=n[s],t===r.toLowerCase())return r;return null}const te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,zt=e=>!de(e)&&e!==te;function Ze(){const{caseless:e,skipUndefined:t}=zt(this)&&this||{},n={},s=(r,o)=>{const i=e&&Ht(n,o)||o;xe(n[i])&&xe(r)?n[i]=Ze(n[i],r):xe(r)?n[i]=Ze({},r):he(r)?n[i]=r.slice():(!t||!de(r))&&(n[i]=r)};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&Se(arguments[r],s);return n}const Xn=(e,t,n,{allOwnKeys:s}={})=>(Se(t,(r,o)=>{n&&B(r)?e[o]=jt(r,n):e[o]=r},{allOwnKeys:s}),e),Gn=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Zn=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Yn=(e,t,n,s)=>{let r,o,i;const c={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),o=r.length;o-- >0;)i=r[o],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&rt(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},es=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},ts=e=>{if(!e)return null;if(he(e))return e;let t=e.length;if(!qt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},ns=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&rt(Uint8Array)),ss=(e,t)=>{const s=(e&&e[Ne]).call(e);let r;for(;(r=s.next())&&!r.done;){const o=r.value;t.call(e,o[0],o[1])}},rs=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},is=q("HTMLFormElement"),os=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),wt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),as=q("RegExp"),$t=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Se(n,(r,o)=>{let i;(i=t(r,o,e))!==!1&&(s[o]=i||r)}),Object.defineProperties(e,s)},cs=e=>{$t(e,(t,n)=>{if(B(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(B(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},us=(e,t)=>{const n={},s=r=>{r.forEach(o=>{n[o]=!0})};return he(e)?s(e):s(String(e).split(t)),n},ls=()=>{},fs=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ds(e){return!!(e&&B(e.append)&&e[Mt]==="FormData"&&e[Ne])}const hs=e=>{const t=new Array(10),n=(s,r)=>{if(Re(s)){if(t.indexOf(s)>=0)return;if(Ee(s))return s;if(!("toJSON"in s)){t[r]=s;const o=he(s)?[]:{};return Se(s,(i,c)=>{const d=n(i,r+1);!de(d)&&(o[c]=d)}),t[r]=void 0,o}}return s};return n(e,0)},ps=q("AsyncFunction"),ms=e=>e&&(Re(e)||B(e))&&B(e.then)&&B(e.catch),Jt=((e,t)=>e?setImmediate:t?((n,s)=>(te.addEventListener("message",({source:r,data:o})=>{r===te&&o===n&&s.length&&s.shift()()},!1),r=>{s.push(r),te.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",B(te.postMessage)),ys=typeof queueMicrotask<"u"?queueMicrotask.bind(te):typeof process<"u"&&process.nextTick||Jt,bs=e=>e!=null&&B(e[Ne]),a={isArray:he,isArrayBuffer:vt,isBuffer:Ee,isFormData:zn,isArrayBufferView:Dn,isString:kn,isNumber:qt,isBoolean:Bn,isObject:Re,isPlainObject:xe,isEmptyObject:In,isReadableStream:Jn,isRequest:Qn,isResponse:Vn,isHeaders:Wn,isUndefined:de,isDate:jn,isFile:Mn,isBlob:vn,isRegExp:as,isFunction:B,isStream:Hn,isURLSearchParams:$n,isTypedArray:ns,isFileList:qn,forEach:Se,merge:Ze,extend:Xn,trim:Kn,stripBOM:Gn,inherits:Zn,toFlatObject:Yn,kindOf:Ue,kindOfTest:q,endsWith:es,toArray:ts,forEachEntry:ss,matchAll:rs,isHTMLForm:is,hasOwnProperty:wt,hasOwnProp:wt,reduceDescriptors:$t,freezeMethods:cs,toObjectSet:us,toCamelCase:os,noop:ls,toFiniteNumber:fs,findKey:Ht,global:te,isContextDefined:zt,isSpecCompliantForm:ds,toJSONObject:hs,isAsyncFn:ps,isThenable:ms,setImmediate:Jt,asap:ys,isIterable:bs};function b(e,t,n,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}a.inherits(b,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const Qt=b.prototype,Vt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Vt[e]={value:e}});Object.defineProperties(b,Vt);Object.defineProperty(Qt,"isAxiosError",{value:!0});b.from=(e,t,n,s,r,o)=>{const i=Object.create(Qt);a.toFlatObject(e,i,function(l){return l!==Error.prototype},u=>u!=="isAxiosError");const c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return b.call(i,c,d,n,s,r),e&&i.cause==null&&Object.defineProperty(i,"cause",{value:e,configurable:!0}),i.name=e&&e.name||"Error",o&&Object.assign(i,o),i};const ws=null;function Ye(e){return a.isPlainObject(e)||a.isArray(e)}function Wt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function gt(e,t,n){return e?e.concat(t).map(function(r,o){return r=Wt(r),!n&&o?"["+r+"]":r}).join(n?".":""):t}function gs(e){return a.isArray(e)&&!e.some(Ye)}const Es=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function De(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,m){return!a.isUndefined(m[y])});const s=n.metaTokens,r=n.visitor||l,o=n.dots,i=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(r))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!d&&a.isBlob(f))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,y,m){let S=f;if(f&&!m&&typeof f=="object"){if(a.endsWith(y,"{}"))y=s?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&gs(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(S=a.toArray(f)))return y=Wt(y),S.forEach(function(T,x){!(a.isUndefined(T)||T===null)&&t.append(i===!0?gt([y],x,o):i===null?y:y+"[]",u(T))}),!1}return Ye(f)?!0:(t.append(gt(m,y,o),u(f)),!1)}const p=[],E=Object.assign(Es,{defaultVisitor:l,convertValue:u,isVisitable:Ye});function w(f,y){if(!a.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(f),a.forEach(f,function(S,F){(!(a.isUndefined(S)||S===null)&&r.call(t,S,a.isString(F)?F.trim():F,y,E))===!0&&w(S,y?y.concat(F):[F])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return w(e),t}function Et(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function it(e,t){this._pairs=[],e&&De(e,this,t)}const Kt=it.prototype;Kt.append=function(t,n){this._pairs.push([t,n])};Kt.toString=function(t){const n=t?function(s){return t.call(this,s,Et)}:Et;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function Rs(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xt(e,t,n){if(!t)return e;const s=n&&n.encode||Rs;a.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let o;if(r?o=r(t,n):o=a.isURLSearchParams(t)?t.toString():new it(t,n).toString(s),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Rt{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(s){s!==null&&t(s)})}}const Gt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ss=typeof URLSearchParams<"u"?URLSearchParams:it,Os=typeof FormData<"u"?FormData:null,Ts=typeof Blob<"u"?Blob:null,Cs={isBrowser:!0,classes:{URLSearchParams:Ss,FormData:Os,Blob:Ts},protocols:["http","https","file","blob","url","data"]},ot=typeof window<"u"&&typeof document<"u",et=typeof navigator=="object"&&navigator||void 0,As=ot&&(!et||["ReactNative","NativeScript","NS"].indexOf(et.product)<0),xs=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Ps=ot&&window.location.href||"http://localhost",Fs=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ot,hasStandardBrowserEnv:As,hasStandardBrowserWebWorkerEnv:xs,navigator:et,origin:Ps},Symbol.toStringTag,{value:"Module"})),_={...Fs,...Cs};function _s(e,t){return De(e,new _.classes.URLSearchParams,{visitor:function(n,s,r,o){return _.isNode&&a.isBuffer(n)?(this.append(s,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Ns(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Us(e){const t={},n=Object.keys(e);let s;const r=n.length;let o;for(s=0;s<r;s++)o=n[s],t[o]=e[o];return t}function Zt(e){function t(n,s,r,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),d=o>=n.length;return i=!i&&a.isArray(r)?r.length:i,d?(a.hasOwnProp(r,i)?r[i]=[r[i],s]:r[i]=s,!c):((!r[i]||!a.isObject(r[i]))&&(r[i]=[]),t(n,s,r[i],o)&&a.isArray(r[i])&&(r[i]=Us(r[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(s,r)=>{t(Ns(s),r,n,0)}),n}return null}function Ls(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Oe={transitional:Gt,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return r?JSON.stringify(Zt(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(s.indexOf("application/x-www-form-urlencoded")>-1)return _s(t,this.formSerializer).toString();if((c=a.isFileList(t))||s.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return De(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return o||r?(n.setContentType("application/json",!1),Ls(t)):t}],transformResponse:[function(t){const n=this.transitional||Oe.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(s&&!this.responseType||r)){const i=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?b.from(c,b.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:_.classes.FormData,Blob:_.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{Oe.headers[e]={}});const Ds=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ks=e=>{const t={};let n,s,r;return e&&e.split(`
2
2
  `).forEach(function(i){r=i.indexOf(":"),n=i.substring(0,r).trim().toLowerCase(),s=i.substring(r+1).trim(),!(!n||t[n]&&Ds[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},St=Symbol("internals");function me(e){return e&&String(e).trim().toLowerCase()}function Pe(e){return e===!1||e==null?e:a.isArray(e)?e.map(Pe):String(e)}function Bs(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Is=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function je(e,t,n,s,r){if(a.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!a.isString(t)){if(a.isString(s))return t.indexOf(s)!==-1;if(a.isRegExp(s))return s.test(t)}}function js(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Ms(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,o,i){return this[s].call(this,t,r,o,i)},configurable:!0})})}let I=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function o(c,d,u){const l=me(d);if(!l)throw new Error("header name must be a non-empty string");const p=a.findKey(r,l);(!p||r[p]===void 0||u===!0||u===void 0&&r[p]!==!1)&&(r[p||d]=Pe(c))}const i=(c,d)=>a.forEach(c,(u,l)=>o(u,l,d));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!Is(t))i(ks(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},d,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(d=c[u])?a.isArray(d)?[...d,l[1]]:[d,l[1]]:l[1]}i(c,n)}else t!=null&&o(n,t,s);return this}get(t,n){if(t=me(t),t){const s=a.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return Bs(r);if(a.isFunction(n))return n.call(this,r,s);if(a.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=me(t),t){const s=a.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||je(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function o(i){if(i=me(i),i){const c=a.findKey(s,i);c&&(!n||je(s,s[c],c,n))&&(delete s[c],r=!0)}}return a.isArray(t)?t.forEach(o):o(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const o=n[s];(!t||je(this,this[o],o,t,!0))&&(delete this[o],r=!0)}return r}normalize(t){const n=this,s={};return a.forEach(this,(r,o)=>{const i=a.findKey(s,o);if(i){n[i]=Pe(r),delete n[o];return}const c=t?js(o):String(o).trim();c!==o&&delete n[o],n[c]=Pe(r),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&a.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
3
3
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[St]=this[St]={accessors:{}}).accessors,r=this.prototype;function o(i){const c=me(i);s[c]||(Ms(r,i),s[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};I.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(I.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});a.freezeMethods(I);function Me(e,t){const n=this||Oe,s=t||n,r=I.from(s.headers);let o=s.data;return a.forEach(e,function(c){o=c.call(n,o,r.normalize(),t?t.status:void 0)}),r.normalize(),o}function Yt(e){return!!(e&&e.__CANCEL__)}function pe(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(pe,b,{__CANCEL__:!0});function en(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function vs(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function qs(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,o=0,i;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=s[o];i||(i=u),n[r]=d,s[r]=u;let p=o,E=0;for(;p!==r;)E+=n[p++],p=p%e;if(r=(r+1)%e,r===o&&(o=(o+1)%e),u-i<t)return;const w=l&&u-l;return w?Math.round(E*1e3/w):void 0}}function Hs(e,t){let n=0,s=1e3/t,r,o;const i=(u,l=Date.now())=>{n=l,r=null,o&&(clearTimeout(o),o=null),e(...u)};return[(...u)=>{const l=Date.now(),p=l-n;p>=s?i(u,l):(r=u,o||(o=setTimeout(()=>{o=null,i(r)},s-p)))},()=>r&&i(r)]}const _e=(e,t,n=3)=>{let s=0;const r=qs(50,250);return Hs(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,d=i-s,u=r(d),l=i<=c;s=i;const p={loaded:i,total:c,progress:c?i/c:void 0,bytes:d,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},n)},Ot=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},Tt=e=>(...t)=>a.asap(()=>e(...t)),zs=_.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,_.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(_.origin),_.navigator&&/(msie|trident)/i.test(_.navigator.userAgent)):()=>!0,$s=_.hasStandardBrowserEnv?{write(e,t,n,s,r,o){const i=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),a.isString(s)&&i.push("path="+s),a.isString(r)&&i.push("domain="+r),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Js(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function tn(e,t,n){let s=!Js(t);return e&&(s||n==!1)?Qs(e,t):t}const Ct=e=>e instanceof I?{...e}:e;function oe(e,t){t=t||{};const n={};function s(u,l,p,E){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:E},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function r(u,l,p,E){if(a.isUndefined(l)){if(!a.isUndefined(u))return s(void 0,u,p,E)}else return s(u,l,p,E)}function o(u,l){if(!a.isUndefined(l))return s(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return s(void 0,u)}else return s(void 0,l)}function c(u,l,p){if(p in t)return s(u,l);if(p in e)return s(void 0,u)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(u,l,p)=>r(Ct(u),Ct(l),p,!0)};return a.forEach(Object.keys({...e,...t}),function(l){const p=d[l]||r,E=p(e[l],t[l],l);a.isUndefined(E)&&p!==c||(n[l]=E)}),n}const nn=e=>{const t=oe({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=I.from(i),t.url=Xt(tn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(_.hasStandardBrowserEnv||_.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const d=n.getHeaders(),u=["content-type","content-length"];Object.entries(d).forEach(([l,p])=>{u.includes(l.toLowerCase())&&i.set(l,p)})}}if(_.hasStandardBrowserEnv&&(s&&a.isFunction(s)&&(s=s(t)),s||s!==!1&&zs(t.url))){const d=r&&o&&$s.read(o);d&&i.set(r,d)}return t},Vs=typeof XMLHttpRequest<"u",Ws=Vs&&function(e){return new Promise(function(n,s){const r=nn(e);let o=r.data;const i=I.from(r.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:u}=r,l,p,E,w,f;function y(){w&&w(),f&&f(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let m=new XMLHttpRequest;m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout;function S(){if(!m)return;const T=I.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),L={data:!c||c==="text"||c==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:T,config:e,request:m};en(function(j){n(j),y()},function(j){s(j),y()},L),m=null}"onloadend"in m?m.onloadend=S:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(S)},m.onabort=function(){m&&(s(new b("Request aborted",b.ECONNABORTED,e,m)),m=null)},m.onerror=function(x){const L=x&&x.message?x.message:"Network Error",H=new b(L,b.ERR_NETWORK,e,m);H.event=x||null,s(H),m=null},m.ontimeout=function(){let x=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const L=r.transitional||Gt;r.timeoutErrorMessage&&(x=r.timeoutErrorMessage),s(new b(x,L.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,m)),m=null},o===void 0&&i.setContentType(null),"setRequestHeader"in m&&a.forEach(i.toJSON(),function(x,L){m.setRequestHeader(L,x)}),a.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),c&&c!=="json"&&(m.responseType=r.responseType),u&&([E,f]=_e(u,!0),m.addEventListener("progress",E)),d&&m.upload&&([p,w]=_e(d),m.upload.addEventListener("progress",p),m.upload.addEventListener("loadend",w)),(r.cancelToken||r.signal)&&(l=T=>{m&&(s(!T||T.type?new pe(null,e,m):T),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const F=vs(r.url);if(F&&_.protocols.indexOf(F)===-1){s(new b("Unsupported protocol "+F+":",b.ERR_BAD_REQUEST,e));return}m.send(o||null)})},Ks=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const o=function(u){if(!r){r=!0,c();const l=u instanceof Error?u:this.reason;s.abort(l instanceof b?l:new pe(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:d}=s;return d.unsubscribe=()=>a.asap(c),d}},Xs=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let s=0,r;for(;s<n;)r=s+t,yield e.slice(s,r),s=r},Gs=async function*(e,t){for await(const n of Zs(e))yield*Xs(n,t)},Zs=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)break;yield s}}finally{await t.cancel()}},At=(e,t,n,s)=>{const r=Gs(e,t);let o=0,i,c=d=>{i||(i=!0,s&&s(d))};return new ReadableStream({async pull(d){try{const{done:u,value:l}=await r.next();if(u){c(),d.close();return}let p=l.byteLength;if(n){let E=o+=p;n(E)}d.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(d){return c(d),r.return()}},{highWaterMark:2})},xt=64*1024,{isFunction:Ae}=a,Ys=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Pt,TextEncoder:Ft}=a.global,_t=(e,...t)=>{try{return!!e(...t)}catch{return!1}},er=e=>{e=a.merge.call({skipUndefined:!0},Ys,e);const{fetch:t,Request:n,Response:s}=e,r=t?Ae(t):typeof fetch=="function",o=Ae(n),i=Ae(s);if(!r)return!1;const c=r&&Ae(Pt),d=r&&(typeof Ft=="function"?(f=>y=>f.encode(y))(new Ft):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=o&&c&&_t(()=>{let f=!1;const y=new n(_.origin,{body:new Pt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),l=i&&c&&_t(()=>a.isReadableStream(new s("").body)),p={stream:l&&(f=>f.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!p[f]&&(p[f]=(y,m)=>{let S=y&&y[f];if(S)return S.call(y);throw new b(`Response type '${f}' is not supported`,b.ERR_NOT_SUPPORT,m)})});const E=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(_.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await d(f)).byteLength},w=async(f,y)=>{const m=a.toFiniteNumber(f.getContentLength());return m??E(y)};return async f=>{let{url:y,method:m,data:S,signal:F,cancelToken:T,timeout:x,onDownloadProgress:L,onUploadProgress:H,responseType:j,headers:D,withCredentials:Z="same-origin",fetchOptions:N}=nn(f),Y=t||fetch;j=j?(j+"").toLowerCase():"text";let M=Ks([F,T&&T.toAbortSignal()],x),z=null;const ee=M&&M.unsubscribe&&(()=>{M.unsubscribe()});let at;try{if(H&&u&&m!=="get"&&m!=="head"&&(at=await w(D,S))!==0){let K=new n(y,{method:"POST",body:S,duplex:"half"}),ae;if(a.isFormData(S)&&(ae=K.headers.get("content-type"))&&D.setContentType(ae),K.body){const[Be,Te]=Ot(at,_e(Tt(H)));S=At(K.body,xt,Be,Te)}}a.isString(Z)||(Z=Z?"include":"omit");const $=o&&"credentials"in n.prototype,ct={...N,signal:M,method:m.toUpperCase(),headers:D.normalize().toJSON(),body:S,duplex:"half",credentials:$?Z:void 0};z=o&&new n(y,ct);let W=await(o?Y(z,N):Y(y,ct));const ut=l&&(j==="stream"||j==="response");if(l&&(L||ut&&ee)){const K={};["status","statusText","headers"].forEach(lt=>{K[lt]=W[lt]});const ae=a.toFiniteNumber(W.headers.get("content-length")),[Be,Te]=L&&Ot(ae,_e(Tt(L),!0))||[];W=new s(At(W.body,xt,Be,()=>{Te&&Te(),ee&&ee()}),K)}j=j||"text";let ln=await p[a.findKey(p,j)||"text"](W,f);return!ut&&ee&&ee(),await new Promise((K,ae)=>{en(K,ae,{data:ln,headers:I.from(W.headers),status:W.status,statusText:W.statusText,config:f,request:z})})}catch($){throw ee&&ee(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,f,z),{cause:$.cause||$}):b.from($,$&&$.code,f,z)}}},tr=new Map,sn=e=>{let t=e?e.env:{};const{fetch:n,Request:s,Response:r}=t,o=[s,r,n];let i=o.length,c=i,d,u,l=tr;for(;c--;)d=o[c],u=l.get(d),u===void 0&&l.set(d,u=c?new Map:er(t)),l=u;return u};sn();const tt={http:ws,xhr:Ws,fetch:{get:sn}};a.forEach(tt,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Nt=e=>`- ${e}`,nr=e=>a.isFunction(e)||e===null||e===!1,rn={getAdapter:(e,t)=>{e=a.isArray(e)?e:[e];const{length:n}=e;let s,r;const o={};for(let i=0;i<n;i++){s=e[i];let c;if(r=s,!nr(s)&&(r=tt[(c=String(s)).toLowerCase()],r===void 0))throw new b(`Unknown adapter '${c}'`);if(r&&(a.isFunction(r)||(r=r.get(t))))break;o[c||"#"+i]=r}if(!r){const i=Object.entries(o).map(([d,u])=>`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
4
4
  `+i.map(Nt).join(`
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>cc-gw 控制台</title>
7
- <script type="module" crossorigin src="/assets/index-DSgvyziA.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-B_Unl5wz.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-Bym_WpRV.css">
9
9
  </head>
10
10
  <body class="bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-50">
@@ -1 +0,0 @@
1
- import{u as te,r as p,j as e,a as ue}from"./index-DSgvyziA.js";import{u as be,a as F}from"./useApiQuery-DMfHsHz0.js";function ae(){return typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID=="function"?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2,10)}function ie(){return{_key:ae(),id:"",label:"",capabilities:{thinking:!1,tools:!1}}}const ee={openai:{baseUrl:"https://api.openai.com/v1"},deepseek:{baseUrl:"https://api.deepseek.com/v1"},huawei:{baseUrl:"https://api.modelarts-maas.com/v1"},kimi:{baseUrl:"https://api.moonshot.cn/v1"},anthropic:{baseUrl:"https://api.anthropic.com/v1",defaultModel:"claude-sonnet-4-20250514",models:[{id:"claude-sonnet-4-20250514",label:"Claude Sonnet 4 (2025-05-14)",capabilities:{thinking:!0,tools:!0},maxTokens:2e5},{id:"claude-opus-4-1-20250805",label:"Claude Opus 4.1 (2025-08-05)",capabilities:{thinking:!0,tools:!0},maxTokens:2e5},{id:"claude-3-5-haiku-20241022",label:"Claude 3.5 Haiku (2024-10-22)",capabilities:{thinking:!0,tools:!0},maxTokens:2e5}]},custom:{}};function le(s){return s?{id:s.id,label:s.label??s.id,baseUrl:s.baseUrl,apiKey:s.apiKey??"",type:s.type??"custom",defaultModel:s.defaultModel??"",models:(s.models??[]).map(o=>({...o,_key:ae(),capabilities:o.capabilities??{}}))}:{id:"",label:"",baseUrl:"",apiKey:"",type:"custom",defaultModel:"",models:[ie()]}}function xe(s){var o,n;return{_key:ae(),id:s.id,label:s.label,maxTokens:s.maxTokens,capabilities:{thinking:!!((o=s.capabilities)!=null&&o.thinking),tools:!!((n=s.capabilities)!=null&&n.tools)}}}function me({open:s,mode:o,provider:n,existingProviderIds:x,onClose:v,onSubmit:P}){const{t:l}=te(),[i,k]=p.useState(()=>le(n)),[j,q]=p.useState({}),[L,D]=p.useState(!1),[R,w]=p.useState(null),_=p.useRef(null),N=p.useRef(null),C=p.useRef(null),[U,Q]=p.useState(o==="edit");p.useEffect(()=>{s&&(k(le(n)),q({}),w(null),D(!1),Q(o==="edit"))},[s,n,o]),p.useEffect(()=>{if(!s)return;const a=d=>{d.key==="Escape"&&v()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[s,v]),p.useEffect(()=>{if(s){if(o==="create"&&C.current){C.current.focus();return}N.current&&N.current.focus()}},[s,o]);const $=p.useMemo(()=>i.models.filter(a=>a.id.trim().length>0),[i.models]),H=a=>d=>{k(u=>({...u,[a]:d}))},z=a=>{k(d=>{const c=!U||d.label.trim().length===0||d.label===d.id?a:d.label;return{...d,id:a,label:c}})},G=a=>{k(d=>{var J;const c=ee[a??"custom"]??ee.custom,m=Object.values(ee).map(T=>T.baseUrl).filter(T=>!!T),y=!d.baseUrl||m.includes(d.baseUrl),S=o==="create"&&(d.models.length===0||d.models.every(T=>T.id.trim().length===0)),E={...d,type:a};return c!=null&&c.baseUrl&&y&&(E.baseUrl=c.baseUrl),c!=null&&c.models&&S&&(E.models=c.models.map(xe),E.defaultModel=c.defaultModel??((J=c.models[0])==null?void 0:J.id)??""),E})},A=(a,d)=>{k(u=>{const c=[...u.models];return c[a]={...c[a],...d},{...u,models:c}})},V=(a,d)=>{k(u=>{const c=[...u.models],m=c[a];if(!m)return u;const y=!U||!m.label||m.label===m.id,S={...m,id:d,label:y?d:m.label};c[a]=S;const E=u.defaultModel===m.id?d:u.defaultModel;return{...u,models:c,defaultModel:E}})},B=(a,d)=>{k(u=>{var y;const c=[...u.models],m=c[a];return c[a]={...m,capabilities:{...m.capabilities,[d]:!((y=m.capabilities)!=null&&y[d])}},{...u,models:c}})},M=a=>{k(d=>{var m;if(d.models.length<=1)return d;const u=d.models.filter((y,S)=>S!==a);let c=d.defaultModel;return u.some(y=>y.id===c)||(c=((m=u[0])==null?void 0:m.id)??""),{...d,models:u,defaultModel:c}})},W=()=>{k(a=>({...a,models:[...a.models,ie()]}))},X=()=>{const a={},d=i.id.trim(),u=i.baseUrl.trim();if(o==="create"&&(d.length===0?a.id=l("providers.drawer.errors.idRequired"):x.includes(d)&&(a.id=l("providers.drawer.errors.idDuplicate"))),o==="edit"&&d.length===0&&(a.id=l("providers.drawer.errors.idRequired")),u.length===0)a.baseUrl=l("providers.drawer.errors.baseUrlInvalid");else try{new URL(u)}catch{a.baseUrl=l("providers.drawer.errors.baseUrlInvalid")}const c=new Set;return i.models.some(y=>{const S=y.id.trim();return S.length===0||c.has(S)?!0:(c.add(S),!1)})&&(a.models=l("providers.drawer.errors.modelInvalid")),i.models.length===0&&(a.models=l("providers.drawer.errors.modelsRequired")),i.defaultModel&&!i.models.some(y=>y.id===i.defaultModel)&&(a.models=l("providers.drawer.errors.defaultInvalid")),q(a),Object.keys(a).length===0},Z=()=>{const a=i.models.map(u=>{var c;return{id:u.id.trim(),label:(c=u.label)!=null&&c.trim()?u.label.trim():void 0,capabilities:u.capabilities,maxTokens:typeof u.maxTokens=="number"&&Number.isFinite(u.maxTokens)?u.maxTokens:void 0}}),d=n!=null&&n.extraHeaders&&Object.keys(n.extraHeaders).length>0?n.extraHeaders:void 0;return{id:i.id.trim(),label:i.label.trim()||i.id.trim(),baseUrl:i.baseUrl.trim(),apiKey:i.apiKey.trim()||void 0,type:i.type??"custom",defaultModel:i.defaultModel||void 0,models:a,extraHeaders:d}},K=async()=>{if(w(null),!!X()){D(!0);try{const a=Z();await P(a)}catch(a){w(l("providers.drawer.toast.saveFailure",{message:a instanceof Error?a.message:"unknown"})),D(!1);return}D(!1),v()}},Y=o==="create";return s?e.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[e.jsx("div",{className:"flex-1 bg-slate-900/60",onClick:v,"aria-hidden":"true"}),e.jsxs("aside",{ref:_,role:"dialog","aria-modal":"true","aria-labelledby":"provider-drawer-title","aria-describedby":"provider-drawer-desc",className:"flex h-full w-full max-w-3xl flex-col border-l border-slate-200 bg-white shadow-xl dark:border-slate-800 dark:bg-slate-900",children:[e.jsxs("header",{className:"flex items-center justify-between border-b border-slate-200 px-6 py-4 dark:border-slate-800",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"provider-drawer-title",className:"text-lg font-semibold",children:l(Y?"providers.drawer.createTitle":"providers.drawer.editTitle")}),e.jsx("p",{id:"provider-drawer-desc",className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.description")})]}),e.jsx("button",{type:"button",ref:N,onClick:v,className:"rounded-md border border-slate-200 px-3 py-1 text-sm transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",children:l("common.actions.close")})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:[e.jsxs("section",{className:"space-y-4","aria-labelledby":"provider-basic-fields",children:[e.jsx("div",{id:"provider-basic-fields",className:"sr-only",children:l("providers.drawer.description")}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("button",{type:"button",onClick:()=>Q(a=>!a),className:"rounded-md border border-slate-200 px-3 py-1 text-xs transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",children:l(U?"providers.drawer.fields.hideAdvanced":"providers.drawer.fields.showAdvanced")})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.id")}),e.jsx("input",{value:i.id,ref:C,onChange:a=>z(a.target.value),disabled:!Y,placeholder:l("providers.drawer.fields.idPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60","aria-invalid":!!j.id}),j.id?e.jsx("span",{className:"text-xs text-red-500",children:j.id}):null]}),U?e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.label")}),e.jsx("input",{value:i.label,onChange:a=>H("label")(a.target.value),placeholder:l("providers.drawer.fields.labelPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60"})]}):null]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.baseUrl")}),e.jsx("input",{value:i.baseUrl,onChange:a=>H("baseUrl")(a.target.value),placeholder:l("providers.drawer.fields.baseUrlPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60","aria-invalid":!!j.baseUrl}),j.baseUrl?e.jsx("span",{className:"text-xs text-red-500",children:j.baseUrl}):null]}),e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.type")}),e.jsxs("select",{value:i.type??"custom",onChange:a=>G(a.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60",children:[e.jsx("option",{value:"openai",children:"OpenAI"}),e.jsx("option",{value:"deepseek",children:"DeepSeek"}),e.jsx("option",{value:"huawei",children:"华为云"}),e.jsx("option",{value:"kimi",children:"Kimi"}),e.jsx("option",{value:"anthropic",children:"Anthropic (Claude)"}),e.jsx("option",{value:"custom",children:"Custom"})]})]})]}),e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.apiKey")}),e.jsx("input",{value:i.apiKey,onChange:a=>H("apiKey")(a.target.value),placeholder:l("providers.drawer.fields.apiKeyPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60"})]})]}),e.jsxs("section",{className:"mt-6 space-y-3","aria-labelledby":"provider-model-fields",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{id:"provider-model-fields",className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.models")}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.modelsDescription")})]}),e.jsx("button",{type:"button",onClick:W,className:"rounded-md border border-slate-200 px-3 py-1 text-xs transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",children:l("providers.drawer.fields.addModel")})]}),j.models?e.jsx("p",{className:"text-xs text-red-500",children:j.models}):null,e.jsx("div",{className:"space-y-4",children:i.models.map((a,d)=>{var u,c;return e.jsxs("div",{className:"rounded-lg border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-800/40",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.modelId")}),e.jsx("input",{value:a.id,onChange:m=>V(d,m.target.value),placeholder:l("providers.drawer.fields.modelIdPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60"})]}),U?e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.modelLabel")}),e.jsx("input",{value:a.label??"",onChange:m=>A(d,{label:m.target.value}),placeholder:l("providers.drawer.fields.modelLabelPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60"})]}):null]}),U?e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.maxTokens")}),e.jsx("input",{type:"number",min:1,value:a.maxTokens??"",onChange:m=>A(d,{maxTokens:m.target.value?Number(m.target.value):void 0}),placeholder:"128000",className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60"})]}),e.jsxs("div",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.fields.capabilities")}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs("label",{className:"inline-flex items-center gap-2 text-xs text-slate-600 dark:text-slate-300",children:[e.jsx("input",{type:"checkbox",checked:!!((u=a.capabilities)!=null&&u.thinking),onChange:()=>B(d,"thinking"),className:"h-4 w-4 rounded border-slate-300"}),l("providers.drawer.fields.capabilityThinking")]}),e.jsxs("label",{className:"inline-flex items-center gap-2 text-xs text-slate-600 dark:text-slate-300",children:[e.jsx("input",{type:"checkbox",checked:!!((c=a.capabilities)!=null&&c.tools),onChange:()=>B(d,"tools"),className:"h-4 w-4 rounded border-slate-300"}),l("providers.drawer.fields.capabilityTools")]})]})]})]}):null,e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-2 text-slate-600 dark:text-slate-300",children:[e.jsx("input",{type:"radio",name:"defaultModel",value:a.id,checked:i.defaultModel===a.id,onChange:()=>k(m=>({...m,defaultModel:a.id})),disabled:a.id.trim().length===0}),l("providers.drawer.fields.setDefault")]}),e.jsx("button",{type:"button",className:"text-red-500 transition hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-40",onClick:()=>M(d),disabled:i.models.length<=1,children:l("providers.drawer.fields.removeModel")})]})]},a._key)})}),$.length>1?e.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:l("providers.drawer.defaultHint",{model:i.defaultModel||l("providers.card.noDefault")})}):null]})]}),e.jsxs("footer",{className:"flex items-center justify-between gap-3 border-t border-slate-200 px-6 py-4 text-sm dark:border-slate-800",children:[e.jsx("div",{className:"flex flex-col text-xs text-red-500","aria-live":"polite",children:R?e.jsx("span",{children:R}):null}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:v,className:"rounded-md border border-slate-200 px-4 py-2 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",disabled:L,children:l("common.actions.cancel")}),e.jsx("button",{type:"button",onClick:K,className:"rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700 disabled:opacity-60",disabled:L,children:l(L?"common.actions.saving":"common.actions.save")})]})]})]})]}):null}const pe=["claude-sonnet-4-20250514","claude-opus-4-1-20250805","claude-3-5-haiku-20241022"];function se(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Math.random().toString(36).slice(2,10)}function O(s){return s?Object.entries(s).map(([o,n])=>({id:se(),source:o,target:n})):[]}function je(){const{t:s}=te(),{pushToast:o}=ue(),n=be(["config","full"],{url:"/api/config",method:"GET"}),[x,v]=p.useState(null),[P,l]=p.useState(!1),[i,k]=p.useState("create"),[j,q]=p.useState(void 0),[L,D]=p.useState(null),[R,w]=p.useState([]),[_,N]=p.useState(null),[C,U]=p.useState(!1),[Q,$]=p.useState(!1),[H,z]=p.useState(""),[G,A]=p.useState(null),[V,B]=p.useState(!1),M=(x==null?void 0:x.providers)??[],W=M.length;p.useEffect(()=>{n.data&&(v(n.data),w(O(n.data.modelRoutes)),N(null))},[n.data]),p.useEffect(()=>{n.isError&&n.error&&o({title:s("providers.toast.loadFailure",{message:n.error.message}),variant:"error"})},[n.isError,n.error,o,s]);const X=p.useMemo(()=>{const t=new Map;for(const r of M){if(!r.defaultModel||!r.models)continue;const b=r.models.find(f=>f.id===r.defaultModel);b&&t.set(r.id,de(b))}return t},[M]),Z=p.useMemo(()=>{const t=[],r=new Set;for(const b of M){const f=b.label||b.id,h=b.models??[];if(h.length>0)for(const g of h){const I=`${b.id}:${g.id}`;r.has(I)||(r.add(I),t.push({value:I,label:`${f} · ${g.label??g.id}`}))}else if(b.defaultModel){const g=`${b.id}:${b.defaultModel}`;r.has(g)||(r.add(g),t.push({value:g,label:`${f} · ${b.defaultModel}`}))}}for(const b of R){const f=b.target.trim();f&&!r.has(f)&&(r.add(f),t.push({value:f,label:f}))}return t},[M,R]),K=()=>x?!0:(o({title:s("settings.toast.missingConfig"),variant:"error"}),n.refetch(),!1),Y=t=>{if(!x)return t;let r=t,b=1;for(;x.providers.some(f=>f.id===r);)r=`${t}-${b}`,b+=1;return r},a=()=>{K()&&(k("create"),q(void 0),l(!0))},d=()=>{K()&&(z(""),A(null),$(!0))},u=t=>{K()&&(k("edit"),q(t),l(!0))},c=async()=>{if(!x){o({title:s("settings.toast.missingConfig"),variant:"error"});return}const t=H.trim();if(!t){A(s("providers.quickAddHuawei.validation.apiKey"));return}const f={id:Y("huawei-cloud"),label:s("providers.quickAddHuawei.providerLabel"),baseUrl:"https://api.modelarts-maas.com/v1",apiKey:t,type:"huawei",defaultModel:"deepseek-v3.1",models:[{id:"deepseek-v3.1",label:"DeepSeek V3.1",capabilities:{thinking:!1,tools:!0}},{id:"KIMI-K2",label:"KIMI-K2",capabilities:{thinking:!1,tools:!0}},{id:"qwen3-235b-a22b",label:"Qwen3 235B A22B",capabilities:{thinking:!1,tools:!0}}]},h={...x,providers:[...x.providers,f]};try{B(!0),await F.put("/api/config",h),v(h),w(O(h.modelRoutes)),$(!1),o({title:s("providers.quickAddHuawei.toast.success"),description:s("providers.quickAddHuawei.toast.added",{name:f.label||f.id}),variant:"success"}),n.refetch()}catch(g){A(g instanceof Error?g.message:s("providers.quickAddHuawei.toast.failure"))}finally{B(!1)}},m=async t=>{if(!x)throw new Error(s("settings.toast.missingConfig"));const r=i==="create"?[...M,t]:M.map(h=>j&&h.id===j.id?{...t,id:j.id}:h),b={...x,providers:r};await F.put("/api/config",b),v(b),w(O(b.modelRoutes)),n.refetch();const f=i==="create"?s("providers.toast.createSuccess",{name:t.label||t.id}):s("providers.toast.updateSuccess",{name:t.label||t.id});o({title:f,variant:"success"})},y=async t=>{D(t.id);try{const r=await F.post(`/api/providers/${t.id}/test`);r.data.ok?o({title:s("providers.toast.testSuccess"),description:s("providers.toast.testSuccessDesc",{status:r.data.status,duration:r.data.durationMs?`${r.data.durationMs} ms`:"—"}),variant:"success"}):o({title:s("providers.toast.testFailure",{message:`${r.data.status} ${r.data.statusText}`}),variant:"error"})}catch(r){o({title:s("providers.toast.testFailure",{message:r instanceof Error?r.message:"unknown"}),variant:"error"})}finally{D(null)}},S=async t=>{if(!K()||!window.confirm(s("providers.confirm.delete",{name:t.label||t.id})))return;const b=M.filter(g=>g.id!==t.id),f={};if(x!=null&&x.modelRoutes)for(const[g,I]of Object.entries(x.modelRoutes)){if(!I)continue;const[re]=I.split(":");re&&re===t.id||I===t.id||(f[g]=I)}const h={...x,providers:b,modelRoutes:f};try{await F.put("/api/config",h),v(h),w(O(h.modelRoutes)),o({title:s("providers.toast.deleteSuccess",{name:t.label||t.id}),variant:"success"}),n.refetch()}catch(g){o({title:s("providers.toast.deleteFailure",{message:g instanceof Error?g.message:"unknown"}),variant:"error"})}},E=()=>{w(t=>[...t,{id:se(),source:"",target:""}]),N(null)},J=t=>{w(r=>r.some(b=>b.source.trim()===t)?r:[...r,{id:se(),source:t,target:""}]),N(null)},T=(t,r,b)=>{w(f=>f.map(h=>h.id===t?{...h,[r]:b}:h)),N(null)},oe=t=>{w(r=>r.filter(b=>b.id!==t)),N(null)},ne=()=>{x&&(w(O(x.modelRoutes)),N(null))},ce=async()=>{if(!K())return;const t={};for(const r of R){const b=r.source.trim(),f=r.target.trim();if(!(!b&&!f)){if(!b||!f){N(s("settings.validation.routePair"));return}if(t[b]){N(s("settings.validation.routeDuplicate",{model:b}));return}t[b]=f}}N(null),U(!0);try{const r={...x,modelRoutes:t};await F.put("/api/config",r),v(r),w(O(r.modelRoutes)),o({title:s("modelManagement.toast.routesSaved"),variant:"success"}),n.refetch()}catch(r){o({title:s("modelManagement.toast.routesSaveFailure",{message:r instanceof Error?r.message:"unknown"}),variant:"error"})}finally{U(!1)}};return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("header",{className:"flex flex-col gap-2",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:s("modelManagement.title")}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:s("modelManagement.description")})]}),e.jsxs("section",{className:"space-y-4 rounded-lg border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("providers.title")}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:s("providers.description")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-slate-500 dark:text-slate-400",children:[e.jsx("span",{children:s("providers.count",{count:W})}),e.jsx("button",{type:"button",className:"rounded-md border border-slate-200 px-3 py-1 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",onClick:()=>n.refetch(),disabled:n.isFetching,children:n.isFetching?s("common.actions.refreshing"):s("providers.actions.refresh")}),e.jsx("button",{type:"button",className:"rounded-md border border-slate-200 px-3 py-1 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",onClick:d,children:s("providers.quickAddHuawei.button")}),e.jsx("button",{type:"button",className:"rounded-md border border-slate-200 px-3 py-1 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",onClick:a,children:s("providers.actions.add")})]})]}),n.isPending||!x&&n.isFetching?e.jsx("section",{className:"flex min-h-[200px] items-center justify-center rounded-lg border border-slate-200 bg-white text-sm text-slate-500 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-400",children:s("common.loading")}):M.length===0?e.jsx("section",{className:"rounded-lg border border-dashed border-slate-300 bg-white p-8 text-sm text-slate-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-400",children:s("providers.emptyState")}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:M.map(t=>e.jsxs("article",{className:"flex h-full flex-col gap-4 rounded-lg border border-slate-200 bg-white p-5 shadow-sm transition hover:shadow-md dark:border-slate-800 dark:bg-slate-900",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t.label||t.id}),t.type?e.jsx(ge,{type:t.type}):null]}),e.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:["ID:",t.id]}),e.jsxs("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:["Base URL:",e.jsx("span",{className:"break-all text-slate-600 dark:text-slate-300",children:t.baseUrl})]})]}),e.jsx("div",{className:"flex flex-col gap-2 text-xs text-slate-500 dark:text-slate-400",children:t.defaultModel?e.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-100 px-2 py-0.5 font-medium text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-200",children:s("providers.card.defaultModel",{model:X.get(t.id)??t.defaultModel})}):e.jsx("span",{className:"inline-flex items-center rounded-full bg-slate-100 px-2 py-0.5 font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300",children:s("providers.card.noDefault")})})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400",children:s("providers.card.modelsTitle")}),t.models&&t.models.length>0?e.jsx("ul",{className:"flex flex-wrap gap-2",children:t.models.map(r=>e.jsxs("li",{className:"flex items-center gap-2 rounded-md border border-slate-200 bg-slate-50 px-3 py-1 text-xs dark:border-slate-700 dark:bg-slate-800/60",children:[e.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-200",children:de(r)}),e.jsx(he,{model:r})]},r.id))}):e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:s("providers.card.noModels")})]}),e.jsxs("footer",{className:"mt-auto flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",className:"rounded-md border border-slate-200 px-3 py-1 text-sm transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",onClick:()=>u(t),children:s("providers.actions.edit")}),e.jsx("button",{type:"button",onClick:()=>y(t),disabled:L===t.id,className:"rounded-md border border-slate-200 px-3 py-1 text-sm transition enabled:hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-60 dark:border-slate-700 dark:enabled:hover:bg-slate-800",children:L===t.id?s("common.actions.testingConnection"):s("providers.actions.test")}),e.jsx("button",{type:"button",className:"rounded-md border border-red-200 px-3 py-1 text-sm text-red-600 transition hover:bg-red-50 dark:border-red-800 dark:text-red-300 dark:hover:bg-red-900/40",onClick:()=>S(t),children:s("providers.actions.delete")})]})]},t.id))})]}),e.jsxs("section",{className:"space-y-4 rounded-lg border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("settings.routing.title")}),e.jsx("p",{className:"max-w-3xl text-xs text-slate-500 dark:text-slate-400",children:s("settings.routing.description")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("button",{type:"button",onClick:E,className:"rounded-md border border-slate-200 px-3 py-1 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",children:s("settings.routing.add")}),e.jsx("button",{type:"button",onClick:ne,className:"rounded-md border border-slate-200 px-3 py-1 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",disabled:C,children:s("common.actions.reset")}),e.jsx("button",{type:"button",onClick:ce,className:"rounded-md bg-blue-600 px-3 py-1 text-white transition hover:bg-blue-700 disabled:opacity-60",disabled:C,children:s(C?"common.actions.saving":"modelManagement.actions.saveRoutes")})]})]}),_?e.jsx("p",{className:"text-xs text-red-500",children:_}):null,R.length===0?e.jsx("p",{className:"rounded-md border border-dashed border-slate-200 bg-slate-50 px-3 py-6 text-center text-sm text-slate-500 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-300",children:s("settings.routing.empty")}):e.jsx("div",{className:"grid gap-3",children:R.map(t=>e.jsxs("div",{className:"grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto]",children:[e.jsxs("label",{className:"flex flex-col gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:s("settings.routing.sourceLabel")}),e.jsx("input",{value:t.source,onChange:r=>T(t.id,"source",r.target.value),placeholder:s("settings.routing.sourcePlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40",disabled:C})]}),e.jsxs("label",{className:"flex flex-col gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:s("settings.routing.targetLabel")}),e.jsxs("select",{value:t.target,onChange:r=>T(t.id,"target",r.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-100 disabled:text-slate-400 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40 dark:disabled:bg-slate-800/60",disabled:C,children:[e.jsx("option",{value:"",children:s("modelManagement.routing.selectTarget")}),Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))]})]}),e.jsx("div",{className:"flex items-end justify-start pb-1 md:justify-end",children:e.jsx("button",{type:"button",onClick:()=>oe(t.id),className:"rounded-md border border-slate-200 px-3 py-2 text-xs text-slate-600 transition hover:bg-slate-100 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800",disabled:C,children:s("settings.routing.remove")})})]},t.id))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-slate-500 dark:text-slate-400",children:[e.jsx("span",{children:s("settings.routing.suggested")}),pe.map(t=>e.jsx("button",{type:"button",onClick:()=>J(t),className:"rounded-md border border-slate-200 px-2 py-1 text-xs text-slate-600 transition hover:bg-slate-100 dark:border-slate-700 dark:text-slate-300 dark:hover:bg-slate-800",disabled:C,children:t},t))]})]}),e.jsx(me,{open:P,mode:i,provider:i==="edit"?j:void 0,existingProviderIds:M.map(t=>t.id).filter(t=>i==="edit"&&j?t!==j.id:!0),onClose:()=>{l(!1),q(void 0),k("create")},onSubmit:m}),e.jsx(fe,{open:Q,apiKey:H,onApiKeyChange:t=>{z(t),G&&A(null)},loading:V,error:G,onClose:()=>{V||($(!1),A(null))},onSubmit:c})]})}function fe({open:s,apiKey:o,onApiKeyChange:n,loading:x,error:v,onClose:P,onSubmit:l}){const{t:i}=te();return s?e.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[e.jsx("div",{className:"flex-1 bg-slate-900/60",onClick:P,"aria-hidden":"true"}),e.jsxs("aside",{role:"dialog","aria-modal":"true","aria-labelledby":"quick-add-huawei",className:"flex h-full w-full max-w-md flex-col border-l border-slate-200 bg-white shadow-xl dark:border-slate-800 dark:bg-slate-900",children:[e.jsxs("header",{className:"flex items-center justify-between border-b border-slate-200 px-6 py-4 dark:border-slate-800",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"quick-add-huawei",className:"text-lg font-semibold",children:i("providers.quickAddHuawei.title")}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:i("providers.quickAddHuawei.description")})]}),e.jsx("button",{type:"button",onClick:P,className:"rounded-md border border-slate-200 px-3 py-1 text-sm transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",disabled:x,children:i("common.actions.close")})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 px-6 py-5 text-sm",children:[e.jsxs("label",{className:"flex flex-col gap-2 text-sm",children:[e.jsx("span",{className:"text-xs text-slate-500 dark:text-slate-400",children:i("providers.quickAddHuawei.apiKeyLabel")}),e.jsx("input",{type:"password",value:o,onChange:k=>n(k.target.value),placeholder:i("providers.quickAddHuawei.apiKeyPlaceholder"),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-200 dark:border-slate-700 dark:bg-slate-800 dark:focus:border-blue-400 dark:focus:ring-blue-400/40",disabled:x})]}),e.jsx("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:i("providers.quickAddHuawei.note")}),v?e.jsx("p",{className:"text-xs text-red-500",children:v}):null]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-slate-200 px-6 py-4 text-sm dark:border-slate-800",children:[e.jsx("button",{type:"button",onClick:P,className:"rounded-md border border-slate-200 px-4 py-2 transition hover:bg-slate-100 dark:border-slate-700 dark:hover:bg-slate-800",disabled:x,children:i("common.actions.cancel")}),e.jsx("button",{type:"button",onClick:l,className:"rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700 disabled:opacity-60",disabled:x,children:i(x?"common.actions.saving":"providers.quickAddHuawei.submit")})]})]})]}):null}function de(s){return s.label&&s.label.trim().length>0?`${s.label} (${s.id})`:s.id}function he({model:s}){const o=s.capabilities;if(!o)return null;const n=[];return o.thinking&&n.push("Thinking"),o.tools&&n.push("Tools"),n.length===0?null:e.jsx("span",{className:"rounded-full bg-sky-100 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:bg-sky-900/40 dark:text-sky-200",children:n.join(" · ")})}function ge({type:s}){const o={openai:"OpenAI",deepseek:"DeepSeek",huawei:"华为云",kimi:"Kimi",anthropic:"Anthropic",custom:"Custom"};return e.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-0.5 text-xs font-medium text-slate-600 dark:bg-slate-800 dark:text-slate-300",children:o[s]??s})}export{je as default};