console.log(" iRingo: \uD83C\uDF24 WeatherKit"),console.log("request.bundle.js"),console.log("Version: 2.0.6"),console.log("Date: 2025/9/10 00:47:28"),(()=>{"use strict";let e,t=(()=>{let e=Object.keys(globalThis);switch(!0){case e.includes("$task"):return"Quantumult X";case e.includes("$loon"):return"Loon";case e.includes("$rocket"):return"Shadowrocket";case"undefined"!=typeof module:return"Node.js";case e.includes("Egern"):return"Egern";case e.includes("$environment"):if($environment["surge-version"])return"Surge";if($environment["stash-version"])return"Stash";return;default:return}})();class a{static #e=new Map([]);static #t=[];static #a=new Map([]);static clear=()=>{};static count=(e="default")=>{switch(a.#e.has(e)){case!0:a.#e.set(e,a.#e.get(e)+1);break;case!1:a.#e.set(e,0)}a.log(`${e}: ${a.#e.get(e)}`)};static countReset=(e="default")=>{switch(a.#e.has(e)){case!0:a.#e.set(e,0),a.log(`${e}: ${a.#e.get(e)}`);break;case!1:a.warn(`Counter "${e}" doesn’t exist`)}};static debug=(...e)=>{a.#s<4||(e=e.map(e=>`🅱️ ${e}`),a.log(...e))};static error(...e){if(!(a.#s<1)){switch(t){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Quantumult X":default:e=e.map(e=>`❌ ${e}`);break;case"Node.js":e=e.map(e=>`❌ ${e.stack}`)}a.log(...e)}}static exception=(...e)=>a.error(...e);static group=e=>a.#t.unshift(e);static groupEnd=()=>a.#t.shift();static info(...e){a.#s<3||(e=e.map(e=>`ℹ️ ${e}`),a.log(...e))}static #s=3;static get logLevel(){switch(a.#s){case 0:return"OFF";case 1:return"ERROR";case 2:return"WARN";case 3:default:return"INFO";case 4:return"DEBUG";case 5:return"ALL"}}static set logLevel(e){switch(typeof e){case"string":e=e.toLowerCase();break;case"number":break;default:e="warn"}switch(e){case 0:case"off":a.#s=0;break;case 1:case"error":a.#s=1;break;case 2:case"warn":case"warning":default:a.#s=2;break;case 3:case"info":a.#s=3;break;case 4:case"debug":a.#s=4;break;case 5:case"all":a.#s=5}}static log=(...e)=>{0!==a.#s&&(e=e.map(e=>{switch(typeof e){case"object":e=JSON.stringify(e);break;case"bigint":case"number":case"boolean":case"string":e=e.toString()}return e}),a.#t.forEach(t=>{(e=e.map(e=>` ${e}`)).unshift(`▼ ${t}:`)}),console.log((e=["",...e]).join("\n")))};static time=(e="default")=>a.#a.set(e,Date.now());static timeEnd=(e="default")=>a.#a.delete(e);static timeLog=(e="default")=>{let t=a.#a.get(e);t?a.log(`${e}: ${Date.now()-t}ms`):a.warn(`Timer "${e}" doesn’t exist`)};static warn(...e){a.#s<2||(e=e.map(e=>`⚠️ ${e}`),a.log(...e))}}class s{static escape(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,e=>t[e])}static get(e={},t="",a){Array.isArray(t)||(t=s.toPath(t));let r=t.reduce((e,t)=>Object(e)[t],e);return void 0===r?a:r}static omit(e={},t=[]){return Array.isArray(t)||(t=[t.toString()]),t.forEach(t=>s.unset(e,t)),e}static pick(e={},t=[]){return Array.isArray(t)||(t=[t.toString()]),Object.fromEntries(Object.entries(e).filter(([e,a])=>t.includes(e)))}static set(e,t,a){return Array.isArray(t)||(t=s.toPath(t)),t.slice(0,-1).reduce((e,a,s)=>Object(e[a])===e[a]?e[a]:e[a]=/^\d+$/.test(t[s+1])?[]:{},e)[t[t.length-1]]=a,e}static toPath(e){return e.replace(/\[(\d+)\]/g,".$1").split(".").filter(Boolean)}static unescape(e){let t={"&":"&","<":"<",">":">",""":'"',"'":"'"};return e.replace(/&|<|>|"|'/g,e=>t[e])}static unset(e={},t=""){return Array.isArray(t)||(t=s.toPath(t)),t.reduce((e,a,s)=>s===t.length-1?(delete e[a],!0):Object(e)[a],e)}}let r={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Content Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"};function o(e={}){switch(t){case"Surge":e.policy&&s.set(e,"headers.X-Surge-Policy",e.policy),a.log("\uD83D\uDEA9 执行结束!",`🕛 ${new Date().getTime()/1e3-$script.startTime} 秒`),$done(e);break;case"Loon":e.policy&&(e.node=e.policy),a.log("\uD83D\uDEA9 执行结束!",`🕛 ${(new Date-$script.startTime)/1e3} 秒`),$done(e);break;case"Stash":e.policy&&s.set(e,"headers.X-Stash-Selected-Proxy",encodeURI(e.policy)),a.log("\uD83D\uDEA9 执行结束!",`🕛 ${(new Date-$script.startTime)/1e3} 秒`),$done(e);break;case"Egern":case"Shadowrocket":a.log("\uD83D\uDEA9 执行结束!"),$done(e);break;case"Quantumult X":switch(e.policy&&s.set(e,"opts.policy",e.policy),typeof(e=s.pick(e,["status","url","headers","body","bodyBytes"])).status){case"number":e.status=`HTTP/1.1 ${e.status} ${r[e.status]}`;break;case"string":case"undefined":break;default:throw TypeError(`${Function.name}: 参数类型错误, status 必须为数字或字符串`)}e.body instanceof ArrayBuffer?(e.bodyBytes=e.body,e.body=void 0):ArrayBuffer.isView(e.body)?(e.bodyBytes=e.body.buffer.slice(e.body.byteOffset,e.body.byteLength+e.body.byteOffset),e.body=void 0):e.body&&(e.bodyBytes=void 0),a.log("\uD83D\uDEA9 执行结束!"),$done(e);break;default:a.log("\uD83D\uDEA9 执行结束!"),process.exit(1)}}class i{static data=null;static dataFile="box.dat";static #r=/^@(?[^.]+)(?:\.(?.*))?$/;static getItem(e,a=null){let r=a;if(!0===e.startsWith("@")){let{key:t,path:a}=e.match(i.#r)?.groups;e=t;let o=i.getItem(e,{});"object"!=typeof o&&(o={}),r=s.get(o,a);try{r=JSON.parse(r)}catch(e){}}else{switch(t){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":r=$persistentStore.read(e);break;case"Quantumult X":r=$prefs.valueForKey(e);break;case"Node.js":i.data=i.#o(i.dataFile),r=i.data?.[e];break;default:r=i.data?.[e]||null}try{r=JSON.parse(r)}catch(e){}}return r??a}static setItem(e=new String,a=new String){let r=!1;if(a="object"==typeof a?JSON.stringify(a):String(a),!0===e.startsWith("@")){let{key:t,path:o}=e.match(i.#r)?.groups;e=t;let c=i.getItem(e,{});"object"!=typeof c&&(c={}),s.set(c,o,a),r=i.setItem(e,c)}else switch(t){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":r=$persistentStore.write(a,e);break;case"Quantumult X":r=$prefs.setValueForKey(a,e);break;case"Node.js":i.data=i.#o(i.dataFile),i.data[e]=a,i.#i(i.dataFile),r=!0;break;default:r=i.data?.[e]||null}return r}static removeItem(e){let a=!1;if(!0===e.startsWith("@")){let{key:t,path:r}=e.match(i.#r)?.groups;e=t;let o=i.getItem(e);"object"!=typeof o&&(o={}),keyValue=s.unset(o,r),a=i.setItem(e,o)}else switch(t){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Node.js":default:a=!1;break;case"Quantumult X":a=$prefs.removeValueForKey(e)}return a}static clear(){let e=!1;switch(t){case"Surge":case"Loon":case"Stash":case"Egern":case"Shadowrocket":case"Node.js":default:e=!1;break;case"Quantumult X":e=$prefs.removeAllValues()}return e}static #o=e=>{if("Node.js"!==t)return{};{this.fs=this.fs?this.fs:require("node:fs"),this.path=this.path?this.path:require("node:path");let t=this.path.resolve(e),a=this.path.resolve(process.cwd(),e),s=this.fs.existsSync(t),r=!s&&this.fs.existsSync(a);if(!s&&!r)return{};try{return JSON.parse(this.fs.readFileSync(s?t:a))}catch(e){return{}}}};static #i=(e=this.dataFile)=>{if("Node.js"===t){this.fs=this.fs?this.fs:require("node:fs"),this.path=this.path?this.path:require("node:path");let t=this.path.resolve(e),a=this.path.resolve(process.cwd(),e),s=this.fs.existsSync(t),r=!s&&this.fs.existsSync(a),o=JSON.stringify(this.data);s?this.fs.writeFileSync(t,o):r?this.fs.writeFileSync(a,o):this.fs.writeFileSync(t,o)}}}function c(e){return/^\d+$/.test(e)&&(e=Number.parseInt(e,10)),e}let n={WeatherKit:{Settings:{DataSets:["airQuality","currentWeather","forecastDaily","forecastHourly","forecastNextHour","locationInfo","news","historicalComparisons","weatherAlerts","weatherChanges"],Weather:{Provider:"WeatherKit"},NextHour:{Provider:"ColorfulClouds"},AQI:{Provider:"ColorfulClouds",ReplaceProviders:["QWeather"],ComparisonProvider:"Auto",Local:{Scale:"EPA_NowCast",ReplaceScales:["HJ6332012"],ConvertUnits:!1}},API:{WAQI:{Token:null},QWeather:{Token:null,Host:"devapi.qweather.com"},ColorfulClouds:{Token:null}}},Configs:{Availability:{v1:["currentWeather","dailyForecast","hourlyForecast","minuteForecast","weatherAlerts"],v2:["airQuality","currentWeather","forecastDaily","forecastHourly","forecastPeriodic","historicalComparisons","weatherChanges","forecastNextHour","weatherAlerts","weatherAlertNotifications","news"]}}},Default:{Settings:{LogLevel:"WARN"},Configs:{Storefront:{AE:"143481",AF:"143610",AG:"143540",AI:"143538",AL:"143575",AM:"143524",AO:"143564",AR:"143505",AT:"143445",AU:"143460",AZ:"143568",BA:"143612",BB:"143541",BD:"143490",BE:"143446",BF:"143578",BG:"143526",BH:"143559",BJ:"143576",BM:"143542",BN:"143560",BO:"143556",BR:"143503",BS:"143539",BT:"143577",BW:"143525",BY:"143565",BZ:"143555",CA:"143455",CD:"143613",CG:"143582",CH:"143459",CI:"143527",CL:"143483",CM:"143574",CN:"143465",CO:"143501",CR:"143495",CV:"143580",CY:"143557",CZ:"143489",DE:"143443",DK:"143458",DM:"143545",DO:"143508",DZ:"143563",EC:"143509",EE:"143518",EG:"143516",ES:"143454",FI:"143447",FJ:"143583",FM:"143591",FR:"143442",GA:"143614",GB:"143444",GD:"143546",GF:"143615",GH:"143573",GM:"143584",GR:"143448",GT:"143504",GW:"143585",GY:"143553",HK:"143463",HN:"143510",HR:"143494",HU:"143482",ID:"143476",IE:"143449",IL:"143491",IN:"143467",IQ:"143617",IS:"143558",IT:"143450",JM:"143511",JO:"143528",JP:"143462",KE:"143529",KG:"143586",KH:"143579",KN:"143548",KP:"143466",KR:"143466",KW:"143493",KY:"143544",KZ:"143517",TC:"143552",TD:"143581",TJ:"143603",TH:"143475",TM:"143604",TN:"143536",TO:"143608",TR:"143480",TT:"143551",TW:"143470",TZ:"143572",LA:"143587",LB:"143497",LC:"143549",LI:"143522",LK:"143486",LR:"143588",LT:"143520",LU:"143451",LV:"143519",LY:"143567",MA:"143620",MD:"143523",ME:"143619",MG:"143531",MK:"143530",ML:"143532",MM:"143570",MN:"143592",MO:"143515",MR:"143590",MS:"143547",MT:"143521",MU:"143533",MV:"143488",MW:"143589",MX:"143468",MY:"143473",MZ:"143593",NA:"143594",NE:"143534",NG:"143561",NI:"143512",NL:"143452",NO:"143457",NP:"143484",NR:"143606",NZ:"143461",OM:"143562",PA:"143485",PE:"143507",PG:"143597",PH:"143474",PK:"143477",PL:"143478",PT:"143453",PW:"143595",PY:"143513",QA:"143498",RO:"143487",RS:"143500",RU:"143469",RW:"143621",SA:"143479",SB:"143601",SC:"143599",SE:"143456",SG:"143464",SI:"143499",SK:"143496",SL:"143600",SN:"143535",SR:"143554",ST:"143598",SV:"143506",SZ:"143602",UA:"143492",UG:"143537",US:"143441",UY:"143514",UZ:"143566",VC:"143550",VE:"143502",VG:"143543",VN:"143471",VU:"143609",XK:"143624",YE:"143571",ZA:"143472",ZM:"143622",ZW:"143605"}}}},l=new URL($request.url);a.info(`url: ${l.toJSON()}`);let u=($request.headers?.["Content-Type"]??$request.headers?.["content-type"])?.split(";")?.[0];a.info(`FORMAT: ${u}`),(async()=>{let{Settings:e,Caches:r,Configs:o}=function(e,t,r){a.info("☑️ Set Environment Variables");let{Settings:o,Caches:n,Configs:l}=function(e,t,a){t=[t].flat(1/0);let r={Settings:a?.Default?.Settings||{},Configs:a?.Default?.Configs||{},Caches:{}};switch(t.forEach(e=>{r.Settings={...r.Settings,...a?.[e]?.Settings},r.Configs={...r.Configs,...a?.[e]?.Configs}}),typeof $argument){case"string":$argument=Object.fromEntries($argument.split("&").map(e=>e.split("=",2).map(e=>e.replace(/\"/g,""))));case"object":{let e={};Object.keys($argument).forEach(t=>s.set(e,t,$argument[t])),r.Settings={...r.Settings,...e}}}let o=i.getItem(e);return o&&t.forEach(e=>{switch(typeof o?.[e]?.Settings){case"string":o[e].Settings=JSON.parse(o[e].Settings||"{}");case"object":r.Settings={...r.Settings,...o[e].Settings}}switch(typeof o?.[e]?.Caches){case"string":o[e].Caches=JSON.parse(o[e].Caches||"{}");case"object":r.Caches={...r.Caches,...o[e].Caches}}}),function e(t,a){for(let s in t){let r=t[s];t[s]="object"==typeof r&&null!==r?e(r,a):a(s,r)}return t}(r.Settings,(e,t)=>("true"===t||"false"===t?t=JSON.parse(t):"string"==typeof t&&(t=t.includes(",")?t.split(",").map(e=>c(e)):c(t)),t)),r}(e,t,r);if(Array.isArray(o?.AQI?.ReplaceProviders)||s.set(o,"AQI.ReplaceProviders",o?.AQI?.ReplaceProviders?[o.AQI.ReplaceProviders.toString()]:[]),o.AQI.ReplaceProviders.includes("TWC")&&o.AQI.ReplaceProviders.push("The Weather Channel"),o.AQI.ReplaceProviders.includes("QWeather")&&o.AQI.ReplaceProviders.push("和风天气"),o.AQI.ReplaceProviders.push(void 0),Array.isArray(o?.AQI?.Local?.ReplaceScales)||s.set(o,"AQI.Local.ReplaceScales",o?.AQI?.Local?.ReplaceScales?[o.AQI.Local.ReplaceScales.toString()]:[]),a.info(`typeof Settings: ${typeof o}`,`Settings: ${JSON.stringify(o,null,2)}`),l.Locale&&(l.Locale=new Map(l.Locale)),l.i18n)for(let e in l.i18n)l.i18n[e]=new Map(l.i18n[e]);return a.info("✅ Set Environment Variables"),{Settings:o,Caches:n,Configs:l}}("iRingo","WeatherKit",n);switch($request.method){case"POST":case"PUT":case"PATCH":case"DELETE":switch(u){case void 0:case"application/x-www-form-urlencoded":case"text/plain":default:case"application/x-mpegURL":case"application/x-mpegurl":case"application/vnd.apple.mpegurl":case"audio/mpegurl":case"text/xml":case"text/html":case"text/plist":case"application/xml":case"application/plist":case"application/x-plist":case"text/vtt":case"application/vtt":case"text/json":case"application/json":break;case"application/protobuf":case"application/x-protobuf":case"application/vnd.google.protobuf":case"application/grpc":case"application/grpc+proto":case"application/octet-stream":{let e="Quantumult X"===t?new Uint8Array($request.bodyBytes??[]):$request.body??new Uint8Array;$request.body=e}}case"GET":case"HEAD":case"OPTIONS":default:if(delete $request?.headers?.["If-None-Match"],delete $request?.headers?.["if-none-match"],"weatherkit.apple.com"===l.hostname&&!0===l.pathname.startsWith("/api/v2/weather/")){switch(!0){case $request.headers["User-Agent"]?.startsWith("WeatherKit_Weather_macOS_Version"):case $request.headers["user-agent"]?.startsWith("WeatherKit_Weather_macOS_Version"):if(l.searchParams.has("country"));else{let e=i.getItem("@iRingo.Location.Caches")?.pep?.gcc;e&&l.searchParams.set("country",e)}}let t=l.searchParams.get("dataSets")?.split(",");t&&(t=t?.filter(t=>e.DataSets?.includes(t)),l.searchParams.set("dataSets",t?.join(",")))}case"CONNECT":case"TRACE":}$request.url=l.toString(),a.debug(`$request.url: ${$request.url}`)})().catch(e=>a.error(e)).finally(()=>{switch(typeof e){case"object":e.headers?.["Content-Encoding"]&&(e.headers["Content-Encoding"]="identity"),e.headers?.["content-encoding"]&&(e.headers["content-encoding"]="identity"),"Quantumult X"===t?(e.status||(e.status="HTTP/1.1 200 OK"),delete e.headers?.["Content-Length"],delete e.headers?.["content-length"],delete e.headers?.["Transfer-Encoding"],o(e)):o({response:e});break;case"undefined":o($request);break;default:a.error(`不合法的 $response 类型: ${typeof e}`)}})})();