frappe-react-sdk 1.14.0 → 1.15.0

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,9 +1,12 @@
1
- (function(B,de){typeof exports=="object"&&typeof module<"u"?de(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],de):(B=typeof globalThis<"u"?globalThis:B||self,de(B["Frappe React"]={},B.jsxRuntime,B.React))})(this,function(B,de,S){"use strict";var Da=Object.defineProperty;var La=(B,de,S)=>de in B?Da(B,de,{enumerable:!0,configurable:!0,writable:!0,value:S}):B[de]=S;var Xe=(B,de,S)=>La(B,typeof de!="symbol"?de+"":de,S);var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ye={},ht={},Oe={},ns;function ss(){if(ns)return Oe;ns=1;var t=Oe&&Oe.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Oe&&Oe.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(v){try{y(h.next(v))}catch(O){m(O)}}function E(v){try{y(h.throw(v))}catch(O){m(O)}}function y(v){v.done?l(v.value):f(v.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Oe&&Oe.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(v){return E([y,v])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(v){y=[6,v],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Oe,"__esModule",{value:!0}),Oe.FrappeCall=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.get=function(c,o){return e(this,void 0,void 0,function(){var h;return n(this,function(f){return h=new URLSearchParams,o&&Object.entries(o).forEach(function(l){var m=l[0],b=l[1];if(b!=null){var E=typeof b=="object"?JSON.stringify(b):b;h.set(m,E)}}),[2,this.axios.get("/api/method/".concat(c),{params:h}).then(function(l){return l.data}).catch(function(l){var m,b;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:(m=l.response.data.message)!==null&&m!==void 0?m:"There was an error.",exception:(b=l.response.data.exception)!==null&&b!==void 0?b:""})})]})})},a.prototype.post=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/method/".concat(c),t({},o)).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a.prototype.put=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.put("/api/method/".concat(c),t({},o)).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a.prototype.delete=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.delete("/api/method/".concat(c),{params:o}).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error.",exception:(m=f.response.data.exception)!==null&&m!==void 0?m:""})})]})})},a}();return Oe.FrappeCall=s,Oe}var Ce={},rs;function is(){if(rs)return Ce;rs=1;var t=Ce&&Ce.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Ce&&Ce.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(v){try{y(h.next(v))}catch(O){m(O)}}function E(v){try{y(h.throw(v))}catch(O){m(O)}}function y(v){v.done?l(v.value):f(v.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Ce&&Ce.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(v){return E([y,v])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(v){y=[6,v],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.FrappeDB=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.getDoc=function(c,o){return o===void 0&&(o=""),e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.get("/api/resource/".concat(c,"/").concat(encodeURIComponent(o))).then(function(f){return f.data.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while fetching the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getDocList=function(c,o){var h;return e(this,void 0,void 0,function(){var f,l,m,b,E,y,v,O,I,R,K;return n(this,function(G){return f={},o&&(l=o.fields,m=o.filters,b=o.orFilters,E=o.orderBy,y=o.limit,v=o.limit_start,O=o.groupBy,I=o.asDict,R=I===void 0?!0:I,K=E?"".concat(String(E==null?void 0:E.field)," ").concat((h=E==null?void 0:E.order)!==null&&h!==void 0?h:"asc"):"",f={fields:l?JSON.stringify(l):void 0,filters:m?JSON.stringify(m):void 0,or_filters:b?JSON.stringify(b):void 0,order_by:K,group_by:O,limit:y,limit_start:v,as_dict:R}),[2,this.axios.get("/api/resource/".concat(c),{params:f}).then(function(H){return H.data.data}).catch(function(H){var j,Z;throw t(t({},H.response.data),{httpStatus:H.response.status,httpStatusText:H.response.statusText,message:"There was an error while fetching the documents.",exception:(Z=(j=H.response.data.exception)!==null&&j!==void 0?j:H.response.data.exc_type)!==null&&Z!==void 0?Z:""})})]})})},a.prototype.createDoc=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/resource/".concat(c),t({},o)).then(function(f){return f.data.data}).catch(function(f){var l,m,b;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(l=f.response.data.message)!==null&&l!==void 0?l:"There was an error while creating the document.",exception:(b=(m=f.response.data.exception)!==null&&m!==void 0?m:f.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},a.prototype.updateDoc=function(c,o,h){return e(this,void 0,void 0,function(){return n(this,function(f){return[2,this.axios.put("/api/resource/".concat(c,"/").concat(o&&encodeURIComponent(o)),t({},h)).then(function(l){return l.data.data}).catch(function(l){var m,b,E;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:(m=l.response.data.message)!==null&&m!==void 0?m:"There was an error while updating the document.",exception:(E=(b=l.response.data.exception)!==null&&b!==void 0?b:l.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.deleteDoc=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.delete("/api/resource/".concat(c,"/").concat(o&&encodeURIComponent(o))).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while deleting the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getCount=function(c,o,h){return h===void 0&&(h=!1),e(this,void 0,void 0,function(){var f;return n(this,function(l){return f={doctype:c,filters:[]},h&&(f.debug=h),o&&(f.filters=o?JSON.stringify(o):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:f}).then(function(m){return m.data.message}).catch(function(m){var b,E;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:"There was an error while getting the count.",exception:(E=(b=m.response.data.exception)!==null&&b!==void 0?b:m.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.getLastDoc=function(c,o){return e(this,void 0,void 0,function(){var h,f;return n(this,function(l){switch(l.label){case 0:return h={orderBy:{field:"creation",order:"desc"}},o&&(h=t(t({},h),o)),[4,this.getDocList(c,t(t({},h),{limit:1,fields:["name"]}))];case 1:return f=l.sent(),f.length>0?[2,this.getDoc(c,f[0].name)]:[2,{}]}})})},a.prototype.renameDoc=function(c,o,h,f){return f===void 0&&(f=!1),e(this,void 0,void 0,function(){return n(this,function(l){return[2,this.axios.post("/api/method/frappe.client.rename_doc",{doctype:c,old_name:o,new_name:h,merge:f}).then(function(m){return m.data}).catch(function(m){var b,E,y;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:(b=m.response.data.message)!==null&&b!==void 0?b:"There was an error while renaming the document.",exception:(y=(E=m.response.data.exception)!==null&&E!==void 0?E:m.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a.prototype.getValue=function(c,o,h,f,l,m){return f===void 0&&(f=!0),l===void 0&&(l=!1),m===void 0&&(m=null),e(this,void 0,void 0,function(){var b;return n(this,function(E){return b={doctype:c,fieldname:"[]",filters:[],as_dict:f,debug:l,parent:null},o&&(b.fieldname=typeof o=="object"?JSON.stringify(o):o),h&&(b.filters=h?JSON.stringify(h):void 0),m&&(b.parent=m),[2,this.axios.get("/api/method/frappe.client.get_value",{params:b}).then(function(y){return y.data}).catch(function(y){var v,O;throw t(t({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:"There was an error while getting the value.",exception:(O=(v=y.response.data.exception)!==null&&v!==void 0?v:y.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},a.prototype.setValue=function(c,o,h,f){return e(this,void 0,void 0,function(){return n(this,function(l){return h!==null&&typeof h=="object"&&!Array.isArray(h)&&(f=void 0),[2,this.axios.post("/api/method/frappe.client.set_value",{doctype:c,name:o,fieldname:h,value:f}).then(function(m){return m.data}).catch(function(m){var b,E;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:"There was an error while setting the value.",exception:(E=(b=m.response.data.exception)!==null&&b!==void 0?b:m.response.data.exc_type)!==null&&E!==void 0?E:""})})]})})},a.prototype.getSingleValue=function(c,o){return e(this,void 0,void 0,function(){var h;return n(this,function(f){return h={doctype:c,field:o},[2,this.axios.get("/api/method/frappe.client.get_single_value",{params:h}).then(function(l){return l.data}).catch(function(l){var m,b;throw t(t({},l.response.data),{httpStatus:l.response.status,httpStatusText:l.response.statusText,message:"There was an error while getting the value of single doctype.",exception:(b=(m=l.response.data.exception)!==null&&m!==void 0?m:l.response.data.exc_type)!==null&&b!==void 0?b:""})})]})})},a.prototype.submit=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/frappe.client.submit",{doc:c}).then(function(h){return h.data.message}).catch(function(h){var f,l;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while submitting the document.",exception:(l=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&l!==void 0?l:""})})]})})},a.prototype.cancel=function(c,o){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.post("/api/method/frappe.client.cancel",{doctype:c,name:o}).then(function(f){return f.data}).catch(function(f){var l,m;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while cancelling the document.",exception:(m=(l=f.response.data.exception)!==null&&l!==void 0?l:f.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a}();return Ce.FrappeDB=s,Ce}var xe={},je={};/*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */var nn,os;function Hr(){if(os)return nn;os=1;function t(r,i){return function(){return r.apply(i,arguments)}}const{toString:e}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:s,toStringTag:a}=Symbol,c=(r=>i=>{const u=e.call(i);return r[u]||(r[u]=u.slice(8,-1).toLowerCase())})(Object.create(null)),o=r=>(r=r.toLowerCase(),i=>c(i)===r),h=r=>i=>typeof i===r,{isArray:f}=Array,l=h("undefined");function m(r){return r!==null&&!l(r)&&r.constructor!==null&&!l(r.constructor)&&v(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}const b=o("ArrayBuffer");function E(r){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(r):i=r&&r.buffer&&b(r.buffer),i}const y=h("string"),v=h("function"),O=h("number"),I=r=>r!==null&&typeof r=="object",R=r=>r===!0||r===!1,K=r=>{if(c(r)!=="object")return!1;const i=n(r);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(a in r)&&!(s in r)},G=r=>{if(!I(r)||m(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},H=o("Date"),j=o("File"),Z=o("Blob"),pe=o("FileList"),P=r=>I(r)&&v(r.pipe),le=r=>{let i;return r&&(typeof FormData=="function"&&r instanceof FormData||v(r.append)&&((i=c(r))==="formdata"||i==="object"&&v(r.toString)&&r.toString()==="[object FormData]"))},V=o("URLSearchParams"),[ae,Pe,me,W]=["ReadableStream","Request","Response","Headers"].map(o),ge=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function we(r,i,{allOwnKeys:u=!1}={}){if(r===null||typeof r>"u")return;let d,p;if(typeof r!="object"&&(r=[r]),f(r))for(d=0,p=r.length;d<p;d++)i.call(null,r[d],d,r);else{if(m(r))return;const w=u?Object.getOwnPropertyNames(r):Object.keys(r),g=w.length;let T;for(d=0;d<g;d++)T=w[d],i.call(null,r[T],T,r)}}function ee(r,i){if(m(r))return null;i=i.toLowerCase();const u=Object.keys(r);let d=u.length,p;for(;d-- >0;)if(p=u[d],i===p.toLowerCase())return p;return null}const te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:$r,Ve=r=>!l(r)&&r!==te;function Ze(){const{caseless:r,skipUndefined:i}=Ve(this)&&this||{},u={},d=(p,w)=>{const g=r&&ee(u,w)||w;K(u[g])&&K(p)?u[g]=Ze(u[g],p):K(p)?u[g]=Ze({},p):f(p)?u[g]=p.slice():(!i||!l(p))&&(u[g]=p)};for(let p=0,w=arguments.length;p<w;p++)arguments[p]&&we(arguments[p],d);return u}const Ue=(r,i,u,{allOwnKeys:d}={})=>(we(i,(p,w)=>{u&&v(p)?r[w]=t(p,u):r[w]=p},{allOwnKeys:d}),r),re=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),We=(r,i,u,d)=>{r.prototype=Object.create(i.prototype,d),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:i.prototype}),u&&Object.assign(r.prototype,u)},ze=(r,i,u,d)=>{let p,w,g;const T={};if(i=i||{},r==null)return i;do{for(p=Object.getOwnPropertyNames(r),w=p.length;w-- >0;)g=p[w],(!d||d(g,r,i))&&!T[g]&&(i[g]=r[g],T[g]=!0);r=u!==!1&&n(r)}while(r&&(!u||u(r,i))&&r!==Object.prototype);return i},et=(r,i,u)=>{r=String(r),(u===void 0||u>r.length)&&(u=r.length),u-=i.length;const d=r.indexOf(i,u);return d!==-1&&d===u},at=r=>{if(!r)return null;if(f(r))return r;let i=r.length;if(!O(i))return null;const u=new Array(i);for(;i-- >0;)u[i]=r[i];return u},It=(r=>i=>r&&i instanceof r)(typeof Uint8Array<"u"&&n(Uint8Array)),In=(r,i)=>{const d=(r&&r[s]).call(r);let p;for(;(p=d.next())&&!p.done;){const w=p.value;i.call(r,w[0],w[1])}},jn=(r,i)=>{let u;const d=[];for(;(u=r.exec(i))!==null;)d.push(u);return d},tt=o("HTMLFormElement"),jt=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(u,d,p){return d.toUpperCase()+p}),Mn=(({hasOwnProperty:r})=>(i,u)=>r.call(i,u))(Object.prototype),M=o("RegExp"),z=(r,i)=>{const u=Object.getOwnPropertyDescriptors(r),d={};we(u,(p,w)=>{let g;(g=i(p,w,r))!==!1&&(d[w]=g||p)}),Object.defineProperties(r,d)},ne=r=>{z(r,(i,u)=>{if(v(r)&&["arguments","caller","callee"].indexOf(u)!==-1)return!1;const d=r[u];if(v(d)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+u+"'")})}})},$=(r,i)=>{const u={},d=p=>{p.forEach(w=>{u[w]=!0})};return f(r)?d(r):d(String(r).split(i)),u},be=()=>{},Je=(r,i)=>r!=null&&Number.isFinite(r=+r)?r:i;function ie(r){return!!(r&&v(r.append)&&r[a]==="FormData"&&r[s])}const ue=r=>{const i=new Array(10),u=(d,p)=>{if(I(d)){if(i.indexOf(d)>=0)return;if(m(d))return d;if(!("toJSON"in d)){i[p]=d;const w=f(d)?[]:{};return we(d,(g,T)=>{const k=u(g,p+1);!l(k)&&(w[T]=k)}),i[p]=void 0,w}}return d};return u(r,0)},De=o("AsyncFunction"),Mt=r=>r&&(I(r)||v(r))&&v(r.then)&&v(r.catch),vt=((r,i)=>r?setImmediate:i?((u,d)=>(te.addEventListener("message",({source:p,data:w})=>{p===te&&w===u&&d.length&&d.shift()()},!1),p=>{d.push(p),te.postMessage(u,"*")}))(`axios@${Math.random()}`,[]):u=>setTimeout(u))(typeof setImmediate=="function",v(te.postMessage)),Vt=typeof queueMicrotask<"u"?queueMicrotask.bind(te):typeof process<"u"&&process.nextTick||vt;var _={isArray:f,isArrayBuffer:b,isBuffer:m,isFormData:le,isArrayBufferView:E,isString:y,isNumber:O,isBoolean:R,isObject:I,isPlainObject:K,isEmptyObject:G,isReadableStream:ae,isRequest:Pe,isResponse:me,isHeaders:W,isUndefined:l,isDate:H,isFile:j,isBlob:Z,isRegExp:M,isFunction:v,isStream:P,isURLSearchParams:V,isTypedArray:It,isFileList:pe,forEach:we,merge:Ze,extend:Ue,trim:ge,stripBOM:re,inherits:We,toFlatObject:ze,kindOf:c,kindOfTest:o,endsWith:et,toArray:at,forEachEntry:In,matchAll:jn,isHTMLForm:tt,hasOwnProperty:Mn,hasOwnProp:Mn,reduceDescriptors:z,freezeMethods:ne,toObjectSet:$,toCamelCase:jt,noop:be,toFiniteNumber:Je,findKey:ee,global:te,isContextDefined:Ve,isSpecCompliantForm:ie,toJSONObject:ue,isAsyncFn:De,isThenable:Mt,setImmediate:vt,asap:Vt,isIterable:r=>r!=null&&v(r[s])};function N(r,i,u,d,p){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",i&&(this.code=i),u&&(this.config=u),d&&(this.request=d),p&&(this.response=p,this.status=p.status?p.status:null)}_.inherits(N,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:_.toJSONObject(this.config),code:this.code,status:this.status}}});const $t=N.prototype,ct={};["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(r=>{ct[r]={value:r}}),Object.defineProperties(N,ct),Object.defineProperty($t,"isAxiosError",{value:!0}),N.from=(r,i,u,d,p,w)=>{const g=Object.create($t);_.toFlatObject(r,g,function(C){return C!==Error.prototype},A=>A!=="isAxiosError");const T=r&&r.message?r.message:"Error",k=i==null&&r?r.code:i;return N.call(g,T,k,u,d,p),r&&g.cause==null&&Object.defineProperty(g,"cause",{value:r,configurable:!0}),g.name=r&&r.name||"Error",w&&Object.assign(g,w),g};var jo=null;function Vn(r){return _.isPlainObject(r)||_.isArray(r)}function ur(r){return _.endsWith(r,"[]")?r.slice(0,-2):r}function lr(r,i,u){return r?r.concat(i).map(function(p,w){return p=ur(p),!u&&w?"["+p+"]":p}).join(u?".":""):i}function Mo(r){return _.isArray(r)&&!r.some(Vn)}const Vo=_.toFlatObject(_,{},null,function(i){return/^is[A-Z]/.test(i)});function Ht(r,i,u){if(!_.isObject(r))throw new TypeError("target must be an object");i=i||new FormData,u=_.toFlatObject(u,{metaTokens:!0,dots:!1,indexes:!1},!1,function(F,D){return!_.isUndefined(D[F])});const d=u.metaTokens,p=u.visitor||C,w=u.dots,g=u.indexes,k=(u.Blob||typeof Blob<"u"&&Blob)&&_.isSpecCompliantForm(i);if(!_.isFunction(p))throw new TypeError("visitor must be a function");function A(x){if(x===null)return"";if(_.isDate(x))return x.toISOString();if(_.isBoolean(x))return x.toString();if(!k&&_.isBlob(x))throw new N("Blob is not supported. Use a Buffer instead.");return _.isArrayBuffer(x)||_.isTypedArray(x)?k&&typeof Blob=="function"?new Blob([x]):Buffer.from(x):x}function C(x,F,D){let oe=x;if(x&&!D&&typeof x=="object"){if(_.endsWith(F,"{}"))F=d?F:F.slice(0,-2),x=JSON.stringify(x);else if(_.isArray(x)&&Mo(x)||(_.isFileList(x)||_.endsWith(F,"[]"))&&(oe=_.toArray(x)))return F=ur(F),oe.forEach(function(ce,ye){!(_.isUndefined(ce)||ce===null)&&i.append(g===!0?lr([F],ye,w):g===null?F:F+"[]",A(ce))}),!1}return Vn(x)?!0:(i.append(lr(D,F,w),A(x)),!1)}const L=[],J=Object.assign(Vo,{defaultVisitor:C,convertValue:A,isVisitable:Vn});function he(x,F){if(!_.isUndefined(x)){if(L.indexOf(x)!==-1)throw Error("Circular reference detected in "+F.join("."));L.push(x),_.forEach(x,function(oe,Ee){(!(_.isUndefined(oe)||oe===null)&&p.call(i,oe,_.isString(Ee)?Ee.trim():Ee,F,J))===!0&&he(oe,F?F.concat(Ee):[Ee])}),L.pop()}}if(!_.isObject(r))throw new TypeError("data must be an object");return he(r),i}function fr(r){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(d){return i[d]})}function $n(r,i){this._pairs=[],r&&Ht(r,this,i)}const hr=$n.prototype;hr.append=function(i,u){this._pairs.push([i,u])},hr.toString=function(i){const u=i?function(d){return i.call(this,d,fr)}:fr;return this._pairs.map(function(p){return u(p[0])+"="+u(p[1])},"").join("&")};function $o(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function dr(r,i,u){if(!i)return r;const d=u&&u.encode||$o;_.isFunction(u)&&(u={serialize:u});const p=u&&u.serialize;let w;if(p?w=p(i,u):w=_.isURLSearchParams(i)?i.toString():new $n(i,u).toString(d),w){const g=r.indexOf("#");g!==-1&&(r=r.slice(0,g)),r+=(r.indexOf("?")===-1?"?":"&")+w}return r}class Ho{constructor(){this.handlers=[]}use(i,u,d){return this.handlers.push({fulfilled:i,rejected:u,synchronous:d?d.synchronous:!1,runWhen:d?d.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){_.forEach(this.handlers,function(d){d!==null&&i(d)})}}var pr=Ho,mr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Wo=typeof URLSearchParams<"u"?URLSearchParams:$n,zo=typeof FormData<"u"?FormData:null,Jo=typeof Blob<"u"?Blob:null,Ko={isBrowser:!0,classes:{URLSearchParams:Wo,FormData:zo,Blob:Jo},protocols:["http","https","file","blob","url","data"]};const Hn=typeof window<"u"&&typeof document<"u",Wn=typeof navigator=="object"&&navigator||void 0,Go=Hn&&(!Wn||["ReactNative","NativeScript","NS"].indexOf(Wn.product)<0),Xo=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Yo=Hn&&window.location.href||"http://localhost";var Qo=Object.freeze({__proto__:null,hasBrowserEnv:Hn,hasStandardBrowserWebWorkerEnv:Xo,hasStandardBrowserEnv:Go,navigator:Wn,origin:Yo}),fe={...Qo,...Ko};function Zo(r,i){return Ht(r,new fe.classes.URLSearchParams,{visitor:function(u,d,p,w){return fe.isNode&&_.isBuffer(u)?(this.append(d,u.toString("base64")),!1):w.defaultVisitor.apply(this,arguments)},...i})}function ea(r){return _.matchAll(/\w+|\[(\w*)]/g,r).map(i=>i[0]==="[]"?"":i[1]||i[0])}function ta(r){const i={},u=Object.keys(r);let d;const p=u.length;let w;for(d=0;d<p;d++)w=u[d],i[w]=r[w];return i}function yr(r){function i(u,d,p,w){let g=u[w++];if(g==="__proto__")return!0;const T=Number.isFinite(+g),k=w>=u.length;return g=!g&&_.isArray(p)?p.length:g,k?(_.hasOwnProp(p,g)?p[g]=[p[g],d]:p[g]=d,!T):((!p[g]||!_.isObject(p[g]))&&(p[g]=[]),i(u,d,p[g],w)&&_.isArray(p[g])&&(p[g]=ta(p[g])),!T)}if(_.isFormData(r)&&_.isFunction(r.entries)){const u={};return _.forEachEntry(r,(d,p)=>{i(ea(d),p,u,0)}),u}return null}function na(r,i,u){if(_.isString(r))try{return(i||JSON.parse)(r),_.trim(r)}catch(d){if(d.name!=="SyntaxError")throw d}return(u||JSON.stringify)(r)}const zn={transitional:mr,adapter:["xhr","http","fetch"],transformRequest:[function(i,u){const d=u.getContentType()||"",p=d.indexOf("application/json")>-1,w=_.isObject(i);if(w&&_.isHTMLForm(i)&&(i=new FormData(i)),_.isFormData(i))return p?JSON.stringify(yr(i)):i;if(_.isArrayBuffer(i)||_.isBuffer(i)||_.isStream(i)||_.isFile(i)||_.isBlob(i)||_.isReadableStream(i))return i;if(_.isArrayBufferView(i))return i.buffer;if(_.isURLSearchParams(i))return u.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let T;if(w){if(d.indexOf("application/x-www-form-urlencoded")>-1)return Zo(i,this.formSerializer).toString();if((T=_.isFileList(i))||d.indexOf("multipart/form-data")>-1){const k=this.env&&this.env.FormData;return Ht(T?{"files[]":i}:i,k&&new k,this.formSerializer)}}return w||p?(u.setContentType("application/json",!1),na(i)):i}],transformResponse:[function(i){const u=this.transitional||zn.transitional,d=u&&u.forcedJSONParsing,p=this.responseType==="json";if(_.isResponse(i)||_.isReadableStream(i))return i;if(i&&_.isString(i)&&(d&&!this.responseType||p)){const g=!(u&&u.silentJSONParsing)&&p;try{return JSON.parse(i,this.parseReviver)}catch(T){if(g)throw T.name==="SyntaxError"?N.from(T,N.ERR_BAD_RESPONSE,this,null,this.response):T}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};_.forEach(["delete","get","head","post","put","patch"],r=>{zn.headers[r]={}});var Jn=zn;const sa=_.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"]);var ra=r=>{const i={};let u,d,p;return r&&r.split(`
2
- `).forEach(function(g){p=g.indexOf(":"),u=g.substring(0,p).trim().toLowerCase(),d=g.substring(p+1).trim(),!(!u||i[u]&&sa[u])&&(u==="set-cookie"?i[u]?i[u].push(d):i[u]=[d]:i[u]=i[u]?i[u]+", "+d:d)}),i};const gr=Symbol("internals");function St(r){return r&&String(r).trim().toLowerCase()}function Wt(r){return r===!1||r==null?r:_.isArray(r)?r.map(Wt):String(r)}function ia(r){const i=Object.create(null),u=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let d;for(;d=u.exec(r);)i[d[1]]=d[2];return i}const oa=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function Kn(r,i,u,d,p){if(_.isFunction(d))return d.call(this,i,u);if(p&&(i=u),!!_.isString(i)){if(_.isString(d))return i.indexOf(d)!==-1;if(_.isRegExp(d))return d.test(i)}}function aa(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,u,d)=>u.toUpperCase()+d)}function ca(r,i){const u=_.toCamelCase(" "+i);["get","set","has"].forEach(d=>{Object.defineProperty(r,d+u,{value:function(p,w,g){return this[d].call(this,i,p,w,g)},configurable:!0})})}class zt{constructor(i){i&&this.set(i)}set(i,u,d){const p=this;function w(T,k,A){const C=St(k);if(!C)throw new Error("header name must be a non-empty string");const L=_.findKey(p,C);(!L||p[L]===void 0||A===!0||A===void 0&&p[L]!==!1)&&(p[L||k]=Wt(T))}const g=(T,k)=>_.forEach(T,(A,C)=>w(A,C,k));if(_.isPlainObject(i)||i instanceof this.constructor)g(i,u);else if(_.isString(i)&&(i=i.trim())&&!oa(i))g(ra(i),u);else if(_.isObject(i)&&_.isIterable(i)){let T={},k,A;for(const C of i){if(!_.isArray(C))throw TypeError("Object iterator must return a key-value pair");T[A=C[0]]=(k=T[A])?_.isArray(k)?[...k,C[1]]:[k,C[1]]:C[1]}g(T,u)}else i!=null&&w(u,i,d);return this}get(i,u){if(i=St(i),i){const d=_.findKey(this,i);if(d){const p=this[d];if(!u)return p;if(u===!0)return ia(p);if(_.isFunction(u))return u.call(this,p,d);if(_.isRegExp(u))return u.exec(p);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,u){if(i=St(i),i){const d=_.findKey(this,i);return!!(d&&this[d]!==void 0&&(!u||Kn(this,this[d],d,u)))}return!1}delete(i,u){const d=this;let p=!1;function w(g){if(g=St(g),g){const T=_.findKey(d,g);T&&(!u||Kn(d,d[T],T,u))&&(delete d[T],p=!0)}}return _.isArray(i)?i.forEach(w):w(i),p}clear(i){const u=Object.keys(this);let d=u.length,p=!1;for(;d--;){const w=u[d];(!i||Kn(this,this[w],w,i,!0))&&(delete this[w],p=!0)}return p}normalize(i){const u=this,d={};return _.forEach(this,(p,w)=>{const g=_.findKey(d,w);if(g){u[g]=Wt(p),delete u[w];return}const T=i?aa(w):String(w).trim();T!==w&&delete u[w],u[T]=Wt(p),d[T]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const u=Object.create(null);return _.forEach(this,(d,p)=>{d!=null&&d!==!1&&(u[p]=i&&_.isArray(d)?d.join(", "):d)}),u}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,u])=>i+": "+u).join(`
3
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...u){const d=new this(i);return u.forEach(p=>d.set(p)),d}static accessor(i){const d=(this[gr]=this[gr]={accessors:{}}).accessors,p=this.prototype;function w(g){const T=St(g);d[T]||(ca(p,g),d[T]=!0)}return _.isArray(i)?i.forEach(w):w(i),this}}zt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),_.reduceDescriptors(zt.prototype,({value:r},i)=>{let u=i[0].toUpperCase()+i.slice(1);return{get:()=>r,set(d){this[u]=d}}}),_.freezeMethods(zt);var Le=zt;function Gn(r,i){const u=this||Jn,d=i||u,p=Le.from(d.headers);let w=d.data;return _.forEach(r,function(T){w=T.call(u,w,p.normalize(),i?i.status:void 0)}),p.normalize(),w}function wr(r){return!!(r&&r.__CANCEL__)}function ut(r,i,u){N.call(this,r??"canceled",N.ERR_CANCELED,i,u),this.name="CanceledError"}_.inherits(ut,N,{__CANCEL__:!0});function br(r,i,u){const d=u.config.validateStatus;!u.status||!d||d(u.status)?r(u):i(new N("Request failed with status code "+u.status,[N.ERR_BAD_REQUEST,N.ERR_BAD_RESPONSE][Math.floor(u.status/100)-4],u.config,u.request,u))}function ua(r){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return i&&i[1]||""}function la(r,i){r=r||10;const u=new Array(r),d=new Array(r);let p=0,w=0,g;return i=i!==void 0?i:1e3,function(k){const A=Date.now(),C=d[w];g||(g=A),u[p]=k,d[p]=A;let L=w,J=0;for(;L!==p;)J+=u[L++],L=L%r;if(p=(p+1)%r,p===w&&(w=(w+1)%r),A-g<i)return;const he=C&&A-C;return he?Math.round(J*1e3/he):void 0}}function fa(r,i){let u=0,d=1e3/i,p,w;const g=(A,C=Date.now())=>{u=C,p=null,w&&(clearTimeout(w),w=null),r(...A)};return[(...A)=>{const C=Date.now(),L=C-u;L>=d?g(A,C):(p=A,w||(w=setTimeout(()=>{w=null,g(p)},d-L)))},()=>p&&g(p)]}const Jt=(r,i,u=3)=>{let d=0;const p=la(50,250);return fa(w=>{const g=w.loaded,T=w.lengthComputable?w.total:void 0,k=g-d,A=p(k),C=g<=T;d=g;const L={loaded:g,total:T,progress:T?g/T:void 0,bytes:k,rate:A||void 0,estimated:A&&T&&C?(T-g)/A:void 0,event:w,lengthComputable:T!=null,[i?"download":"upload"]:!0};r(L)},u)},_r=(r,i)=>{const u=r!=null;return[d=>i[0]({lengthComputable:u,total:r,loaded:d}),i[1]]},vr=r=>(...i)=>_.asap(()=>r(...i));var ha=fe.hasStandardBrowserEnv?((r,i)=>u=>(u=new URL(u,fe.origin),r.protocol===u.protocol&&r.host===u.host&&(i||r.port===u.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,da=fe.hasStandardBrowserEnv?{write(r,i,u,d,p,w){const g=[r+"="+encodeURIComponent(i)];_.isNumber(u)&&g.push("expires="+new Date(u).toGMTString()),_.isString(d)&&g.push("path="+d),_.isString(p)&&g.push("domain="+p),w===!0&&g.push("secure"),document.cookie=g.join("; ")},read(r){const i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove(r){this.write(r,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pa(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function ma(r,i){return i?r.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):r}function Sr(r,i,u){let d=!pa(i);return r&&(d||u==!1)?ma(r,i):i}const Er=r=>r instanceof Le?{...r}:r;function nt(r,i){i=i||{};const u={};function d(A,C,L,J){return _.isPlainObject(A)&&_.isPlainObject(C)?_.merge.call({caseless:J},A,C):_.isPlainObject(C)?_.merge({},C):_.isArray(C)?C.slice():C}function p(A,C,L,J){if(_.isUndefined(C)){if(!_.isUndefined(A))return d(void 0,A,L,J)}else return d(A,C,L,J)}function w(A,C){if(!_.isUndefined(C))return d(void 0,C)}function g(A,C){if(_.isUndefined(C)){if(!_.isUndefined(A))return d(void 0,A)}else return d(void 0,C)}function T(A,C,L){if(L in i)return d(A,C);if(L in r)return d(void 0,A)}const k={url:w,method:w,data:w,baseURL:g,transformRequest:g,transformResponse:g,paramsSerializer:g,timeout:g,timeoutMessage:g,withCredentials:g,withXSRFToken:g,adapter:g,responseType:g,xsrfCookieName:g,xsrfHeaderName:g,onUploadProgress:g,onDownloadProgress:g,decompress:g,maxContentLength:g,maxBodyLength:g,beforeRedirect:g,transport:g,httpAgent:g,httpsAgent:g,cancelToken:g,socketPath:g,responseEncoding:g,validateStatus:T,headers:(A,C,L)=>p(Er(A),Er(C),L,!0)};return _.forEach(Object.keys({...r,...i}),function(C){const L=k[C]||p,J=L(r[C],i[C],C);_.isUndefined(J)&&L!==T||(u[C]=J)}),u}var Tr=r=>{const i=nt({},r);let{data:u,withXSRFToken:d,xsrfHeaderName:p,xsrfCookieName:w,headers:g,auth:T}=i;if(i.headers=g=Le.from(g),i.url=dr(Sr(i.baseURL,i.url,i.allowAbsoluteUrls),r.params,r.paramsSerializer),T&&g.set("Authorization","Basic "+btoa((T.username||"")+":"+(T.password?unescape(encodeURIComponent(T.password)):""))),_.isFormData(u)){if(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv)g.setContentType(void 0);else if(_.isFunction(u.getHeaders)){const k=u.getHeaders(),A=["content-type","content-length"];Object.entries(k).forEach(([C,L])=>{A.includes(C.toLowerCase())&&g.set(C,L)})}}if(fe.hasStandardBrowserEnv&&(d&&_.isFunction(d)&&(d=d(i)),d||d!==!1&&ha(i.url))){const k=p&&w&&da.read(w);k&&g.set(p,k)}return i},ya=typeof XMLHttpRequest<"u"&&function(r){return new Promise(function(u,d){const p=Tr(r);let w=p.data;const g=Le.from(p.headers).normalize();let{responseType:T,onUploadProgress:k,onDownloadProgress:A}=p,C,L,J,he,x;function F(){he&&he(),x&&x(),p.cancelToken&&p.cancelToken.unsubscribe(C),p.signal&&p.signal.removeEventListener("abort",C)}let D=new XMLHttpRequest;D.open(p.method.toUpperCase(),p.url,!0),D.timeout=p.timeout;function oe(){if(!D)return;const ce=Le.from("getAllResponseHeaders"in D&&D.getAllResponseHeaders()),Fe={data:!T||T==="text"||T==="json"?D.responseText:D.response,status:D.status,statusText:D.statusText,headers:ce,config:r,request:D};br(function(Te){u(Te),F()},function(Te){d(Te),F()},Fe),D=null}"onloadend"in D?D.onloadend=oe:D.onreadystatechange=function(){!D||D.readyState!==4||D.status===0&&!(D.responseURL&&D.responseURL.indexOf("file:")===0)||setTimeout(oe)},D.onabort=function(){D&&(d(new N("Request aborted",N.ECONNABORTED,r,D)),D=null)},D.onerror=function(ye){const Fe=ye&&ye.message?ye.message:"Network Error",st=new N(Fe,N.ERR_NETWORK,r,D);st.event=ye||null,d(st),D=null},D.ontimeout=function(){let ye=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded";const Fe=p.transitional||mr;p.timeoutErrorMessage&&(ye=p.timeoutErrorMessage),d(new N(ye,Fe.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,r,D)),D=null},w===void 0&&g.setContentType(null),"setRequestHeader"in D&&_.forEach(g.toJSON(),function(ye,Fe){D.setRequestHeader(Fe,ye)}),_.isUndefined(p.withCredentials)||(D.withCredentials=!!p.withCredentials),T&&T!=="json"&&(D.responseType=p.responseType),A&&([J,x]=Jt(A,!0),D.addEventListener("progress",J)),k&&D.upload&&([L,he]=Jt(k),D.upload.addEventListener("progress",L),D.upload.addEventListener("loadend",he)),(p.cancelToken||p.signal)&&(C=ce=>{D&&(d(!ce||ce.type?new ut(null,r,D):ce),D.abort(),D=null)},p.cancelToken&&p.cancelToken.subscribe(C),p.signal&&(p.signal.aborted?C():p.signal.addEventListener("abort",C)));const Ee=ua(p.url);if(Ee&&fe.protocols.indexOf(Ee)===-1){d(new N("Unsupported protocol "+Ee+":",N.ERR_BAD_REQUEST,r));return}D.send(w||null)})},ga=(r,i)=>{const{length:u}=r=r?r.filter(Boolean):[];if(i||u){let d=new AbortController,p;const w=function(A){if(!p){p=!0,T();const C=A instanceof Error?A:this.reason;d.abort(C instanceof N?C:new ut(C instanceof Error?C.message:C))}};let g=i&&setTimeout(()=>{g=null,w(new N(`timeout ${i} of ms exceeded`,N.ETIMEDOUT))},i);const T=()=>{r&&(g&&clearTimeout(g),g=null,r.forEach(A=>{A.unsubscribe?A.unsubscribe(w):A.removeEventListener("abort",w)}),r=null)};r.forEach(A=>A.addEventListener("abort",w));const{signal:k}=d;return k.unsubscribe=()=>_.asap(T),k}};const wa=function*(r,i){let u=r.byteLength;if(u<i){yield r;return}let d=0,p;for(;d<u;)p=d+i,yield r.slice(d,p),d=p},ba=async function*(r,i){for await(const u of _a(r))yield*wa(u,i)},_a=async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}const i=r.getReader();try{for(;;){const{done:u,value:d}=await i.read();if(u)break;yield d}}finally{await i.cancel()}},Or=(r,i,u,d)=>{const p=ba(r,i);let w=0,g,T=k=>{g||(g=!0,d&&d(k))};return new ReadableStream({async pull(k){try{const{done:A,value:C}=await p.next();if(A){T(),k.close();return}let L=C.byteLength;if(u){let J=w+=L;u(J)}k.enqueue(new Uint8Array(C))}catch(A){throw T(A),A}},cancel(k){return T(k),p.return()}},{highWaterMark:2})},Cr=64*1024,{isFunction:Kt}=_,va=(({Request:r,Response:i})=>({Request:r,Response:i}))(_.global),{ReadableStream:xr,TextEncoder:Ar}=_.global,Rr=(r,...i)=>{try{return!!r(...i)}catch{return!1}},Sa=r=>{r=_.merge.call({skipUndefined:!0},va,r);const{fetch:i,Request:u,Response:d}=r,p=i?Kt(i):typeof fetch=="function",w=Kt(u),g=Kt(d);if(!p)return!1;const T=p&&Kt(xr),k=p&&(typeof Ar=="function"?(x=>F=>x.encode(F))(new Ar):async x=>new Uint8Array(await new u(x).arrayBuffer())),A=w&&T&&Rr(()=>{let x=!1;const F=new u(fe.origin,{body:new xr,method:"POST",get duplex(){return x=!0,"half"}}).headers.has("Content-Type");return x&&!F}),C=g&&T&&Rr(()=>_.isReadableStream(new d("").body)),L={stream:C&&(x=>x.body)};p&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!L[x]&&(L[x]=(F,D)=>{let oe=F&&F[x];if(oe)return oe.call(F);throw new N(`Response type '${x}' is not supported`,N.ERR_NOT_SUPPORT,D)})});const J=async x=>{if(x==null)return 0;if(_.isBlob(x))return x.size;if(_.isSpecCompliantForm(x))return(await new u(fe.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(_.isArrayBufferView(x)||_.isArrayBuffer(x))return x.byteLength;if(_.isURLSearchParams(x)&&(x=x+""),_.isString(x))return(await k(x)).byteLength},he=async(x,F)=>{const D=_.toFiniteNumber(x.getContentLength());return D??J(F)};return async x=>{let{url:F,method:D,data:oe,signal:Ee,cancelToken:ce,timeout:ye,onDownloadProgress:Fe,onUploadProgress:st,responseType:Te,headers:es,withCredentials:Zt="same-origin",fetchOptions:Ur}=Tr(x),qr=i||fetch;Te=Te?(Te+"").toLowerCase():"text";let en=ga([Ee,ce&&ce.toAbortSignal()],ye),Et=null;const rt=en&&en.unsubscribe&&(()=>{en.unsubscribe()});let Ir;try{if(st&&A&&D!=="get"&&D!=="head"&&(Ir=await he(es,oe))!==0){let Ge=new u(F,{method:"POST",body:oe,duplex:"half"}),lt;if(_.isFormData(oe)&&(lt=Ge.headers.get("content-type"))&&es.setContentType(lt),Ge.body){const[ts,tn]=_r(Ir,Jt(vr(st)));oe=Or(Ge.body,Cr,ts,tn)}}_.isString(Zt)||(Zt=Zt?"include":"omit");const Ie=w&&"credentials"in u.prototype,jr={...Ur,signal:en,method:D.toUpperCase(),headers:es.normalize().toJSON(),body:oe,duplex:"half",credentials:Ie?Zt:void 0};Et=w&&new u(F,jr);let Ke=await(w?qr(Et,Ur):qr(F,jr));const Mr=C&&(Te==="stream"||Te==="response");if(C&&(Fe||Mr&&rt)){const Ge={};["status","statusText","headers"].forEach(Vr=>{Ge[Vr]=Ke[Vr]});const lt=_.toFiniteNumber(Ke.headers.get("content-length")),[ts,tn]=Fe&&_r(lt,Jt(vr(Fe),!0))||[];Ke=new d(Or(Ke.body,Cr,ts,()=>{tn&&tn(),rt&&rt()}),Ge)}Te=Te||"text";let ka=await L[_.findKey(L,Te)||"text"](Ke,x);return!Mr&&rt&&rt(),await new Promise((Ge,lt)=>{br(Ge,lt,{data:ka,headers:Le.from(Ke.headers),status:Ke.status,statusText:Ke.statusText,config:x,request:Et})})}catch(Ie){throw rt&&rt(),Ie&&Ie.name==="TypeError"&&/Load failed|fetch/i.test(Ie.message)?Object.assign(new N("Network Error",N.ERR_NETWORK,x,Et),{cause:Ie.cause||Ie}):N.from(Ie,Ie&&Ie.code,x,Et)}}},Ea=new Map,kr=r=>{let i=r?r.env:{};const{fetch:u,Request:d,Response:p}=i,w=[d,p,u];let g=w.length,T=g,k,A,C=Ea;for(;T--;)k=w[T],A=C.get(k),A===void 0&&C.set(k,A=T?new Map:Sa(i)),C=A;return A};kr();const Xn={http:jo,xhr:ya,fetch:{get:kr}};_.forEach(Xn,(r,i)=>{if(r){try{Object.defineProperty(r,"name",{value:i})}catch{}Object.defineProperty(r,"adapterName",{value:i})}});const Dr=r=>`- ${r}`,Ta=r=>_.isFunction(r)||r===null||r===!1;var Lr={getAdapter:(r,i)=>{r=_.isArray(r)?r:[r];const{length:u}=r;let d,p;const w={};for(let g=0;g<u;g++){d=r[g];let T;if(p=d,!Ta(d)&&(p=Xn[(T=String(d)).toLowerCase()],p===void 0))throw new N(`Unknown adapter '${T}'`);if(p&&(_.isFunction(p)||(p=p.get(i))))break;w[T||"#"+g]=p}if(!p){const g=Object.entries(w).map(([k,A])=>`adapter ${k} `+(A===!1?"is not supported by the environment":"is not available in the build"));let T=u?g.length>1?`since :
4
- `+g.map(Dr).join(`
5
- `):" "+Dr(g[0]):"as no adapter specified";throw new N("There is no suitable adapter to dispatch the request "+T,"ERR_NOT_SUPPORT")}return p},adapters:Xn};function Yn(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new ut(null,r)}function Fr(r){return Yn(r),r.headers=Le.from(r.headers),r.data=Gn.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),Lr.getAdapter(r.adapter||Jn.adapter,r)(r).then(function(d){return Yn(r),d.data=Gn.call(r,r.transformResponse,d),d.headers=Le.from(d.headers),d},function(d){return wr(d)||(Yn(r),d&&d.response&&(d.response.data=Gn.call(r,r.transformResponse,d.response),d.response.headers=Le.from(d.response.headers))),Promise.reject(d)})}const Nr="1.12.2",Gt={};["object","boolean","number","function","string","symbol"].forEach((r,i)=>{Gt[r]=function(d){return typeof d===r||"a"+(i<1?"n ":" ")+r}});const Br={};Gt.transitional=function(i,u,d){function p(w,g){return"[Axios v"+Nr+"] Transitional option '"+w+"'"+g+(d?". "+d:"")}return(w,g,T)=>{if(i===!1)throw new N(p(g," has been removed"+(u?" in "+u:"")),N.ERR_DEPRECATED);return u&&!Br[g]&&(Br[g]=!0,console.warn(p(g," has been deprecated since v"+u+" and will be removed in the near future"))),i?i(w,g,T):!0}},Gt.spelling=function(i){return(u,d)=>(console.warn(`${d} is likely a misspelling of ${i}`),!0)};function Oa(r,i,u){if(typeof r!="object")throw new N("options must be an object",N.ERR_BAD_OPTION_VALUE);const d=Object.keys(r);let p=d.length;for(;p-- >0;){const w=d[p],g=i[w];if(g){const T=r[w],k=T===void 0||g(T,w,r);if(k!==!0)throw new N("option "+w+" must be "+k,N.ERR_BAD_OPTION_VALUE);continue}if(u!==!0)throw new N("Unknown option "+w,N.ERR_BAD_OPTION)}}var Xt={assertOptions:Oa,validators:Gt};const qe=Xt.validators;class Yt{constructor(i){this.defaults=i||{},this.interceptors={request:new pr,response:new pr}}async request(i,u){try{return await this._request(i,u)}catch(d){if(d instanceof Error){let p={};Error.captureStackTrace?Error.captureStackTrace(p):p=new Error;const w=p.stack?p.stack.replace(/^.+\n/,""):"";try{d.stack?w&&!String(d.stack).endsWith(w.replace(/^.+\n.+\n/,""))&&(d.stack+=`
6
- `+w):d.stack=w}catch{}}throw d}}_request(i,u){typeof i=="string"?(u=u||{},u.url=i):u=i||{},u=nt(this.defaults,u);const{transitional:d,paramsSerializer:p,headers:w}=u;d!==void 0&&Xt.assertOptions(d,{silentJSONParsing:qe.transitional(qe.boolean),forcedJSONParsing:qe.transitional(qe.boolean),clarifyTimeoutError:qe.transitional(qe.boolean)},!1),p!=null&&(_.isFunction(p)?u.paramsSerializer={serialize:p}:Xt.assertOptions(p,{encode:qe.function,serialize:qe.function},!0)),u.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?u.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:u.allowAbsoluteUrls=!0),Xt.assertOptions(u,{baseUrl:qe.spelling("baseURL"),withXsrfToken:qe.spelling("withXSRFToken")},!0),u.method=(u.method||this.defaults.method||"get").toLowerCase();let g=w&&_.merge(w.common,w[u.method]);w&&_.forEach(["delete","get","head","post","put","patch","common"],x=>{delete w[x]}),u.headers=Le.concat(g,w);const T=[];let k=!0;this.interceptors.request.forEach(function(F){typeof F.runWhen=="function"&&F.runWhen(u)===!1||(k=k&&F.synchronous,T.unshift(F.fulfilled,F.rejected))});const A=[];this.interceptors.response.forEach(function(F){A.push(F.fulfilled,F.rejected)});let C,L=0,J;if(!k){const x=[Fr.bind(this),void 0];for(x.unshift(...T),x.push(...A),J=x.length,C=Promise.resolve(u);L<J;)C=C.then(x[L++],x[L++]);return C}J=T.length;let he=u;for(;L<J;){const x=T[L++],F=T[L++];try{he=x(he)}catch(D){F.call(this,D);break}}try{C=Fr.call(this,he)}catch(x){return Promise.reject(x)}for(L=0,J=A.length;L<J;)C=C.then(A[L++],A[L++]);return C}getUri(i){i=nt(this.defaults,i);const u=Sr(i.baseURL,i.url,i.allowAbsoluteUrls);return dr(u,i.params,i.paramsSerializer)}}_.forEach(["delete","get","head","options"],function(i){Yt.prototype[i]=function(u,d){return this.request(nt(d||{},{method:i,url:u,data:(d||{}).data}))}}),_.forEach(["post","put","patch"],function(i){function u(d){return function(w,g,T){return this.request(nt(T||{},{method:i,headers:d?{"Content-Type":"multipart/form-data"}:{},url:w,data:g}))}}Yt.prototype[i]=u(),Yt.prototype[i+"Form"]=u(!0)});var Qt=Yt;class Qn{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let u;this.promise=new Promise(function(w){u=w});const d=this;this.promise.then(p=>{if(!d._listeners)return;let w=d._listeners.length;for(;w-- >0;)d._listeners[w](p);d._listeners=null}),this.promise.then=p=>{let w;const g=new Promise(T=>{d.subscribe(T),w=T}).then(p);return g.cancel=function(){d.unsubscribe(w)},g},i(function(w,g,T){d.reason||(d.reason=new ut(w,g,T),u(d.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const u=this._listeners.indexOf(i);u!==-1&&this._listeners.splice(u,1)}toAbortSignal(){const i=new AbortController,u=d=>{i.abort(d)};return this.subscribe(u),i.signal.unsubscribe=()=>this.unsubscribe(u),i.signal}static source(){let i;return{token:new Qn(function(p){i=p}),cancel:i}}}var Ca=Qn;function xa(r){return function(u){return r.apply(null,u)}}function Aa(r){return _.isObject(r)&&r.isAxiosError===!0}const Zn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Zn).forEach(([r,i])=>{Zn[i]=r});var Ra=Zn;function Pr(r){const i=new Qt(r),u=t(Qt.prototype.request,i);return _.extend(u,Qt.prototype,i,{allOwnKeys:!0}),_.extend(u,i,null,{allOwnKeys:!0}),u.create=function(p){return Pr(nt(r,p))},u}const se=Pr(Jn);return se.Axios=Qt,se.CanceledError=ut,se.CancelToken=Ca,se.isCancel=wr,se.VERSION=Nr,se.toFormData=Ht,se.AxiosError=N,se.Cancel=se.CanceledError,se.all=function(i){return Promise.all(i)},se.spread=xa,se.isAxiosError=Aa,se.mergeConfig=nt,se.AxiosHeaders=Le,se.formToJSON=r=>yr(_.isHTMLForm(r)?new FormData(r):r),se.getAdapter=Lr.getAdapter,se.HttpStatusCode=Ra,se.default=se,nn=se,nn}var as;function cs(){if(as)return je;as=1;var t=je&&je.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)};Object.defineProperty(je,"__esModule",{value:!0}),je.getRequestHeaders=je.getAxiosClient=void 0;var e=Hr();function n(a,c,o,h,f){var l=e.default.create({baseURL:a,headers:s(c,h,o,a,f),withCredentials:!0});return l.interceptors.request.use(function(m){return typeof window<"u"&&window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(m.headers["X-Frappe-CSRF-Token"]=window.csrf_token),c&&h&&o&&(m.headers.Authorization="".concat(h," ").concat(o())),m}),l}je.getAxiosClient=n;function s(a,c,o,h,f){a===void 0&&(a=!1);var l={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return a&&c&&o&&(l.Authorization="".concat(c," ").concat(o())),typeof window<"u"&&typeof document<"u"&&(window.location&&(h&&h!==window.location.origin||(l["X-Frappe-Site-Name"]=window.location.hostname)),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(l["X-Frappe-CSRF-Token"]=window.csrf_token)),t(t({},l),f??{})}return je.getRequestHeaders=s,je}var us;function ls(){if(us)return xe;us=1;var t=xe&&xe.__assign||function(){return t=Object.assign||function(c){for(var o,h=1,f=arguments.length;h<f;h++){o=arguments[h];for(var l in o)Object.prototype.hasOwnProperty.call(o,l)&&(c[l]=o[l])}return c},t.apply(this,arguments)},e=xe&&xe.__awaiter||function(c,o,h,f){function l(m){return m instanceof h?m:new h(function(b){b(m)})}return new(h||(h=Promise))(function(m,b){function E(O){try{v(f.next(O))}catch(I){b(I)}}function y(O){try{v(f.throw(O))}catch(I){b(I)}}function v(O){O.done?m(O.value):l(O.value).then(E,y)}v((f=f.apply(c,o||[])).next())})},n=xe&&xe.__generator||function(c,o){var h={label:0,sent:function(){if(m[0]&1)throw m[1];return m[1]},trys:[],ops:[]},f,l,m,b;return b={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function E(v){return function(O){return y([v,O])}}function y(v){if(f)throw new TypeError("Generator is already executing.");for(;b&&(b=0,v[0]&&(h=0)),h;)try{if(f=1,l&&(m=v[0]&2?l.return:v[0]?l.throw||((m=l.return)&&m.call(l),0):l.next)&&!(m=m.call(l,v[1])).done)return m;switch(l=0,m&&(v=[v[0]&2,m.value]),v[0]){case 0:case 1:m=v;break;case 4:return h.label++,{value:v[1],done:!1};case 5:h.label++,l=v[1],v=[0];continue;case 7:v=h.ops.pop(),h.trys.pop();continue;default:if(m=h.trys,!(m=m.length>0&&m[m.length-1])&&(v[0]===6||v[0]===2)){h=0;continue}if(v[0]===3&&(!m||v[1]>m[0]&&v[1]<m[3])){h.label=v[1];break}if(v[0]===6&&h.label<m[1]){h.label=m[1],m=v;break}if(m&&h.label<m[2]){h.label=m[2],h.ops.push(v);break}m[2]&&h.ops.pop(),h.trys.pop();continue}v=o.call(c,h)}catch(O){v=[6,O],l=0}finally{f=m=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}};Object.defineProperty(xe,"__esModule",{value:!0}),xe.FrappeFileUpload=void 0;var s=cs(),a=function(){function c(o,h,f,l,m,b){this.appURL=o,this.axios=h,this.useToken=f??!1,this.token=l,this.tokenType=m,this.customHeaders=b}return c.prototype.uploadFile=function(o,h,f,l){return l===void 0&&(l="upload_file"),e(this,void 0,void 0,function(){var m,b,E,y,v,O,I,R;return n(this,function(K){return m=new FormData,o&&m.append("file",o,o.name),b=h.isPrivate,E=h.folder,y=h.file_url,v=h.doctype,O=h.docname,I=h.fieldname,R=h.otherData,b&&m.append("is_private","1"),E&&m.append("folder",E),y&&m.append("file_url",y),v&&O&&(m.append("doctype",v),m.append("docname",O),I&&m.append("fieldname",I)),R&&Object.keys(R).forEach(function(G){var H=R[G];m.append(G,H)}),[2,this.axios.post("/api/method/".concat(l),m,{onUploadProgress:function(G){f&&f(G.loaded,G.total,G)},headers:t(t({},(0,s.getRequestHeaders)(this.useToken,this.tokenType,this.token,this.appURL,this.customHeaders)),{"Content-Type":"multipart/form-data"})}).catch(function(G){var H,j;throw t(t({},G.response.data),{httpStatus:G.response.status,httpStatusText:G.response.statusText,message:(H=G.response.data.message)!==null&&H!==void 0?H:"There was an error while uploading the file.",exception:(j=G.response.data.exception)!==null&&j!==void 0?j:""})})]})})},c}();return xe.FrappeFileUpload=a,xe}var fs;function Wr(){if(fs)return ht;fs=1,Object.defineProperty(ht,"__esModule",{value:!0}),ht.FrappeApp=void 0;var t=ps(),e=ss(),n=is(),s=ls(),a=cs(),c=function(){function o(h,f,l,m){var b,E;this.url=h,this.name=l??"FrappeApp",this.useToken=(b=f==null?void 0:f.useToken)!==null&&b!==void 0?b:!1,this.token=f==null?void 0:f.token,this.tokenType=(E=f==null?void 0:f.type)!==null&&E!==void 0?E:"Bearer",this.customHeaders=m,this.axios=(0,a.getAxiosClient)(this.url,this.useToken,this.token,this.tokenType,this.customHeaders)}return o.prototype.auth=function(){return new t.FrappeAuth(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.db=function(){return new n.FrappeDB(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.file=function(){return new s.FrappeFileUpload(this.url,this.axios,this.useToken,this.token,this.tokenType,this.customHeaders)},o.prototype.call=function(){return new e.FrappeCall(this.url,this.axios,this.useToken,this.token,this.tokenType)},o}();return ht.FrappeApp=c,ht}var Ae={},hs;function zr(){if(hs)return Ae;hs=1;var t=Ae&&Ae.__assign||function(){return t=Object.assign||function(a){for(var c,o=1,h=arguments.length;o<h;o++){c=arguments[o];for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(a[f]=c[f])}return a},t.apply(this,arguments)},e=Ae&&Ae.__awaiter||function(a,c,o,h){function f(l){return l instanceof o?l:new o(function(m){m(l)})}return new(o||(o=Promise))(function(l,m){function b(v){try{y(h.next(v))}catch(O){m(O)}}function E(v){try{y(h.throw(v))}catch(O){m(O)}}function y(v){v.done?l(v.value):f(v.value).then(b,E)}y((h=h.apply(a,c||[])).next())})},n=Ae&&Ae.__generator||function(a,c){var o={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},h,f,l,m;return m={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function b(y){return function(v){return E([y,v])}}function E(y){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,y[0]&&(o=0)),o;)try{if(h=1,f&&(l=y[0]&2?f.return:y[0]?f.throw||((l=f.return)&&l.call(f),0):f.next)&&!(l=l.call(f,y[1])).done)return l;switch(f=0,l&&(y=[y[0]&2,l.value]),y[0]){case 0:case 1:l=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(l=o.trys,!(l=l.length>0&&l[l.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!l||y[1]>l[0]&&y[1]<l[3])){o.label=y[1];break}if(y[0]===6&&o.label<l[1]){o.label=l[1],l=y;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(y);break}l[2]&&o.ops.pop(),o.trys.pop();continue}y=c.call(a,o)}catch(v){y=[6,v],f=0}finally{h=l=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.FrappeAuth=void 0;var s=function(){function a(c,o,h,f,l){this.appURL=c,this.axios=o,this.useToken=h??!1,this.token=f,this.tokenType=l}return a.prototype.loginWithUsernamePassword=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/login",{usr:c.username,pwd:c.password,otp:c.otp,tmp_id:c.tmp_id,device:c.device}).then(function(h){return h.data}).catch(function(h){var f,l;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error while logging in",exception:(l=h.response.data.exception)!==null&&l!==void 0?l:""})})]})})},a.prototype.getLoggedInUser=function(){return e(this,void 0,void 0,function(){return n(this,function(c){return[2,this.axios.get("/api/method/frappe.auth.get_logged_user").then(function(o){return o.data.message}).catch(function(o){var h;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:"There was an error while fetching the logged in user",exception:(h=o.response.data.exception)!==null&&h!==void 0?h:""})})]})})},a.prototype.logout=function(){return e(this,void 0,void 0,function(){return n(this,function(c){return[2,this.axios.post("/api/method/logout",{}).then(function(){}).catch(function(o){var h,f;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:(h=o.response.data.message)!==null&&h!==void 0?h:"There was an error while logging out",exception:(f=o.response.data.exception)!==null&&f!==void 0?f:""})})]})})},a.prototype.forgetPassword=function(c){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/",{cmd:"frappe.core.doctype.user.user.reset_password",user:c}).then(function(){}).catch(function(h){var f,l;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error sending password reset email.",exception:(l=h.response.data.exception)!==null&&l!==void 0?l:""})})]})})},a}();return Ae.FrappeAuth=s,Ae}var ds;function ps(){return ds||(ds=1,function(t){var e=Ye&&Ye.__createBinding||(Object.create?function(s,a,c,o){o===void 0&&(o=c);var h=Object.getOwnPropertyDescriptor(a,c);(!h||("get"in h?!a.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return a[c]}}),Object.defineProperty(s,o,h)}:function(s,a,c,o){o===void 0&&(o=c),s[o]=a[c]}),n=Ye&&Ye.__exportStar||function(s,a){for(var c in s)c!=="default"&&!Object.prototype.hasOwnProperty.call(a,c)&&e(a,s,c)};Object.defineProperty(t,"__esModule",{value:!0}),n(Wr(),t),n(zr(),t),n(is(),t),n(ls(),t),n(ss(),t)}(Ye)),Ye}var Jr=ps(),Tt={exports:{}},sn={};/**
1
+ (function(B,we){typeof exports=="object"&&typeof module<"u"?we(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],we):(B=typeof globalThis<"u"?globalThis:B||self,we(B["Frappe React"]={},B.jsxRuntime,B.React))})(this,function(B,we,S){"use strict";var Ja=Object.defineProperty;var Ka=(B,we,S)=>we in B?Ja(B,we,{enumerable:!0,configurable:!0,writable:!0,value:S}):B[we]=S;var it=(B,we,S)=>Ka(B,typeof we!="symbol"?we+"":we,S);var pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ot={},St={},Ne={},ws;function bs(){if(ws)return Ne;ws=1;var t=Ne&&Ne.__assign||function(){return t=Object.assign||function(a){for(var l,o=1,d=arguments.length;o<d;o++){l=arguments[o];for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(a[h]=l[h])}return a},t.apply(this,arguments)},e=Ne&&Ne.__awaiter||function(a,l,o,d){function h(f){return f instanceof o?f:new o(function(y){y(f)})}return new(o||(o=Promise))(function(f,y){function _(E){try{m(d.next(E))}catch(R){y(R)}}function O(E){try{m(d.throw(E))}catch(R){y(R)}}function m(E){E.done?f(E.value):h(E.value).then(_,O)}m((d=d.apply(a,l||[])).next())})},n=Ne&&Ne.__generator||function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},d,h,f,y;return y={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function _(m){return function(E){return O([m,E])}}function O(m){if(d)throw new TypeError("Generator is already executing.");for(;y&&(y=0,m[0]&&(o=0)),o;)try{if(d=1,h&&(f=m[0]&2?h.return:m[0]?h.throw||((f=h.return)&&f.call(h),0):h.next)&&!(f=f.call(h,m[1])).done)return f;switch(h=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,h=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){o=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){o.label=m[1];break}if(m[0]===6&&o.label<f[1]){o.label=f[1],f=m;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(m);break}f[2]&&o.ops.pop(),o.trys.pop();continue}m=l.call(a,o)}catch(E){m=[6,E],h=0}finally{d=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.FrappeCall=void 0;var r=function(){function a(l,o,d,h,f){this.appURL=l,this.axios=o,this.useToken=d??!1,this.token=h,this.tokenType=f}return a.prototype.get=function(l,o){return e(this,void 0,void 0,function(){var d;return n(this,function(h){return d=new URLSearchParams,o&&Object.entries(o).forEach(function(f){var y=f[0],_=f[1];if(_!=null){var O=typeof _=="object"?JSON.stringify(_):_;d.set(y,O)}}),[2,this.axios.get("/api/method/".concat(l),{params:d}).then(function(f){return f.data}).catch(function(f){var y,_;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(y=f.response.data.message)!==null&&y!==void 0?y:"There was an error.",exception:(_=f.response.data.exception)!==null&&_!==void 0?_:""})})]})})},a.prototype.post=function(l,o){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.post("/api/method/".concat(l),t({},o)).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error.",exception:(y=h.response.data.exception)!==null&&y!==void 0?y:""})})]})})},a.prototype.put=function(l,o){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.put("/api/method/".concat(l),t({},o)).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error.",exception:(y=h.response.data.exception)!==null&&y!==void 0?y:""})})]})})},a.prototype.delete=function(l,o){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.delete("/api/method/".concat(l),{params:o}).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error.",exception:(y=h.response.data.exception)!==null&&y!==void 0?y:""})})]})})},a}();return Ne.FrappeCall=r,Ne}var ke={},_s;function vs(){if(_s)return ke;_s=1;var t=ke&&ke.__assign||function(){return t=Object.assign||function(a){for(var l,o=1,d=arguments.length;o<d;o++){l=arguments[o];for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(a[h]=l[h])}return a},t.apply(this,arguments)},e=ke&&ke.__awaiter||function(a,l,o,d){function h(f){return f instanceof o?f:new o(function(y){y(f)})}return new(o||(o=Promise))(function(f,y){function _(E){try{m(d.next(E))}catch(R){y(R)}}function O(E){try{m(d.throw(E))}catch(R){y(R)}}function m(E){E.done?f(E.value):h(E.value).then(_,O)}m((d=d.apply(a,l||[])).next())})},n=ke&&ke.__generator||function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},d,h,f,y;return y={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function _(m){return function(E){return O([m,E])}}function O(m){if(d)throw new TypeError("Generator is already executing.");for(;y&&(y=0,m[0]&&(o=0)),o;)try{if(d=1,h&&(f=m[0]&2?h.return:m[0]?h.throw||((f=h.return)&&f.call(h),0):h.next)&&!(f=f.call(h,m[1])).done)return f;switch(h=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,h=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){o=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){o.label=m[1];break}if(m[0]===6&&o.label<f[1]){o.label=f[1],f=m;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(m);break}f[2]&&o.ops.pop(),o.trys.pop();continue}m=l.call(a,o)}catch(E){m=[6,E],h=0}finally{d=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(ke,"__esModule",{value:!0}),ke.FrappeDB=void 0;var r=function(){function a(l,o,d,h,f){this.appURL=l,this.axios=o,this.useToken=d??!1,this.token=h,this.tokenType=f}return a.prototype.getDoc=function(l,o){return o===void 0&&(o=""),e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.get("/api/resource/".concat(l,"/").concat(encodeURIComponent(o))).then(function(h){return h.data.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while fetching the document.",exception:(y=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a.prototype.getDocList=function(l,o){var d;return e(this,void 0,void 0,function(){var h,f,y,_,O,m,E,R,U,J,L;return n(this,function(Z){return h={},o&&(f=o.fields,y=o.filters,_=o.orFilters,O=o.orderBy,m=o.limit,E=o.limit_start,R=o.groupBy,U=o.asDict,J=U===void 0?!0:U,L=O?"".concat(String(O==null?void 0:O.field)," ").concat((d=O==null?void 0:O.order)!==null&&d!==void 0?d:"asc"):"",h={fields:f?JSON.stringify(f):void 0,filters:y?JSON.stringify(y):void 0,or_filters:_?JSON.stringify(_):void 0,order_by:L,group_by:R,limit:m,limit_start:E,as_dict:J}),[2,this.axios.get("/api/resource/".concat(l),{params:h}).then(function(Y){return Y.data.data}).catch(function(Y){var M,oe;throw t(t({},Y.response.data),{httpStatus:Y.response.status,httpStatusText:Y.response.statusText,message:"There was an error while fetching the documents.",exception:(oe=(M=Y.response.data.exception)!==null&&M!==void 0?M:Y.response.data.exc_type)!==null&&oe!==void 0?oe:""})})]})})},a.prototype.createDoc=function(l,o){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.post("/api/resource/".concat(l),t({},o)).then(function(h){return h.data.data}).catch(function(h){var f,y,_;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:(f=h.response.data.message)!==null&&f!==void 0?f:"There was an error while creating the document.",exception:(_=(y=h.response.data.exception)!==null&&y!==void 0?y:h.response.data.exc_type)!==null&&_!==void 0?_:""})})]})})},a.prototype.updateDoc=function(l,o,d){return e(this,void 0,void 0,function(){return n(this,function(h){return[2,this.axios.put("/api/resource/".concat(l,"/").concat(o&&encodeURIComponent(o)),t({},d)).then(function(f){return f.data.data}).catch(function(f){var y,_,O;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:(y=f.response.data.message)!==null&&y!==void 0?y:"There was an error while updating the document.",exception:(O=(_=f.response.data.exception)!==null&&_!==void 0?_:f.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},a.prototype.deleteDoc=function(l,o){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.delete("/api/resource/".concat(l,"/").concat(o&&encodeURIComponent(o))).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while deleting the document.",exception:(y=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a.prototype.getCount=function(l,o,d){return d===void 0&&(d=!1),e(this,void 0,void 0,function(){var h;return n(this,function(f){return h={doctype:l,filters:[]},d&&(h.debug=d),o&&(h.filters=o?JSON.stringify(o):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:h}).then(function(y){return y.data.message}).catch(function(y){var _,O;throw t(t({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:"There was an error while getting the count.",exception:(O=(_=y.response.data.exception)!==null&&_!==void 0?_:y.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},a.prototype.getLastDoc=function(l,o){return e(this,void 0,void 0,function(){var d,h;return n(this,function(f){switch(f.label){case 0:return d={orderBy:{field:"creation",order:"desc"}},o&&(d=t(t({},d),o)),[4,this.getDocList(l,t(t({},d),{limit:1,fields:["name"]}))];case 1:return h=f.sent(),h.length>0?[2,this.getDoc(l,h[0].name)]:[2,{}]}})})},a.prototype.renameDoc=function(l,o,d,h){return h===void 0&&(h=!1),e(this,void 0,void 0,function(){return n(this,function(f){return[2,this.axios.post("/api/method/frappe.client.rename_doc",{doctype:l,old_name:o,new_name:d,merge:h}).then(function(y){return y.data}).catch(function(y){var _,O,m;throw t(t({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:(_=y.response.data.message)!==null&&_!==void 0?_:"There was an error while renaming the document.",exception:(m=(O=y.response.data.exception)!==null&&O!==void 0?O:y.response.data.exc_type)!==null&&m!==void 0?m:""})})]})})},a.prototype.getValue=function(l,o,d,h,f,y){return h===void 0&&(h=!0),f===void 0&&(f=!1),y===void 0&&(y=null),e(this,void 0,void 0,function(){var _;return n(this,function(O){return _={doctype:l,fieldname:"[]",filters:[],as_dict:h,debug:f,parent:null},o&&(_.fieldname=typeof o=="object"?JSON.stringify(o):o),d&&(_.filters=d?JSON.stringify(d):void 0),y&&(_.parent=y),[2,this.axios.get("/api/method/frappe.client.get_value",{params:_}).then(function(m){return m.data}).catch(function(m){var E,R;throw t(t({},m.response.data),{httpStatus:m.response.status,httpStatusText:m.response.statusText,message:"There was an error while getting the value.",exception:(R=(E=m.response.data.exception)!==null&&E!==void 0?E:m.response.data.exc_type)!==null&&R!==void 0?R:""})})]})})},a.prototype.setValue=function(l,o,d,h){return e(this,void 0,void 0,function(){return n(this,function(f){return d!==null&&typeof d=="object"&&!Array.isArray(d)&&(h=void 0),[2,this.axios.post("/api/method/frappe.client.set_value",{doctype:l,name:o,fieldname:d,value:h}).then(function(y){return y.data}).catch(function(y){var _,O;throw t(t({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:"There was an error while setting the value.",exception:(O=(_=y.response.data.exception)!==null&&_!==void 0?_:y.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},a.prototype.getSingleValue=function(l,o){return e(this,void 0,void 0,function(){var d;return n(this,function(h){return d={doctype:l,field:o},[2,this.axios.get("/api/method/frappe.client.get_single_value",{params:d}).then(function(f){return f.data}).catch(function(f){var y,_;throw t(t({},f.response.data),{httpStatus:f.response.status,httpStatusText:f.response.statusText,message:"There was an error while getting the value of single doctype.",exception:(_=(y=f.response.data.exception)!==null&&y!==void 0?y:f.response.data.exc_type)!==null&&_!==void 0?_:""})})]})})},a.prototype.submit=function(l){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/frappe.client.submit",{doc:l}).then(function(d){return d.data.message}).catch(function(d){var h,f;throw t(t({},d.response.data),{httpStatus:d.response.status,httpStatusText:d.response.statusText,message:"There was an error while submitting the document.",exception:(f=(h=d.response.data.exception)!==null&&h!==void 0?h:d.response.data.exc_type)!==null&&f!==void 0?f:""})})]})})},a.prototype.cancel=function(l,o){return e(this,void 0,void 0,function(){return n(this,function(d){return[2,this.axios.post("/api/method/frappe.client.cancel",{doctype:l,name:o}).then(function(h){return h.data}).catch(function(h){var f,y;throw t(t({},h.response.data),{httpStatus:h.response.status,httpStatusText:h.response.statusText,message:"There was an error while cancelling the document.",exception:(y=(f=h.response.data.exception)!==null&&f!==void 0?f:h.response.data.exc_type)!==null&&y!==void 0?y:""})})]})})},a}();return ke.FrappeDB=r,ke}var Fe={},ze={};/*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */var yn,Es;function Zr(){if(Es)return yn;Es=1;function t(s,i){return function(){return s.apply(i,arguments)}}const{toString:e}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:a}=Symbol,l=(s=>i=>{const c=e.call(i);return s[c]||(s[c]=c.slice(8,-1).toLowerCase())})(Object.create(null)),o=s=>(s=s.toLowerCase(),i=>l(i)===s),d=s=>i=>typeof i===s,{isArray:h}=Array,f=d("undefined");function y(s){return s!==null&&!f(s)&&s.constructor!==null&&!f(s.constructor)&&E(s.constructor.isBuffer)&&s.constructor.isBuffer(s)}const _=o("ArrayBuffer");function O(s){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(s):i=s&&s.buffer&&_(s.buffer),i}const m=d("string"),E=d("function"),R=d("number"),U=s=>s!==null&&typeof s=="object",J=s=>s===!0||s===!1,L=s=>{if(l(s)!=="object")return!1;const i=n(s);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(a in s)&&!(r in s)},Z=s=>{if(!U(s)||y(s))return!1;try{return Object.keys(s).length===0&&Object.getPrototypeOf(s)===Object.prototype}catch{return!1}},Y=o("Date"),M=o("File"),oe=s=>!!(s&&typeof s.uri<"u"),be=s=>s&&typeof s.getParts<"u",X=o("Blob"),$=o("FileList"),ee=s=>U(s)&&E(s.pipe);function se(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof pn<"u"?pn:{}}const Se=se(),me=typeof Se.FormData<"u"?Se.FormData:void 0,re=s=>{if(!s)return!1;if(me&&s instanceof me)return!0;const i=n(s);if(!i||i===Object.prototype||!E(s.append))return!1;const c=l(s);return c==="formdata"||c==="object"&&E(s.toString)&&s.toString()==="[object FormData]"},_e=o("URLSearchParams"),[Oe,fe,qe,Ze]=["ReadableStream","Request","Response","Headers"].map(o),Me=s=>s.trim?s.trim():s.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ge(s,i,{allOwnKeys:c=!1}={}){if(s===null||typeof s>"u")return;let u,p;if(typeof s!="object"&&(s=[s]),h(s))for(u=0,p=s.length;u<p;u++)i.call(null,s[u],u,s);else{if(y(s))return;const g=c?Object.getOwnPropertyNames(s):Object.keys(s),w=g.length;let v;for(u=0;u<w;u++)v=g[u],i.call(null,s[v],v,s)}}function he(s,i){if(y(s))return null;i=i.toLowerCase();const c=Object.keys(s);let u=c.length,p;for(;u-- >0;)if(p=c[u],i===p.toLowerCase())return p;return null}const de=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:pn,Ve=s=>!f(s)&&s!==de;function et(...s){const{caseless:i,skipUndefined:c}=Ve(this)&&this||{},u={},p=(g,w)=>{if(w==="__proto__"||w==="constructor"||w==="prototype")return;const v=i&&he(u,w)||w,x=W(u,v)?u[v]:void 0;L(x)&&L(g)?u[v]=et(x,g):L(g)?u[v]=et({},g):h(g)?u[v]=g.slice():(!c||!f(g))&&(u[v]=g)};for(let g=0,w=s.length;g<w;g++)s[g]&&Ge(s[g],p);return u}const tt=(s,i,c,{allOwnKeys:u}={})=>(Ge(i,(p,g)=>{c&&E(p)?Object.defineProperty(s,g,{__proto__:null,value:t(p,c),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(s,g,{__proto__:null,value:p,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:u}),s),Xe=s=>(s.charCodeAt(0)===65279&&(s=s.slice(1)),s),ut=(s,i,c,u)=>{s.prototype=Object.create(i.prototype,u),Object.defineProperty(s.prototype,"constructor",{__proto__:null,value:s,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(s,"super",{__proto__:null,value:i.prototype}),c&&Object.assign(s.prototype,c)},Qn=(s,i,c,u)=>{let p,g,w;const v={};if(i=i||{},s==null)return i;do{for(p=Object.getOwnPropertyNames(s),g=p.length;g-- >0;)w=p[g],(!u||u(w,s,i))&&!v[w]&&(i[w]=s[w],v[w]=!0);s=c!==!1&&n(s)}while(s&&(!c||c(s,i))&&s!==Object.prototype);return i},en=(s,i,c)=>{s=String(s),(c===void 0||c>s.length)&&(c=s.length),c-=i.length;const u=s.indexOf(i,c);return u!==-1&&u===c},tn=s=>{if(!s)return null;if(h(s))return s;let i=s.length;if(!R(i))return null;const c=new Array(i);for(;i-- >0;)c[i]=s[i];return c},Zn=(s=>i=>s&&i instanceof s)(typeof Uint8Array<"u"&&n(Uint8Array)),es=(s,i)=>{const u=(s&&s[r]).call(s);let p;for(;(p=u.next())&&!p.done;){const g=p.value;i.call(s,g[0],g[1])}},lt=(s,i)=>{let c;const u=[];for(;(c=s.exec(i))!==null;)u.push(c);return u},nn=o("HTMLFormElement"),Or=s=>s.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(c,u,p){return u.toUpperCase()+p}),W=(({hasOwnProperty:s})=>(i,c)=>s.call(i,c))(Object.prototype),te=o("RegExp"),Q=(s,i)=>{const c=Object.getOwnPropertyDescriptors(s),u={};Ge(c,(p,g)=>{let w;(w=i(p,g,s))!==!1&&(u[g]=w||p)}),Object.defineProperties(s,u)},ne=s=>{Q(s,(i,c)=>{if(E(s)&&["arguments","caller","callee"].includes(c))return!1;const u=s[c];if(E(u)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+c+"'")})}})},Re=(s,i)=>{const c={},u=p=>{p.forEach(g=>{c[g]=!0})};return h(s)?u(s):u(String(s).split(i)),c},ve=()=>{},ae=(s,i)=>s!=null&&Number.isFinite(s=+s)?s:i;function Te(s){return!!(s&&E(s.append)&&s[a]==="FormData"&&s[r])}const ft=s=>{const i=new Array(10),c=(u,p)=>{if(U(u)){if(i.indexOf(u)>=0)return;if(y(u))return u;if(!("toJSON"in u)){i[p]=u;const g=h(u)?[]:{};return Ge(u,(w,v)=>{const x=c(w,p+1);!f(x)&&(g[v]=x)}),i[p]=void 0,g}}return u};return c(s,0)},ht=o("AsyncFunction"),sn=s=>s&&(U(s)||E(s))&&E(s.then)&&E(s.catch),Lt=((s,i)=>s?setImmediate:i?((c,u)=>(de.addEventListener("message",({source:p,data:g})=>{p===de&&g===c&&u.length&&u.shift()()},!1),p=>{u.push(p),de.postMessage(c,"*")}))(`axios@${Math.random()}`,[]):c=>setTimeout(c))(typeof setImmediate=="function",E(de.postMessage)),Ee=typeof queueMicrotask<"u"?queueMicrotask.bind(de):typeof process<"u"&&process.nextTick||Lt;var b={isArray:h,isArrayBuffer:_,isBuffer:y,isFormData:re,isArrayBufferView:O,isString:m,isNumber:R,isBoolean:J,isObject:U,isPlainObject:L,isEmptyObject:Z,isReadableStream:Oe,isRequest:fe,isResponse:qe,isHeaders:Ze,isUndefined:f,isDate:Y,isFile:M,isReactNativeBlob:oe,isReactNative:be,isBlob:X,isRegExp:te,isFunction:E,isStream:ee,isURLSearchParams:_e,isTypedArray:Zn,isFileList:$,forEach:Ge,merge:et,extend:tt,trim:Me,stripBOM:Xe,inherits:ut,toFlatObject:Qn,kindOf:l,kindOfTest:o,endsWith:en,toArray:tn,forEachEntry:es,matchAll:lt,isHTMLForm:nn,hasOwnProperty:W,hasOwnProp:W,reduceDescriptors:Q,freezeMethods:ne,toObjectSet:Re,toCamelCase:Or,noop:ve,toFiniteNumber:ae,findKey:he,global:de,isContextDefined:Ve,isSpecCompliantForm:Te,toJSONObject:ft,isAsyncFn:ht,isThenable:sn,setImmediate:Lt,asap:Ee,isIterable:s=>s!=null&&E(s[r])};const ts=b.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"]);var Nt=s=>{const i={};let c,u,p;return s&&s.split(`
2
+ `).forEach(function(w){p=w.indexOf(":"),c=w.substring(0,p).trim().toLowerCase(),u=w.substring(p+1).trim(),!(!c||i[c]&&ts[c])&&(c==="set-cookie"?i[c]?i[c].push(u):i[c]=[u]:i[c]=i[c]?i[c]+", "+u:u)}),i};const Tr=Symbol("internals"),Xo=/[^\x09\x20-\x7E\x80-\xFF]/g;function Yo(s){let i=0,c=s.length;for(;i<c;){const u=s.charCodeAt(i);if(u!==9&&u!==32)break;i+=1}for(;c>i;){const u=s.charCodeAt(c-1);if(u!==9&&u!==32)break;c-=1}return i===0&&c===s.length?s:s.slice(i,c)}function kt(s){return s&&String(s).trim().toLowerCase()}function Qo(s){return Yo(s.replace(Xo,""))}function rn(s){return s===!1||s==null?s:b.isArray(s)?s.map(rn):Qo(String(s))}function Zo(s){const i=Object.create(null),c=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let u;for(;u=c.exec(s);)i[u[1]]=u[2];return i}const ea=s=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(s.trim());function ns(s,i,c,u,p){if(b.isFunction(u))return u.call(this,i,c);if(p&&(i=c),!!b.isString(i)){if(b.isString(u))return i.indexOf(u)!==-1;if(b.isRegExp(u))return u.test(i)}}function ta(s){return s.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,c,u)=>c.toUpperCase()+u)}function na(s,i){const c=b.toCamelCase(" "+i);["get","set","has"].forEach(u=>{Object.defineProperty(s,u+c,{__proto__:null,value:function(p,g,w){return this[u].call(this,i,p,g,w)},configurable:!0})})}class ge{constructor(i){i&&this.set(i)}set(i,c,u){const p=this;function g(v,x,C){const T=kt(x);if(!T)throw new Error("header name must be a non-empty string");const F=b.findKey(p,T);(!F||p[F]===void 0||C===!0||C===void 0&&p[F]!==!1)&&(p[F||x]=rn(v))}const w=(v,x)=>b.forEach(v,(C,T)=>g(C,T,x));if(b.isPlainObject(i)||i instanceof this.constructor)w(i,c);else if(b.isString(i)&&(i=i.trim())&&!ea(i))w(Nt(i),c);else if(b.isObject(i)&&b.isIterable(i)){let v={},x,C;for(const T of i){if(!b.isArray(T))throw TypeError("Object iterator must return a key-value pair");v[C=T[0]]=(x=v[C])?b.isArray(x)?[...x,T[1]]:[x,T[1]]:T[1]}w(v,c)}else i!=null&&g(c,i,u);return this}get(i,c){if(i=kt(i),i){const u=b.findKey(this,i);if(u){const p=this[u];if(!c)return p;if(c===!0)return Zo(p);if(b.isFunction(c))return c.call(this,p,u);if(b.isRegExp(c))return c.exec(p);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,c){if(i=kt(i),i){const u=b.findKey(this,i);return!!(u&&this[u]!==void 0&&(!c||ns(this,this[u],u,c)))}return!1}delete(i,c){const u=this;let p=!1;function g(w){if(w=kt(w),w){const v=b.findKey(u,w);v&&(!c||ns(u,u[v],v,c))&&(delete u[v],p=!0)}}return b.isArray(i)?i.forEach(g):g(i),p}clear(i){const c=Object.keys(this);let u=c.length,p=!1;for(;u--;){const g=c[u];(!i||ns(this,this[g],g,i,!0))&&(delete this[g],p=!0)}return p}normalize(i){const c=this,u={};return b.forEach(this,(p,g)=>{const w=b.findKey(u,g);if(w){c[w]=rn(p),delete c[g];return}const v=i?ta(g):String(g).trim();v!==g&&delete c[g],c[v]=rn(p),u[v]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const c=Object.create(null);return b.forEach(this,(u,p)=>{u!=null&&u!==!1&&(c[p]=i&&b.isArray(u)?u.join(", "):u)}),c}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,c])=>i+": "+c).join(`
3
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...c){const u=new this(i);return c.forEach(p=>u.set(p)),u}static accessor(i){const u=(this[Tr]=this[Tr]={accessors:{}}).accessors,p=this.prototype;function g(w){const v=kt(w);u[v]||(na(p,w),u[v]=!0)}return b.isArray(i)?i.forEach(g):g(i),this}}ge.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),b.reduceDescriptors(ge.prototype,({value:s},i)=>{let c=i[0].toUpperCase()+i.slice(1);return{get:()=>s,set(u){this[c]=u}}}),b.freezeMethods(ge);const sa="[REDACTED ****]";function ra(s){if(b.hasOwnProp(s,"toJSON"))return!0;let i=Object.getPrototypeOf(s);for(;i&&i!==Object.prototype;){if(b.hasOwnProp(i,"toJSON"))return!0;i=Object.getPrototypeOf(i)}return!1}function ia(s,i){const c=new Set(i.map(g=>String(g).toLowerCase())),u=[],p=g=>{if(g===null||typeof g!="object"||b.isBuffer(g))return g;if(u.indexOf(g)!==-1)return;g instanceof ge&&(g=g.toJSON()),u.push(g);let w;if(b.isArray(g))w=[],g.forEach((v,x)=>{const C=p(v);b.isUndefined(C)||(w[x]=C)});else{if(!b.isPlainObject(g)&&ra(g))return u.pop(),g;w=Object.create(null);for(const[v,x]of Object.entries(g)){const C=c.has(v.toLowerCase())?sa:p(x);b.isUndefined(C)||(w[v]=C)}}return u.pop(),w};return p(s)}class D extends Error{static from(i,c,u,p,g,w){const v=new D(i.message,c||i.code,u,p,g);return v.cause=i,v.name=i.name,i.status!=null&&v.status==null&&(v.status=i.status),w&&Object.assign(v,w),v}constructor(i,c,u,p,g){super(i),Object.defineProperty(this,"message",{__proto__:null,value:i,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,c&&(this.code=c),u&&(this.config=u),p&&(this.request=p),g&&(this.response=g,this.status=g.status)}toJSON(){const i=this.config,c=i&&b.hasOwnProp(i,"redact")?i.redact:void 0,u=b.isArray(c)&&c.length>0?ia(i,c):b.toJSONObject(i);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:u,code:this.code,status:this.status}}}D.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",D.ERR_BAD_OPTION="ERR_BAD_OPTION",D.ECONNABORTED="ECONNABORTED",D.ETIMEDOUT="ETIMEDOUT",D.ECONNREFUSED="ECONNREFUSED",D.ERR_NETWORK="ERR_NETWORK",D.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",D.ERR_DEPRECATED="ERR_DEPRECATED",D.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",D.ERR_BAD_REQUEST="ERR_BAD_REQUEST",D.ERR_CANCELED="ERR_CANCELED",D.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",D.ERR_INVALID_URL="ERR_INVALID_URL",D.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var oa=null;function ss(s){return b.isPlainObject(s)||b.isArray(s)}function Cr(s){return b.endsWith(s,"[]")?s.slice(0,-2):s}function rs(s,i,c){return s?s.concat(i).map(function(p,g){return p=Cr(p),!c&&g?"["+p+"]":p}).join(c?".":""):i}function aa(s){return b.isArray(s)&&!s.some(ss)}const ca=b.toFlatObject(b,{},null,function(i){return/^is[A-Z]/.test(i)});function on(s,i,c){if(!b.isObject(s))throw new TypeError("target must be an object");i=i||new FormData,c=b.toFlatObject(c,{metaTokens:!0,dots:!1,indexes:!1},!1,function(A,k){return!b.isUndefined(k[A])});const u=c.metaTokens,p=c.visitor||F,g=c.dots,w=c.indexes,v=c.Blob||typeof Blob<"u"&&Blob,x=c.maxDepth===void 0?100:c.maxDepth,C=v&&b.isSpecCompliantForm(i);if(!b.isFunction(p))throw new TypeError("visitor must be a function");function T(N){if(N===null)return"";if(b.isDate(N))return N.toISOString();if(b.isBoolean(N))return N.toString();if(!C&&b.isBlob(N))throw new D("Blob is not supported. Use a Buffer instead.");return b.isArrayBuffer(N)||b.isTypedArray(N)?C&&typeof Blob=="function"?new Blob([N]):Buffer.from(N):N}function F(N,A,k){let K=N;if(b.isReactNative(i)&&b.isReactNativeBlob(N))return i.append(rs(k,A,g),T(N)),!1;if(N&&!k&&typeof N=="object"){if(b.endsWith(A,"{}"))A=u?A:A.slice(0,-2),N=JSON.stringify(N);else if(b.isArray(N)&&aa(N)||(b.isFileList(N)||b.endsWith(A,"[]"))&&(K=b.toArray(N)))return A=Cr(A),K.forEach(function(H,De){!(b.isUndefined(H)||H===null)&&i.append(w===!0?rs([A],De,g):w===null?A:A+"[]",T(H))}),!1}return ss(N)?!0:(i.append(rs(k,A,g),T(N)),!1)}const V=[],q=Object.assign(ca,{defaultVisitor:F,convertValue:T,isVisitable:ss});function j(N,A,k=0){if(!b.isUndefined(N)){if(k>x)throw new D("Object is too deeply nested ("+k+" levels). Max depth: "+x,D.ERR_FORM_DATA_DEPTH_EXCEEDED);if(V.indexOf(N)!==-1)throw Error("Circular reference detected in "+A.join("."));V.push(N),b.forEach(N,function(z,H){(!(b.isUndefined(z)||z===null)&&p.call(i,z,b.isString(H)?H.trim():H,A,q))===!0&&j(z,A?A.concat(H):[H],k+1)}),V.pop()}}if(!b.isObject(s))throw new TypeError("data must be an object");return j(s),i}function xr(s){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(s).replace(/[!'()~]|%20/g,function(u){return i[u]})}function is(s,i){this._pairs=[],s&&on(s,this,i)}const Rr=is.prototype;Rr.append=function(i,c){this._pairs.push([i,c])},Rr.toString=function(i){const c=i?function(u){return i.call(this,u,xr)}:xr;return this._pairs.map(function(p){return c(p[0])+"="+c(p[1])},"").join("&")};function ua(s){return encodeURIComponent(s).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ar(s,i,c){if(!i)return s;const u=c&&c.encode||ua,p=b.isFunction(c)?{serialize:c}:c,g=p&&p.serialize;let w;if(g?w=g(i,p):w=b.isURLSearchParams(i)?i.toString():new is(i,p).toString(u),w){const v=s.indexOf("#");v!==-1&&(s=s.slice(0,v)),s+=(s.indexOf("?")===-1?"?":"&")+w}return s}class Dr{constructor(){this.handlers=[]}use(i,c,u){return this.handlers.push({fulfilled:i,rejected:c,synchronous:u?u.synchronous:!1,runWhen:u?u.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){b.forEach(this.handlers,function(u){u!==null&&i(u)})}}var os={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},la=typeof URLSearchParams<"u"?URLSearchParams:is,fa=typeof FormData<"u"?FormData:null,ha=typeof Blob<"u"?Blob:null,da={isBrowser:!0,classes:{URLSearchParams:la,FormData:fa,Blob:ha},protocols:["http","https","file","blob","url","data"]};const as=typeof window<"u"&&typeof document<"u",cs=typeof navigator=="object"&&navigator||void 0,pa=as&&(!cs||["ReactNative","NativeScript","NS"].indexOf(cs.product)<0),ya=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",ma=as&&window.location.href||"http://localhost";var ga=Object.freeze({__proto__:null,hasBrowserEnv:as,hasStandardBrowserEnv:pa,hasStandardBrowserWebWorkerEnv:ya,navigator:cs,origin:ma}),pe={...ga,...da};function wa(s,i){return on(s,new pe.classes.URLSearchParams,{visitor:function(c,u,p,g){return pe.isNode&&b.isBuffer(c)?(this.append(u,c.toString("base64")),!1):g.defaultVisitor.apply(this,arguments)},...i})}function ba(s){return b.matchAll(/\w+|\[(\w*)]/g,s).map(i=>i[0]==="[]"?"":i[1]||i[0])}function _a(s){const i={},c=Object.keys(s);let u;const p=c.length;let g;for(u=0;u<p;u++)g=c[u],i[g]=s[g];return i}function Lr(s){function i(c,u,p,g){let w=c[g++];if(w==="__proto__")return!0;const v=Number.isFinite(+w),x=g>=c.length;return w=!w&&b.isArray(p)?p.length:w,x?(b.hasOwnProp(p,w)?p[w]=b.isArray(p[w])?p[w].concat(u):[p[w],u]:p[w]=u,!v):((!p[w]||!b.isObject(p[w]))&&(p[w]=[]),i(c,u,p[w],g)&&b.isArray(p[w])&&(p[w]=_a(p[w])),!v)}if(b.isFormData(s)&&b.isFunction(s.entries)){const c={};return b.forEachEntry(s,(u,p)=>{i(ba(u),p,c,0)}),c}return null}const _t=(s,i)=>s!=null&&b.hasOwnProp(s,i)?s[i]:void 0;function va(s,i,c){if(b.isString(s))try{return(i||JSON.parse)(s),b.trim(s)}catch(u){if(u.name!=="SyntaxError")throw u}return(c||JSON.stringify)(s)}const Ft={transitional:os,adapter:["xhr","http","fetch"],transformRequest:[function(i,c){const u=c.getContentType()||"",p=u.indexOf("application/json")>-1,g=b.isObject(i);if(g&&b.isHTMLForm(i)&&(i=new FormData(i)),b.isFormData(i))return p?JSON.stringify(Lr(i)):i;if(b.isArrayBuffer(i)||b.isBuffer(i)||b.isStream(i)||b.isFile(i)||b.isBlob(i)||b.isReadableStream(i))return i;if(b.isArrayBufferView(i))return i.buffer;if(b.isURLSearchParams(i))return c.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let v;if(g){const x=_t(this,"formSerializer");if(u.indexOf("application/x-www-form-urlencoded")>-1)return wa(i,x).toString();if((v=b.isFileList(i))||u.indexOf("multipart/form-data")>-1){const C=_t(this,"env"),T=C&&C.FormData;return on(v?{"files[]":i}:i,T&&new T,x)}}return g||p?(c.setContentType("application/json",!1),va(i)):i}],transformResponse:[function(i){const c=_t(this,"transitional")||Ft.transitional,u=c&&c.forcedJSONParsing,p=_t(this,"responseType"),g=p==="json";if(b.isResponse(i)||b.isReadableStream(i))return i;if(i&&b.isString(i)&&(u&&!p||g)){const v=!(c&&c.silentJSONParsing)&&g;try{return JSON.parse(i,_t(this,"parseReviver"))}catch(x){if(v)throw x.name==="SyntaxError"?D.from(x,D.ERR_BAD_RESPONSE,this,null,_t(this,"response")):x}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};b.forEach(["delete","get","head","post","put","patch","query"],s=>{Ft.headers[s]={}});function us(s,i){const c=this||Ft,u=i||c,p=ge.from(u.headers);let g=u.data;return b.forEach(s,function(v){g=v.call(c,g,p.normalize(),i?i.status:void 0)}),p.normalize(),g}function Nr(s){return!!(s&&s.__CANCEL__)}class Pt extends D{constructor(i,c,u){super(i??"canceled",D.ERR_CANCELED,c,u),this.name="CanceledError",this.__CANCEL__=!0}}function kr(s,i,c){const u=c.config.validateStatus;!c.status||!u||u(c.status)?s(c):i(new D("Request failed with status code "+c.status,c.status>=400&&c.status<500?D.ERR_BAD_REQUEST:D.ERR_BAD_RESPONSE,c.config,c.request,c))}function Ea(s){const i=/^([-+\w]{1,25}):(?:\/\/)?/.exec(s);return i&&i[1]||""}function Sa(s,i){s=s||10;const c=new Array(s),u=new Array(s);let p=0,g=0,w;return i=i!==void 0?i:1e3,function(x){const C=Date.now(),T=u[g];w||(w=C),c[p]=x,u[p]=C;let F=g,V=0;for(;F!==p;)V+=c[F++],F=F%s;if(p=(p+1)%s,p===g&&(g=(g+1)%s),C-w<i)return;const q=T&&C-T;return q?Math.round(V*1e3/q):void 0}}function Oa(s,i){let c=0,u=1e3/i,p,g;const w=(C,T=Date.now())=>{c=T,p=null,g&&(clearTimeout(g),g=null),s(...C)};return[(...C)=>{const T=Date.now(),F=T-c;F>=u?w(C,T):(p=C,g||(g=setTimeout(()=>{g=null,w(p)},u-F)))},()=>p&&w(p)]}const an=(s,i,c=3)=>{let u=0;const p=Sa(50,250);return Oa(g=>{const w=g.loaded,v=g.lengthComputable?g.total:void 0,x=v!=null?Math.min(w,v):w,C=Math.max(0,x-u),T=p(C);u=Math.max(u,x);const F={loaded:x,total:v,progress:v?x/v:void 0,bytes:C,rate:T||void 0,estimated:T&&v?(v-x)/T:void 0,event:g,lengthComputable:v!=null,[i?"download":"upload"]:!0};s(F)},c)},Fr=(s,i)=>{const c=s!=null;return[u=>i[0]({lengthComputable:c,total:s,loaded:u}),i[1]]},Pr=s=>(...i)=>b.asap(()=>s(...i));var Ta=pe.hasStandardBrowserEnv?((s,i)=>c=>(c=new URL(c,pe.origin),s.protocol===c.protocol&&s.host===c.host&&(i||s.port===c.port)))(new URL(pe.origin),pe.navigator&&/(msie|trident)/i.test(pe.navigator.userAgent)):()=>!0,Ca=pe.hasStandardBrowserEnv?{write(s,i,c,u,p,g,w){if(typeof document>"u")return;const v=[`${s}=${encodeURIComponent(i)}`];b.isNumber(c)&&v.push(`expires=${new Date(c).toUTCString()}`),b.isString(u)&&v.push(`path=${u}`),b.isString(p)&&v.push(`domain=${p}`),g===!0&&v.push("secure"),b.isString(w)&&v.push(`SameSite=${w}`),document.cookie=v.join("; ")},read(s){if(typeof document>"u")return null;const i=document.cookie.split(";");for(let c=0;c<i.length;c++){const u=i[c].replace(/^\s+/,""),p=u.indexOf("=");if(p!==-1&&u.slice(0,p)===s)return decodeURIComponent(u.slice(p+1))}return null},remove(s){this.write(s,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function xa(s){return typeof s!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(s)}function Ra(s,i){return i?s.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):s}function Br(s,i,c){let u=!xa(i);return s&&(u||c===!1)?Ra(s,i):i}const Ur=s=>s instanceof ge?{...s}:s;function dt(s,i){i=i||{};const c=Object.create(null);Object.defineProperty(c,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function u(C,T,F,V){return b.isPlainObject(C)&&b.isPlainObject(T)?b.merge.call({caseless:V},C,T):b.isPlainObject(T)?b.merge({},T):b.isArray(T)?T.slice():T}function p(C,T,F,V){if(b.isUndefined(T)){if(!b.isUndefined(C))return u(void 0,C,F,V)}else return u(C,T,F,V)}function g(C,T){if(!b.isUndefined(T))return u(void 0,T)}function w(C,T){if(b.isUndefined(T)){if(!b.isUndefined(C))return u(void 0,C)}else return u(void 0,T)}function v(C,T,F){if(b.hasOwnProp(i,F))return u(C,T);if(b.hasOwnProp(s,F))return u(void 0,C)}const x={url:g,method:g,data:g,baseURL:w,transformRequest:w,transformResponse:w,paramsSerializer:w,timeout:w,timeoutMessage:w,withCredentials:w,withXSRFToken:w,adapter:w,responseType:w,xsrfCookieName:w,xsrfHeaderName:w,onUploadProgress:w,onDownloadProgress:w,decompress:w,maxContentLength:w,maxBodyLength:w,beforeRedirect:w,transport:w,httpAgent:w,httpsAgent:w,cancelToken:w,socketPath:w,allowedSocketPaths:w,responseEncoding:w,validateStatus:v,headers:(C,T,F)=>p(Ur(C),Ur(T),F,!0)};return b.forEach(Object.keys({...s,...i}),function(T){if(T==="__proto__"||T==="constructor"||T==="prototype")return;const F=b.hasOwnProp(x,T)?x[T]:p,V=b.hasOwnProp(s,T)?s[T]:void 0,q=b.hasOwnProp(i,T)?i[T]:void 0,j=F(V,q,T);b.isUndefined(j)&&F!==v||(c[T]=j)}),c}const Aa=["content-type","content-length"];function Da(s,i,c){if(c!=="content-only"){s.set(i);return}Object.entries(i).forEach(([u,p])=>{Aa.includes(u.toLowerCase())&&s.set(u,p)})}const La=s=>encodeURIComponent(s).replace(/%([0-9A-F]{2})/gi,(i,c)=>String.fromCharCode(parseInt(c,16)));var qr=s=>{const i=dt({},s),c=V=>b.hasOwnProp(i,V)?i[V]:void 0,u=c("data");let p=c("withXSRFToken");const g=c("xsrfHeaderName"),w=c("xsrfCookieName");let v=c("headers");const x=c("auth"),C=c("baseURL"),T=c("allowAbsoluteUrls"),F=c("url");if(i.headers=v=ge.from(v),i.url=Ar(Br(C,F,T),s.params,s.paramsSerializer),x&&v.set("Authorization","Basic "+btoa((x.username||"")+":"+(x.password?La(x.password):""))),b.isFormData(u)&&(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv?v.setContentType(void 0):b.isFunction(u.getHeaders)&&Da(v,u.getHeaders(),c("formDataHeaderPolicy"))),pe.hasStandardBrowserEnv&&(b.isFunction(p)&&(p=p(i)),p===!0||p==null&&Ta(i.url))){const q=g&&w&&Ca.read(w);q&&v.set(g,q)}return i},Na=typeof XMLHttpRequest<"u"&&function(s){return new Promise(function(c,u){const p=qr(s);let g=p.data;const w=ge.from(p.headers).normalize();let{responseType:v,onUploadProgress:x,onDownloadProgress:C}=p,T,F,V,q,j;function N(){q&&q(),j&&j(),p.cancelToken&&p.cancelToken.unsubscribe(T),p.signal&&p.signal.removeEventListener("abort",T)}let A=new XMLHttpRequest;A.open(p.method.toUpperCase(),p.url,!0),A.timeout=p.timeout;function k(){if(!A)return;const z=ge.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),De={data:!v||v==="text"||v==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:z,config:s,request:A};kr(function(Bt){c(Bt),N()},function(Bt){u(Bt),N()},De),A=null}"onloadend"in A?A.onloadend=k:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.startsWith("file:"))||setTimeout(k)},A.onabort=function(){A&&(u(new D("Request aborted",D.ECONNABORTED,s,A)),N(),A=null)},A.onerror=function(H){const De=H&&H.message?H.message:"Network Error",yt=new D(De,D.ERR_NETWORK,s,A);yt.event=H||null,u(yt),N(),A=null},A.ontimeout=function(){let H=p.timeout?"timeout of "+p.timeout+"ms exceeded":"timeout exceeded";const De=p.transitional||os;p.timeoutErrorMessage&&(H=p.timeoutErrorMessage),u(new D(H,De.clarifyTimeoutError?D.ETIMEDOUT:D.ECONNABORTED,s,A)),N(),A=null},g===void 0&&w.setContentType(null),"setRequestHeader"in A&&b.forEach(w.toJSON(),function(H,De){A.setRequestHeader(De,H)}),b.isUndefined(p.withCredentials)||(A.withCredentials=!!p.withCredentials),v&&v!=="json"&&(A.responseType=p.responseType),C&&([V,j]=an(C,!0),A.addEventListener("progress",V)),x&&A.upload&&([F,q]=an(x),A.upload.addEventListener("progress",F),A.upload.addEventListener("loadend",q)),(p.cancelToken||p.signal)&&(T=z=>{A&&(u(!z||z.type?new Pt(null,s,A):z),A.abort(),N(),A=null)},p.cancelToken&&p.cancelToken.subscribe(T),p.signal&&(p.signal.aborted?T():p.signal.addEventListener("abort",T)));const K=Ea(p.url);if(K&&!pe.protocols.includes(K)){u(new D("Unsupported protocol "+K+":",D.ERR_BAD_REQUEST,s));return}A.send(g||null)})};const ka=(s,i)=>{const{length:c}=s=s?s.filter(Boolean):[];if(i||c){let u=new AbortController,p;const g=function(C){if(!p){p=!0,v();const T=C instanceof Error?C:this.reason;u.abort(T instanceof D?T:new Pt(T instanceof Error?T.message:T))}};let w=i&&setTimeout(()=>{w=null,g(new D(`timeout of ${i}ms exceeded`,D.ETIMEDOUT))},i);const v=()=>{s&&(w&&clearTimeout(w),w=null,s.forEach(C=>{C.unsubscribe?C.unsubscribe(g):C.removeEventListener("abort",g)}),s=null)};s.forEach(C=>C.addEventListener("abort",g));const{signal:x}=u;return x.unsubscribe=()=>b.asap(v),x}},Fa=function*(s,i){let c=s.byteLength;if(c<i){yield s;return}let u=0,p;for(;u<c;)p=u+i,yield s.slice(u,p),u=p},Pa=async function*(s,i){for await(const c of Ba(s))yield*Fa(c,i)},Ba=async function*(s){if(s[Symbol.asyncIterator]){yield*s;return}const i=s.getReader();try{for(;;){const{done:c,value:u}=await i.read();if(c)break;yield u}}finally{await i.cancel()}},Ir=(s,i,c,u)=>{const p=Pa(s,i);let g=0,w,v=x=>{w||(w=!0,u&&u(x))};return new ReadableStream({async pull(x){try{const{done:C,value:T}=await p.next();if(C){v(),x.close();return}let F=T.byteLength;if(c){let V=g+=F;c(V)}x.enqueue(new Uint8Array(T))}catch(C){throw v(C),C}},cancel(x){return v(x),p.return()}},{highWaterMark:2})};function Ua(s){if(!s||typeof s!="string"||!s.startsWith("data:"))return 0;const i=s.indexOf(",");if(i<0)return 0;const c=s.slice(5,i),u=s.slice(i+1);if(/;base64/i.test(c)){let w=u.length;const v=u.length;for(let q=0;q<v;q++)if(u.charCodeAt(q)===37&&q+2<v){const j=u.charCodeAt(q+1),N=u.charCodeAt(q+2);(j>=48&&j<=57||j>=65&&j<=70||j>=97&&j<=102)&&(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102)&&(w-=2,q+=2)}let x=0,C=v-1;const T=q=>q>=2&&u.charCodeAt(q-2)===37&&u.charCodeAt(q-1)===51&&(u.charCodeAt(q)===68||u.charCodeAt(q)===100);C>=0&&(u.charCodeAt(C)===61?(x++,C--):T(C)&&(x++,C-=3)),x===1&&C>=0&&(u.charCodeAt(C)===61||T(C))&&x++;const V=Math.floor(w/4)*3-(x||0);return V>0?V:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(u,"utf8");let g=0;for(let w=0,v=u.length;w<v;w++){const x=u.charCodeAt(w);if(x<128)g+=1;else if(x<2048)g+=2;else if(x>=55296&&x<=56319&&w+1<v){const C=u.charCodeAt(w+1);C>=56320&&C<=57343?(g+=4,w++):g+=3}else g+=3}return g}const ls="1.16.0",jr=64*1024,{isFunction:cn}=b,Mr=(s,...i)=>{try{return!!s(...i)}catch{return!1}},qa=s=>{const i=b.global??globalThis,{ReadableStream:c,TextEncoder:u}=i;s=b.merge.call({skipUndefined:!0},{Request:i.Request,Response:i.Response},s);const{fetch:p,Request:g,Response:w}=s,v=p?cn(p):typeof fetch=="function",x=cn(g),C=cn(w);if(!v)return!1;const T=v&&cn(c),F=v&&(typeof u=="function"?(k=>K=>k.encode(K))(new u):async k=>new Uint8Array(await new g(k).arrayBuffer())),V=x&&T&&Mr(()=>{let k=!1;const K=new g(pe.origin,{body:new c,method:"POST",get duplex(){return k=!0,"half"}}),z=K.headers.has("Content-Type");return K.body!=null&&K.body.cancel(),k&&!z}),q=C&&T&&Mr(()=>b.isReadableStream(new w("").body)),j={stream:q&&(k=>k.body)};v&&["text","arrayBuffer","blob","formData","stream"].forEach(k=>{!j[k]&&(j[k]=(K,z)=>{let H=K&&K[k];if(H)return H.call(K);throw new D(`Response type '${k}' is not supported`,D.ERR_NOT_SUPPORT,z)})});const N=async k=>{if(k==null)return 0;if(b.isBlob(k))return k.size;if(b.isSpecCompliantForm(k))return(await new g(pe.origin,{method:"POST",body:k}).arrayBuffer()).byteLength;if(b.isArrayBufferView(k)||b.isArrayBuffer(k))return k.byteLength;if(b.isURLSearchParams(k)&&(k=k+""),b.isString(k))return(await F(k)).byteLength},A=async(k,K)=>{const z=b.toFiniteNumber(k.getContentLength());return z??N(K)};return async k=>{let{url:K,method:z,data:H,signal:De,cancelToken:yt,timeout:Bt,onDownloadProgress:ys,onUploadProgress:Kr,responseType:nt,headers:mt,withCredentials:fn="same-origin",fetchOptions:Gr,maxContentLength:He,maxBodyLength:ms}=qr(k);const Ut=b.isNumber(He)&&He>-1,Wa=b.isNumber(ms)&&ms>-1;let Xr=p||fetch;nt=nt?(nt+"").toLowerCase():"text";let st=ka([De,yt&&yt.toAbortSignal()],Bt),Le=null;const gt=st&&st.unsubscribe&&(()=>{st.unsubscribe()});let Yr;try{if(Ut&&typeof K=="string"&&K.startsWith("data:")&&Ua(K)>He)throw new D("maxContentLength size of "+He+" exceeded",D.ERR_BAD_RESPONSE,k,Le);if(Wa&&z!=="get"&&z!=="head"){const G=await A(mt,H);if(typeof G=="number"&&isFinite(G)&&G>ms)throw new D("Request body larger than maxBodyLength limit",D.ERR_BAD_REQUEST,k,Le)}if(Kr&&V&&z!=="get"&&z!=="head"&&(Yr=await A(mt,H))!==0){let G=new g(K,{method:"POST",body:H,duplex:"half"}),vt;if(b.isFormData(H)&&(vt=G.headers.get("content-type"))&&mt.setContentType(vt),G.body){const[hn,dn]=Fr(Yr,an(Pr(Kr)));H=Ir(G.body,jr,hn,dn)}}b.isString(fn)||(fn=fn?"include":"omit");const ye=x&&"credentials"in g.prototype;if(b.isFormData(H)){const G=mt.getContentType();G&&/^multipart\/form-data/i.test(G)&&!/boundary=/i.test(G)&&mt.delete("content-type")}mt.set("User-Agent","axios/"+ls,!1);const rt={...Gr,signal:st,method:z.toUpperCase(),headers:mt.normalize().toJSON(),body:H,duplex:"half",credentials:ye?fn:void 0};Le=x&&new g(K,rt);let We=await(x?Xr(Le,Gr):Xr(K,rt));if(Ut){const G=b.toFiniteNumber(We.headers.get("content-length"));if(G!=null&&G>He)throw new D("maxContentLength size of "+He+" exceeded",D.ERR_BAD_RESPONSE,k,Le)}const gs=q&&(nt==="stream"||nt==="response");if(q&&We.body&&(ys||Ut||gs&&gt)){const G={};["status","statusText","headers"].forEach(qt=>{G[qt]=We[qt]});const vt=b.toFiniteNumber(We.headers.get("content-length")),[hn,dn]=ys&&Fr(vt,an(Pr(ys),!0))||[];let Qr=0;const za=qt=>{if(Ut&&(Qr=qt,Qr>He))throw new D("maxContentLength size of "+He+" exceeded",D.ERR_BAD_RESPONSE,k,Le);hn&&hn(qt)};We=new w(Ir(We.body,jr,za,()=>{dn&&dn(),gt&&gt()}),G)}nt=nt||"text";let Ye=await j[b.findKey(j,nt)||"text"](We,k);if(Ut&&!q&&!gs){let G;if(Ye!=null&&(typeof Ye.byteLength=="number"?G=Ye.byteLength:typeof Ye.size=="number"?G=Ye.size:typeof Ye=="string"&&(G=typeof u=="function"?new u().encode(Ye).byteLength:Ye.length)),typeof G=="number"&&G>He)throw new D("maxContentLength size of "+He+" exceeded",D.ERR_BAD_RESPONSE,k,Le)}return!gs&&gt&&gt(),await new Promise((G,vt)=>{kr(G,vt,{data:Ye,headers:ge.from(We.headers),status:We.status,statusText:We.statusText,config:k,request:Le})})}catch(ye){if(gt&&gt(),st&&st.aborted&&st.reason instanceof D){const rt=st.reason;throw rt.config=k,Le&&(rt.request=Le),ye!==rt&&(rt.cause=ye),rt}throw ye&&ye.name==="TypeError"&&/Load failed|fetch/i.test(ye.message)?Object.assign(new D("Network Error",D.ERR_NETWORK,k,Le,ye&&ye.response),{cause:ye.cause||ye}):D.from(ye,ye&&ye.code,k,Le,ye&&ye.response)}}},Ia=new Map,Vr=s=>{let i=s&&s.env||{};const{fetch:c,Request:u,Response:p}=i,g=[u,p,c];let w=g.length,v=w,x,C,T=Ia;for(;v--;)x=g[v],C=T.get(x),C===void 0&&T.set(x,C=v?new Map:qa(i)),T=C;return C};Vr();const fs={http:oa,xhr:Na,fetch:{get:Vr}};b.forEach(fs,(s,i)=>{if(s){try{Object.defineProperty(s,"name",{__proto__:null,value:i})}catch{}Object.defineProperty(s,"adapterName",{__proto__:null,value:i})}});const $r=s=>`- ${s}`,ja=s=>b.isFunction(s)||s===null||s===!1;function Ma(s,i){s=b.isArray(s)?s:[s];const{length:c}=s;let u,p;const g={};for(let w=0;w<c;w++){u=s[w];let v;if(p=u,!ja(u)&&(p=fs[(v=String(u)).toLowerCase()],p===void 0))throw new D(`Unknown adapter '${v}'`);if(p&&(b.isFunction(p)||(p=p.get(i))))break;g[v||"#"+w]=p}if(!p){const w=Object.entries(g).map(([x,C])=>`adapter ${x} `+(C===!1?"is not supported by the environment":"is not available in the build"));let v=c?w.length>1?`since :
4
+ `+w.map($r).join(`
5
+ `):" "+$r(w[0]):"as no adapter specified";throw new D("There is no suitable adapter to dispatch the request "+v,"ERR_NOT_SUPPORT")}return p}var Hr={getAdapter:Ma,adapters:fs};function hs(s){if(s.cancelToken&&s.cancelToken.throwIfRequested(),s.signal&&s.signal.aborted)throw new Pt(null,s)}function Wr(s){return hs(s),s.headers=ge.from(s.headers),s.data=us.call(s,s.transformRequest),["post","put","patch"].indexOf(s.method)!==-1&&s.headers.setContentType("application/x-www-form-urlencoded",!1),Hr.getAdapter(s.adapter||Ft.adapter,s)(s).then(function(u){hs(s),s.response=u;try{u.data=us.call(s,s.transformResponse,u)}finally{delete s.response}return u.headers=ge.from(u.headers),u},function(u){if(!Nr(u)&&(hs(s),u&&u.response)){s.response=u.response;try{u.response.data=us.call(s,s.transformResponse,u.response)}finally{delete s.response}u.response.headers=ge.from(u.response.headers)}return Promise.reject(u)})}const un={};["object","boolean","number","function","string","symbol"].forEach((s,i)=>{un[s]=function(u){return typeof u===s||"a"+(i<1?"n ":" ")+s}});const zr={};un.transitional=function(i,c,u){function p(g,w){return"[Axios v"+ls+"] Transitional option '"+g+"'"+w+(u?". "+u:"")}return(g,w,v)=>{if(i===!1)throw new D(p(w," has been removed"+(c?" in "+c:"")),D.ERR_DEPRECATED);return c&&!zr[w]&&(zr[w]=!0,console.warn(p(w," has been deprecated since v"+c+" and will be removed in the near future"))),i?i(g,w,v):!0}},un.spelling=function(i){return(c,u)=>(console.warn(`${u} is likely a misspelling of ${i}`),!0)};function Va(s,i,c){if(typeof s!="object")throw new D("options must be an object",D.ERR_BAD_OPTION_VALUE);const u=Object.keys(s);let p=u.length;for(;p-- >0;){const g=u[p],w=Object.prototype.hasOwnProperty.call(i,g)?i[g]:void 0;if(w){const v=s[g],x=v===void 0||w(v,g,s);if(x!==!0)throw new D("option "+g+" must be "+x,D.ERR_BAD_OPTION_VALUE);continue}if(c!==!0)throw new D("Unknown option "+g,D.ERR_BAD_OPTION)}}var ln={assertOptions:Va,validators:un};const Ae=ln.validators;class pt{constructor(i){this.defaults=i||{},this.interceptors={request:new Dr,response:new Dr}}async request(i,c){try{return await this._request(i,c)}catch(u){if(u instanceof Error){let p={};Error.captureStackTrace?Error.captureStackTrace(p):p=new Error;const g=(()=>{if(!p.stack)return"";const w=p.stack.indexOf(`
6
+ `);return w===-1?"":p.stack.slice(w+1)})();try{if(!u.stack)u.stack=g;else if(g){const w=g.indexOf(`
7
+ `),v=w===-1?-1:g.indexOf(`
8
+ `,w+1),x=v===-1?"":g.slice(v+1);String(u.stack).endsWith(x)||(u.stack+=`
9
+ `+g)}}catch{}}throw u}}_request(i,c){typeof i=="string"?(c=c||{},c.url=i):c=i||{},c=dt(this.defaults,c);const{transitional:u,paramsSerializer:p,headers:g}=c;u!==void 0&&ln.assertOptions(u,{silentJSONParsing:Ae.transitional(Ae.boolean),forcedJSONParsing:Ae.transitional(Ae.boolean),clarifyTimeoutError:Ae.transitional(Ae.boolean),legacyInterceptorReqResOrdering:Ae.transitional(Ae.boolean)},!1),p!=null&&(b.isFunction(p)?c.paramsSerializer={serialize:p}:ln.assertOptions(p,{encode:Ae.function,serialize:Ae.function},!0)),c.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?c.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:c.allowAbsoluteUrls=!0),ln.assertOptions(c,{baseUrl:Ae.spelling("baseURL"),withXsrfToken:Ae.spelling("withXSRFToken")},!0),c.method=(c.method||this.defaults.method||"get").toLowerCase();let w=g&&b.merge(g.common,g[c.method]);g&&b.forEach(["delete","get","head","post","put","patch","query","common"],j=>{delete g[j]}),c.headers=ge.concat(w,g);const v=[];let x=!0;this.interceptors.request.forEach(function(N){if(typeof N.runWhen=="function"&&N.runWhen(c)===!1)return;x=x&&N.synchronous;const A=c.transitional||os;A&&A.legacyInterceptorReqResOrdering?v.unshift(N.fulfilled,N.rejected):v.push(N.fulfilled,N.rejected)});const C=[];this.interceptors.response.forEach(function(N){C.push(N.fulfilled,N.rejected)});let T,F=0,V;if(!x){const j=[Wr.bind(this),void 0];for(j.unshift(...v),j.push(...C),V=j.length,T=Promise.resolve(c);F<V;)T=T.then(j[F++],j[F++]);return T}V=v.length;let q=c;for(;F<V;){const j=v[F++],N=v[F++];try{q=j(q)}catch(A){N.call(this,A);break}}try{T=Wr.call(this,q)}catch(j){return Promise.reject(j)}for(F=0,V=C.length;F<V;)T=T.then(C[F++],C[F++]);return T}getUri(i){i=dt(this.defaults,i);const c=Br(i.baseURL,i.url,i.allowAbsoluteUrls);return Ar(c,i.params,i.paramsSerializer)}}b.forEach(["delete","get","head","options"],function(i){pt.prototype[i]=function(c,u){return this.request(dt(u||{},{method:i,url:c,data:(u||{}).data}))}}),b.forEach(["post","put","patch","query"],function(i){function c(u){return function(g,w,v){return this.request(dt(v||{},{method:i,headers:u?{"Content-Type":"multipart/form-data"}:{},url:g,data:w}))}}pt.prototype[i]=c(),i!=="query"&&(pt.prototype[i+"Form"]=c(!0))});class ds{constructor(i){if(typeof i!="function")throw new TypeError("executor must be a function.");let c;this.promise=new Promise(function(g){c=g});const u=this;this.promise.then(p=>{if(!u._listeners)return;let g=u._listeners.length;for(;g-- >0;)u._listeners[g](p);u._listeners=null}),this.promise.then=p=>{let g;const w=new Promise(v=>{u.subscribe(v),g=v}).then(p);return w.cancel=function(){u.unsubscribe(g)},w},i(function(g,w,v){u.reason||(u.reason=new Pt(g,w,v),c(u.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(i){if(this.reason){i(this.reason);return}this._listeners?this._listeners.push(i):this._listeners=[i]}unsubscribe(i){if(!this._listeners)return;const c=this._listeners.indexOf(i);c!==-1&&this._listeners.splice(c,1)}toAbortSignal(){const i=new AbortController,c=u=>{i.abort(u)};return this.subscribe(c),i.signal.unsubscribe=()=>this.unsubscribe(c),i.signal}static source(){let i;return{token:new ds(function(p){i=p}),cancel:i}}}function $a(s){return function(c){return s.apply(null,c)}}function Ha(s){return b.isObject(s)&&s.isAxiosError===!0}const ps={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(ps).forEach(([s,i])=>{ps[i]=s});function Jr(s){const i=new pt(s),c=t(pt.prototype.request,i);return b.extend(c,pt.prototype,i,{allOwnKeys:!0}),b.extend(c,i,null,{allOwnKeys:!0}),c.create=function(p){return Jr(dt(s,p))},c}const le=Jr(Ft);return le.Axios=pt,le.CanceledError=Pt,le.CancelToken=ds,le.isCancel=Nr,le.VERSION=ls,le.toFormData=on,le.AxiosError=D,le.Cancel=le.CanceledError,le.all=function(i){return Promise.all(i)},le.spread=$a,le.isAxiosError=Ha,le.mergeConfig=dt,le.AxiosHeaders=ge,le.formToJSON=s=>Lr(b.isHTMLForm(s)?new FormData(s):s),le.getAdapter=Hr.getAdapter,le.HttpStatusCode=ps,le.default=le,yn=le,yn}var Ss;function Os(){if(Ss)return ze;Ss=1;var t=ze&&ze.__assign||function(){return t=Object.assign||function(a){for(var l,o=1,d=arguments.length;o<d;o++){l=arguments[o];for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(a[h]=l[h])}return a},t.apply(this,arguments)};Object.defineProperty(ze,"__esModule",{value:!0}),ze.getRequestHeaders=ze.getAxiosClient=void 0;var e=Zr();function n(a,l,o,d,h){var f=e.default.create({baseURL:a,headers:r(l,d,o,a,h),withCredentials:!0});return f.interceptors.request.use(function(y){return typeof window<"u"&&window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(y.headers["X-Frappe-CSRF-Token"]=window.csrf_token),l&&d&&o&&(y.headers.Authorization="".concat(d," ").concat(o())),y}),f}ze.getAxiosClient=n;function r(a,l,o,d,h){a===void 0&&(a=!1);var f={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return a&&l&&o&&(f.Authorization="".concat(l," ").concat(o())),typeof window<"u"&&typeof document<"u"&&(window.location&&(d&&d!==window.location.origin||(f["X-Frappe-Site-Name"]=window.location.hostname)),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(f["X-Frappe-CSRF-Token"]=window.csrf_token)),t(t({},f),h??{})}return ze.getRequestHeaders=r,ze}var Ts;function Cs(){if(Ts)return Fe;Ts=1;var t=Fe&&Fe.__assign||function(){return t=Object.assign||function(l){for(var o,d=1,h=arguments.length;d<h;d++){o=arguments[d];for(var f in o)Object.prototype.hasOwnProperty.call(o,f)&&(l[f]=o[f])}return l},t.apply(this,arguments)},e=Fe&&Fe.__awaiter||function(l,o,d,h){function f(y){return y instanceof d?y:new d(function(_){_(y)})}return new(d||(d=Promise))(function(y,_){function O(R){try{E(h.next(R))}catch(U){_(U)}}function m(R){try{E(h.throw(R))}catch(U){_(U)}}function E(R){R.done?y(R.value):f(R.value).then(O,m)}E((h=h.apply(l,o||[])).next())})},n=Fe&&Fe.__generator||function(l,o){var d={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},h,f,y,_;return _={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function O(E){return function(R){return m([E,R])}}function m(E){if(h)throw new TypeError("Generator is already executing.");for(;_&&(_=0,E[0]&&(d=0)),d;)try{if(h=1,f&&(y=E[0]&2?f.return:E[0]?f.throw||((y=f.return)&&y.call(f),0):f.next)&&!(y=y.call(f,E[1])).done)return y;switch(f=0,y&&(E=[E[0]&2,y.value]),E[0]){case 0:case 1:y=E;break;case 4:return d.label++,{value:E[1],done:!1};case 5:d.label++,f=E[1],E=[0];continue;case 7:E=d.ops.pop(),d.trys.pop();continue;default:if(y=d.trys,!(y=y.length>0&&y[y.length-1])&&(E[0]===6||E[0]===2)){d=0;continue}if(E[0]===3&&(!y||E[1]>y[0]&&E[1]<y[3])){d.label=E[1];break}if(E[0]===6&&d.label<y[1]){d.label=y[1],y=E;break}if(y&&d.label<y[2]){d.label=y[2],d.ops.push(E);break}y[2]&&d.ops.pop(),d.trys.pop();continue}E=o.call(l,d)}catch(R){E=[6,R],f=0}finally{h=y=0}if(E[0]&5)throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}};Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.FrappeFileUpload=void 0;var r=Os(),a=function(){function l(o,d,h,f,y,_){this.appURL=o,this.axios=d,this.useToken=h??!1,this.token=f,this.tokenType=y,this.customHeaders=_}return l.prototype.uploadFile=function(o,d,h,f){return f===void 0&&(f="upload_file"),e(this,void 0,void 0,function(){var y,_,O,m,E,R,U,J;return n(this,function(L){return y=new FormData,o&&y.append("file",o,o.name),_=d.isPrivate,O=d.folder,m=d.file_url,E=d.doctype,R=d.docname,U=d.fieldname,J=d.otherData,_&&y.append("is_private","1"),O&&y.append("folder",O),m&&y.append("file_url",m),E&&R&&(y.append("doctype",E),y.append("docname",R),U&&y.append("fieldname",U)),J&&Object.keys(J).forEach(function(Z){var Y=J[Z];y.append(Z,Y)}),[2,this.axios.post("/api/method/".concat(f),y,{onUploadProgress:function(Z){h&&h(Z.loaded,Z.total,Z)},headers:t(t({},(0,r.getRequestHeaders)(this.useToken,this.tokenType,this.token,this.appURL,this.customHeaders)),{"Content-Type":"multipart/form-data"})}).catch(function(Z){var Y,M;throw t(t({},Z.response.data),{httpStatus:Z.response.status,httpStatusText:Z.response.statusText,message:(Y=Z.response.data.message)!==null&&Y!==void 0?Y:"There was an error while uploading the file.",exception:(M=Z.response.data.exception)!==null&&M!==void 0?M:""})})]})})},l}();return Fe.FrappeFileUpload=a,Fe}var xs;function ei(){if(xs)return St;xs=1,Object.defineProperty(St,"__esModule",{value:!0}),St.FrappeApp=void 0;var t=Ds(),e=bs(),n=vs(),r=Cs(),a=Os(),l=function(){function o(d,h,f,y){var _,O;this.url=d,this.name=f??"FrappeApp",this.useToken=(_=h==null?void 0:h.useToken)!==null&&_!==void 0?_:!1,this.token=h==null?void 0:h.token,this.tokenType=(O=h==null?void 0:h.type)!==null&&O!==void 0?O:"Bearer",this.customHeaders=y,this.axios=(0,a.getAxiosClient)(this.url,this.useToken,this.token,this.tokenType,this.customHeaders)}return o.prototype.auth=function(){return new t.FrappeAuth(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.db=function(){return new n.FrappeDB(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.file=function(){return new r.FrappeFileUpload(this.url,this.axios,this.useToken,this.token,this.tokenType,this.customHeaders)},o.prototype.call=function(){return new e.FrappeCall(this.url,this.axios,this.useToken,this.token,this.tokenType)},o}();return St.FrappeApp=l,St}var Pe={},Rs;function ti(){if(Rs)return Pe;Rs=1;var t=Pe&&Pe.__assign||function(){return t=Object.assign||function(a){for(var l,o=1,d=arguments.length;o<d;o++){l=arguments[o];for(var h in l)Object.prototype.hasOwnProperty.call(l,h)&&(a[h]=l[h])}return a},t.apply(this,arguments)},e=Pe&&Pe.__awaiter||function(a,l,o,d){function h(f){return f instanceof o?f:new o(function(y){y(f)})}return new(o||(o=Promise))(function(f,y){function _(E){try{m(d.next(E))}catch(R){y(R)}}function O(E){try{m(d.throw(E))}catch(R){y(R)}}function m(E){E.done?f(E.value):h(E.value).then(_,O)}m((d=d.apply(a,l||[])).next())})},n=Pe&&Pe.__generator||function(a,l){var o={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},d,h,f,y;return y={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function _(m){return function(E){return O([m,E])}}function O(m){if(d)throw new TypeError("Generator is already executing.");for(;y&&(y=0,m[0]&&(o=0)),o;)try{if(d=1,h&&(f=m[0]&2?h.return:m[0]?h.throw||((f=h.return)&&f.call(h),0):h.next)&&!(f=f.call(h,m[1])).done)return f;switch(h=0,f&&(m=[m[0]&2,f.value]),m[0]){case 0:case 1:f=m;break;case 4:return o.label++,{value:m[1],done:!1};case 5:o.label++,h=m[1],m=[0];continue;case 7:m=o.ops.pop(),o.trys.pop();continue;default:if(f=o.trys,!(f=f.length>0&&f[f.length-1])&&(m[0]===6||m[0]===2)){o=0;continue}if(m[0]===3&&(!f||m[1]>f[0]&&m[1]<f[3])){o.label=m[1];break}if(m[0]===6&&o.label<f[1]){o.label=f[1],f=m;break}if(f&&o.label<f[2]){o.label=f[2],o.ops.push(m);break}f[2]&&o.ops.pop(),o.trys.pop();continue}m=l.call(a,o)}catch(E){m=[6,E],h=0}finally{d=f=0}if(m[0]&5)throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}};Object.defineProperty(Pe,"__esModule",{value:!0}),Pe.FrappeAuth=void 0;var r=function(){function a(l,o,d,h,f){this.appURL=l,this.axios=o,this.useToken=d??!1,this.token=h,this.tokenType=f}return a.prototype.loginWithUsernamePassword=function(l){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/api/method/login",{usr:l.username,pwd:l.password,otp:l.otp,tmp_id:l.tmp_id,device:l.device}).then(function(d){return d.data}).catch(function(d){var h,f;throw t(t({},d.response.data),{httpStatus:d.response.status,httpStatusText:d.response.statusText,message:(h=d.response.data.message)!==null&&h!==void 0?h:"There was an error while logging in",exception:(f=d.response.data.exception)!==null&&f!==void 0?f:""})})]})})},a.prototype.getLoggedInUser=function(){return e(this,void 0,void 0,function(){return n(this,function(l){return[2,this.axios.get("/api/method/frappe.auth.get_logged_user").then(function(o){return o.data.message}).catch(function(o){var d;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:"There was an error while fetching the logged in user",exception:(d=o.response.data.exception)!==null&&d!==void 0?d:""})})]})})},a.prototype.logout=function(){return e(this,void 0,void 0,function(){return n(this,function(l){return[2,this.axios.post("/api/method/logout",{}).then(function(){}).catch(function(o){var d,h;throw t(t({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:(d=o.response.data.message)!==null&&d!==void 0?d:"There was an error while logging out",exception:(h=o.response.data.exception)!==null&&h!==void 0?h:""})})]})})},a.prototype.forgetPassword=function(l){return e(this,void 0,void 0,function(){return n(this,function(o){return[2,this.axios.post("/",{cmd:"frappe.core.doctype.user.user.reset_password",user:l}).then(function(){}).catch(function(d){var h,f;throw t(t({},d.response.data),{httpStatus:d.response.status,httpStatusText:d.response.statusText,message:(h=d.response.data.message)!==null&&h!==void 0?h:"There was an error sending password reset email.",exception:(f=d.response.data.exception)!==null&&f!==void 0?f:""})})]})})},a}();return Pe.FrappeAuth=r,Pe}var As;function Ds(){return As||(As=1,function(t){var e=ot&&ot.__createBinding||(Object.create?function(r,a,l,o){o===void 0&&(o=l);var d=Object.getOwnPropertyDescriptor(a,l);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[l]}}),Object.defineProperty(r,o,d)}:function(r,a,l,o){o===void 0&&(o=l),r[o]=a[l]}),n=ot&&ot.__exportStar||function(r,a){for(var l in r)l!=="default"&&!Object.prototype.hasOwnProperty.call(a,l)&&e(a,r,l)};Object.defineProperty(t,"__esModule",{value:!0}),n(ei(),t),n(ti(),t),n(vs(),t),n(Cs(),t),n(bs(),t)}(ot)),ot}var ni=Ds(),It={exports:{}},mn={};/**
7
10
  * @license React
8
11
  * use-sync-external-store-shim.production.js
9
12
  *
@@ -11,7 +14,7 @@
11
14
  *
12
15
  * This source code is licensed under the MIT license found in the
13
16
  * LICENSE file in the root directory of this source tree.
14
- */var ms;function Kr(){if(ms)return sn;ms=1;var t=S;function e(b,E){return b===E&&(b!==0||1/b===1/E)||b!==b&&E!==E}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,c=t.useLayoutEffect,o=t.useDebugValue;function h(b,E){var y=E(),v=s({inst:{value:y,getSnapshot:E}}),O=v[0].inst,I=v[1];return c(function(){O.value=y,O.getSnapshot=E,f(O)&&I({inst:O})},[b,y,E]),a(function(){return f(O)&&I({inst:O}),b(function(){f(O)&&I({inst:O})})},[b]),o(y),y}function f(b){var E=b.getSnapshot;b=b.value;try{var y=E();return!n(b,y)}catch{return!0}}function l(b,E){return E()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:h;return sn.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:m,sn}var rn={};/**
17
+ */var Ls;function si(){if(Ls)return mn;Ls=1;var t=S;function e(_,O){return _===O&&(_!==0||1/_===1/O)||_!==_&&O!==O}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,a=t.useEffect,l=t.useLayoutEffect,o=t.useDebugValue;function d(_,O){var m=O(),E=r({inst:{value:m,getSnapshot:O}}),R=E[0].inst,U=E[1];return l(function(){R.value=m,R.getSnapshot=O,h(R)&&U({inst:R})},[_,m,O]),a(function(){return h(R)&&U({inst:R}),_(function(){h(R)&&U({inst:R})})},[_]),o(m),m}function h(_){var O=_.getSnapshot;_=_.value;try{var m=O();return!n(_,m)}catch{return!0}}function f(_,O){return O()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:d;return mn.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y,mn}var gn={};/**
15
18
  * @license React
16
19
  * use-sync-external-store-shim.development.js
17
20
  *
@@ -19,4 +22,4 @@
19
22
  *
20
23
  * This source code is licensed under the MIT license found in the
21
24
  * LICENSE file in the root directory of this source tree.
22
- */var ys;function Gr(){return ys||(ys=1,process.env.NODE_ENV!=="production"&&function(){function t(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}function e(y,v){m||a.startTransition===void 0||(m=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var O=v();if(!b){var I=v();c(O,I)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),b=!0)}I=o({inst:{value:O,getSnapshot:v}});var R=I[0].inst,K=I[1];return f(function(){R.value=O,R.getSnapshot=v,n(R)&&K({inst:R})},[y,O,v]),h(function(){return n(R)&&K({inst:R}),y(function(){n(R)&&K({inst:R})})},[y]),l(O),O}function n(y){var v=y.getSnapshot;y=y.value;try{var O=v();return!c(y,O)}catch{return!0}}function s(y,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=S,c=typeof Object.is=="function"?Object.is:t,o=a.useState,h=a.useEffect,f=a.useLayoutEffect,l=a.useDebugValue,m=!1,b=!1,E=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?s:e;rn.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:E,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),rn}var gs;function Xr(){return gs||(gs=1,process.env.NODE_ENV==="production"?Tt.exports=Kr():Tt.exports=Gr()),Tt.exports}var ws=Xr();const bs=0,_s=1,vs=2,Ss=3;var Es=Object.prototype.hasOwnProperty;function on(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&on(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(Es.call(t,n)&&++s&&!Es.call(e,n)||!(n in e)||!on(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const Re=new WeakMap,$e=()=>{},Y=$e(),Ot=Object,U=t=>t===Y,ve=t=>typeof t=="function",Me=(t,e)=>({...t,...e}),Ts=t=>ve(t.then),an={},Ct={},cn="undefined",dt=typeof window!=cn,un=typeof document!=cn,Yr=dt&&"Deno"in window,Qr=()=>dt&&typeof window.requestAnimationFrame!=cn,He=(t,e)=>{const n=Re.get(t);return[()=>!U(e)&&t.get(e)||an,s=>{if(!U(e)){const a=t.get(e);e in Ct||(Ct[e]=a),n[5](e,Me(a,s),a||an)}},n[6],()=>!U(e)&&e in Ct?Ct[e]:!U(e)&&t.get(e)||an]};let ln=!0;const Zr=()=>ln,[fn,hn]=dt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[$e,$e],ei=()=>{const t=un&&document.visibilityState;return U(t)||t!=="hidden"},ti=t=>(un&&document.addEventListener("visibilitychange",t),fn("focus",t),()=>{un&&document.removeEventListener("visibilitychange",t),hn("focus",t)}),ni=t=>{const e=()=>{ln=!0,t()},n=()=>{ln=!1};return fn("online",e),fn("offline",n),()=>{hn("online",e),hn("offline",n)}},si={isOnline:Zr,isVisible:ei},ri={initFocus:ti,initReconnect:ni},Os=!S.useId,pt=!dt||Yr,ii=t=>Qr()?window.requestAnimationFrame(t):setTimeout(t,1),mt=pt?S.useEffect:S.useLayoutEffect,dn=typeof navigator<"u"&&navigator.connection,Cs=!pt&&dn&&(["slow-2g","2g"].includes(dn.effectiveType)||dn.saveData),xt=new WeakMap,oi=t=>Ot.prototype.toString.call(t),pn=(t,e)=>t===`[object ${e}]`;let ai=0;const mn=t=>{const e=typeof t,n=oi(t),s=pn(n,"Date"),a=pn(n,"RegExp"),c=pn(n,"Object");let o,h;if(Ot(t)===t&&!s&&!a){if(o=xt.get(t),o)return o;if(o=++ai+"~",xt.set(t,o),Array.isArray(t)){for(o="@",h=0;h<t.length;h++)o+=mn(t[h])+",";xt.set(t,o)}if(c){o="#";const f=Ot.keys(t).sort();for(;!U(h=f.pop());)U(t[h])||(o+=h+":"+mn(t[h])+",");xt.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},it=t=>{if(ve(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?mn(t):"",[t,e]};let ci=0;const yn=()=>++ci;async function xs(...t){const[e,n,s,a]=t,c=Me({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let o=c.populateCache;const h=c.rollbackOnError;let f=c.optimisticData;const l=E=>typeof h=="function"?h(E):h!==!1,m=c.throwOnError;if(ve(n)){const E=n,y=[],v=e.keys();for(const O of v)!/^\$(inf|sub)\$/.test(O)&&E(e.get(O)._k)&&y.push(O);return Promise.all(y.map(b))}return b(n);async function b(E){const[y]=it(E);if(!y)return;const[v,O]=He(e,y),[I,R,K,G]=Re.get(e),H=()=>{const W=I[y];return(ve(c.revalidate)?c.revalidate(v().data,E):c.revalidate!==!1)&&(delete K[y],delete G[y],W&&W[0])?W[0](vs).then(()=>v().data):v().data};if(t.length<3)return H();let j=s,Z,pe=!1;const P=yn();R[y]=[P,0];const le=!U(f),V=v(),ae=V.data,Pe=V._c,me=U(Pe)?ae:Pe;if(le&&(f=ve(f)?f(me,ae):f,O({data:f,_c:me})),ve(j))try{j=j(me)}catch(W){Z=W,pe=!0}if(j&&Ts(j))if(j=await j.catch(W=>{Z=W,pe=!0}),P!==R[y][0]){if(pe)throw Z;return j}else pe&&le&&l(Z)&&(o=!0,O({data:me,_c:Y}));if(o&&!pe)if(ve(o)){const W=o(j,me);O({data:W,error:Y,_c:Y})}else O({data:j,error:Y,_c:Y});if(R[y][1]=yn(),Promise.resolve(H()).then(()=>{O({_c:Y})}),pe){if(m)throw Z;return}return j}}const As=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Rs=(t,e)=>{if(!Re.has(t)){const n=Me(ri,e),s=Object.create(null),a=xs.bind(Y,t);let c=$e;const o=Object.create(null),h=(m,b)=>{const E=o[m]||[];return o[m]=E,E.push(b),()=>E.splice(E.indexOf(b),1)},f=(m,b,E)=>{t.set(m,b);const y=o[m];if(y)for(const v of y)v(b,E)},l=()=>{if(!Re.has(t)&&(Re.set(t,[s,Object.create(null),Object.create(null),Object.create(null),a,f,h]),!pt)){const m=n.initFocus(setTimeout.bind(Y,As.bind(Y,s,bs))),b=n.initReconnect(setTimeout.bind(Y,As.bind(Y,s,_s)));c=()=>{m&&m(),b&&b(),Re.delete(t)}}};return l(),[t,a,l,c]}return[t,Re.get(t)[4]]},ui=(t,e,n,s,a)=>{const c=n.errorRetryCount,o=a.retryCount,h=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!U(c)&&o>c||setTimeout(s,h,a)},li=on,[yt,fi]=Rs(new Map),ks=Me({onLoadingSlow:$e,onSuccess:$e,onError:$e,onErrorRetry:ui,onDiscarded:$e,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Cs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Cs?5e3:3e3,compare:li,isPaused:()=>!1,cache:yt,mutate:fi,fallback:{}},si),Ds=(t,e)=>{const n=Me(t,e);if(e){const{use:s,fallback:a}=t,{use:c,fallback:o}=e;s&&c&&(n.use=s.concat(c)),a&&o&&(n.fallback=Me(a,o))}return n},gn=S.createContext({}),hi=t=>{const{value:e}=t,n=S.useContext(gn),s=ve(e),a=S.useMemo(()=>s?e(n):e,[s,n,e]),c=S.useMemo(()=>s?a:Ds(n,a),[s,n,a]),o=a&&a.provider,h=S.useRef(Y);o&&!h.current&&(h.current=Rs(o(c.cache||yt),a));const f=h.current;return f&&(c.cache=f[0],c.mutate=f[1]),mt(()=>{if(f)return f[2]&&f[2](),f[3]},[]),S.createElement(gn.Provider,Me(t,{value:c}))},Ls="$inf$",Fs=dt&&window.__SWR_DEVTOOLS_USE__,di=Fs?window.__SWR_DEVTOOLS_USE__:[],pi=()=>{Fs&&(window.__SWR_DEVTOOLS_REACT__=S)},Ns=t=>ve(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Bs=()=>{const t=S.useContext(gn);return S.useMemo(()=>Me(ks,t),[t])},gt=(t,e)=>{const[n,s]=it(t),[,,,a]=Re.get(yt);if(a[n])return a[n];const c=e(s);return a[n]=c,c},mi=t=>(e,n,s)=>t(e,n&&((...c)=>{const[o]=it(e),[,,,h]=Re.get(yt);if(o.startsWith(Ls))return n(...c);const f=h[o];return U(f)?n(...c):(delete h[o],f)}),s),yi=di.concat(mi),gi=t=>function(...n){const s=Bs(),[a,c,o]=Ns(n),h=Ds(s,o);let f=t;const{use:l}=h,m=(l||[]).concat(yi);for(let b=m.length;b--;)f=m[b](f);return f(a,c||h.fetcher||null,h)},wi=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const a=s.indexOf(n);a>=0&&(s[a]=s[s.length-1],s.pop())}},bi=(t,e)=>(...n)=>{const[s,a,c]=Ns(n),o=(c.use||[]).concat(e);return t(s,a,{...c,use:o})};pi();const wn=S.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),bn={dedupe:!0},Ps=Promise.resolve(Y),_i=(t,e,n)=>{const{cache:s,compare:a,suspense:c,fallbackData:o,revalidateOnMount:h,revalidateIfStale:f,refreshInterval:l,refreshWhenHidden:m,refreshWhenOffline:b,keepPreviousData:E}=n,[y,v,O,I]=Re.get(s),[R,K]=it(t),G=S.useRef(!1),H=S.useRef(!1),j=S.useRef(R),Z=S.useRef(e),pe=S.useRef(n),P=()=>pe.current,le=()=>P().isVisible()&&P().isOnline(),[V,ae,Pe,me]=He(s,R),W=S.useRef({}).current,ge=U(o)?U(n.fallback)?Y:n.fallback[R]:o,we=(M,z)=>{for(const ne in W){const $=ne;if($==="data"){if(!a(M[$],z[$])&&(!U(M[$])||!a(et,z[$])))return!1}else if(z[$]!==M[$])return!1}return!0},ee=S.useMemo(()=>{const M=!R||!e?!1:U(h)?P().isPaused()||c?!1:f!==!1:h,z=ue=>{const De=Me(ue);return delete De._k,M?{isValidating:!0,isLoading:!0,...De}:De},ne=V(),$=me(),be=z(ne),Je=ne===$?be:z($);let ie=be;return[()=>{const ue=z(V());return we(ue,ie)?(ie.data=ue.data,ie.isLoading=ue.isLoading,ie.isValidating=ue.isValidating,ie.error=ue.error,ie):(ie=ue,ue)},()=>Je]},[s,R]),te=ws.useSyncExternalStore(S.useCallback(M=>Pe(R,(z,ne)=>{we(ne,z)||M()}),[s,R]),ee[0],ee[1]),Ve=!G.current,Ze=y[R]&&y[R].length>0,Ue=te.data,re=U(Ue)?ge&&Ts(ge)?wn(ge):ge:Ue,We=te.error,ze=S.useRef(re),et=E?U(Ue)?U(ze.current)?re:ze.current:Ue:re,at=Ze&&!U(We)?!1:Ve&&!U(h)?h:P().isPaused()?!1:c?U(re)?!1:f:U(re)||f,It=!!(R&&e&&Ve&&at),In=U(te.isValidating)?It:te.isValidating,jn=U(te.isLoading)?It:te.isLoading,tt=S.useCallback(async M=>{const z=Z.current;if(!R||!z||H.current||P().isPaused())return!1;let ne,$,be=!0;const Je=M||{},ie=!O[R]||!Je.dedupe,ue=()=>Os?!H.current&&R===j.current&&G.current:R===j.current,De={isValidating:!1,isLoading:!1},Mt=()=>{ae(De)},vt=()=>{const _e=O[R];_e&&_e[1]===$&&delete O[R]},Vt={isValidating:!0};U(V().data)&&(Vt.isLoading=!0);try{if(ie&&(ae(Vt),n.loadingTimeout&&U(V().data)&&setTimeout(()=>{be&&ue()&&P().onLoadingSlow(R,n)},n.loadingTimeout),O[R]=[z(K),yn()]),[ne,$]=O[R],ne=await ne,ie&&setTimeout(vt,n.dedupingInterval),!O[R]||O[R][1]!==$)return ie&&ue()&&P().onDiscarded(R),!1;De.error=Y;const _e=v[R];if(!U(_e)&&($<=_e[0]||$<=_e[1]||_e[1]===0))return Mt(),ie&&ue()&&P().onDiscarded(R),!1;const _=V().data;De.data=a(_,ne)?_:ne,ie&&ue()&&P().onSuccess(ne,R,n)}catch(_e){vt();const _=P(),{shouldRetryOnError:N}=_;_.isPaused()||(De.error=_e,ie&&ue()&&(_.onError(_e,R,_),(N===!0||ve(N)&&N(_e))&&(!P().revalidateOnFocus||!P().revalidateOnReconnect||le())&&_.onErrorRetry(_e,R,_,$t=>{const ct=y[R];ct&&ct[0]&&ct[0](Ss,$t)},{retryCount:(Je.retryCount||0)+1,dedupe:!0})))}return be=!1,Mt(),!0},[R,s]),jt=S.useCallback((...M)=>xs(s,j.current,...M),[]);if(mt(()=>{Z.current=e,pe.current=n,U(Ue)||(ze.current=Ue)}),mt(()=>{if(!R)return;const M=tt.bind(Y,bn);let z=0;P().revalidateOnFocus&&(z=Date.now()+P().focusThrottleInterval);const $=wi(R,y,(be,Je={})=>{if(be==bs){const ie=Date.now();P().revalidateOnFocus&&ie>z&&le()&&(z=ie+P().focusThrottleInterval,M())}else if(be==_s)P().revalidateOnReconnect&&le()&&M();else{if(be==vs)return tt();if(be==Ss)return tt(Je)}});return H.current=!1,j.current=R,G.current=!0,ae({_k:K}),at&&(O[R]||(U(re)||pt?M():ii(M))),()=>{H.current=!0,$()}},[R]),mt(()=>{let M;function z(){const $=ve(l)?l(V().data):l;$&&M!==-1&&(M=setTimeout(ne,$))}function ne(){!V().error&&(m||P().isVisible())&&(b||P().isOnline())?tt(bn).then(z):z()}return z(),()=>{M&&(clearTimeout(M),M=-1)}},[l,m,b,R]),S.useDebugValue(et),c){const M=R&&U(re);if(!Os&&pt&&M)throw new Error("Fallback data is required when using Suspense in SSR.");M&&(Z.current=e,pe.current=n,H.current=!1);const z=I[R],ne=!U(z)&&M?jt(z):Ps;if(wn(ne),!U(We)&&M)throw We;const $=M?tt(bn):Ps;!U(et)&&M&&($.status="fulfilled",$.value=!0),wn($)}return{mutate:jt,get data(){return W.data=!0,et},get error(){return W.error=!0,We},get isValidating(){return W.isValidating=!0,In},get isLoading(){return W.isLoading=!0,jn}}},vi=Ot.defineProperty(hi,"defaultValue",{value:ks}),Qe=gi(_i),Si=void 0,_n=Object,Us=t=>t===Si,Ei=t=>typeof t=="function",At=new WeakMap,Ti=t=>_n.prototype.toString.call(t),vn=(t,e)=>t===`[object ${e}]`;let Oi=0;const Sn=t=>{const e=typeof t,n=Ti(t),s=vn(n,"Date"),a=vn(n,"RegExp"),c=vn(n,"Object");let o,h;if(_n(t)===t&&!s&&!a){if(o=At.get(t),o)return o;if(o=++Oi+"~",At.set(t,o),Array.isArray(t)){for(o="@",h=0;h<t.length;h++)o+=Sn(t[h])+",";At.set(t,o)}if(c){o="#";const f=_n.keys(t).sort();for(;!Us(h=f.pop());)Us(t[h])||(o+=h+":"+Sn(t[h])+",");At.set(t,o)}}else o=s?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},Ci=t=>{if(Ei(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Sn(t):"",[t,e]},xi=t=>Ci(t?t(0,null):null)[0],En=Promise.resolve(),Ai=bi(Qe,t=>(e,n,s)=>{const a=S.useRef(!1),{cache:c,initialSize:o=1,revalidateAll:h=!1,persistSize:f=!1,revalidateFirstPage:l=!0,revalidateOnMount:m=!1,parallel:b=!1}=s,[,,,E]=Re.get(yt);let y;try{y=xi(e),y&&(y=Ls+y)}catch{}const[v,O,I]=He(c,y),R=S.useCallback(()=>U(v()._l)?o:v()._l,[c,y,o]);ws.useSyncExternalStore(S.useCallback(P=>y?I(y,()=>{P()}):()=>{},[c,y]),R,R);const K=S.useCallback(()=>{const P=v()._l;return U(P)?o:P},[y,o]),G=S.useRef(K());mt(()=>{if(!a.current){a.current=!0;return}y&&O({_l:f?G.current:K()})},[y,c]);const H=m&&!a.current,j=t(y,async P=>{const le=v()._i,V=v()._r;O({_r:Y});const ae=[],Pe=K(),[me]=He(c,P),W=me().data,ge=[];let we=null;for(let ee=0;ee<Pe;++ee){const[te,Ve]=it(e(ee,b?null:we));if(!te)break;const[Ze,Ue]=He(c,te);let re=Ze().data;const We=h||le||U(re)||l&&!ee&&!U(W)||H||W&&!U(W[ee])&&!s.compare(W[ee],re);if(n&&(typeof V=="function"?V(re,Ve):We)){const ze=async()=>{if(!(te in E))re=await n(Ve);else{const at=E[te];delete E[te],re=await at}Ue({data:re,_k:Ve}),ae[ee]=re};b?ge.push(ze):await ze()}else ae[ee]=re;b||(we=re)}return b&&await Promise.all(ge.map(ee=>ee())),O({_i:Y}),ae},s),Z=S.useCallback(function(P,le){const V=typeof le=="boolean"?{revalidate:le}:le||{},ae=V.revalidate!==!1;return y?(ae&&(U(P)?O({_i:!0,_r:V.revalidate}):O({_i:!1,_r:V.revalidate})),arguments.length?j.mutate(P,{...V,revalidate:ae}):j.mutate()):En},[y,c]),pe=S.useCallback(P=>{if(!y)return En;const[,le]=He(c,y);let V;if(ve(P)?V=P(K()):typeof P=="number"&&(V=P),typeof V!="number")return En;le({_l:V}),G.current=V;const ae=[],[Pe]=He(c,y);let me=null;for(let W=0;W<V;++W){const[ge]=it(e(W,me)),[we]=He(c,ge),ee=ge?we().data:Y;if(U(ee))return Z(Pe().data);ae.push(ee),me=ee}return Z(ae)},[y,c,Z,K]);return{size:K(),setSize:pe,mutate:Z,get data(){return j.data},get error(){return j.error},get isValidating(){return j.isValidating},get isLoading(){return j.isLoading}}}),Ne=Object.create(null);Ne.open="0",Ne.close="1",Ne.ping="2",Ne.pong="3",Ne.message="4",Ne.upgrade="5",Ne.noop="6";const Rt=Object.create(null);Object.keys(Ne).forEach(t=>{Rt[Ne[t]]=t});const Tn={type:"error",data:"parser error"},qs=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Is=typeof ArrayBuffer=="function",js=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,On=({type:t,data:e},n,s)=>qs&&e instanceof Blob?n?s(e):Ms(e,s):Is&&(e instanceof ArrayBuffer||js(e))?n?s(e):Ms(new Blob([e]),s):s(Ne[t]+(e||"")),Ms=(t,e)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];e("b"+(s||""))},n.readAsDataURL(t)};function Vs(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Cn;function Ri(t,e){if(qs&&t.data instanceof Blob)return t.data.arrayBuffer().then(Vs).then(e);if(Is&&(t.data instanceof ArrayBuffer||js(t.data)))return e(Vs(t.data));On(t,!1,n=>{Cn||(Cn=new TextEncoder),e(Cn.encode(n))})}const $s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",wt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<$s.length;t++)wt[$s.charCodeAt(t)]=t;const ki=t=>{let e=t.length*.75,n=t.length,s,a=0,c,o,h,f;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const l=new ArrayBuffer(e),m=new Uint8Array(l);for(s=0;s<n;s+=4)c=wt[t.charCodeAt(s)],o=wt[t.charCodeAt(s+1)],h=wt[t.charCodeAt(s+2)],f=wt[t.charCodeAt(s+3)],m[a++]=c<<2|o>>4,m[a++]=(o&15)<<4|h>>2,m[a++]=(h&3)<<6|f&63;return l},Di=typeof ArrayBuffer=="function",xn=(t,e)=>{if(typeof t!="string")return{type:"message",data:Hs(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Li(t.substring(1),e)}:Rt[n]?t.length>1?{type:Rt[n],data:t.substring(1)}:{type:Rt[n]}:Tn},Li=(t,e)=>{if(Di){const n=ki(t);return Hs(n,e)}else return{base64:!0,data:t}},Hs=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},Ws="",Fi=(t,e)=>{const n=t.length,s=new Array(n);let a=0;t.forEach((c,o)=>{On(c,!1,h=>{s[o]=h,++a===n&&e(s.join(Ws))})})},Ni=(t,e)=>{const n=t.split(Ws),s=[];for(let a=0;a<n.length;a++){const c=xn(n[a],e);if(s.push(c),c.type==="error")break}return s};function Bi(){return new TransformStream({transform(t,e){Ri(t,n=>{const s=n.length;let a;if(s<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,s);else if(s<65536){a=new Uint8Array(3);const c=new DataView(a.buffer);c.setUint8(0,126),c.setUint16(1,s)}else{a=new Uint8Array(9);const c=new DataView(a.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(s))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(n)})}})}let An;function kt(t){return t.reduce((e,n)=>e+n.length,0)}function Dt(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let s=0;for(let a=0;a<e;a++)n[a]=t[0][s++],s===t[0].length&&(t.shift(),s=0);return t.length&&s<t[0].length&&(t[0]=t[0].slice(s)),n}function Pi(t,e){An||(An=new TextDecoder);const n=[];let s=0,a=-1,c=!1;return new TransformStream({transform(o,h){for(n.push(o);;){if(s===0){if(kt(n)<1)break;const f=Dt(n,1);c=(f[0]&128)===128,a=f[0]&127,a<126?s=3:a===126?s=1:s=2}else if(s===1){if(kt(n)<2)break;const f=Dt(n,2);a=new DataView(f.buffer,f.byteOffset,f.length).getUint16(0),s=3}else if(s===2){if(kt(n)<8)break;const f=Dt(n,8),l=new DataView(f.buffer,f.byteOffset,f.length),m=l.getUint32(0);if(m>Math.pow(2,21)-1){h.enqueue(Tn);break}a=m*Math.pow(2,32)+l.getUint32(4),s=3}else{if(kt(n)<a)break;const f=Dt(n,a);h.enqueue(xn(c?f:An.decode(f),e)),s=0}if(a===0||a>t){h.enqueue(Tn);break}}}})}const zs=4;function Q(t){if(t)return Ui(t)}function Ui(t){for(var e in Q.prototype)t[e]=Q.prototype[e];return t}Q.prototype.on=Q.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Q.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},Q.prototype.off=Q.prototype.removeListener=Q.prototype.removeAllListeners=Q.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var s,a=0;a<n.length;a++)if(s=n[a],s===e||s.fn===e){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+t],this},Q.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,a=n.length;s<a;++s)n[s].apply(this,e)}return this},Q.prototype.emitReserved=Q.prototype.emit,Q.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Q.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Se=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Js(t,...e){return e.reduce((n,s)=>(t.hasOwnProperty(s)&&(n[s]=t[s]),n),{})}const qi=Se.setTimeout,Ii=Se.clearTimeout;function Lt(t,e){e.useNativeTimers?(t.setTimeoutFn=qi.bind(Se),t.clearTimeoutFn=Ii.bind(Se)):(t.setTimeoutFn=Se.setTimeout.bind(Se),t.clearTimeoutFn=Se.clearTimeout.bind(Se))}const ji=1.33;function Mi(t){return typeof t=="string"?Vi(t):Math.ceil((t.byteLength||t.size)*ji)}function Vi(t){let e=0,n=0;for(let s=0,a=t.length;s<a;s++)e=t.charCodeAt(s),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(s++,n+=4);return n}function $i(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Hi(t){let e={},n=t.split("&");for(let s=0,a=n.length;s<a;s++){let c=n[s].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class Wi extends Error{constructor(e,n,s){super(e),this.description=n,this.context=s,this.type="TransportError"}}class Rn extends Q{constructor(e){super(),this.writable=!1,Lt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,s){return super.emitReserved("error",new Wi(e,n,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=xn(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=$i(e);return n.length?"?"+n:""}}const Ks="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),kn=64,zi={};let Gs=0,Ft=0,Xs;function Ys(t){let e="";do e=Ks[t%kn]+e,t=Math.floor(t/kn);while(t>0);return e}function Qs(){const t=Ys(+new Date);return t!==Xs?(Gs=0,Xs=t):t+"."+Ys(Gs++)}for(;Ft<kn;Ft++)zi[Ks[Ft]]=Ft;let Zs=!1;try{Zs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ji=Zs;function er(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ji))return new XMLHttpRequest}catch{}if(!e)try{return new Se[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ba(){}function Ki(){}const Gi=function(){return new er({xdomain:!1}).responseType!=null}();class Xi extends Rn{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const s=location.protocol==="https:";let a=location.port;a||(a=s?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||a!==e.port}const n=e&&e.forceBase64;this.supportsBinary=Gi&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let s=0;this.polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Ni(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Fi(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=Qs()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Be(this.uri(),e)}doWrite(e,n){const s=this.request({method:"POST",data:e});s.on("success",n),s.on("error",(a,c)=>{this.onError("xhr post error",a,c)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=e}}class Be extends Q{constructor(e,n){super(),Lt(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=Js(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const s=this.xhr=new er(n);try{s.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let a in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(a)&&s.setRequestHeader(a,this.opts.extraHeaders[a])}}catch{}if(this.method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(s.timeout=this.opts.requestTimeout),s.onreadystatechange=()=>{var a;s.readyState===3&&((a=this.opts.cookieJar)===null||a===void 0||a.parseCookies(s)),s.readyState===4&&(s.status===200||s.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof s.status=="number"?s.status:0)},0))},s.send(this.data)}catch(a){this.setTimeoutFn(()=>{this.onError(a)},0);return}typeof document<"u"&&(this.index=Be.requestsCount++,Be.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Ki,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Be.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(Be.requestsCount=0,Be.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",tr);else if(typeof addEventListener=="function"){const t="onpagehide"in Se?"pagehide":"unload";addEventListener(t,tr,!1)}}function tr(){for(let t in Be.requests)Be.requests.hasOwnProperty(t)&&Be.requests[t].abort()}const Dn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Nt=Se.WebSocket||Se.MozWebSocket,nr=!0,Yi="arraybuffer",sr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Qi extends Rn{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,s=sr?{}:Js(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=nr&&!sr?n?new Nt(e,n):new Nt(e):new Nt(e,n,s)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;On(s,this.supportsBinary,c=>{const o={};try{nr&&this.ws.send(c)}catch{}a&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=Qs()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}check(){return!!Nt}}class Zi extends Rn{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const n=Pi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(n).getReader(),a=Bi();a.readable.pipeTo(e.writable),this.writer=a.writable.getWriter();const c=()=>{s.read().then(({done:h,value:f})=>{h||(this.onPacket(f),c())}).catch(h=>{})};c();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const s=e[n],a=n===e.length-1;this.writer.write(s).then(()=>{a&&Dn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const eo={websocket:Qi,webtransport:Zi,polling:Xi},to=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,no=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Ln(t){if(t.length>2e3)throw"URI too long";const e=t,n=t.indexOf("["),s=t.indexOf("]");n!=-1&&s!=-1&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));let a=to.exec(t||""),c={},o=14;for(;o--;)c[no[o]]=a[o]||"";return n!=-1&&s!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=so(c,c.path),c.queryKey=ro(c,c.query),c}function so(t,e){const n=/\/{2,9}/g,s=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function ro(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,a,c){a&&(n[a]=c)}),n}let rr=class ft extends Q{constructor(e,n={}){super(),this.binaryType=Yi,this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Ln(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Ln(n.host).host),Lt(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Hi(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=zs,n.transport=e,this.id&&(n.sid=this.id);const s=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new eo[e](s)}open(){let e;if(this.opts.rememberUpgrade&&ft.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),s=!1;ft.priorWebsocketSuccess=!1;const a=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",b=>{if(!s)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ft.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(m(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const E=new Error("probe error");E.transport=n.name,this.emitReserved("upgradeError",E)}}))};function c(){s||(s=!0,m(),n.close(),n=null)}const o=b=>{const E=new Error("probe error: "+b);E.transport=n.name,c(),this.emitReserved("upgradeError",E)};function h(){o("transport closed")}function f(){o("socket closed")}function l(b){n&&b.name!==n.name&&c()}const m=()=>{n.removeListener("open",a),n.removeListener("error",o),n.removeListener("close",h),this.off("close",f),this.off("upgrading",l)};n.once("open",a),n.once("error",o),n.once("close",h),this.once("close",f),this.once("upgrading",l),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||n.open()},200):n.open()}onOpen(){if(this.readyState="open",ft.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let s=0;s<this.writeBuffer.length;s++){const a=this.writeBuffer[s].data;if(a&&(n+=Mi(a)),s>0&&n>this.maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}write(e,n,s){return this.sendPacket("message",e,n,s),this}send(e,n,s){return this.sendPacket("message",e,n,s),this}sendPacket(e,n,s,a){if(typeof n=="function"&&(a=n,n=void 0),typeof s=="function"&&(a=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const c={type:e,data:n,options:s};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},s=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}onError(e){ft.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let s=0;const a=e.length;for(;s<a;s++)~this.transports.indexOf(e[s])&&n.push(e[s]);return n}};rr.protocol=zs;function io(t,e="",n){let s=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),s=Ln(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const c=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+c+":"+s.port+e,s.href=s.protocol+"://"+c+(n&&n.port===s.port?"":":"+s.port),s}const oo=typeof ArrayBuffer=="function",ao=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,co=typeof Blob=="function"||typeof Blob<"u"&&ir.call(Blob)==="[object BlobConstructor]",uo=typeof File=="function"||typeof File<"u"&&ir.call(File)==="[object FileConstructor]";function Fn(t){return oo&&(t instanceof ArrayBuffer||ao(t))||co&&t instanceof Blob||uo&&t instanceof File}function Bt(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,s=t.length;n<s;n++)if(Bt(t[n]))return!0;return!1}if(Fn(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Bt(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Bt(t[n]))return!0;return!1}function lo(t){const e=[],n=t.data,s=t;return s.data=Nn(n,e),s.attachments=e.length,{packet:s,buffers:e}}function Nn(t,e){if(!t)return t;if(Fn(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let s=0;s<t.length;s++)n[s]=Nn(t[s],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=Nn(t[s],e));return n}return t}function fo(t,e){return t.data=Bn(t.data,e),delete t.attachments,t}function Bn(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Bn(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Bn(t[n],e));return t}const ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],po=5;var q;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(q||(q={}));class mo{constructor(e){this.replacer=e}encode(e){return(e.type===q.EVENT||e.type===q.ACK)&&Bt(e)?this.encodeAsBinary({type:e.type===q.EVENT?q.BINARY_EVENT:q.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===q.BINARY_EVENT||e.type===q.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=lo(e),s=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(s),a}}function or(t){return Object.prototype.toString.call(t)==="[object Object]"}class Pn extends Q{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const s=n.type===q.BINARY_EVENT;s||n.type===q.BINARY_ACK?(n.type=s?q.EVENT:q.ACK,this.reconstructor=new yo(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Fn(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const s={type:Number(e.charAt(0))};if(q[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===q.BINARY_EVENT||s.type===q.BINARY_ACK){const c=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const o=e.substring(c,n);if(o!=Number(o)||e.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(n+1)==="/"){const c=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););s.nsp=e.substring(c,n)}else s.nsp="/";const a=e.charAt(n+1);if(a!==""&&Number(a)==a){const c=n+1;for(;++n;){const o=e.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===e.length)break}s.id=Number(e.substring(c,n+1))}if(e.charAt(++n)){const c=this.tryParse(e.substr(n));if(Pn.isPayloadValid(s.type,c))s.data=c;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case q.CONNECT:return or(n);case q.DISCONNECT:return n===void 0;case q.CONNECT_ERROR:return typeof n=="string"||or(n);case q.EVENT:case q.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ho.indexOf(n[0])===-1);case q.ACK:case q.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class yo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=fo(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const go=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Pn,Encoder:mo,get PacketType(){return q},protocol:po},Symbol.toStringTag,{value:"Module"}));function ke(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const wo=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ar extends Q{constructor(e,n,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ke(e,"open",this.onopen.bind(this)),ke(e,"packet",this.onpacket.bind(this)),ke(e,"error",this.onerror.bind(this)),ke(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(wo.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:q.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const o=this.ids++,h=n.pop();this._registerAckCallback(o,h),s.id=o}const a=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!a||!this.connected)||(this.connected?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,n){var s;const a=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(a===void 0){this.acks[e]=n;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},a);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(c),n.apply(this,[null,...o])}}emitWithAck(e,...n){const s=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((a,c)=>{n.push((o,h)=>s?o?c(o):a(h):a(o)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...c)=>s!==this._queue[0]?void 0:(a!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...c)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:q.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case q.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case q.EVENT:case q.BINARY_EVENT:this.onevent(e);break;case q.ACK:case q.BINARY_ACK:this.onack(e);break;case q.DISCONNECT:this.ondisconnect();break;case q.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const s of n)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let s=!1;return function(...a){s||(s=!0,n.packet({type:q.ACK,id:e,data:a}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:q.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let s=0;s<n.length;s++)if(e===n[s])return n.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const s of n)s.apply(this,e.data)}}}function ot(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}ot.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0},ot.prototype.reset=function(){this.attempts=0},ot.prototype.setMin=function(t){this.ms=t},ot.prototype.setMax=function(t){this.max=t},ot.prototype.setJitter=function(t){this.jitter=t};class Un extends Q{constructor(e,n){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Lt(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new ot({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const a=n.parser||go;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new rr(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const a=ke(n,"open",function(){s.onopen(),e&&e()}),c=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},o=ke(n,"error",c);if(this._timeout!==!1){const h=this._timeout,f=this.setTimeoutFn(()=>{a(),c(new Error("timeout")),n.close()},h);this.opts.autoUnref&&f.unref(),this.subs.push(()=>{this.clearTimeoutFn(f)})}return this.subs.push(a),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ke(e,"ping",this.onping.bind(this)),ke(e,"data",this.ondata.bind(this)),ke(e,"error",this.onerror.bind(this)),ke(e,"close",this.onclose.bind(this)),ke(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Dn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ar(this,e,n),this.nsps[e]=s),s}_destroy(e){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let s=0;s<n.length;s++)this.engine.write(n[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},n);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const bt={};function Pt(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=io(t,e.path||"/socket.io"),s=n.source,a=n.id,c=n.path,o=bt[a]&&c in bt[a].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let f;return h?f=new Un(s,e):(bt[a]||(bt[a]=new Un(s,e)),f=bt[a]),n.query&&!e.query&&(e.query=n.queryKey),f.socket(n.path,e)}Object.assign(Pt,{Manager:Un,Socket:ar,io:Pt,connect:Pt});class bo{constructor(e,n,s,a){Xe(this,"socket_port");Xe(this,"host");Xe(this,"port");Xe(this,"protocol");Xe(this,"url");Xe(this,"site_name");Xe(this,"socket");var c,o,h,f;if(this.socket_port=s??"9000",this.host=(c=window.location)==null?void 0:c.hostname,this.port=(o=window.location)!=null&&o.port?`:${this.socket_port}`:"",this.protocol=((h=window.location)==null?void 0:h.protocol)==="https:"?"https":"http",e){let l=new URL(e);l.port="",s?(l.port=s,this.url=l.toString()):this.url=l.toString()}else this.url=`${this.protocol}://${this.host}${this.port}/`;n&&(this.url=`${this.url}${n}`),this.site_name=n,this.socket=Pt(`${this.url}`,{withCredentials:!0,secure:this.protocol==="https",extraHeaders:a&&a.useToken===!0?{Authorization:`${a.type} ${(f=a.token)==null?void 0:f.call(a)}`}:{}})}}const X=S.createContext(null),_o=({url:t="",tokenParams:e,socketPort:n,swrConfig:s,siteName:a,enableSocket:c=!0,children:o,customHeaders:h})=>{const f=S.useMemo(()=>{const l=new Jr.FrappeApp(t,e,void 0,h);return{url:t,tokenParams:e,app:l,auth:l.auth(),db:l.db(),call:l.call(),file:l.file(),socket:c?new bo(t,a,n,e).socket:void 0,enableSocket:c,socketPort:n}},[t,e,n,c,h]);return de.jsx(X.Provider,{value:f,children:de.jsx(vi,{value:s,children:o})})},vo=t=>{const{url:e,auth:n,tokenParams:s}=S.useContext(X),[a,c]=S.useState(),o=S.useCallback(()=>{const v=document.cookie.split(";").find(O=>O.trim().startsWith("user_id="));if(v){const O=v.split("=")[1];c(O&&O!=="Guest"?O:null)}else c(null)},[]);S.useEffect(()=>{s&&s.useToken?c(null):o()},[]);const{data:h,error:f,isLoading:l,isValidating:m,mutate:b}=Qe(()=>s&&s.useToken||a?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>n.getLoggedInUser(),{onError:()=>{c(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...t}),E=S.useCallback(async v=>n.loginWithUsernamePassword(v).then(O=>(o(),O)),[]),y=S.useCallback(async()=>n.logout().then(()=>b(null)).then(()=>c(null)),[]);return{isLoading:a===void 0||l,currentUser:h,isValidating:m,error:f,login:E,logout:y,updateCurrentUser:b,getUserCookie:o}},_t=(t,e,n)=>{let s=`${e}/api/resource/`;return n?s+=`${t}/${n}`:s+=`${t}`,s},So=(t,e,n,s)=>{const{url:a,db:c}=S.useContext(X);return Qe(n===void 0?_t(t,a,e):n,()=>c.getDoc(t,e),s)},Eo=(t,e,n,s)=>{const{db:a,url:c}=S.useContext(X),o=n===void 0?_t(t,c,e):n;return S.useCallback(()=>{gt(o,()=>a.getDoc(t,e))},[o,t,e])},qn=t=>{var n,s;let e="";if(t!=null&&t.fields&&(e+="fields="+JSON.stringify(t==null?void 0:t.fields)+"&"),t!=null&&t.filters&&(e+="filters="+JSON.stringify(t==null?void 0:t.filters)+"&"),t!=null&&t.orFilters&&(e+="or_filters="+JSON.stringify(t==null?void 0:t.orFilters)+"&"),t!=null&&t.limit_start&&(e+="limit_start="+JSON.stringify(t==null?void 0:t.limit_start)+"&"),t!=null&&t.limit&&(e+="limit="+JSON.stringify(t==null?void 0:t.limit)+"&"),t!=null&&t.groupBy&&(e+="group_by="+String(t.groupBy)+"&"),t!=null&&t.orderBy){const a=`${String((n=t.orderBy)==null?void 0:n.field)} ${((s=t.orderBy)==null?void 0:s.order)??"asc"}`;e+="order_by="+a+"&"}return t!=null&&t.asDict&&(e+="as_dict="+t.asDict),e},To=(t,e,n,s)=>{const{url:a,db:c}=S.useContext(X);return Qe(n===void 0?`${_t(t,a)}?${qn(e)}`:n,()=>c.getDocList(t,e),s)},Oo=(t,e,n)=>{const{db:s,url:a}=S.useContext(X),c=n===void 0?`${_t(t,a)}?${qn(e)}`:n;return S.useCallback(()=>{gt(c,()=>s.getDocList(t,e))},[c,t,e])},Co=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{createDoc:S.useCallback(async(l,m)=>(a(null),o(!1),n(!0),t.createDoc(l,m).then(b=>(n(!1),o(!0),b)).catch(b=>{throw n(!1),o(!1),a(b),b})),[]),loading:e,error:s,isCompleted:c,reset:h}},xo=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{updateDoc:S.useCallback(async(l,m,b)=>(a(null),o(!1),n(!0),t.updateDoc(l,m,b).then(E=>(n(!1),o(!0),E)).catch(E=>{throw n(!1),o(!1),a(E),E})),[]),loading:e,error:s,reset:h,isCompleted:c}},Ao=()=>{const{db:t}=S.useContext(X),[e,n]=S.useState(!1),[s,a]=S.useState(null),[c,o]=S.useState(!1),h=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{deleteDoc:S.useCallback(async(l,m)=>(a(null),o(!1),n(!0),t.deleteDoc(l,m).then(b=>(n(!1),o(!0),b)).catch(b=>{throw n(!1),o(!1),a(b),b})),[]),loading:e,error:s,reset:h,isCompleted:c}};function Ut(t){const e=[];for(let n in t)e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}const Ro=(t,e,n=!1,s,a)=>{const{url:c,db:o}=S.useContext(X);return Qe(s===void 0?(()=>{const l=Ut({doctype:t,filters:e??[],debug:n});return`${c}/api/method/frappe.client.get_count?${l}`})():s,()=>o.getCount(t,e,n),a)},ko=(t,e,n=!1,s)=>{const{db:a,url:c}=S.useContext(X),o=s===void 0?`${c}/api/method/frappe.client.get_count?${Ut({doctype:t,filters:e??[],debug:n})}`:s;return S.useCallback(()=>{gt(o,()=>a.getCount(t,e,!1))},[o,t,e])},cr=(t,e,n,s,a="GET")=>{const{call:c}=S.useContext(X),o=Ut(e??{}),h=`${t}?${o}`;return{...Qe(n===void 0?h:n,a==="GET"?()=>c.get(t,e):()=>c.post(t,e),s)}},Do=(t,e,n,s="GET")=>{const{call:a}=S.useContext(X),c=Ut(e??{}),o=`${t}?${c}`;return S.useCallback(()=>{gt(n??o,s==="GET"?()=>a.get(t,e):()=>a.post(t,e))},[o,t,e,n])},Lo=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.post(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},Fo=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.put(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},No=t=>{const{call:e}=S.useContext(X),[n,s]=S.useState(null),[a,c]=S.useState(!1),[o,h]=S.useState(null),[f,l]=S.useState(!1),m=S.useCallback(()=>{s(null),c(!1),h(null),l(!1)},[]);return{call:S.useCallback(async E=>(h(null),l(!1),c(!0),s(null),e.delete(t,E).then(y=>(s(y),c(!1),l(!0),y)).catch(y=>{throw c(!1),l(!1),h(y),y})),[]),result:n,loading:a,error:o,reset:m,isCompleted:f}},Bo=()=>{const{file:t}=S.useContext(X),[e,n]=S.useState(0),[s,a]=S.useState(!1),[c,o]=S.useState(null),[h,f]=S.useState(!1),l=S.useCallback(async(b,E,y)=>(m(),a(!0),t.uploadFile(b,E,(v,O)=>{O&&n(Math.round(v/O*100))},y).then(v=>(f(!0),n(100),a(!1),v.data.message)).catch(v=>{throw console.error(v),o(v),a(!1),v})),[]),m=S.useCallback(()=>{n(0),a(!1),o(null),f(!1)},[]);return{upload:l,progress:e,loading:s,isCompleted:h,error:c,reset:m}},Po=(t,e,n=[],s=20,a=250)=>{const c=Uo(e,a);return cr("frappe.desk.search.search_link",{doctype:t,page_length:s,txt:c,filters:JSON.stringify(n??[])})},Uo=(t,e)=>{const[n,s]=S.useState(t);return S.useEffect(()=>{const a=setTimeout(()=>{s(t)},e);return()=>{clearTimeout(a)}},[t,e]),n},qt=(t,e)=>{const{socket:n}=S.useContext(X);S.useEffect(()=>{n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider.");let s=n==null?void 0:n.on(t,e);return()=>{s==null||s.off(t)}},[t,e])},qo=(t,e,n,s=!0)=>{const{socket:a}=S.useContext(X),[c,o]=S.useState([]);S.useEffect(()=>(a===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),a==null||a.emit("doc_subscribe",t,e),a==null||a.io.on("reconnect",()=>{a==null||a.emit("doc_subscribe",t,e)}),s&&(a==null||a.emit("doc_open",t,e)),()=>{a==null||a.emit("doc_unsubscribe",t,e),s&&(a==null||a.emit("doc_close",t,e))}),[t,e,s]),qt("doc_update",n);const h=S.useCallback(()=>{a==null||a.emit("doc_open",t,e)},[t,e]),f=S.useCallback(()=>{a==null||a.emit("doc_close",t,e)},[t,e]),l=S.useCallback(m=>{m.doctype===t&&m.docname===e&&o(m.users)},[t,e]);return qt("doc_viewers",l),{viewers:c,emitDocOpen:h,emitDocClose:f}},Io=(t,e)=>{const{socket:n}=S.useContext(X);S.useEffect(()=>(n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),n==null||n.emit("doctype_subscribe",t),n==null||n.io.on("reconnect",()=>{n==null||n.emit("doctype_subscribe",t)}),()=>{n==null||n.emit("doctype_unsubscribe",t)}),[t]),qt("list_update",e)};B.FrappeContext=X,B.FrappeProvider=_o,B.getDocListQueryString=qn,B.getRequestURL=_t,B.preload=gt,B.useFrappeAuth=vo,B.useFrappeCreateDoc=Co,B.useFrappeDeleteCall=No,B.useFrappeDeleteDoc=Ao,B.useFrappeDocTypeEventListener=Io,B.useFrappeDocumentEventListener=qo,B.useFrappeEventListener=qt,B.useFrappeFileUpload=Bo,B.useFrappeGetCall=cr,B.useFrappeGetDoc=So,B.useFrappeGetDocCount=Ro,B.useFrappeGetDocList=To,B.useFrappePostCall=Lo,B.useFrappePrefetchCall=Do,B.useFrappePrefetchDoc=Eo,B.useFrappePrefetchDocCount=ko,B.useFrappePrefetchDocList=Oo,B.useFrappePutCall=Fo,B.useFrappeUpdateDoc=xo,B.useSWR=Qe,B.useSWRConfig=Bs,B.useSWRInfinite=Ai,B.useSearch=Po,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});
25
+ */var Ns;function ri(){return Ns||(Ns=1,process.env.NODE_ENV!=="production"&&function(){function t(m,E){return m===E&&(m!==0||1/m===1/E)||m!==m&&E!==E}function e(m,E){y||a.startTransition===void 0||(y=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var R=E();if(!_){var U=E();l(R,U)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),_=!0)}U=o({inst:{value:R,getSnapshot:E}});var J=U[0].inst,L=U[1];return h(function(){J.value=R,J.getSnapshot=E,n(J)&&L({inst:J})},[m,R,E]),d(function(){return n(J)&&L({inst:J}),m(function(){n(J)&&L({inst:J})})},[m]),f(R),R}function n(m){var E=m.getSnapshot;m=m.value;try{var R=E();return!l(m,R)}catch{return!0}}function r(m,E){return E()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var a=S,l=typeof Object.is=="function"?Object.is:t,o=a.useState,d=a.useEffect,h=a.useLayoutEffect,f=a.useDebugValue,y=!1,_=!1,O=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:e;gn.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:O,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),gn}var ks;function ii(){return ks||(ks=1,process.env.NODE_ENV==="production"?It.exports=si():It.exports=ri()),It.exports}var wn=ii();const Fs=0,Ps=1,Bs=2,Us=3;var qs=Object.prototype.hasOwnProperty;function bn(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&bn(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(qs.call(t,n)&&++r&&!qs.call(e,n)||!(n in e)||!bn(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const Be=new WeakMap,Je=()=>{},ce=Je(),jt=Object,P=t=>t===ce,Ce=t=>typeof t=="function",Ke=(t,e)=>({...t,...e}),Is=t=>Ce(t.then),_n={},Mt={},vn="undefined",Ot=typeof window!=vn,En=typeof document!=vn,oi=Ot&&"Deno"in window,ai=()=>Ot&&typeof window.requestAnimationFrame!=vn,Qe=(t,e)=>{const n=Be.get(t);return[()=>!P(e)&&t.get(e)||_n,r=>{if(!P(e)){const a=t.get(e);e in Mt||(Mt[e]=a),n[5](e,Ke(a,r),a||_n)}},n[6],()=>!P(e)&&e in Mt?Mt[e]:!P(e)&&t.get(e)||_n]};let Sn=!0;const ci=()=>Sn,[On,Tn]=Ot&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Je,Je],ui=()=>{const t=En&&document.visibilityState;return P(t)||t!=="hidden"},li=t=>(En&&document.addEventListener("visibilitychange",t),On("focus",t),()=>{En&&document.removeEventListener("visibilitychange",t),Tn("focus",t)}),fi=t=>{const e=()=>{Sn=!0,t()},n=()=>{Sn=!1};return On("online",e),On("offline",n),()=>{Tn("online",e),Tn("offline",n)}},hi={isOnline:ci,isVisible:ui},di={initFocus:li,initReconnect:fi},js=!S.useId,at=!Ot||oi,pi=t=>ai()?window.requestAnimationFrame(t):setTimeout(t,1),Tt=at?S.useEffect:S.useLayoutEffect,Cn=typeof navigator<"u"&&navigator.connection,Ms=!at&&Cn&&(["slow-2g","2g"].includes(Cn.effectiveType)||Cn.saveData),Vt=new WeakMap,yi=t=>jt.prototype.toString.call(t),xn=(t,e)=>t===`[object ${e}]`;let mi=0;const Rn=t=>{const e=typeof t,n=yi(t),r=xn(n,"Date"),a=xn(n,"RegExp"),l=xn(n,"Object");let o,d;if(jt(t)===t&&!r&&!a){if(o=Vt.get(t),o)return o;if(o=++mi+"~",Vt.set(t,o),Array.isArray(t)){for(o="@",d=0;d<t.length;d++)o+=Rn(t[d])+",";Vt.set(t,o)}if(l){o="#";const h=jt.keys(t).sort();for(;!P(d=h.pop());)P(t[d])||(o+=d+":"+Rn(t[d])+",");Vt.set(t,o)}}else o=r?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},wt=t=>{if(Ce(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Rn(t):"",[t,e]};let gi=0;const An=()=>++gi;async function Vs(...t){const[e,n,r,a]=t,l=Ke({populateCache:!0,throwOnError:!0},typeof a=="boolean"?{revalidate:a}:a||{});let o=l.populateCache;const d=l.rollbackOnError;let h=l.optimisticData;const f=O=>typeof d=="function"?d(O):d!==!1,y=l.throwOnError;if(Ce(n)){const O=n,m=[],E=e.keys();for(const R of E)!/^\$(inf|sub)\$/.test(R)&&O(e.get(R)._k)&&m.push(R);return Promise.all(m.map(_))}return _(n);async function _(O){const[m]=wt(O);if(!m)return;const[E,R]=Qe(e,m),[U,J,L,Z]=Be.get(e),Y=()=>{const re=U[m];return(Ce(l.revalidate)?l.revalidate(E().data,O):l.revalidate!==!1)&&(delete L[m],delete Z[m],re&&re[0])?re[0](Bs).then(()=>E().data):E().data};if(t.length<3)return Y();let M=r,oe,be=!1;const X=An();J[m]=[X,0];const $=!P(h),ee=E(),se=ee.data,Se=ee._c,me=P(Se)?se:Se;if($&&(h=Ce(h)?h(me,se):h,R({data:h,_c:me})),Ce(M))try{M=M(me)}catch(re){oe=re,be=!0}if(M&&Is(M))if(M=await M.catch(re=>{oe=re,be=!0}),X!==J[m][0]){if(be)throw oe;return M}else be&&$&&f(oe)&&(o=!0,R({data:me,_c:ce}));if(o&&!be)if(Ce(o)){const re=o(M,me);R({data:re,error:ce,_c:ce})}else R({data:M,error:ce,_c:ce});if(J[m][1]=An(),Promise.resolve(Y()).then(()=>{R({_c:ce})}),be){if(y)throw oe;return}return M}}const $s=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Hs=(t,e)=>{if(!Be.has(t)){const n=Ke(di,e),r=Object.create(null),a=Vs.bind(ce,t);let l=Je;const o=Object.create(null),d=(y,_)=>{const O=o[y]||[];return o[y]=O,O.push(_),()=>O.splice(O.indexOf(_),1)},h=(y,_,O)=>{t.set(y,_);const m=o[y];if(m)for(const E of m)E(_,O)},f=()=>{if(!Be.has(t)&&(Be.set(t,[r,Object.create(null),Object.create(null),Object.create(null),a,h,d]),!at)){const y=n.initFocus(setTimeout.bind(ce,$s.bind(ce,r,Fs))),_=n.initReconnect(setTimeout.bind(ce,$s.bind(ce,r,Ps)));l=()=>{y&&y(),_&&_(),Be.delete(t)}}};return f(),[t,a,f,l]}return[t,Be.get(t)[4]]},wi=(t,e,n,r,a)=>{const l=n.errorRetryCount,o=a.retryCount,d=~~((Math.random()+.5)*(1<<(o<8?o:8)))*n.errorRetryInterval;!P(l)&&o>l||setTimeout(r,d,a)},bi=bn,[Ct,_i]=Hs(new Map),Ws=Ke({onLoadingSlow:Je,onSuccess:Je,onError:Je,onErrorRetry:wi,onDiscarded:Je,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ms?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ms?5e3:3e3,compare:bi,isPaused:()=>!1,cache:Ct,mutate:_i,fallback:{}},hi),zs=(t,e)=>{const n=Ke(t,e);if(e){const{use:r,fallback:a}=t,{use:l,fallback:o}=e;r&&l&&(n.use=r.concat(l)),a&&o&&(n.fallback=Ke(a,o))}return n},Dn=S.createContext({}),vi=t=>{const{value:e}=t,n=S.useContext(Dn),r=Ce(e),a=S.useMemo(()=>r?e(n):e,[r,n,e]),l=S.useMemo(()=>r?a:zs(n,a),[r,n,a]),o=a&&a.provider,d=S.useRef(ce);o&&!d.current&&(d.current=Hs(o(l.cache||Ct),a));const h=d.current;return h&&(l.cache=h[0],l.mutate=h[1]),Tt(()=>{if(h)return h[2]&&h[2](),h[3]},[]),S.createElement(Dn.Provider,Ke(t,{value:l}))},Js="$inf$",Ks=Ot&&window.__SWR_DEVTOOLS_USE__,Ei=Ks?window.__SWR_DEVTOOLS_USE__:[],Si=()=>{Ks&&(window.__SWR_DEVTOOLS_REACT__=S)},Gs=t=>Ce(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],Xs=()=>{const t=S.useContext(Dn);return S.useMemo(()=>Ke(Ws,t),[t])},xt=(t,e)=>{if(at)return;const[n,r]=wt(t),[,,,a]=Be.get(Ct);if(a[n])return a[n];const l=e(r);return a[n]=l,l},Oi=t=>(e,n,r)=>t(e,n&&((...l)=>{const[o]=wt(e),[,,,d]=Be.get(Ct);if(o.startsWith(Js))return n(...l);const h=d[o];return P(h)?n(...l):(delete d[o],h)}),r),Ti=Ei.concat(Oi),Ci=t=>function(...n){const r=Xs(),[a,l,o]=Gs(n),d=zs(r,o);let h=t;const{use:f}=d,y=(f||[]).concat(Ti);for(let _=y.length;_--;)h=y[_](h);return h(a,l||d.fetcher||null,d)},xi=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const a=r.indexOf(n);a>=0&&(r[a]=r[r.length-1],r.pop())}},Ri=(t,e)=>(...n)=>{const[r,a,l]=Gs(n),o=(l.use||[]).concat(e);return t(r,a,{...l,use:o})};Si();const Ln=S.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Nn={dedupe:!0},Ys=Promise.resolve(ce),Ai=()=>Je,Di=(t,e,n)=>{const{cache:r,compare:a,suspense:l,fallbackData:o,revalidateOnMount:d,revalidateIfStale:h,refreshInterval:f,refreshWhenHidden:y,refreshWhenOffline:_,keepPreviousData:O,strictServerPrefetchWarning:m}=n,[E,R,U,J]=Be.get(r),[L,Z]=wt(t),Y=S.useRef(!1),M=S.useRef(!1),oe=S.useRef(L),be=S.useRef(e),X=S.useRef(n),$=()=>X.current,ee=()=>$().isVisible()&&$().isOnline(),[se,Se,me,re]=Qe(r,L),_e=S.useRef({}).current,Oe=P(o)?P(n.fallback)?ce:n.fallback[L]:o,fe=(W,te)=>{for(const Q in _e){const ne=Q;if(ne==="data"){if(!a(W[ne],te[ne])&&(!P(W[ne])||!a(tt,te[ne])))return!1}else if(te[ne]!==W[ne])return!1}return!0},qe=!Y.current,Ze=S.useMemo(()=>{const W=se(),te=re(),Q=ae=>{const Te=Ke(ae);return delete Te._k,(()=>{if(!L||!e||$().isPaused())return!1;if(qe&&!P(d))return d;const ht=P(Oe)?Te.data:Oe;return P(ht)||h})()?{isValidating:!0,isLoading:!0,...Te}:Te},ne=Q(W),Re=W===te?ne:Q(te);let ve=ne;return[()=>{const ae=Q(se());return fe(ae,ve)?(ve.data=ae.data,ve.isLoading=ae.isLoading,ve.isValidating=ae.isValidating,ve.error=ae.error,ve):(ve=ae,ae)},()=>Re]},[r,L]),Me=wn.useSyncExternalStore(S.useCallback(W=>me(L,(te,Q)=>{fe(Q,te)||W()}),[r,L]),Ze[0],Ze[1]),Ge=E[L]&&E[L].length>0,he=Me.data,de=P(he)?Oe&&Is(Oe)?Ln(Oe):Oe:he,Ve=Me.error,et=S.useRef(de),tt=O?P(he)?P(et.current)?de:et.current:he:de,Xe=L&&P(de),ut=S.useRef(null);!at&&wn.useSyncExternalStore(Ai,()=>(ut.current=!1,ut),()=>(ut.current=!0,ut));const Qn=ut.current;m&&Qn&&!l&&Xe&&console.warn(`Missing pre-initiated data for serialized key "${L}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const en=!L||!e||$().isPaused()||Ge&&!P(Ve)?!1:qe&&!P(d)?d:l?P(de)?!1:h:P(de)||h,tn=qe&&en,Zn=P(Me.isValidating)?tn:Me.isValidating,es=P(Me.isLoading)?tn:Me.isLoading,lt=S.useCallback(async W=>{const te=be.current;if(!L||!te||M.current||$().isPaused())return!1;let Q,ne,Re=!0;const ve=W||{},ae=!U[L]||!ve.dedupe,Te=()=>js?!M.current&&L===oe.current&&Y.current:L===oe.current,ft={isValidating:!1,isLoading:!1},ht=()=>{Se(ft)},sn=()=>{const Ee=U[L];Ee&&Ee[1]===ne&&delete U[L]},Lt={isValidating:!0};P(se().data)&&(Lt.isLoading=!0);try{if(ae&&(Se(Lt),n.loadingTimeout&&P(se().data)&&setTimeout(()=>{Re&&Te()&&$().onLoadingSlow(L,n)},n.loadingTimeout),U[L]=[te(Z),An()]),[Q,ne]=U[L],Q=await Q,ae&&setTimeout(sn,n.dedupingInterval),!U[L]||U[L][1]!==ne)return ae&&Te()&&$().onDiscarded(L),!1;ft.error=ce;const Ee=R[L];if(!P(Ee)&&(ne<=Ee[0]||ne<=Ee[1]||Ee[1]===0))return ht(),ae&&Te()&&$().onDiscarded(L),!1;const $e=se().data;ft.data=a($e,Q)?$e:Q,ae&&Te()&&$().onSuccess(Q,L,n)}catch(Ee){sn();const $e=$(),{shouldRetryOnError:b}=$e;$e.isPaused()||(ft.error=Ee,ae&&Te()&&($e.onError(Ee,L,$e),(b===!0||Ce(b)&&b(Ee))&&(!$().revalidateOnFocus||!$().revalidateOnReconnect||ee())&&$e.onErrorRetry(Ee,L,$e,ts=>{const Nt=E[L];Nt&&Nt[0]&&Nt[0](Us,ts)},{retryCount:(ve.retryCount||0)+1,dedupe:!0})))}return Re=!1,ht(),!0},[L,r]),nn=S.useCallback((...W)=>Vs(r,oe.current,...W),[]);if(Tt(()=>{be.current=e,X.current=n,P(he)||(et.current=he)}),Tt(()=>{if(!L)return;const W=lt.bind(ce,Nn);let te=0;$().revalidateOnFocus&&(te=Date.now()+$().focusThrottleInterval);const ne=xi(L,E,(Re,ve={})=>{if(Re==Fs){const ae=Date.now();$().revalidateOnFocus&&ae>te&&ee()&&(te=ae+$().focusThrottleInterval,W())}else if(Re==Ps)$().revalidateOnReconnect&&ee()&&W();else{if(Re==Bs)return lt();if(Re==Us)return lt(ve)}});return M.current=!1,oe.current=L,Y.current=!0,Se({_k:Z}),en&&(U[L]||(P(de)||at?W():pi(W))),()=>{M.current=!0,ne()}},[L]),Tt(()=>{let W;function te(){const ne=Ce(f)?f(se().data):f;ne&&W!==-1&&(W=setTimeout(Q,ne))}function Q(){!se().error&&(y||$().isVisible())&&(_||$().isOnline())?lt(Nn).then(te):te()}return te(),()=>{W&&(clearTimeout(W),W=-1)}},[f,y,_,L]),S.useDebugValue(tt),l){if(!js&&at&&Xe)throw new Error("Fallback data is required when using Suspense in SSR.");Xe&&(be.current=e,X.current=n,M.current=!1);const W=J[L],te=!P(W)&&Xe?nn(W):Ys;if(Ln(te),!P(Ve)&&Xe)throw Ve;const Q=Xe?lt(Nn):Ys;!P(tt)&&Xe&&(Q.status="fulfilled",Q.value=!0),Ln(Q)}return{mutate:nn,get data(){return _e.data=!0,tt},get error(){return _e.error=!0,Ve},get isValidating(){return _e.isValidating=!0,Zn},get isLoading(){return _e.isLoading=!0,es}}},Li=jt.defineProperty(vi,"defaultValue",{value:Ws}),ct=Ci(Di),Ni=void 0,kn=Object,Qs=t=>t===Ni,ki=t=>typeof t=="function",$t=new WeakMap,Fi=t=>kn.prototype.toString.call(t),Fn=(t,e)=>t===`[object ${e}]`;let Pi=0;const Pn=t=>{const e=typeof t,n=Fi(t),r=Fn(n,"Date"),a=Fn(n,"RegExp"),l=Fn(n,"Object");let o,d;if(kn(t)===t&&!r&&!a){if(o=$t.get(t),o)return o;if(o=++Pi+"~",$t.set(t,o),Array.isArray(t)){for(o="@",d=0;d<t.length;d++)o+=Pn(t[d])+",";$t.set(t,o)}if(l){o="#";const h=kn.keys(t).sort();for(;!Qs(d=h.pop());)Qs(t[d])||(o+=d+":"+Pn(t[d])+",");$t.set(t,o)}}else o=r?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return o},Bi=t=>{if(ki(t))try{t=t()}catch{t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Pn(t):"",[t,e]},Ui=t=>Bi(t?t(0,null):null)[0],Bn=Promise.resolve(),qi=Ri(ct,t=>(e,n,r)=>{const a=S.useRef(!1),{cache:l,initialSize:o=1,revalidateAll:d=!1,persistSize:h=!1,revalidateFirstPage:f=!0,revalidateOnMount:y=!1,parallel:_=!1}=r,[,,,O]=Be.get(Ct);let m;try{m=Ui(e),m&&(m=Js+m)}catch{}const[E,R,U]=Qe(l,m),J=S.useCallback(()=>P(E()._l)?o:E()._l,[l,m,o]);wn.useSyncExternalStore(S.useCallback(X=>m?U(m,()=>{X()}):()=>{},[l,m]),J,J);const L=S.useCallback(()=>{const X=E()._l;return P(X)?o:X},[m,o]),Z=S.useRef(L());Tt(()=>{if(!a.current){a.current=!0;return}m&&R({_l:h?Z.current:L()})},[m,l]);const Y=y&&!a.current,M=t(m,async X=>{const $=E()._i,ee=E()._r;R({_r:ce});const se=[],Se=L(),[me]=Qe(l,X),re=me().data,_e=[];let Oe=null;for(let fe=0;fe<Se;++fe){const[qe,Ze]=wt(e(fe,_?null:Oe));if(!qe)break;const[Me,Ge]=Qe(l,qe);let he=Me().data;const de=d||$||P(he)||f&&!fe&&!P(re)||Y||re&&!P(re[fe])&&!r.compare(re[fe],he);if(n&&(typeof ee=="function"?ee(he,Ze):de)){const Ve=async()=>{if(!(qe in O))he=await n(Ze);else{const tt=O[qe];delete O[qe],he=await tt}Ge({data:he,_k:Ze}),se[fe]=he};_?_e.push(Ve):await Ve()}else se[fe]=he;_||(Oe=he)}return _&&await Promise.all(_e.map(fe=>fe())),R({_i:ce}),se},r),oe=S.useCallback(function(X,$){const ee=typeof $=="boolean"?{revalidate:$}:$||{},se=ee.revalidate!==!1;return m?(se&&(P(X)?R({_i:!0,_r:ee.revalidate}):R({_i:!1,_r:ee.revalidate})),arguments.length?M.mutate(X,{...ee,revalidate:se}):M.mutate()):Bn},[m,l]),be=S.useCallback(X=>{if(!m)return Bn;const[,$]=Qe(l,m);let ee;if(Ce(X)?ee=X(L()):typeof X=="number"&&(ee=X),typeof ee!="number")return Bn;$({_l:ee}),Z.current=ee;const se=[],[Se]=Qe(l,m);let me=null;for(let re=0;re<ee;++re){const[_e]=wt(e(re,me)),[Oe]=Qe(l,_e),fe=_e?Oe().data:ce;if(P(fe))return oe(Se().data);se.push(fe),me=fe}return oe(se)},[m,l,oe,L]);return{size:L(),setSize:be,mutate:oe,get data(){return M.data},get error(){return M.error},get isValidating(){return M.isValidating},get isLoading(){return M.isLoading}}}),Ie=Object.create(null);Ie.open="0",Ie.close="1",Ie.ping="2",Ie.pong="3",Ie.message="4",Ie.upgrade="5",Ie.noop="6";const Ht=Object.create(null);Object.keys(Ie).forEach(t=>{Ht[Ie[t]]=t});const Un={type:"error",data:"parser error"},Zs=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",er=typeof ArrayBuffer=="function",tr=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,qn=({type:t,data:e},n,r)=>Zs&&e instanceof Blob?n?r(e):nr(e,r):er&&(e instanceof ArrayBuffer||tr(e))?n?r(e):nr(new Blob([e]),r):r(Ie[t]+(e||"")),nr=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function sr(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let In;function Ii(t,e){if(Zs&&t.data instanceof Blob)return t.data.arrayBuffer().then(sr).then(e);if(er&&(t.data instanceof ArrayBuffer||tr(t.data)))return e(sr(t.data));qn(t,!1,n=>{In||(In=new TextEncoder),e(In.encode(n))})}const rr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<rr.length;t++)Rt[rr.charCodeAt(t)]=t;const ji=t=>{let e=t.length*.75,n=t.length,r,a=0,l,o,d,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),y=new Uint8Array(f);for(r=0;r<n;r+=4)l=Rt[t.charCodeAt(r)],o=Rt[t.charCodeAt(r+1)],d=Rt[t.charCodeAt(r+2)],h=Rt[t.charCodeAt(r+3)],y[a++]=l<<2|o>>4,y[a++]=(o&15)<<4|d>>2,y[a++]=(d&3)<<6|h&63;return f},Mi=typeof ArrayBuffer=="function",jn=(t,e)=>{if(typeof t!="string")return{type:"message",data:ir(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Vi(t.substring(1),e)}:Ht[n]?t.length>1?{type:Ht[n],data:t.substring(1)}:{type:Ht[n]}:Un},Vi=(t,e)=>{if(Mi){const n=ji(t);return ir(n,e)}else return{base64:!0,data:t}},ir=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},or="",$i=(t,e)=>{const n=t.length,r=new Array(n);let a=0;t.forEach((l,o)=>{qn(l,!1,d=>{r[o]=d,++a===n&&e(r.join(or))})})},Hi=(t,e)=>{const n=t.split(or),r=[];for(let a=0;a<n.length;a++){const l=jn(n[a],e);if(r.push(l),l.type==="error")break}return r};function Wi(){return new TransformStream({transform(t,e){Ii(t,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const l=new DataView(a.buffer);l.setUint8(0,126),l.setUint16(1,r)}else{a=new Uint8Array(9);const l=new DataView(a.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(n)})}})}let Mn;function Wt(t){return t.reduce((e,n)=>e+n.length,0)}function zt(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let a=0;a<e;a++)n[a]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function zi(t,e){Mn||(Mn=new TextDecoder);const n=[];let r=0,a=-1,l=!1;return new TransformStream({transform(o,d){for(n.push(o);;){if(r===0){if(Wt(n)<1)break;const h=zt(n,1);l=(h[0]&128)===128,a=h[0]&127,a<126?r=3:a===126?r=1:r=2}else if(r===1){if(Wt(n)<2)break;const h=zt(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(Wt(n)<8)break;const h=zt(n,8),f=new DataView(h.buffer,h.byteOffset,h.length),y=f.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(Un);break}a=y*Math.pow(2,32)+f.getUint32(4),r=3}else{if(Wt(n)<a)break;const h=zt(n,a);d.enqueue(jn(l?h:Mn.decode(h),e)),r=0}if(a===0||a>t){d.enqueue(Un);break}}}})}const ar=4;function ue(t){if(t)return Ji(t)}function Ji(t){for(var e in ue.prototype)t[e]=ue.prototype[e];return t}ue.prototype.on=ue.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},ue.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},ue.prototype.off=ue.prototype.removeListener=ue.prototype.removeAllListeners=ue.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,a=0;a<n.length;a++)if(r=n[a],r===e||r.fn===e){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+t],this},ue.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,a=n.length;r<a;++r)n[r].apply(this,e)}return this},ue.prototype.emitReserved=ue.prototype.emit,ue.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},ue.prototype.hasListeners=function(t){return!!this.listeners(t).length};const xe=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function cr(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Ki=xe.setTimeout,Gi=xe.clearTimeout;function Jt(t,e){e.useNativeTimers?(t.setTimeoutFn=Ki.bind(xe),t.clearTimeoutFn=Gi.bind(xe)):(t.setTimeoutFn=xe.setTimeout.bind(xe),t.clearTimeoutFn=xe.clearTimeout.bind(xe))}const Xi=1.33;function Yi(t){return typeof t=="string"?Qi(t):Math.ceil((t.byteLength||t.size)*Xi)}function Qi(t){let e=0,n=0;for(let r=0,a=t.length;r<a;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function Zi(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function eo(t){let e={},n=t.split("&");for(let r=0,a=n.length;r<a;r++){let l=n[r].split("=");e[decodeURIComponent(l[0])]=decodeURIComponent(l[1])}return e}class to extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Vn extends ue{constructor(e){super(),this.writable=!1,Jt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new to(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=jn(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=Zi(e);return n.length?"?"+n:""}}const ur="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),$n=64,no={};let lr=0,Kt=0,fr;function hr(t){let e="";do e=ur[t%$n]+e,t=Math.floor(t/$n);while(t>0);return e}function dr(){const t=hr(+new Date);return t!==fr?(lr=0,fr=t):t+"."+hr(lr++)}for(;Kt<$n;Kt++)no[ur[Kt]]=Kt;let pr=!1;try{pr=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const so=pr;function yr(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||so))return new XMLHttpRequest}catch{}if(!e)try{return new xe[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ya(){}function ro(){}const io=function(){return new yr({xdomain:!1}).responseType!=null}();class oo extends Vn{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let a=location.port;a||(a=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||a!==e.port}const n=e&&e.forceBase64;this.supportsBinary=io&&!n,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Hi(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,$i(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=dr()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new je(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(a,l)=>{this.onError("xhr post error",a,l)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class je extends ue{constructor(e,n){super(),Jt(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.data=n.data!==void 0?n.data:null,this.create()}create(){var e;const n=cr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new yr(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this.opts.extraHeaders[a])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this.opts.cookieJar)===null||a===void 0||a.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(a){this.setTimeoutFn(()=>{this.onError(a)},0);return}typeof document<"u"&&(this.index=je.requestsCount++,je.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=ro,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete je.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(je.requestsCount=0,je.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mr);else if(typeof addEventListener=="function"){const t="onpagehide"in xe?"pagehide":"unload";addEventListener(t,mr,!1)}}function mr(){for(let t in je.requests)je.requests.hasOwnProperty(t)&&je.requests[t].abort()}const Hn=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Gt=xe.WebSocket||xe.MozWebSocket,gr=!0,ao="arraybuffer",wr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class co extends Vn{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=wr?{}:cr(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=gr&&!wr?n?new Gt(e,n):new Gt(e):new Gt(e,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],a=n===e.length-1;qn(r,this.supportsBinary,l=>{const o={};try{gr&&this.ws.send(l)}catch{}a&&Hn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=dr()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}check(){return!!Gt}}class uo extends Vn{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const n=zi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),a=Wi();a.readable.pipeTo(e.writable),this.writer=a.writable.getWriter();const l=()=>{r.read().then(({done:d,value:h})=>{d||(this.onPacket(h),l())}).catch(d=>{})};l();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],a=n===e.length-1;this.writer.write(r).then(()=>{a&&Hn(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const lo={websocket:co,webtransport:uo,polling:oo},fo=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ho=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Wn(t){if(t.length>2e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let a=fo.exec(t||""),l={},o=14;for(;o--;)l[ho[o]]=a[o]||"";return n!=-1&&r!=-1&&(l.source=e,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=po(l,l.path),l.queryKey=yo(l,l.query),l}function po(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function yo(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,l){a&&(n[a]=l)}),n}let br=class Et extends ue{constructor(e,n={}){super(),this.binaryType=ao,this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Wn(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Wn(n.host).host),Jt(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=eo(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=ar,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new lo[e](r)}open(){let e;if(this.opts.rememberUpgrade&&Et.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(e){let n=this.createTransport(e),r=!1;Et.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",_=>{if(!r)if(_.type==="pong"&&_.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Et.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const O=new Error("probe error");O.transport=n.name,this.emitReserved("upgradeError",O)}}))};function l(){r||(r=!0,y(),n.close(),n=null)}const o=_=>{const O=new Error("probe error: "+_);O.transport=n.name,l(),this.emitReserved("upgradeError",O)};function d(){o("transport closed")}function h(){o("socket closed")}function f(_){n&&_.name!==n.name&&l()}const y=()=>{n.removeListener("open",a),n.removeListener("error",o),n.removeListener("close",d),this.off("close",h),this.off("upgrading",f)};n.once("open",a),n.once("error",o),n.once("close",d),this.once("close",h),this.once("upgrading",f),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Et.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e<n;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const n=new Error("server error");n.code=e.data,this.onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const a=this.writeBuffer[r].data;if(a&&(n+=Yi(a)),r>0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const l={type:e,data:n,options:r};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){Et.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const a=e.length;for(;r<a;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}};br.protocol=ar;function mo(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=Wn(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const l=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+l+":"+r.port+e,r.href=r.protocol+"://"+l+(n&&n.port===r.port?"":":"+r.port),r}const go=typeof ArrayBuffer=="function",wo=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,_r=Object.prototype.toString,bo=typeof Blob=="function"||typeof Blob<"u"&&_r.call(Blob)==="[object BlobConstructor]",_o=typeof File=="function"||typeof File<"u"&&_r.call(File)==="[object FileConstructor]";function zn(t){return go&&(t instanceof ArrayBuffer||wo(t))||bo&&t instanceof Blob||_o&&t instanceof File}function Xt(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Xt(t[n]))return!0;return!1}if(zn(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Xt(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Xt(t[n]))return!0;return!1}function vo(t){const e=[],n=t.data,r=t;return r.data=Jn(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Jn(t,e){if(!t)return t;if(zn(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Jn(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Jn(t[r],e));return n}return t}function Eo(t,e){return t.data=Kn(t.data,e),delete t.attachments,t}function Kn(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Kn(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Kn(t[n],e));return t}const So=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var I;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(I||(I={}));class Oo{constructor(e){this.replacer=e}encode(e){return(e.type===I.EVENT||e.type===I.ACK)&&Xt(e)?this.encodeAsBinary({type:e.type===I.EVENT?I.BINARY_EVENT:I.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===I.BINARY_EVENT||e.type===I.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=vo(e),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}class Gn extends ue{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===I.BINARY_EVENT;r||n.type===I.BINARY_ACK?(n.type=r?I.EVENT:I.ACK,this.reconstructor=new To(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(zn(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(I[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===I.BINARY_EVENT||r.type===I.BINARY_ACK){const l=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const o=e.substring(l,n);if(o!=Number(o)||e.charAt(n)!=="-")throw new Error("Illegal attachments");const d=Number(o);if(!Co(d)||d<0)throw new Error("Illegal attachments");if(d>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=d}if(e.charAt(n+1)==="/"){const l=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(l,n)}else r.nsp="/";const a=e.charAt(n+1);if(a!==""&&Number(a)==a){const l=n+1;for(;++n;){const o=e.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===e.length)break}r.id=Number(e.substring(l,n+1))}if(e.charAt(++n)){const l=this.tryParse(e.substr(n));if(Gn.isPayloadValid(r.type,l))r.data=l;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case I.CONNECT:return vr(n);case I.DISCONNECT:return n===void 0;case I.CONNECT_ERROR:return typeof n=="string"||vr(n);case I.EVENT:case I.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&So.indexOf(n[0])===-1);case I.ACK:case I.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class To{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=Eo(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Co=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function vr(t){return Object.prototype.toString.call(t)==="[object Object]"}const xo=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Gn,Encoder:Oo,get PacketType(){return I}},Symbol.toStringTag,{value:"Module"}));function Ue(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const Ro=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Er extends ue{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ue(e,"open",this.onopen.bind(this)),Ue(e,"packet",this.onpacket.bind(this)),Ue(e,"error",this.onerror.bind(this)),Ue(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(Ro.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:I.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const o=this.ids++,d=n.pop();this._registerAckCallback(o,d),r.id=o}const a=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!a||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[e]=n;return}const l=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&this.sendBuffer.splice(o,1);n.call(this,new Error("operation has timed out"))},a);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(l),n.apply(this,[null,...o])}}emitWithAck(e,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((a,l)=>{n.push((o,d)=>r?o?l(o):a(d):a(o)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...l)=>r!==this._queue[0]?void 0:(a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...l)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:I.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case I.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case I.EVENT:case I.BINARY_EVENT:this.onevent(e);break;case I.ACK:case I.BINARY_ACK:this.onack(e);break;case I.DISCONNECT:this.ondisconnect();break;case I.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:I.ACK,id:e,data:a}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:I.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function bt(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}bt.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0},bt.prototype.reset=function(){this.attempts=0},bt.prototype.setMin=function(t){this.ms=t},bt.prototype.setMax=function(t){this.max=t},bt.prototype.setJitter=function(t){this.jitter=t};class Xn extends ue{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Jt(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new bt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const a=n.parser||xo;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new br(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Ue(n,"open",function(){r.onopen(),e&&e()}),l=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),e?e(d):this.maybeReconnectOnOpen()},o=Ue(n,"error",l);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{a(),l(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ue(e,"ping",this.onping.bind(this)),Ue(e,"data",this.ondata.bind(this)),Ue(e,"error",this.onerror.bind(this)),Ue(e,"close",this.onclose.bind(this)),Ue(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Hn(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new Er(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const At={};function Yt(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=mo(t,e.path||"/socket.io"),r=n.source,a=n.id,l=n.path,o=At[a]&&l in At[a].nsps,d=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let h;return d?h=new Xn(r,e):(At[a]||(At[a]=new Xn(r,e)),h=At[a]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Yt,{Manager:Xn,Socket:Er,io:Yt,connect:Yt});class Ao{constructor(e,n,r,a){it(this,"socket_port");it(this,"host");it(this,"port");it(this,"protocol");it(this,"url");it(this,"site_name");it(this,"socket");var l,o,d,h;if(this.socket_port=r??"9000",this.host=(l=window.location)==null?void 0:l.hostname,this.port=(o=window.location)!=null&&o.port?`:${this.socket_port}`:"",this.protocol=((d=window.location)==null?void 0:d.protocol)==="https:"?"https":"http",e){let f=new URL(e);f.port="",r?(f.port=r,this.url=f.toString()):this.url=f.toString()}else this.url=`${this.protocol}://${this.host}${this.port}/`;n&&(this.url=`${this.url}${n}`),this.site_name=n,this.socket=Yt(`${this.url}`,{withCredentials:!0,secure:this.protocol==="https",extraHeaders:a&&a.useToken===!0?{Authorization:`${a.type} ${(h=a.token)==null?void 0:h.call(a)}`}:{}})}}const ie=S.createContext(null),Do=({url:t="",tokenParams:e,socketPort:n,swrConfig:r,siteName:a,enableSocket:l=!0,children:o,customHeaders:d})=>{const h=S.useMemo(()=>{const f=new ni.FrappeApp(t,e,void 0,d);return{url:t,tokenParams:e,app:f,auth:f.auth(),db:f.db(),call:f.call(),file:f.file(),socket:l?new Ao(t,a,n,e).socket:void 0,enableSocket:l,socketPort:n}},[t,e,n,l,d]);return we.jsx(ie.Provider,{value:h,children:we.jsx(Li,{value:r,children:o})})},Lo=t=>{const{url:e,auth:n,tokenParams:r}=S.useContext(ie),[a,l]=S.useState(),o=S.useCallback(()=>{const E=document.cookie.split(";").find(R=>R.trim().startsWith("user_id="));if(E){const R=E.split("=")[1];l(R&&R!=="Guest"?R:null)}else l(null)},[]);S.useEffect(()=>{r&&r.useToken?l(null):o()},[]);const{data:d,error:h,isLoading:f,isValidating:y,mutate:_}=ct(()=>r&&r.useToken||a?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>n.getLoggedInUser(),{onError:()=>{l(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...t}),O=S.useCallback(async E=>n.loginWithUsernamePassword(E).then(R=>(o(),R)),[]),m=S.useCallback(async()=>n.logout().then(()=>_(null)).then(()=>l(null)),[]);return{isLoading:a===void 0||f,currentUser:d,isValidating:y,error:h,login:O,logout:m,updateCurrentUser:_,getUserCookie:o}},Dt=(t,e,n)=>{let r=`${e}/api/resource/`;return n?r+=`${t}/${n}`:r+=`${t}`,r},No=(t,e,n,r)=>{const{url:a,db:l}=S.useContext(ie);return ct(n===void 0?Dt(t,a,e):n,()=>l.getDoc(t,e),r)},ko=(t,e,n,r)=>{const{db:a,url:l}=S.useContext(ie),o=n===void 0?Dt(t,l,e):n;return S.useCallback(()=>{xt(o,()=>a.getDoc(t,e))},[o,t,e])},Yn=t=>{var n,r;let e="";if(t!=null&&t.fields&&(e+="fields="+JSON.stringify(t==null?void 0:t.fields)+"&"),t!=null&&t.filters&&(e+="filters="+JSON.stringify(t==null?void 0:t.filters)+"&"),t!=null&&t.orFilters&&(e+="or_filters="+JSON.stringify(t==null?void 0:t.orFilters)+"&"),t!=null&&t.limit_start&&(e+="limit_start="+JSON.stringify(t==null?void 0:t.limit_start)+"&"),t!=null&&t.limit&&(e+="limit="+JSON.stringify(t==null?void 0:t.limit)+"&"),t!=null&&t.groupBy&&(e+="group_by="+String(t.groupBy)+"&"),t!=null&&t.orderBy){const a=`${String((n=t.orderBy)==null?void 0:n.field)} ${((r=t.orderBy)==null?void 0:r.order)??"asc"}`;e+="order_by="+a+"&"}return t!=null&&t.asDict&&(e+="as_dict="+t.asDict),e},Fo=(t,e,n,r)=>{const{url:a,db:l}=S.useContext(ie);return ct(n===void 0?`${Dt(t,a)}?${Yn(e)}`:n,()=>l.getDocList(t,e),r)},Po=(t,e,n)=>{const{db:r,url:a}=S.useContext(ie),l=n===void 0?`${Dt(t,a)}?${Yn(e)}`:n;return S.useCallback(()=>{xt(l,()=>r.getDocList(t,e))},[l,t,e])},Bo=()=>{const{db:t}=S.useContext(ie),[e,n]=S.useState(!1),[r,a]=S.useState(null),[l,o]=S.useState(!1),d=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{createDoc:S.useCallback(async(f,y)=>(a(null),o(!1),n(!0),t.createDoc(f,y).then(_=>(n(!1),o(!0),_)).catch(_=>{throw n(!1),o(!1),a(_),_})),[]),loading:e,error:r,isCompleted:l,reset:d}},Uo=()=>{const{db:t}=S.useContext(ie),[e,n]=S.useState(!1),[r,a]=S.useState(null),[l,o]=S.useState(!1),d=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{updateDoc:S.useCallback(async(f,y,_)=>(a(null),o(!1),n(!0),t.updateDoc(f,y,_).then(O=>(n(!1),o(!0),O)).catch(O=>{throw n(!1),o(!1),a(O),O})),[]),loading:e,error:r,reset:d,isCompleted:l}},qo=()=>{const{db:t}=S.useContext(ie),[e,n]=S.useState(!1),[r,a]=S.useState(null),[l,o]=S.useState(!1),d=S.useCallback(()=>{n(!1),a(null),o(!1)},[]);return{deleteDoc:S.useCallback(async(f,y)=>(a(null),o(!1),n(!0),t.deleteDoc(f,y).then(_=>(n(!1),o(!0),_)).catch(_=>{throw n(!1),o(!1),a(_),_})),[]),loading:e,error:r,reset:d,isCompleted:l}};function Qt(t){const e=[];for(let n in t)e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}const Io=(t,e,n=!1,r,a)=>{const{url:l,db:o}=S.useContext(ie);return ct(r===void 0?(()=>{const f=Qt({doctype:t,filters:e??[],debug:n});return`${l}/api/method/frappe.client.get_count?${f}`})():r,()=>o.getCount(t,e,n),a)},jo=(t,e,n=!1,r)=>{const{db:a,url:l}=S.useContext(ie),o=r===void 0?`${l}/api/method/frappe.client.get_count?${Qt({doctype:t,filters:e??[],debug:n})}`:r;return S.useCallback(()=>{xt(o,()=>a.getCount(t,e,!1))},[o,t,e])},Sr=(t,e,n,r,a="GET")=>{const{call:l}=S.useContext(ie),o=Qt(e??{}),d=`${t}?${o}`;return{...ct(n===void 0?d:n,a==="GET"?()=>l.get(t,e):()=>l.post(t,e),r)}},Mo=(t,e,n,r="GET")=>{const{call:a}=S.useContext(ie),l=Qt(e??{}),o=`${t}?${l}`;return S.useCallback(()=>{xt(n??o,r==="GET"?()=>a.get(t,e):()=>a.post(t,e))},[o,t,e,n])},Vo=t=>{const{call:e}=S.useContext(ie),[n,r]=S.useState(null),[a,l]=S.useState(!1),[o,d]=S.useState(null),[h,f]=S.useState(!1),y=S.useCallback(()=>{r(null),l(!1),d(null),f(!1)},[]);return{call:S.useCallback(async O=>(d(null),f(!1),l(!0),r(null),e.post(t,O).then(m=>(r(m),l(!1),f(!0),m)).catch(m=>{throw l(!1),f(!1),d(m),m})),[]),result:n,loading:a,error:o,reset:y,isCompleted:h}},$o=t=>{const{call:e}=S.useContext(ie),[n,r]=S.useState(null),[a,l]=S.useState(!1),[o,d]=S.useState(null),[h,f]=S.useState(!1),y=S.useCallback(()=>{r(null),l(!1),d(null),f(!1)},[]);return{call:S.useCallback(async O=>(d(null),f(!1),l(!0),r(null),e.put(t,O).then(m=>(r(m),l(!1),f(!0),m)).catch(m=>{throw l(!1),f(!1),d(m),m})),[]),result:n,loading:a,error:o,reset:y,isCompleted:h}},Ho=t=>{const{call:e}=S.useContext(ie),[n,r]=S.useState(null),[a,l]=S.useState(!1),[o,d]=S.useState(null),[h,f]=S.useState(!1),y=S.useCallback(()=>{r(null),l(!1),d(null),f(!1)},[]);return{call:S.useCallback(async O=>(d(null),f(!1),l(!0),r(null),e.delete(t,O).then(m=>(r(m),l(!1),f(!0),m)).catch(m=>{throw l(!1),f(!1),d(m),m})),[]),result:n,loading:a,error:o,reset:y,isCompleted:h}},Wo=()=>{const{file:t}=S.useContext(ie),[e,n]=S.useState(0),[r,a]=S.useState(!1),[l,o]=S.useState(null),[d,h]=S.useState(!1),f=S.useCallback(async(_,O,m)=>(y(),a(!0),t.uploadFile(_,O,(E,R)=>{R&&n(Math.round(E/R*100))},m).then(E=>(h(!0),n(100),a(!1),E.data.message)).catch(E=>{throw console.error(E),o(E),a(!1),E})),[]),y=S.useCallback(()=>{n(0),a(!1),o(null),h(!1)},[]);return{upload:f,progress:e,loading:r,isCompleted:d,error:l,reset:y}},zo=(t,e,n=[],r=20,a=250)=>{const l=Jo(e,a);return Sr("frappe.desk.search.search_link",{doctype:t,page_length:r,txt:l,filters:JSON.stringify(n??[])})},Jo=(t,e)=>{const[n,r]=S.useState(t);return S.useEffect(()=>{const a=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(a)}},[t,e]),n},Zt=(t,e)=>{const{socket:n}=S.useContext(ie);S.useEffect(()=>{n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider.");let r=n==null?void 0:n.on(t,e);return()=>{r==null||r.off(t)}},[t,e])},Ko=(t,e,n,r=!0)=>{const{socket:a}=S.useContext(ie),[l,o]=S.useState([]);S.useEffect(()=>(a===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),a==null||a.emit("doc_subscribe",t,e),a==null||a.io.on("reconnect",()=>{a==null||a.emit("doc_subscribe",t,e)}),r&&(a==null||a.emit("doc_open",t,e)),()=>{a==null||a.emit("doc_unsubscribe",t,e),r&&(a==null||a.emit("doc_close",t,e))}),[t,e,r]),Zt("doc_update",n);const d=S.useCallback(()=>{a==null||a.emit("doc_open",t,e)},[t,e]),h=S.useCallback(()=>{a==null||a.emit("doc_close",t,e)},[t,e]),f=S.useCallback(y=>{y.doctype===t&&y.docname===e&&o(y.users)},[t,e]);return Zt("doc_viewers",f),{viewers:l,emitDocOpen:d,emitDocClose:h}},Go=(t,e)=>{const{socket:n}=S.useContext(ie);S.useEffect(()=>(n===void 0&&console.warn("Socket is not enabled. Please enable socket in FrappeProvider."),n==null||n.emit("doctype_subscribe",t),n==null||n.io.on("reconnect",()=>{n==null||n.emit("doctype_subscribe",t)}),()=>{n==null||n.emit("doctype_unsubscribe",t)}),[t]),Zt("list_update",e)};B.FrappeContext=ie,B.FrappeProvider=Do,B.getDocListQueryString=Yn,B.getRequestURL=Dt,B.preload=xt,B.useFrappeAuth=Lo,B.useFrappeCreateDoc=Bo,B.useFrappeDeleteCall=Ho,B.useFrappeDeleteDoc=qo,B.useFrappeDocTypeEventListener=Go,B.useFrappeDocumentEventListener=Ko,B.useFrappeEventListener=Zt,B.useFrappeFileUpload=Wo,B.useFrappeGetCall=Sr,B.useFrappeGetDoc=No,B.useFrappeGetDocCount=Io,B.useFrappeGetDocList=Fo,B.useFrappePostCall=Vo,B.useFrappePrefetchCall=Mo,B.useFrappePrefetchDoc=ko,B.useFrappePrefetchDocCount=jo,B.useFrappePrefetchDocList=Po,B.useFrappePutCall=$o,B.useFrappeUpdateDoc=Uo,B.useSWR=ct,B.useSWRConfig=Xs,B.useSWRInfinite=qi,B.useSearch=zo,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})});