frappe-react-sdk 1.2.3 → 1.2.4

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,5 +1,5 @@
1
- (function(x,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],d):(x=typeof globalThis<"u"?globalThis:x||self,d(x["Frappe React"]={},x.React))})(this,function(x,d){"use strict";var ka=Object.defineProperty;var Da=(x,d,Ue)=>d in x?ka(x,d,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):x[d]=Ue;var Ie=(x,d,Ue)=>(Da(x,typeof d!="symbol"?d+"":d,Ue),Ue);const Le=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(d);var N=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Mt={},Qe={},Ze={},ae=N&&N.__assign||function(){return ae=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},ae.apply(this,arguments)},pt=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(f){try{a(r.next(f))}catch(l){o(l)}}function h(f){try{a(r.throw(f))}catch(l){o(l)}}function a(f){f.done?i(f.value):s(f.value).then(c,h)}a((r=r.apply(n,e||[])).next())})},vt=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(f){return h([a,f])}}function h(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(f){a=[6,f],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.FrappeCall=void 0;var Ts=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.get=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.get("/api/method/".concat(e),{params:t}).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n.prototype.post=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.post("/api/method/".concat(e),ae({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n.prototype.put=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.put("/api/method/".concat(e),ae({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n.prototype.delete=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.delete("/api/method/".concat(e),{params:t}).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n}();Ze.FrappeCall=Ts;var $e={},Y=N&&N.__assign||function(){return Y=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},Y.apply(this,arguments)},Ne=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(f){try{a(r.next(f))}catch(l){o(l)}}function h(f){try{a(r.throw(f))}catch(l){o(l)}}function a(f){f.done?i(f.value):s(f.value).then(c,h)}a((r=r.apply(n,e||[])).next())})},Fe=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(f){return h([a,f])}}function h(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(f){a=[6,f],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty($e,"__esModule",{value:!0}),$e.FrappeDB=void 0;var Os=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.getDoc=function(e,t){return t===void 0&&(t=""),Ne(this,void 0,void 0,function(){return Fe(this,function(r){return[2,this.axios.get("/api/resource/".concat(e,"/").concat(t)).then(function(s){return s.data.data}).catch(function(s){var i,o;throw Y(Y({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:"There was an error while fetching the document.",exception:(o=(i=s.response.data.exception)!==null&&i!==void 0?i:s.response.data.exc_type)!==null&&o!==void 0?o:""})})]})})},n.prototype.getDocList=function(e,t){var r,s;return Ne(this,void 0,void 0,function(){var i,o,c,h,a,f,l,y,v,w,E;return Fe(this,function(U){return i={},r=t==null?void 0:t.fields,t&&(o=t.fields,c=t.filters,h=t.orFilters,a=t.orderBy,f=t.limit,l=t.limit_start,y=t.groupBy,v=t.asDict,w=v===void 0?!0:v,E=a?"".concat(String(a==null?void 0:a.field)," ").concat((s=a==null?void 0:a.order)!==null&&s!==void 0?s:"asc"):"",i={fields:o?JSON.stringify(o):void 0,filters:c?JSON.stringify(c):void 0,or_filters:h?JSON.stringify(h):void 0,order_by:E,group_by:y,limit:f,limit_start:l,as_dict:w}),[2,this.axios.get("/api/resource/".concat(e),{params:i}).then(function(b){return b.data.data}).catch(function(b){var T,k;throw Y(Y({},b.response.data),{httpStatus:b.response.status,httpStatusText:b.response.statusText,message:"There was an error while fetching the documents.",exception:(k=(T=b.response.data.exception)!==null&&T!==void 0?T:b.response.data.exc_type)!==null&&k!==void 0?k:""})})]})})},n.prototype.createDoc=function(e,t){return Ne(this,void 0,void 0,function(){return Fe(this,function(r){return[2,this.axios.post("/api/resource/".concat(e),Y({},t)).then(function(s){return s.data.data}).catch(function(s){var i,o,c;throw Y(Y({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error while creating the document.",exception:(c=(o=s.response.data.exception)!==null&&o!==void 0?o:s.response.data.exc_type)!==null&&c!==void 0?c:""})})]})})},n.prototype.updateDoc=function(e,t,r){return Ne(this,void 0,void 0,function(){return Fe(this,function(s){return[2,this.axios.put("/api/resource/".concat(e,"/").concat(t),Y({},r)).then(function(i){return i.data.data}).catch(function(i){var o,c,h;throw Y(Y({},i.response.data),{httpStatus:i.response.status,httpStatusText:i.response.statusText,message:(o=i.response.data.message)!==null&&o!==void 0?o:"There was an error while updating the document.",exception:(h=(c=i.response.data.exception)!==null&&c!==void 0?c:i.response.data.exc_type)!==null&&h!==void 0?h:""})})]})})},n.prototype.deleteDoc=function(e,t){return Ne(this,void 0,void 0,function(){return Fe(this,function(r){return[2,this.axios.delete("/api/resource/".concat(e,"/").concat(t)).then(function(s){return s.data}).catch(function(s){var i,o;throw Y(Y({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:"There was an error while deleting the document.",exception:(o=(i=s.response.data.exception)!==null&&i!==void 0?i:s.response.data.exc_type)!==null&&o!==void 0?o:""})})]})})},n.prototype.getCount=function(e,t,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Ne(this,void 0,void 0,function(){var i;return Fe(this,function(o){return i={doctype:e,filters:[]},r&&(i.cache=r),s&&(i.debug=s),t&&(i.filters=t?JSON.stringify(t):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:i}).then(function(c){return c.data.message}).catch(function(c){var h,a;throw Y(Y({},c.response.data),{httpStatus:c.response.status,httpStatusText:c.response.statusText,message:"There was an error while getting the count.",exception:(a=(h=c.response.data.exception)!==null&&h!==void 0?h:c.response.data.exc_type)!==null&&a!==void 0?a:""})})]})})},n.prototype.getLastDoc=function(e,t){return Ne(this,void 0,void 0,function(){var r,s;return Fe(this,function(i){switch(i.label){case 0:return r={orderBy:{field:"creation",order:"desc"}},t&&(r=Y(Y({},r),t)),[4,this.getDocList(e,Y(Y({},r),{limit:1,fields:["name"]}))];case 1:return s=i.sent(),s.length>0?[2,this.getDoc(e,s[0].name)]:[2,{}]}})})},n}();$e.FrappeDB=Os;var et={},yt=N&&N.__assign||function(){return yt=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},yt.apply(this,arguments)},xs=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(f){try{a(r.next(f))}catch(l){o(l)}}function h(f){try{a(r.throw(f))}catch(l){o(l)}}function a(f){f.done?i(f.value):s(f.value).then(c,h)}a((r=r.apply(n,e||[])).next())})},As=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(f){return h([a,f])}}function h(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(f){a=[6,f],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(et,"__esModule",{value:!0}),et.FrappeFileUpload=void 0;var ks=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.uploadFile=function(e,t,r){return xs(this,void 0,void 0,function(){var s,i,o,c,h,a,f;return As(this,function(l){return s=new FormData,e&&s.append("file",e,e.name),i=t.isPrivate,o=t.folder,c=t.file_url,h=t.doctype,a=t.docname,f=t.fieldname,i&&s.append("is_private","1"),o&&s.append("folder",o),c&&s.append("file_url",c),h&&a&&(s.append("doctype",h),s.append("docname",a),f&&s.append("fieldname",f)),[2,this.axios.post("/api/method/upload_file",s,{onUploadProgress:function(y){r&&r(y.loaded,y.total)}}).catch(function(y){var v,w;throw yt(yt({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:(v=y.response.data.message)!==null&&v!==void 0?v:"There was an error while uploading the file.",exception:(w=y.response.data.exception)!==null&&w!==void 0?w:""})})]})})},n}();et.FrappeFileUpload=ks;var Ve={},Vn={exports:{}},Wt={exports:{}},jn=function(e,t){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return e.apply(t,s)}},Ds=jn,Oe=Object.prototype.toString;function Ht(n){return Array.isArray(n)}function qt(n){return typeof n>"u"}function Ls(n){return n!==null&&!qt(n)&&n.constructor!==null&&!qt(n.constructor)&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Mn(n){return Oe.call(n)==="[object ArrayBuffer]"}function Ns(n){return Oe.call(n)==="[object FormData]"}function Fs(n){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Mn(n.buffer),e}function Ps(n){return typeof n=="string"}function Bs(n){return typeof n=="number"}function Wn(n){return n!==null&&typeof n=="object"}function mt(n){if(Oe.call(n)!=="[object Object]")return!1;var e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}function Is(n){return Oe.call(n)==="[object Date]"}function Us(n){return Oe.call(n)==="[object File]"}function Vs(n){return Oe.call(n)==="[object Blob]"}function Hn(n){return Oe.call(n)==="[object Function]"}function js(n){return Wn(n)&&Hn(n.pipe)}function Ms(n){return Oe.call(n)==="[object URLSearchParams]"}function Ws(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Hs(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Yt(n,e){if(!(n===null||typeof n>"u"))if(typeof n!="object"&&(n=[n]),Ht(n))for(var t=0,r=n.length;t<r;t++)e.call(null,n[t],t,n);else for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.call(null,n[s],s,n)}function Jt(){var n={};function e(s,i){mt(n[i])&&mt(s)?n[i]=Jt(n[i],s):mt(s)?n[i]=Jt({},s):Ht(s)?n[i]=s.slice():n[i]=s}for(var t=0,r=arguments.length;t<r;t++)Yt(arguments[t],e);return n}function qs(n,e,t){return Yt(e,function(s,i){t&&typeof s=="function"?n[i]=Ds(s,t):n[i]=s}),n}function Ys(n){return n.charCodeAt(0)===65279&&(n=n.slice(1)),n}var se={isArray:Ht,isArrayBuffer:Mn,isBuffer:Ls,isFormData:Ns,isArrayBufferView:Fs,isString:Ps,isNumber:Bs,isObject:Wn,isPlainObject:mt,isUndefined:qt,isDate:Is,isFile:Us,isBlob:Vs,isFunction:Hn,isStream:js,isURLSearchParams:Ms,isStandardBrowserEnv:Hs,forEach:Yt,merge:Jt,extend:qs,trim:Ws,stripBOM:Ys},je=se;function qn(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Yn=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(je.isURLSearchParams(t))s=t.toString();else{var i=[];je.forEach(t,function(h,a){h===null||typeof h>"u"||(je.isArray(h)?a=a+"[]":h=[h],je.forEach(h,function(l){je.isDate(l)?l=l.toISOString():je.isObject(l)&&(l=JSON.stringify(l)),i.push(qn(a)+"="+qn(l))}))}),s=i.join("&")}if(s){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e},Js=se;function gt(){this.handlers=[]}gt.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1},gt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},gt.prototype.forEach=function(e){Js.forEach(this.handlers,function(r){r!==null&&e(r)})};var zs=gt,Ks=se,Gs=function(e,t){Ks.forEach(e,function(s,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=s,delete e[i])})},Jn=function(e,t,r,s,i){return e.config=t,r&&(e.code=r),e.request=s,e.response=i,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},zn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt,Kn;function Gn(){if(Kn)return zt;Kn=1;var n=Jn;return zt=function(t,r,s,i,o){var c=new Error(t);return n(c,r,s,i,o)},zt}var Kt,Xn;function Xs(){if(Xn)return Kt;Xn=1;var n=Gn();return Kt=function(t,r,s){var i=s.config.validateStatus;!s.status||!i||i(s.status)?t(s):r(n("Request failed with status code "+s.status,s.config,null,s.request,s))},Kt}var Gt,Qn;function Qs(){if(Qn)return Gt;Qn=1;var n=se;return Gt=n.isStandardBrowserEnv()?function(){return{write:function(r,s,i,o,c,h){var a=[];a.push(r+"="+encodeURIComponent(s)),n.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(c)&&a.push("domain="+c),h===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(r){var s=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Gt}var Xt,Zn;function Zs(){return Zn||(Zn=1,Xt=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),Xt}var Qt,$n;function $s(){return $n||($n=1,Qt=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}),Qt}var Zt,er;function ei(){if(er)return Zt;er=1;var n=Zs(),e=$s();return Zt=function(r,s){return r&&!n(s)?e(r,s):s},Zt}var $t,tr;function ti(){if(tr)return $t;tr=1;var n=se,e=["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"];return $t=function(r){var s={},i,o,c;return r&&n.forEach(r.split(`
2
- `),function(a){if(c=a.indexOf(":"),i=n.trim(a.substr(0,c)).toLowerCase(),o=n.trim(a.substr(c+1)),i){if(s[i]&&e.indexOf(i)>=0)return;i==="set-cookie"?s[i]=(s[i]?s[i]:[]).concat([o]):s[i]=s[i]?s[i]+", "+o:o}}),s},$t}var en,nr;function ni(){if(nr)return en;nr=1;var n=se;return en=n.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),s;function i(o){var c=o;return t&&(r.setAttribute("href",c),c=r.href),r.setAttribute("href",c),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return s=i(window.location.href),function(c){var h=n.isString(c)?i(c):c;return h.protocol===s.protocol&&h.host===s.host}}():function(){return function(){return!0}}(),en}var tn,rr;function bt(){if(rr)return tn;rr=1;function n(e){this.message=e}return n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,tn=n,tn}var nn,sr;function ir(){if(sr)return nn;sr=1;var n=se,e=Xs(),t=Qs(),r=Yn,s=ei(),i=ti(),o=ni(),c=Gn(),h=zn,a=bt();return nn=function(l){return new Promise(function(v,w){var E=l.data,U=l.headers,b=l.responseType,T;function k(){l.cancelToken&&l.cancelToken.unsubscribe(T),l.signal&&l.signal.removeEventListener("abort",T)}n.isFormData(E)&&delete U["Content-Type"];var g=new XMLHttpRequest;if(l.auth){var M=l.auth.username||"",V=l.auth.password?unescape(encodeURIComponent(l.auth.password)):"";U.Authorization="Basic "+btoa(M+":"+V)}var L=s(l.baseURL,l.url);g.open(l.method.toUpperCase(),r(L,l.params,l.paramsSerializer),!0),g.timeout=l.timeout;function R(){if(!!g){var F="getAllResponseHeaders"in g?i(g.getAllResponseHeaders()):null,$=!b||b==="text"||b==="json"?g.responseText:g.response,te={data:$,status:g.status,statusText:g.statusText,headers:F,config:l,request:g};e(function(H){v(H),k()},function(H){w(H),k()},te),g=null}}if("onloadend"in g?g.onloadend=R:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(R)},g.onabort=function(){!g||(w(c("Request aborted",l,"ECONNABORTED",g)),g=null)},g.onerror=function(){w(c("Network Error",l,null,g)),g=null},g.ontimeout=function(){var $=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",te=l.transitional||h;l.timeoutErrorMessage&&($=l.timeoutErrorMessage),w(c($,l,te.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",g)),g=null},n.isStandardBrowserEnv()){var W=(l.withCredentials||o(L))&&l.xsrfCookieName?t.read(l.xsrfCookieName):void 0;W&&(U[l.xsrfHeaderName]=W)}"setRequestHeader"in g&&n.forEach(U,function($,te){typeof E>"u"&&te.toLowerCase()==="content-type"?delete U[te]:g.setRequestHeader(te,$)}),n.isUndefined(l.withCredentials)||(g.withCredentials=!!l.withCredentials),b&&b!=="json"&&(g.responseType=l.responseType),typeof l.onDownloadProgress=="function"&&g.addEventListener("progress",l.onDownloadProgress),typeof l.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",l.onUploadProgress),(l.cancelToken||l.signal)&&(T=function(F){!g||(w(!F||F&&F.type?new a("canceled"):F),g.abort(),g=null)},l.cancelToken&&l.cancelToken.subscribe(T),l.signal&&(l.signal.aborted?T():l.signal.addEventListener("abort",T))),E||(E=null),g.send(E)})},nn}var Q=se,or=Gs,ri=Jn,si=zn,ii={"Content-Type":"application/x-www-form-urlencoded"};function ar(n,e){!Q.isUndefined(n)&&Q.isUndefined(n["Content-Type"])&&(n["Content-Type"]=e)}function oi(){var n;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(n=ir()),n}function ai(n,e,t){if(Q.isString(n))try{return(e||JSON.parse)(n),Q.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}var _t={transitional:si,adapter:oi(),transformRequest:[function(e,t){return or(t,"Accept"),or(t,"Content-Type"),Q.isFormData(e)||Q.isArrayBuffer(e)||Q.isBuffer(e)||Q.isStream(e)||Q.isFile(e)||Q.isBlob(e)?e:Q.isArrayBufferView(e)?e.buffer:Q.isURLSearchParams(e)?(ar(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Q.isObject(e)||t&&t["Content-Type"]==="application/json"?(ar(t,"application/json"),ai(e)):e}],transformResponse:[function(e){var t=this.transitional||_t.transitional,r=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,i=!r&&this.responseType==="json";if(i||s&&Q.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(i)throw o.name==="SyntaxError"?ri(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Q.forEach(["delete","get","head"],function(e){_t.headers[e]={}}),Q.forEach(["post","put","patch"],function(e){_t.headers[e]=Q.merge(ii)});var rn=_t,ui=se,ci=rn,li=function(e,t,r){var s=this||ci;return ui.forEach(r,function(o){e=o.call(s,e,t)}),e},sn,ur;function cr(){return ur||(ur=1,sn=function(e){return!!(e&&e.__CANCEL__)}),sn}var lr=se,on=li,fi=cr(),hi=rn,di=bt();function an(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new di("canceled")}var pi=function(e){an(e),e.headers=e.headers||{},e.data=on.call(e,e.data,e.headers,e.transformRequest),e.headers=lr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),lr.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var t=e.adapter||hi.adapter;return t(e).then(function(s){return an(e),s.data=on.call(e,s.data,s.headers,e.transformResponse),s},function(s){return fi(s)||(an(e),s&&s.response&&(s.response.data=on.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})},oe=se,fr=function(e,t){t=t||{};var r={};function s(f,l){return oe.isPlainObject(f)&&oe.isPlainObject(l)?oe.merge(f,l):oe.isPlainObject(l)?oe.merge({},l):oe.isArray(l)?l.slice():l}function i(f){if(oe.isUndefined(t[f])){if(!oe.isUndefined(e[f]))return s(void 0,e[f])}else return s(e[f],t[f])}function o(f){if(!oe.isUndefined(t[f]))return s(void 0,t[f])}function c(f){if(oe.isUndefined(t[f])){if(!oe.isUndefined(e[f]))return s(void 0,e[f])}else return s(void 0,t[f])}function h(f){if(f in t)return s(e[f],t[f]);if(f in e)return s(void 0,e[f])}var a={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:h};return oe.forEach(Object.keys(e).concat(Object.keys(t)),function(l){var y=a[l]||i,v=y(l);oe.isUndefined(v)&&y!==h||(r[l]=v)}),r},un,hr;function dr(){return hr||(hr=1,un={version:"0.26.1"}),un}var vi=dr().version,cn={};["object","boolean","number","function","string","symbol"].forEach(function(n,e){cn[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});var pr={};cn.transitional=function(e,t,r){function s(i,o){return"[Axios v"+vi+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return function(i,o,c){if(e===!1)throw new Error(s(o," has been removed"+(t?" in "+t:"")));return t&&!pr[o]&&(pr[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,c):!0}};function yi(n,e,t){if(typeof n!="object")throw new TypeError("options must be an object");for(var r=Object.keys(n),s=r.length;s-- >0;){var i=r[s],o=e[i];if(o){var c=n[i],h=c===void 0||o(c,i,n);if(h!==!0)throw new TypeError("option "+i+" must be "+h);continue}if(t!==!0)throw Error("Unknown option "+i)}}var mi={assertOptions:yi,validators:cn},vr=se,gi=Yn,yr=zs,mr=pi,wt=fr,gr=mi,Me=gr.validators;function tt(n){this.defaults=n,this.interceptors={request:new yr,response:new yr}}tt.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=wt(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;r!==void 0&&gr.assertOptions(r,{silentJSONParsing:Me.transitional(Me.boolean),forcedJSONParsing:Me.transitional(Me.boolean),clarifyTimeoutError:Me.transitional(Me.boolean)},!1);var s=[],i=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(t)===!1||(i=i&&v.synchronous,s.unshift(v.fulfilled,v.rejected))});var o=[];this.interceptors.response.forEach(function(v){o.push(v.fulfilled,v.rejected)});var c;if(!i){var h=[mr,void 0];for(Array.prototype.unshift.apply(h,s),h=h.concat(o),c=Promise.resolve(t);h.length;)c=c.then(h.shift(),h.shift());return c}for(var a=t;s.length;){var f=s.shift(),l=s.shift();try{a=f(a)}catch(y){l(y);break}}try{c=mr(a)}catch(y){return Promise.reject(y)}for(;o.length;)c=c.then(o.shift(),o.shift());return c},tt.prototype.getUri=function(e){return e=wt(this.defaults,e),gi(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},vr.forEach(["delete","get","head","options"],function(e){tt.prototype[e]=function(t,r){return this.request(wt(r||{},{method:e,url:t,data:(r||{}).data}))}}),vr.forEach(["post","put","patch"],function(e){tt.prototype[e]=function(t,r,s){return this.request(wt(s||{},{method:e,url:t,data:r}))}});var bi=tt,ln,br;function _i(){if(br)return ln;br=1;var n=bt();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(o){r=o});var s=this;this.promise.then(function(i){if(!!s._listeners){var o,c=s._listeners.length;for(o=0;o<c;o++)s._listeners[o](i);s._listeners=null}}),this.promise.then=function(i){var o,c=new Promise(function(h){s.subscribe(h),o=h}).then(i);return c.cancel=function(){s.unsubscribe(o)},c},t(function(o){s.reason||(s.reason=new n(o),r(s.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]},e.prototype.unsubscribe=function(r){if(!!this._listeners){var s=this._listeners.indexOf(r);s!==-1&&this._listeners.splice(s,1)}},e.source=function(){var r,s=new e(function(o){r=o});return{token:s,cancel:r}},ln=e,ln}var fn,_r;function wi(){return _r||(_r=1,fn=function(e){return function(r){return e.apply(null,r)}}),fn}var hn,wr;function Ei(){if(wr)return hn;wr=1;var n=se;return hn=function(t){return n.isObject(t)&&t.isAxiosError===!0},hn}var Er=se,Si=jn,Et=bi,Ri=fr,Ci=rn;function Sr(n){var e=new Et(n),t=Si(Et.prototype.request,e);return Er.extend(t,Et.prototype,e),Er.extend(t,e),t.create=function(s){return Sr(Ri(n,s))},t}var de=Sr(Ci);de.Axios=Et,de.Cancel=bt(),de.CancelToken=_i(),de.isCancel=cr(),de.VERSION=dr().version,de.all=function(e){return Promise.all(e)},de.spread=wi(),de.isAxiosError=Ei(),Wt.exports=de,Wt.exports.default=de,function(n){n.exports=Wt.exports}(Vn),Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.getRequestHeaders=Ve.getAxiosClient=void 0;var Ti=Vn.exports;function Oi(n,e,t,r){return Ti.default.create({baseURL:n,headers:Rr(e,r,t),withCredentials:!0})}Ve.getAxiosClient=Oi;function Rr(n,e,t){n===void 0&&(n=!1);var r={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return n&&e&&t&&(r.Authorization="".concat(e," ").concat(t())),typeof window<"u"&&typeof document<"u"&&(window.location&&(r["X-Frappe-Site-Name"]=window.location.hostname),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(r["X-Frappe-CSRF-Token"]=window.csrf_token)),r}Ve.getRequestHeaders=Rr;var Cr;function xi(){if(Cr)return Qe;Cr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.FrappeApp=void 0;var n=Or(),e=Ze,t=$e,r=et,s=Ve,i=function(){function o(c,h,a){var f,l;this.url=c,this.name=a!=null?a:"FrappeApp",this.useToken=(f=h==null?void 0:h.useToken)!==null&&f!==void 0?f:!1,this.token=h==null?void 0:h.token,this.tokenType=(l=h==null?void 0:h.type)!==null&&l!==void 0?l:"Bearer",this.axios=(0,s.getAxiosClient)(this.url,this.useToken,this.token,this.tokenType)}return o.prototype.auth=function(){return new n.FrappeAuth(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.db=function(){return new t.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)},o.prototype.call=function(){return new e.FrappeCall(this.url,this.axios,this.useToken,this.token,this.tokenType)},o}();return Qe.FrappeApp=i,Qe}var St={},pe=N&&N.__assign||function(){return pe=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},pe.apply(this,arguments)},Rt=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(f){try{a(r.next(f))}catch(l){o(l)}}function h(f){try{a(r.throw(f))}catch(l){o(l)}}function a(f){f.done?i(f.value):s(f.value).then(c,h)}a((r=r.apply(n,e||[])).next())})},Ct=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(f){return h([a,f])}}function h(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(f){a=[6,f],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(St,"__esModule",{value:!0}),St.FrappeAuth=void 0;var Ai=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.loginWithUsernamePassword=function(e){return Rt(this,void 0,void 0,function(){var t,r,s;return Ct(this,function(i){return t=e.username,r=e.password,s=e.device,[2,this.axios.post("/api/method/login",{usr:t,pwd:r,device:s}).then(function(o){return o.data}).catch(function(o){var c,h;throw pe(pe({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:(c=o.response.data.message)!==null&&c!==void 0?c:"There was an error while logging in",exception:(h=o.response.data.exception)!==null&&h!==void 0?h:""})})]})})},n.prototype.getLoggedInUser=function(){return Rt(this,void 0,void 0,function(){return Ct(this,function(e){return[2,this.axios.get("/api/method/frappe.auth.get_logged_user").then(function(t){return t.data.message}).catch(function(t){var r;throw pe(pe({},t.response.data),{httpStatus:t.response.status,httpStatusText:t.response.statusText,message:"There was an error while fetching the logged in user",exception:(r=t.response.data.exception)!==null&&r!==void 0?r:""})})]})})},n.prototype.logout=function(){return Rt(this,void 0,void 0,function(){return Ct(this,function(e){return[2,this.axios.post("/api/method/logout",{}).then(function(){}).catch(function(t){var r,s;throw pe(pe({},t.response.data),{httpStatus:t.response.status,httpStatusText:t.response.statusText,message:(r=t.response.data.message)!==null&&r!==void 0?r:"There was an error while logging out",exception:(s=t.response.data.exception)!==null&&s!==void 0?s:""})})]})})},n.prototype.forgetPassword=function(e){return Rt(this,void 0,void 0,function(){return Ct(this,function(t){return[2,this.axios.post("/",{cmd:"frappe.core.doctype.user.user.reset_password",user:e}).then(function(){}).catch(function(r){var s,i;throw pe(pe({},r.response.data),{httpStatus:r.response.status,httpStatusText:r.response.statusText,message:(s=r.response.data.message)!==null&&s!==void 0?s:"There was an error sending password reset email.",exception:(i=r.response.data.exception)!==null&&i!==void 0?i:""})})]})})},n}();St.FrappeAuth=Ai;var Tr;function Or(){return Tr||(Tr=1,function(n){var e=N&&N.__createBinding||(Object.create?function(r,s,i,o){o===void 0&&(o=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(r,o,c)}:function(r,s,i,o){o===void 0&&(o=i),r[o]=s[i]}),t=N&&N.__exportStar||function(r,s){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,r,i)};Object.defineProperty(n,"__esModule",{value:!0}),t(xi(),n),t(St,n),t($e,n),t(et,n),t(Ze,n)}(Mt)),Mt}var ki=Or(),xr={exports:{}},dn={};/**
1
+ (function(A,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],d):(A=typeof globalThis<"u"?globalThis:A||self,d(A["Frappe React"]={},A.React))})(this,function(A,d){"use strict";var ka=Object.defineProperty;var Da=(A,d,Ue)=>d in A?ka(A,d,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):A[d]=Ue;var Ie=(A,d,Ue)=>(Da(A,typeof d!="symbol"?d+"":d,Ue),Ue);const Le=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(d);var N=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Mt={},Qe={},Ze={},ae=N&&N.__assign||function(){return ae=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},ae.apply(this,arguments)},pt=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{a(r.next(h))}catch(l){o(l)}}function f(h){try{a(r.throw(h))}catch(l){o(l)}}function a(h){h.done?i(h.value):s(h.value).then(c,f)}a((r=r.apply(n,e||[])).next())})},vt=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(h){return f([a,h])}}function f(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(h){a=[6,h],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(Ze,"__esModule",{value:!0}),Ze.FrappeCall=void 0;var Ts=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.get=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.get("/api/method/".concat(e),{params:t}).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n.prototype.post=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.post("/api/method/".concat(e),ae({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n.prototype.put=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.put("/api/method/".concat(e),ae({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n.prototype.delete=function(e,t){return pt(this,void 0,void 0,function(){return vt(this,function(r){return[2,this.axios.delete("/api/method/".concat(e),{params:t}).then(function(s){return s.data}).catch(function(s){var i,o;throw ae(ae({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error.",exception:(o=s.response.data.exception)!==null&&o!==void 0?o:""})})]})})},n}();Ze.FrappeCall=Ts;var $e={},Y=N&&N.__assign||function(){return Y=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},Y.apply(this,arguments)},Ne=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{a(r.next(h))}catch(l){o(l)}}function f(h){try{a(r.throw(h))}catch(l){o(l)}}function a(h){h.done?i(h.value):s(h.value).then(c,f)}a((r=r.apply(n,e||[])).next())})},Fe=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(h){return f([a,h])}}function f(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(h){a=[6,h],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty($e,"__esModule",{value:!0}),$e.FrappeDB=void 0;var Os=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.getDoc=function(e,t){return t===void 0&&(t=""),Ne(this,void 0,void 0,function(){return Fe(this,function(r){return[2,this.axios.get("/api/resource/".concat(e,"/").concat(t)).then(function(s){return s.data.data}).catch(function(s){var i,o;throw Y(Y({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:"There was an error while fetching the document.",exception:(o=(i=s.response.data.exception)!==null&&i!==void 0?i:s.response.data.exc_type)!==null&&o!==void 0?o:""})})]})})},n.prototype.getDocList=function(e,t){var r;return Ne(this,void 0,void 0,function(){var s,i,o,c,f,a,h,l,v,y,w;return Fe(this,function(E){return s={},t&&(i=t.fields,o=t.filters,c=t.orFilters,f=t.orderBy,a=t.limit,h=t.limit_start,l=t.groupBy,v=t.asDict,y=v===void 0?!0:v,w=f?"".concat(String(f==null?void 0:f.field)," ").concat((r=f==null?void 0:f.order)!==null&&r!==void 0?r:"asc"):"",s={fields:i?JSON.stringify(i):void 0,filters:o?JSON.stringify(o):void 0,or_filters:c?JSON.stringify(c):void 0,order_by:w,group_by:l,limit:a,limit_start:h,as_dict:y}),[2,this.axios.get("/api/resource/".concat(e),{params:s}).then(function(x){return x.data.data}).catch(function(x){var b,T;throw Y(Y({},x.response.data),{httpStatus:x.response.status,httpStatusText:x.response.statusText,message:"There was an error while fetching the documents.",exception:(T=(b=x.response.data.exception)!==null&&b!==void 0?b:x.response.data.exc_type)!==null&&T!==void 0?T:""})})]})})},n.prototype.createDoc=function(e,t){return Ne(this,void 0,void 0,function(){return Fe(this,function(r){return[2,this.axios.post("/api/resource/".concat(e),Y({},t)).then(function(s){return s.data.data}).catch(function(s){var i,o,c;throw Y(Y({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:(i=s.response.data.message)!==null&&i!==void 0?i:"There was an error while creating the document.",exception:(c=(o=s.response.data.exception)!==null&&o!==void 0?o:s.response.data.exc_type)!==null&&c!==void 0?c:""})})]})})},n.prototype.updateDoc=function(e,t,r){return Ne(this,void 0,void 0,function(){return Fe(this,function(s){return[2,this.axios.put("/api/resource/".concat(e,"/").concat(t),Y({},r)).then(function(i){return i.data.data}).catch(function(i){var o,c,f;throw Y(Y({},i.response.data),{httpStatus:i.response.status,httpStatusText:i.response.statusText,message:(o=i.response.data.message)!==null&&o!==void 0?o:"There was an error while updating the document.",exception:(f=(c=i.response.data.exception)!==null&&c!==void 0?c:i.response.data.exc_type)!==null&&f!==void 0?f:""})})]})})},n.prototype.deleteDoc=function(e,t){return Ne(this,void 0,void 0,function(){return Fe(this,function(r){return[2,this.axios.delete("/api/resource/".concat(e,"/").concat(t)).then(function(s){return s.data}).catch(function(s){var i,o;throw Y(Y({},s.response.data),{httpStatus:s.response.status,httpStatusText:s.response.statusText,message:"There was an error while deleting the document.",exception:(o=(i=s.response.data.exception)!==null&&i!==void 0?i:s.response.data.exc_type)!==null&&o!==void 0?o:""})})]})})},n.prototype.getCount=function(e,t,r,s){return r===void 0&&(r=!1),s===void 0&&(s=!1),Ne(this,void 0,void 0,function(){var i;return Fe(this,function(o){return i={doctype:e,filters:[]},r&&(i.cache=r),s&&(i.debug=s),t&&(i.filters=t?JSON.stringify(t):void 0),[2,this.axios.get("/api/method/frappe.client.get_count",{params:i}).then(function(c){return c.data.message}).catch(function(c){var f,a;throw Y(Y({},c.response.data),{httpStatus:c.response.status,httpStatusText:c.response.statusText,message:"There was an error while getting the count.",exception:(a=(f=c.response.data.exception)!==null&&f!==void 0?f:c.response.data.exc_type)!==null&&a!==void 0?a:""})})]})})},n.prototype.getLastDoc=function(e,t){return Ne(this,void 0,void 0,function(){var r,s;return Fe(this,function(i){switch(i.label){case 0:return r={orderBy:{field:"creation",order:"desc"}},t&&(r=Y(Y({},r),t)),[4,this.getDocList(e,Y(Y({},r),{limit:1,fields:["name"]}))];case 1:return s=i.sent(),s.length>0?[2,this.getDoc(e,s[0].name)]:[2,{}]}})})},n}();$e.FrappeDB=Os;var et={},yt=N&&N.__assign||function(){return yt=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},yt.apply(this,arguments)},xs=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{a(r.next(h))}catch(l){o(l)}}function f(h){try{a(r.throw(h))}catch(l){o(l)}}function a(h){h.done?i(h.value):s(h.value).then(c,f)}a((r=r.apply(n,e||[])).next())})},As=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(h){return f([a,h])}}function f(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(h){a=[6,h],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(et,"__esModule",{value:!0}),et.FrappeFileUpload=void 0;var ks=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.uploadFile=function(e,t,r){return xs(this,void 0,void 0,function(){var s,i,o,c,f,a,h;return As(this,function(l){return s=new FormData,e&&s.append("file",e,e.name),i=t.isPrivate,o=t.folder,c=t.file_url,f=t.doctype,a=t.docname,h=t.fieldname,i&&s.append("is_private","1"),o&&s.append("folder",o),c&&s.append("file_url",c),f&&a&&(s.append("doctype",f),s.append("docname",a),h&&s.append("fieldname",h)),[2,this.axios.post("/api/method/upload_file",s,{onUploadProgress:function(v){r&&r(v.loaded,v.total)}}).catch(function(v){var y,w;throw yt(yt({},v.response.data),{httpStatus:v.response.status,httpStatusText:v.response.statusText,message:(y=v.response.data.message)!==null&&y!==void 0?y:"There was an error while uploading the file.",exception:(w=v.response.data.exception)!==null&&w!==void 0?w:""})})]})})},n}();et.FrappeFileUpload=ks;var Ve={},Vn={exports:{}},Wt={exports:{}},jn=function(e,t){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return e.apply(t,s)}},Ds=jn,Oe=Object.prototype.toString;function Ht(n){return Array.isArray(n)}function qt(n){return typeof n>"u"}function Ls(n){return n!==null&&!qt(n)&&n.constructor!==null&&!qt(n.constructor)&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function Mn(n){return Oe.call(n)==="[object ArrayBuffer]"}function Ns(n){return Oe.call(n)==="[object FormData]"}function Fs(n){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Mn(n.buffer),e}function Ps(n){return typeof n=="string"}function Bs(n){return typeof n=="number"}function Wn(n){return n!==null&&typeof n=="object"}function mt(n){if(Oe.call(n)!=="[object Object]")return!1;var e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}function Is(n){return Oe.call(n)==="[object Date]"}function Us(n){return Oe.call(n)==="[object File]"}function Vs(n){return Oe.call(n)==="[object Blob]"}function Hn(n){return Oe.call(n)==="[object Function]"}function js(n){return Wn(n)&&Hn(n.pipe)}function Ms(n){return Oe.call(n)==="[object URLSearchParams]"}function Ws(n){return n.trim?n.trim():n.replace(/^\s+|\s+$/g,"")}function Hs(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Yt(n,e){if(!(n===null||typeof n>"u"))if(typeof n!="object"&&(n=[n]),Ht(n))for(var t=0,r=n.length;t<r;t++)e.call(null,n[t],t,n);else for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&e.call(null,n[s],s,n)}function Jt(){var n={};function e(s,i){mt(n[i])&&mt(s)?n[i]=Jt(n[i],s):mt(s)?n[i]=Jt({},s):Ht(s)?n[i]=s.slice():n[i]=s}for(var t=0,r=arguments.length;t<r;t++)Yt(arguments[t],e);return n}function qs(n,e,t){return Yt(e,function(s,i){t&&typeof s=="function"?n[i]=Ds(s,t):n[i]=s}),n}function Ys(n){return n.charCodeAt(0)===65279&&(n=n.slice(1)),n}var se={isArray:Ht,isArrayBuffer:Mn,isBuffer:Ls,isFormData:Ns,isArrayBufferView:Fs,isString:Ps,isNumber:Bs,isObject:Wn,isPlainObject:mt,isUndefined:qt,isDate:Is,isFile:Us,isBlob:Vs,isFunction:Hn,isStream:js,isURLSearchParams:Ms,isStandardBrowserEnv:Hs,forEach:Yt,merge:Jt,extend:qs,trim:Ws,stripBOM:Ys},je=se;function qn(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Yn=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(je.isURLSearchParams(t))s=t.toString();else{var i=[];je.forEach(t,function(f,a){f===null||typeof f>"u"||(je.isArray(f)?a=a+"[]":f=[f],je.forEach(f,function(l){je.isDate(l)?l=l.toISOString():je.isObject(l)&&(l=JSON.stringify(l)),i.push(qn(a)+"="+qn(l))}))}),s=i.join("&")}if(s){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e},Js=se;function gt(){this.handlers=[]}gt.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1},gt.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},gt.prototype.forEach=function(e){Js.forEach(this.handlers,function(r){r!==null&&e(r)})};var zs=gt,Ks=se,Gs=function(e,t){Ks.forEach(e,function(s,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=s,delete e[i])})},Jn=function(e,t,r,s,i){return e.config=t,r&&(e.code=r),e.request=s,e.response=i,e.isAxiosError=!0,e.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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},zn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},zt,Kn;function Gn(){if(Kn)return zt;Kn=1;var n=Jn;return zt=function(t,r,s,i,o){var c=new Error(t);return n(c,r,s,i,o)},zt}var Kt,Xn;function Xs(){if(Xn)return Kt;Xn=1;var n=Gn();return Kt=function(t,r,s){var i=s.config.validateStatus;!s.status||!i||i(s.status)?t(s):r(n("Request failed with status code "+s.status,s.config,null,s.request,s))},Kt}var Gt,Qn;function Qs(){if(Qn)return Gt;Qn=1;var n=se;return Gt=n.isStandardBrowserEnv()?function(){return{write:function(r,s,i,o,c,f){var a=[];a.push(r+"="+encodeURIComponent(s)),n.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(c)&&a.push("domain="+c),f===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(r){var s=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return s?decodeURIComponent(s[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Gt}var Xt,Zn;function Zs(){return Zn||(Zn=1,Xt=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}),Xt}var Qt,$n;function $s(){return $n||($n=1,Qt=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}),Qt}var Zt,er;function ei(){if(er)return Zt;er=1;var n=Zs(),e=$s();return Zt=function(r,s){return r&&!n(s)?e(r,s):s},Zt}var $t,tr;function ti(){if(tr)return $t;tr=1;var n=se,e=["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"];return $t=function(r){var s={},i,o,c;return r&&n.forEach(r.split(`
2
+ `),function(a){if(c=a.indexOf(":"),i=n.trim(a.substr(0,c)).toLowerCase(),o=n.trim(a.substr(c+1)),i){if(s[i]&&e.indexOf(i)>=0)return;i==="set-cookie"?s[i]=(s[i]?s[i]:[]).concat([o]):s[i]=s[i]?s[i]+", "+o:o}}),s},$t}var en,nr;function ni(){if(nr)return en;nr=1;var n=se;return en=n.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),s;function i(o){var c=o;return t&&(r.setAttribute("href",c),c=r.href),r.setAttribute("href",c),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return s=i(window.location.href),function(c){var f=n.isString(c)?i(c):c;return f.protocol===s.protocol&&f.host===s.host}}():function(){return function(){return!0}}(),en}var tn,rr;function bt(){if(rr)return tn;rr=1;function n(e){this.message=e}return n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,tn=n,tn}var nn,sr;function ir(){if(sr)return nn;sr=1;var n=se,e=Xs(),t=Qs(),r=Yn,s=ei(),i=ti(),o=ni(),c=Gn(),f=zn,a=bt();return nn=function(l){return new Promise(function(y,w){var E=l.data,x=l.headers,b=l.responseType,T;function F(){l.cancelToken&&l.cancelToken.unsubscribe(T),l.signal&&l.signal.removeEventListener("abort",T)}n.isFormData(E)&&delete x["Content-Type"];var g=new XMLHttpRequest;if(l.auth){var M=l.auth.username||"",V=l.auth.password?unescape(encodeURIComponent(l.auth.password)):"";x.Authorization="Basic "+btoa(M+":"+V)}var L=s(l.baseURL,l.url);g.open(l.method.toUpperCase(),r(L,l.params,l.paramsSerializer),!0),g.timeout=l.timeout;function R(){if(!!g){var P="getAllResponseHeaders"in g?i(g.getAllResponseHeaders()):null,$=!b||b==="text"||b==="json"?g.responseText:g.response,te={data:$,status:g.status,statusText:g.statusText,headers:P,config:l,request:g};e(function(H){y(H),F()},function(H){w(H),F()},te),g=null}}if("onloadend"in g?g.onloadend=R:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(R)},g.onabort=function(){!g||(w(c("Request aborted",l,"ECONNABORTED",g)),g=null)},g.onerror=function(){w(c("Network Error",l,null,g)),g=null},g.ontimeout=function(){var $=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",te=l.transitional||f;l.timeoutErrorMessage&&($=l.timeoutErrorMessage),w(c($,l,te.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",g)),g=null},n.isStandardBrowserEnv()){var W=(l.withCredentials||o(L))&&l.xsrfCookieName?t.read(l.xsrfCookieName):void 0;W&&(x[l.xsrfHeaderName]=W)}"setRequestHeader"in g&&n.forEach(x,function($,te){typeof E>"u"&&te.toLowerCase()==="content-type"?delete x[te]:g.setRequestHeader(te,$)}),n.isUndefined(l.withCredentials)||(g.withCredentials=!!l.withCredentials),b&&b!=="json"&&(g.responseType=l.responseType),typeof l.onDownloadProgress=="function"&&g.addEventListener("progress",l.onDownloadProgress),typeof l.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",l.onUploadProgress),(l.cancelToken||l.signal)&&(T=function(P){!g||(w(!P||P&&P.type?new a("canceled"):P),g.abort(),g=null)},l.cancelToken&&l.cancelToken.subscribe(T),l.signal&&(l.signal.aborted?T():l.signal.addEventListener("abort",T))),E||(E=null),g.send(E)})},nn}var Q=se,or=Gs,ri=Jn,si=zn,ii={"Content-Type":"application/x-www-form-urlencoded"};function ar(n,e){!Q.isUndefined(n)&&Q.isUndefined(n["Content-Type"])&&(n["Content-Type"]=e)}function oi(){var n;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(n=ir()),n}function ai(n,e,t){if(Q.isString(n))try{return(e||JSON.parse)(n),Q.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}var _t={transitional:si,adapter:oi(),transformRequest:[function(e,t){return or(t,"Accept"),or(t,"Content-Type"),Q.isFormData(e)||Q.isArrayBuffer(e)||Q.isBuffer(e)||Q.isStream(e)||Q.isFile(e)||Q.isBlob(e)?e:Q.isArrayBufferView(e)?e.buffer:Q.isURLSearchParams(e)?(ar(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Q.isObject(e)||t&&t["Content-Type"]==="application/json"?(ar(t,"application/json"),ai(e)):e}],transformResponse:[function(e){var t=this.transitional||_t.transitional,r=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,i=!r&&this.responseType==="json";if(i||s&&Q.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(i)throw o.name==="SyntaxError"?ri(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Q.forEach(["delete","get","head"],function(e){_t.headers[e]={}}),Q.forEach(["post","put","patch"],function(e){_t.headers[e]=Q.merge(ii)});var rn=_t,ui=se,ci=rn,li=function(e,t,r){var s=this||ci;return ui.forEach(r,function(o){e=o.call(s,e,t)}),e},sn,ur;function cr(){return ur||(ur=1,sn=function(e){return!!(e&&e.__CANCEL__)}),sn}var lr=se,on=li,fi=cr(),hi=rn,di=bt();function an(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new di("canceled")}var pi=function(e){an(e),e.headers=e.headers||{},e.data=on.call(e,e.data,e.headers,e.transformRequest),e.headers=lr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),lr.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var t=e.adapter||hi.adapter;return t(e).then(function(s){return an(e),s.data=on.call(e,s.data,s.headers,e.transformResponse),s},function(s){return fi(s)||(an(e),s&&s.response&&(s.response.data=on.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})},oe=se,fr=function(e,t){t=t||{};var r={};function s(h,l){return oe.isPlainObject(h)&&oe.isPlainObject(l)?oe.merge(h,l):oe.isPlainObject(l)?oe.merge({},l):oe.isArray(l)?l.slice():l}function i(h){if(oe.isUndefined(t[h])){if(!oe.isUndefined(e[h]))return s(void 0,e[h])}else return s(e[h],t[h])}function o(h){if(!oe.isUndefined(t[h]))return s(void 0,t[h])}function c(h){if(oe.isUndefined(t[h])){if(!oe.isUndefined(e[h]))return s(void 0,e[h])}else return s(void 0,t[h])}function f(h){if(h in t)return s(e[h],t[h]);if(h in e)return s(void 0,e[h])}var a={url:o,method:o,data:o,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:f};return oe.forEach(Object.keys(e).concat(Object.keys(t)),function(l){var v=a[l]||i,y=v(l);oe.isUndefined(y)&&v!==f||(r[l]=y)}),r},un,hr;function dr(){return hr||(hr=1,un={version:"0.26.1"}),un}var vi=dr().version,cn={};["object","boolean","number","function","string","symbol"].forEach(function(n,e){cn[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});var pr={};cn.transitional=function(e,t,r){function s(i,o){return"[Axios v"+vi+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return function(i,o,c){if(e===!1)throw new Error(s(o," has been removed"+(t?" in "+t:"")));return t&&!pr[o]&&(pr[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,c):!0}};function yi(n,e,t){if(typeof n!="object")throw new TypeError("options must be an object");for(var r=Object.keys(n),s=r.length;s-- >0;){var i=r[s],o=e[i];if(o){var c=n[i],f=c===void 0||o(c,i,n);if(f!==!0)throw new TypeError("option "+i+" must be "+f);continue}if(t!==!0)throw Error("Unknown option "+i)}}var mi={assertOptions:yi,validators:cn},vr=se,gi=Yn,yr=zs,mr=pi,wt=fr,gr=mi,Me=gr.validators;function tt(n){this.defaults=n,this.interceptors={request:new yr,response:new yr}}tt.prototype.request=function(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=wt(this.defaults,t),t.method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;r!==void 0&&gr.assertOptions(r,{silentJSONParsing:Me.transitional(Me.boolean),forcedJSONParsing:Me.transitional(Me.boolean),clarifyTimeoutError:Me.transitional(Me.boolean)},!1);var s=[],i=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(t)===!1||(i=i&&y.synchronous,s.unshift(y.fulfilled,y.rejected))});var o=[];this.interceptors.response.forEach(function(y){o.push(y.fulfilled,y.rejected)});var c;if(!i){var f=[mr,void 0];for(Array.prototype.unshift.apply(f,s),f=f.concat(o),c=Promise.resolve(t);f.length;)c=c.then(f.shift(),f.shift());return c}for(var a=t;s.length;){var h=s.shift(),l=s.shift();try{a=h(a)}catch(v){l(v);break}}try{c=mr(a)}catch(v){return Promise.reject(v)}for(;o.length;)c=c.then(o.shift(),o.shift());return c},tt.prototype.getUri=function(e){return e=wt(this.defaults,e),gi(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},vr.forEach(["delete","get","head","options"],function(e){tt.prototype[e]=function(t,r){return this.request(wt(r||{},{method:e,url:t,data:(r||{}).data}))}}),vr.forEach(["post","put","patch"],function(e){tt.prototype[e]=function(t,r,s){return this.request(wt(s||{},{method:e,url:t,data:r}))}});var bi=tt,ln,br;function _i(){if(br)return ln;br=1;var n=bt();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(o){r=o});var s=this;this.promise.then(function(i){if(!!s._listeners){var o,c=s._listeners.length;for(o=0;o<c;o++)s._listeners[o](i);s._listeners=null}}),this.promise.then=function(i){var o,c=new Promise(function(f){s.subscribe(f),o=f}).then(i);return c.cancel=function(){s.unsubscribe(o)},c},t(function(o){s.reason||(s.reason=new n(o),r(s.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.prototype.subscribe=function(r){if(this.reason){r(this.reason);return}this._listeners?this._listeners.push(r):this._listeners=[r]},e.prototype.unsubscribe=function(r){if(!!this._listeners){var s=this._listeners.indexOf(r);s!==-1&&this._listeners.splice(s,1)}},e.source=function(){var r,s=new e(function(o){r=o});return{token:s,cancel:r}},ln=e,ln}var fn,_r;function wi(){return _r||(_r=1,fn=function(e){return function(r){return e.apply(null,r)}}),fn}var hn,wr;function Ei(){if(wr)return hn;wr=1;var n=se;return hn=function(t){return n.isObject(t)&&t.isAxiosError===!0},hn}var Er=se,Si=jn,Et=bi,Ri=fr,Ci=rn;function Sr(n){var e=new Et(n),t=Si(Et.prototype.request,e);return Er.extend(t,Et.prototype,e),Er.extend(t,e),t.create=function(s){return Sr(Ri(n,s))},t}var de=Sr(Ci);de.Axios=Et,de.Cancel=bt(),de.CancelToken=_i(),de.isCancel=cr(),de.VERSION=dr().version,de.all=function(e){return Promise.all(e)},de.spread=wi(),de.isAxiosError=Ei(),Wt.exports=de,Wt.exports.default=de,function(n){n.exports=Wt.exports}(Vn),Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.getRequestHeaders=Ve.getAxiosClient=void 0;var Ti=Vn.exports;function Oi(n,e,t,r){return Ti.default.create({baseURL:n,headers:Rr(e,r,t),withCredentials:!0})}Ve.getAxiosClient=Oi;function Rr(n,e,t){n===void 0&&(n=!1);var r={Accept:"application/json","Content-Type":"application/json; charset=utf-8"};return n&&e&&t&&(r.Authorization="".concat(e," ").concat(t())),typeof window<"u"&&typeof document<"u"&&(window.location&&(r["X-Frappe-Site-Name"]=window.location.hostname),window.csrf_token&&window.csrf_token!=="{{ csrf_token }}"&&(r["X-Frappe-CSRF-Token"]=window.csrf_token)),r}Ve.getRequestHeaders=Rr;var Cr;function xi(){if(Cr)return Qe;Cr=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.FrappeApp=void 0;var n=Or(),e=Ze,t=$e,r=et,s=Ve,i=function(){function o(c,f,a){var h,l;this.url=c,this.name=a!=null?a:"FrappeApp",this.useToken=(h=f==null?void 0:f.useToken)!==null&&h!==void 0?h:!1,this.token=f==null?void 0:f.token,this.tokenType=(l=f==null?void 0:f.type)!==null&&l!==void 0?l:"Bearer",this.axios=(0,s.getAxiosClient)(this.url,this.useToken,this.token,this.tokenType)}return o.prototype.auth=function(){return new n.FrappeAuth(this.url,this.axios,this.useToken,this.token,this.tokenType)},o.prototype.db=function(){return new t.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)},o.prototype.call=function(){return new e.FrappeCall(this.url,this.axios,this.useToken,this.token,this.tokenType)},o}();return Qe.FrappeApp=i,Qe}var St={},pe=N&&N.__assign||function(){return pe=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++){e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[s]=e[s])}return n},pe.apply(this,arguments)},Rt=N&&N.__awaiter||function(n,e,t,r){function s(i){return i instanceof t?i:new t(function(o){o(i)})}return new(t||(t=Promise))(function(i,o){function c(h){try{a(r.next(h))}catch(l){o(l)}}function f(h){try{a(r.throw(h))}catch(l){o(l)}}function a(h){h.done?i(h.value):s(h.value).then(c,f)}a((r=r.apply(n,e||[])).next())})},Ct=N&&N.__generator||function(n,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(a){return function(h){return f([a,h])}}function f(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,s&&(i=a[0]&2?s.return:a[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,a[1])).done)return i;switch(s=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,s=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){t.label=a[1];break}if(a[0]===6&&t.label<i[1]){t.label=i[1],i=a;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(a);break}i[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(h){a=[6,h],s=0}finally{r=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}};Object.defineProperty(St,"__esModule",{value:!0}),St.FrappeAuth=void 0;var Ai=function(){function n(e,t,r,s,i){this.appURL=e,this.axios=t,this.useToken=r!=null?r:!1,this.token=s,this.tokenType=i}return n.prototype.loginWithUsernamePassword=function(e){return Rt(this,void 0,void 0,function(){var t,r,s;return Ct(this,function(i){return t=e.username,r=e.password,s=e.device,[2,this.axios.post("/api/method/login",{usr:t,pwd:r,device:s}).then(function(o){return o.data}).catch(function(o){var c,f;throw pe(pe({},o.response.data),{httpStatus:o.response.status,httpStatusText:o.response.statusText,message:(c=o.response.data.message)!==null&&c!==void 0?c:"There was an error while logging in",exception:(f=o.response.data.exception)!==null&&f!==void 0?f:""})})]})})},n.prototype.getLoggedInUser=function(){return Rt(this,void 0,void 0,function(){return Ct(this,function(e){return[2,this.axios.get("/api/method/frappe.auth.get_logged_user").then(function(t){return t.data.message}).catch(function(t){var r;throw pe(pe({},t.response.data),{httpStatus:t.response.status,httpStatusText:t.response.statusText,message:"There was an error while fetching the logged in user",exception:(r=t.response.data.exception)!==null&&r!==void 0?r:""})})]})})},n.prototype.logout=function(){return Rt(this,void 0,void 0,function(){return Ct(this,function(e){return[2,this.axios.post("/api/method/logout",{}).then(function(){}).catch(function(t){var r,s;throw pe(pe({},t.response.data),{httpStatus:t.response.status,httpStatusText:t.response.statusText,message:(r=t.response.data.message)!==null&&r!==void 0?r:"There was an error while logging out",exception:(s=t.response.data.exception)!==null&&s!==void 0?s:""})})]})})},n.prototype.forgetPassword=function(e){return Rt(this,void 0,void 0,function(){return Ct(this,function(t){return[2,this.axios.post("/",{cmd:"frappe.core.doctype.user.user.reset_password",user:e}).then(function(){}).catch(function(r){var s,i;throw pe(pe({},r.response.data),{httpStatus:r.response.status,httpStatusText:r.response.statusText,message:(s=r.response.data.message)!==null&&s!==void 0?s:"There was an error sending password reset email.",exception:(i=r.response.data.exception)!==null&&i!==void 0?i:""})})]})})},n}();St.FrappeAuth=Ai;var Tr;function Or(){return Tr||(Tr=1,function(n){var e=N&&N.__createBinding||(Object.create?function(r,s,i,o){o===void 0&&(o=i);var c=Object.getOwnPropertyDescriptor(s,i);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(r,o,c)}:function(r,s,i,o){o===void 0&&(o=i),r[o]=s[i]}),t=N&&N.__exportStar||function(r,s){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,r,i)};Object.defineProperty(n,"__esModule",{value:!0}),t(xi(),n),t(St,n),t($e,n),t(et,n),t(Ze,n)}(Mt)),Mt}var ki=Or(),xr={exports:{}},dn={};/**
3
3
  * @license React
4
4
  * use-sync-external-store-shim.production.min.js
5
5
  *
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var Ar;function Di(){if(Ar)return dn;Ar=1;var n=Le.default;function e(l,y){return l===y&&(l!==0||1/l===1/y)||l!==l&&y!==y}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,s=n.useEffect,i=n.useLayoutEffect,o=n.useDebugValue;function c(l,y){var v=y(),w=r({inst:{value:v,getSnapshot:y}}),E=w[0].inst,U=w[1];return i(function(){E.value=v,E.getSnapshot=y,h(E)&&U({inst:E})},[l,v,y]),s(function(){return h(E)&&U({inst:E}),l(function(){h(E)&&U({inst:E})})},[l]),o(v),v}function h(l){var y=l.getSnapshot;l=l.value;try{var v=y();return!t(l,v)}catch{return!0}}function a(l,y){return y()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:c;return dn.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:f,dn}var pn={};/**
10
+ */var Ar;function Di(){if(Ar)return dn;Ar=1;var n=Le.default;function e(l,v){return l===v&&(l!==0||1/l===1/v)||l!==l&&v!==v}var t=typeof Object.is=="function"?Object.is:e,r=n.useState,s=n.useEffect,i=n.useLayoutEffect,o=n.useDebugValue;function c(l,v){var y=v(),w=r({inst:{value:y,getSnapshot:v}}),E=w[0].inst,x=w[1];return i(function(){E.value=y,E.getSnapshot=v,f(E)&&x({inst:E})},[l,y,v]),s(function(){return f(E)&&x({inst:E}),l(function(){f(E)&&x({inst:E})})},[l]),o(y),y}function f(l){var v=l.getSnapshot;l=l.value;try{var y=v();return!t(l,y)}catch{return!0}}function a(l,v){return v()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:c;return dn.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:h,dn}var pn={};/**
11
11
  * @license React
12
12
  * use-sync-external-store-shim.development.js
13
13
  *
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var kr;function Li(){return kr||(kr=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=Le.default,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(k){{for(var g=arguments.length,M=new Array(g>1?g-1:0),V=1;V<g;V++)M[V-1]=arguments[V];r("error",k,M)}}function r(k,g,M){{var V=e.ReactDebugCurrentFrame,L=V.getStackAddendum();L!==""&&(g+="%s",M=M.concat([L]));var R=M.map(function(W){return String(W)});R.unshift("Warning: "+g),Function.prototype.apply.call(console[k],console,R)}}function s(k,g){return k===g&&(k!==0||1/k===1/g)||k!==k&&g!==g}var i=typeof Object.is=="function"?Object.is:s,o=n.useState,c=n.useEffect,h=n.useLayoutEffect,a=n.useDebugValue,f=!1,l=!1;function y(k,g,M){f||n.startTransition!==void 0&&(f=!0,t("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 V=g();if(!l){var L=g();i(V,L)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var R=o({inst:{value:V,getSnapshot:g}}),W=R[0].inst,F=R[1];return h(function(){W.value=V,W.getSnapshot=g,v(W)&&F({inst:W})},[k,V,g]),c(function(){v(W)&&F({inst:W});var $=function(){v(W)&&F({inst:W})};return k($)},[k]),a(V),V}function v(k){var g=k.getSnapshot,M=k.value;try{var V=g();return!i(M,V)}catch{return!0}}function w(k,g,M){return g()}var E=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",U=!E,b=U?w:y,T=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;pn.useSyncExternalStore=T,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),pn}(function(n){process.env.NODE_ENV==="production"?n.exports=Di():n.exports=Li()})(xr);const xe=()=>{},ue=xe(),vn=Object,A=n=>n===ue,ge=n=>typeof n=="function",Ae=(n,e)=>({...n,...e}),Ni=n=>ge(n.then),Tt=new WeakMap;let Fi=0;const nt=n=>{const e=typeof n,t=n&&n.constructor,r=t==Date;let s,i;if(vn(n)===n&&!r&&t!=RegExp){if(s=Tt.get(n),s)return s;if(s=++Fi+"~",Tt.set(n,s),t==Array){for(s="@",i=0;i<n.length;i++)s+=nt(n[i])+",";Tt.set(n,s)}if(t==vn){s="#";const o=vn.keys(n).sort();for(;!A(i=o.pop());)A(n[i])||(s+=i+":"+nt(n[i])+",");Tt.set(n,s)}}else s=r?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return s},be=new WeakMap,yn={},Ot={},mn="undefined",xt=typeof window!=mn,gn=typeof document!=mn,Pi=()=>xt&&typeof window.requestAnimationFrame!=mn,Dr=(n,e)=>{const t=be.get(n);return[()=>!A(e)&&n.get(e)||yn,r=>{if(!A(e)){const s=n.get(e);e in Ot||(Ot[e]=s),t[5](e,Ae(s,r),s||yn)}},t[6],()=>!A(e)&&e in Ot?Ot[e]:!A(e)&&n.get(e)||yn]};let bn=!0;const Bi=()=>bn,[_n,wn]=xt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[xe,xe],Ii=()=>{const n=gn&&document.visibilityState;return A(n)||n!=="hidden"},Ui=n=>(gn&&document.addEventListener("visibilitychange",n),_n("focus",n),()=>{gn&&document.removeEventListener("visibilitychange",n),wn("focus",n)}),Vi=n=>{const e=()=>{bn=!0,n()},t=()=>{bn=!1};return _n("online",e),_n("offline",t),()=>{wn("online",e),wn("offline",t)}},ji={isOnline:Bi,isVisible:Ii},Mi={initFocus:Ui,initReconnect:Vi},Lr=!Le.default.useId,rt=!xt||"Deno"in window,Wi=n=>Pi()?window.requestAnimationFrame(n):setTimeout(n,1),En=rt?d.useEffect:d.useLayoutEffect,Sn=typeof navigator<"u"&&navigator.connection,Nr=!rt&&Sn&&(["slow-2g","2g"].includes(Sn.effectiveType)||Sn.saveData),Rn=n=>{if(ge(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?nt(n):"",[n,e]};let Hi=0;const Cn=()=>++Hi,Fr=0,Pr=1,Br=2;var st={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Fr,MUTATE_EVENT:Br,RECONNECT_EVENT:Pr};async function Ir(...n){const[e,t,r,s]=n,i=Ae({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const c=i.rollbackOnError;let h=i.optimisticData;const a=i.revalidate!==!1,f=v=>typeof c=="function"?c(v):c!==!1,l=i.throwOnError;if(ge(t)){const v=t,w=[],E=e.keys();for(const U of E)!/^\$(inf|sub)\$/.test(U)&&v(e.get(U)._k)&&w.push(U);return Promise.all(w.map(y))}return y(t);async function y(v){const[w]=Rn(v);if(!w)return;const[E,U]=Dr(e,w),[b,T,k,g]=be.get(e),M=b[w],V=()=>a&&(delete k[w],delete g[w],M&&M[0])?M[0](Br).then(()=>E().data):E().data;if(n.length<3)return V();let L=r,R;const W=Cn();T[w]=[W,0];const F=!A(h),$=E(),te=$.data,ee=$._c,H=A(ee)?te:ee;if(F&&(h=ge(h)?h(H,te):h,U({data:h,_c:H})),ge(L))try{L=L(H)}catch(we){R=we}if(L&&Ni(L))if(L=await L.catch(we=>{R=we}),W!==T[w][0]){if(R)throw R;return L}else R&&F&&f(R)&&(o=!0,L=H,U({data:L,_c:ue}));o&&(R||(ge(o)&&(L=o(L,H)),U({data:L,error:ue,_c:ue}))),T[w][1]=Cn();const _e=await V();if(U({_c:ue}),R){if(l)throw R;return}return o?_e:L}}const Ur=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},qi=(n,e)=>{if(!be.has(n)){const t=Ae(Mi,e),r={},s=Ir.bind(ue,n);let i=xe;const o={},c=(f,l)=>{const y=o[f]||[];return o[f]=y,y.push(l),()=>y.splice(y.indexOf(l),1)},h=(f,l,y)=>{n.set(f,l);const v=o[f];if(v)for(const w of v)w(l,y)},a=()=>{if(!be.has(n)&&(be.set(n,[r,{},{},{},s,h,c]),!rt)){const f=t.initFocus(setTimeout.bind(ue,Ur.bind(ue,r,Fr))),l=t.initReconnect(setTimeout.bind(ue,Ur.bind(ue,r,Pr)));i=()=>{f&&f(),l&&l(),be.delete(n)}}};return a(),[n,s,a,i]}return[n,be.get(n)[4]]},Yi=(n,e,t,r,s)=>{const i=t.errorRetryCount,o=s.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!A(i)&&o>i||setTimeout(r,c,s)},Ji=(n,e)=>nt(n)==nt(e),[Vr,zi]=qi(new Map),Ki=Ae({onLoadingSlow:xe,onSuccess:xe,onError:xe,onErrorRetry:Yi,onDiscarded:xe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Nr?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Nr?5e3:3e3,compare:Ji,isPaused:()=>!1,cache:Vr,mutate:zi,fallback:{}},ji),Gi=(n,e)=>{const t=Ae(n,e);if(e){const{use:r,fallback:s}=n,{use:i,fallback:o}=e;r&&i&&(t.use=r.concat(i)),s&&o&&(t.fallback=Ae(s,o))}return t},Xi=d.createContext({}),jr=xt&&window.__SWR_DEVTOOLS_USE__,Qi=jr?window.__SWR_DEVTOOLS_USE__:[],Zi=()=>{jr&&(window.__SWR_DEVTOOLS_REACT__=Le.default)},$i=n=>ge(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],eo=()=>Ae(Ki,d.useContext(Xi)),to=n=>(e,t,r)=>n(e,t&&((...i)=>{const[o]=Rn(e),[,,,c]=be.get(Vr),h=c[o];return A(h)?t(...i):(delete c[o],h)}),r),no=Qi.concat(to),ro=n=>function(...t){const r=eo(),[s,i,o]=$i(t),c=Gi(r,o);let h=n;const{use:a}=c,f=(a||[]).concat(no);for(let l=f.length;l--;)h=f[l](h);return h(s,i||c.fetcher||null,c)},so=(n,e,t)=>{const r=e[n]||(e[n]=[]);return r.push(t),()=>{const s=r.indexOf(t);s>=0&&(r[s]=r[r.length-1],r.pop())}};Zi();const Mr=Le.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Tn={dedupe:!0},it=ro((n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:h,refreshInterval:a,refreshWhenHidden:f,refreshWhenOffline:l,keepPreviousData:y}=t,[v,w,E,U]=be.get(r),[b,T]=Rn(n),k=d.useRef(!1),g=d.useRef(!1),M=d.useRef(b),V=d.useRef(e),L=d.useRef(t),R=()=>L.current,W=()=>R().isVisible()&&R().isOnline(),[F,$,te,ee]=Dr(r,b),H=d.useRef({}).current,_e=A(o)?t.fallback[b]:o,we=(P,B)=>{for(const X in H){const j=X;if(j==="data"){if(!s(P[j],B[j])&&(!A(P[j])||!s(He,B[j])))return!1}else if(B[j]!==P[j])return!1}return!0},lt=d.useMemo(()=>{const P=(()=>!b||!e?!1:A(c)?R().isPaused()||i?!1:A(h)?!0:h:c)(),B=K=>{const he=Ae(K);return delete he._k,P?{isValidating:!0,isLoading:!0,...he}:he},X=F(),j=ee(),ne=B(X),Ce=X===j?ne:B(j);let z=ne;return[()=>{const K=B(F());return we(K,z)?(z.data=K.data,z.isLoading=K.isLoading,z.isValidating=K.isValidating,z.error=K.error,z):(z=K,K)},()=>Ce]},[r,b]),Ee=xr.exports.useSyncExternalStore(d.useCallback(P=>te(b,(B,X)=>{we(X,B)||P()}),[r,b]),lt[0],lt[1]),ft=!k.current,Bt=v[b]&&v[b].length>0,Se=Ee.data,Re=A(Se)?_e:Se,Pe=Ee.error,It=d.useRef(Re),He=y?A(Se)?It.current:Se:Re,qe=(()=>Bt&&!A(Pe)?!1:ft&&!A(c)?c:R().isPaused()?!1:i?A(Re)?!1:h:A(Re)||h)(),Ye=!!(b&&e&&ft&&qe),Je=A(Ee.isValidating)?Ye:Ee.isValidating,ht=A(Ee.isLoading)?Ye:Ee.isLoading,me=d.useCallback(async P=>{const B=V.current;if(!b||!B||g.current||R().isPaused())return!1;let X,j,ne=!0;const Ce=P||{},z=!E[b]||!Ce.dedupe,K=()=>Lr?!g.current&&b===M.current&&k.current:b===M.current,he={isValidating:!1,isLoading:!1},Vt=()=>{$(he)},ze=()=>{const ie=E[b];ie&&ie[1]===j&&delete E[b]},jt={isValidating:!0};A(F().data)&&(jt.isLoading=!0);try{if(z&&($(jt),t.loadingTimeout&&A(F().data)&&setTimeout(()=>{ne&&K()&&R().onLoadingSlow(b,t)},t.loadingTimeout),E[b]=[B(T),Cn()]),[X,j]=E[b],X=await X,z&&setTimeout(ze,t.dedupingInterval),!E[b]||E[b][1]!==j)return z&&K()&&R().onDiscarded(b),!1;he.error=ue;const ie=w[b];if(!A(ie)&&(j<=ie[0]||j<=ie[1]||ie[1]===0))return Vt(),z&&K()&&R().onDiscarded(b),!1;const ce=F().data;he.data=s(ce,X)?ce:X,z&&K()&&R().onSuccess(X,b,t)}catch(ie){ze();const ce=R(),{shouldRetryOnError:Ke}=ce;ce.isPaused()||(he.error=ie,z&&K()&&(ce.onError(ie,b,ce),(Ke===!0||ge(Ke)&&Ke(ie))&&W()&&ce.onErrorRetry(ie,b,ce,Be=>{const dt=v[b];dt&&dt[0]&&dt[0](st.ERROR_REVALIDATE_EVENT,Be)},{retryCount:(Ce.retryCount||0)+1,dedupe:!0})))}return ne=!1,Vt(),!0},[b,r]),Ut=d.useCallback((...P)=>Ir(r,M.current,...P),[]);if(En(()=>{V.current=e,L.current=t,A(Se)||(It.current=Se)}),En(()=>{if(!b)return;const P=me.bind(ue,Tn);let B=0;const j=so(b,v,(ne,Ce={})=>{if(ne==st.FOCUS_EVENT){const z=Date.now();R().revalidateOnFocus&&z>B&&W()&&(B=z+R().focusThrottleInterval,P())}else if(ne==st.RECONNECT_EVENT)R().revalidateOnReconnect&&W()&&P();else{if(ne==st.MUTATE_EVENT)return me();if(ne==st.ERROR_REVALIDATE_EVENT)return me(Ce)}});return g.current=!1,M.current=b,k.current=!0,$({_k:T}),qe&&(A(Re)||rt?P():Wi(P)),()=>{g.current=!0,j()}},[b]),En(()=>{let P;function B(){const j=ge(a)?a(F().data):a;j&&P!==-1&&(P=setTimeout(X,j))}function X(){!F().error&&(f||R().isVisible())&&(l||R().isOnline())?me(Tn).then(B):B()}return B(),()=>{P&&(clearTimeout(P),P=-1)}},[a,f,l,b]),d.useDebugValue(He),i&&A(Re)&&b){if(!Lr&&rt)throw new Error("Fallback data is required when using suspense in SSR.");V.current=e,L.current=t,g.current=!1;const P=U[b];if(!A(P)){const B=Ut(P);Mr(B)}if(A(Pe)){const B=me(Tn);A(He)||(B.status="fulfilled",B.value=!0),Mr(B)}else throw Pe}return{mutate:Ut,get data(){return H.data=!0,He},get error(){return H.error=!0,Pe},get isValidating(){return H.isValidating=!0,Je},get isLoading(){return H.isLoading=!0,ht}}}),ve=Object.create(null);ve.open="0",ve.close="1",ve.ping="2",ve.pong="3",ve.message="4",ve.upgrade="5",ve.noop="6";const At=Object.create(null);Object.keys(ve).forEach(n=>{At[ve[n]]=n});const io={type:"error",data:"parser error"},oo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ao=typeof ArrayBuffer=="function",uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Wr=({type:n,data:e},t,r)=>oo&&e instanceof Blob?t?r(e):Hr(e,r):ao&&(e instanceof ArrayBuffer||uo(e))?t?r(e):Hr(new Blob([e]),r):r(ve[n]+(e||"")),Hr=(n,e)=>{const t=new FileReader;return t.onload=function(){const r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(n)},qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<qr.length;n++)ot[qr.charCodeAt(n)]=n;const co=n=>{let e=n.length*.75,t=n.length,r,s=0,i,o,c,h;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const a=new ArrayBuffer(e),f=new Uint8Array(a);for(r=0;r<t;r+=4)i=ot[n.charCodeAt(r)],o=ot[n.charCodeAt(r+1)],c=ot[n.charCodeAt(r+2)],h=ot[n.charCodeAt(r+3)],f[s++]=i<<2|o>>4,f[s++]=(o&15)<<4|c>>2,f[s++]=(c&3)<<6|h&63;return a},lo=typeof ArrayBuffer=="function",Yr=(n,e)=>{if(typeof n!="string")return{type:"message",data:Jr(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:fo(n.substring(1),e)}:At[t]?n.length>1?{type:At[t],data:n.substring(1)}:{type:At[t]}:io},fo=(n,e)=>{if(lo){const t=co(n);return Jr(t,e)}else return{base64:!0,data:n}},Jr=(n,e)=>{switch(e){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},zr=String.fromCharCode(30),ho=(n,e)=>{const t=n.length,r=new Array(t);let s=0;n.forEach((i,o)=>{Wr(i,!1,c=>{r[o]=c,++s===t&&e(r.join(zr))})})},po=(n,e)=>{const t=n.split(zr),r=[];for(let s=0;s<t.length;s++){const i=Yr(t[s],e);if(r.push(i),i.type==="error")break}return r},Kr=4;function J(n){if(n)return vo(n)}function vo(n){for(var e in J.prototype)n[e]=J.prototype[e];return n}J.prototype.on=J.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},J.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},J.prototype.off=J.prototype.removeListener=J.prototype.removeAllListeners=J.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+n],this},J.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this},J.prototype.emitReserved=J.prototype.emit,J.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},J.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ke=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Gr(n,...e){return e.reduce((t,r)=>(n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}const yo=setTimeout,mo=clearTimeout;function kt(n,e){e.useNativeTimers?(n.setTimeoutFn=yo.bind(ke),n.clearTimeoutFn=mo.bind(ke)):(n.setTimeoutFn=setTimeout.bind(ke),n.clearTimeoutFn=clearTimeout.bind(ke))}const go=1.33;function bo(n){return typeof n=="string"?_o(n):Math.ceil((n.byteLength||n.size)*go)}function _o(n){let e=0,t=0;for(let r=0,s=n.length;r<s;r++)e=n.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}class wo extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Xr extends J{constructor(e){super(),this.writable=!1,kt(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new wo(e,t,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(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 t=Yr(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const Qr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),On=64,Eo={};let Zr=0,Dt=0,$r;function es(n){let e="";do e=Qr[n%On]+e,n=Math.floor(n/On);while(n>0);return e}function ts(){const n=es(+new Date);return n!==$r?(Zr=0,$r=n):n+"."+es(Zr++)}for(;Dt<On;Dt++)Eo[Qr[Dt]]=Dt;function ns(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function So(n){let e={},t=n.split("&");for(let r=0,s=t.length;r<s;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}let rs=!1;try{rs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ro=rs;function ss(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ro))return new XMLHttpRequest}catch{}if(!e)try{return new ke[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Co(){}const To=function(){return new ss({xdomain:!1}).responseType!=null}();class Oo extends Xr{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port,this.xs=e.secure!==r}const t=e&&e.forceBase64;this.supportsBinary=To&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=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)};po(e,this.socket.binaryType).forEach(t),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,ho(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=ts()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ye(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}}class ye extends J{constructor(e,t){super(),kt(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){const e=Gr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new ss(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ye.requestsCount++,ye.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=Co,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ye.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(ye.requestsCount=0,ye.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",is);else if(typeof addEventListener=="function"){const n="onpagehide"in ke?"pagehide":"unload";addEventListener(n,is,!1)}}function is(){for(let n in ye.requests)ye.requests.hasOwnProperty(n)&&ye.requests[n].abort()}const xo=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Lt=ke.WebSocket||ke.MozWebSocket,os=!0,Ao="arraybuffer",as=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ko extends Xr{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=as?{}:Gr(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=os&&!as?t?new Lt(e,t):new Lt(e):new Lt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType||Ao,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 t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Wr(r,this.supportsBinary,i=>{const o={};try{os&&this.ws.send(i)}catch{}s&&xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=ts()),this.supportsBinary||(e.b64=1);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}check(){return!!Lt}}const Do={websocket:ko,polling:Oo},Lo=/^(?:(?![^:@]+:[^:@\/]*@)(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 xn(n){const e=n,t=n.indexOf("["),r=n.indexOf("]");t!=-1&&r!=-1&&(n=n.substring(0,t)+n.substring(t,r).replace(/:/g,";")+n.substring(r,n.length));let s=Lo.exec(n||""),i={},o=14;for(;o--;)i[No[o]]=s[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Fo(i,i.path),i.queryKey=Po(i,i.query),i}function Fo(n,e){const t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Po(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(t[s]=i)}),t}class De extends J{constructor(e,t={}){super(),e&&typeof e=="object"&&(t=e,e=null),e?(e=xn(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=xn(t.host).host),kt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=So(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 t=Object.assign({},this.opts.query);t.EIO=Kr,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Do[e](r)}open(){let e;if(this.opts.rememberUpgrade&&De.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",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),r=!1;De.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!r)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;De.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const y=new Error("probe error");y.transport=t.name,this.emitReserved("upgradeError",y)}}))};function i(){r||(r=!0,f(),t.close(),t=null)}const o=l=>{const y=new Error("probe error: "+l);y.transport=t.name,i(),this.emitReserved("upgradeError",y)};function c(){o("transport closed")}function h(){o("socket closed")}function a(l){t&&l.name!==t.name&&i()}const f=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",h),this.off("upgrading",a)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",h),this.once("upgrading",a),t.open()}onOpen(){if(this.readyState="open",De.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e<t;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"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);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 t=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(t+=bo(s)),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};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){De.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(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,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}De.protocol=Kr;function Bo(n,e="",t){let r=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),r=xn(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}const Io=typeof ArrayBuffer=="function",Uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,us=Object.prototype.toString,Vo=typeof Blob=="function"||typeof Blob<"u"&&us.call(Blob)==="[object BlobConstructor]",jo=typeof File=="function"||typeof File<"u"&&us.call(File)==="[object FileConstructor]";function An(n){return Io&&(n instanceof ArrayBuffer||Uo(n))||Vo&&n instanceof Blob||jo&&n instanceof File}function Nt(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,r=n.length;t<r;t++)if(Nt(n[t]))return!0;return!1}if(An(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Nt(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Nt(n[t]))return!0;return!1}function Mo(n){const e=[],t=n.data,r=n;return r.data=kn(t,e),r.attachments=e.length,{packet:r,buffers:e}}function kn(n,e){if(!n)return n;if(An(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let r=0;r<n.length;r++)t[r]=kn(n[r],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=kn(n[r],e));return t}return n}function Wo(n,e){return n.data=Dn(n.data,e),delete n.attachments,n}function Dn(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Dn(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Dn(n[t],e));return n}const Ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],qo=5;var S;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(S||(S={}));class Yo{constructor(e){this.replacer=e}encode(e){return(e.type===S.EVENT||e.type===S.ACK)&&Nt(e)?this.encodeAsBinary({type:e.type===S.EVENT?S.BINARY_EVENT:S.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===S.BINARY_EVENT||e.type===S.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Mo(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}}function cs(n){return Object.prototype.toString.call(n)==="[object Object]"}class Ln extends J{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===S.BINARY_EVENT;r||t.type===S.BINARY_ACK?(t.type=r?S.EVENT:S.ACK,this.reconstructor=new Jo(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(An(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(S[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===S.BINARY_EVENT||r.type===S.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";const s=e.charAt(t+1);if(s!==""&&Number(s)==s){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Ln.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case S.CONNECT:return cs(t);case S.DISCONNECT:return t===void 0;case S.CONNECT_ERROR:return typeof t=="string"||cs(t);case S.EVENT:case S.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ho.indexOf(t[0])===-1);case S.ACK:case S.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Jo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Wo(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zo=Object.freeze(Object.defineProperty({__proto__:null,protocol:qo,get PacketType(){return S},Encoder:Yo,Decoder:Ln},Symbol.toStringTag,{value:"Module"}));function fe(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ko=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ls extends J{constructor(e,t,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[fe(e,"open",this.onopen.bind(this)),fe(e,"packet",this.onpacket.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(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,...t){if(Ko.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');t.unshift(e);const r={type:S.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,c=t.pop();this._registerAckCallback(o,c),r.id=o}const s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){const r=this.flags.timeout;if(r===void 0){this.acks[e]=t;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...i)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...i])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:S.CONNECT,data:e})}):this.packet({type:S.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case S.CONNECT:if(e.data&&e.data.sid){const s=e.data.sid;this.onconnect(s)}else 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 S.EVENT:case S.BINARY_EVENT:this.onevent(e);break;case S.ACK:case S.BINARY_ACK:this.onack(e);break;case S.DISCONNECT:this.ondisconnect();break;case S.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 t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:S.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}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:S.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 t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.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 t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function We(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}We.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0},We.prototype.reset=function(){this.attempts=0},We.prototype.setMin=function(n){this.ms=n},We.prototype.setMax=function(n){this.max=n},We.prototype.setJitter=function(n){this.jitter=n};class Nn extends J{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new We({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||zo;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.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 t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.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 De(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=fe(t,"open",function(){r.onopen(),e&&e()}),i=fe(t,"error",o=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",o),e?e(o):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&s();const c=this.setTimeoutFn(()=>{s(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(fe(e,"ping",this.onping.bind(this)),fe(e,"data",this.ondata.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(e,"close",this.onclose.bind(this)),fe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r||(r=new ls(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[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,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),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 t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const at={};function Ft(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Bo(n,e.path||"/socket.io"),r=t.source,s=t.id,i=t.path,o=at[s]&&i in at[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let h;return c?h=new Nn(r,e):(at[s]||(at[s]=new Nn(r,e)),h=at[s]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(Ft,{Manager:Nn,Socket:ls,io:Ft,connect:Ft});class Go{constructor(e,t){Ie(this,"socket_port");Ie(this,"host");Ie(this,"port");Ie(this,"protocol");Ie(this,"url");Ie(this,"socket");var r,s;this.socket_port=t!=null?t:"9000",this.host=(r=window.location)==null?void 0:r.hostname,this.port=(s=window.location)!=null&&s.port?`:${this.socket_port}`:"",this.protocol=this.port?"http":"https",this.url=e||`${this.protocol}://${this.host}${this.port}`,this.socket=Ft(this.url,{withCredentials:!0})}}var fs={exports:{}},ut={};/**
18
+ */var kr;function Li(){return kr||(kr=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=Le.default,e=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function t(F){{for(var g=arguments.length,M=new Array(g>1?g-1:0),V=1;V<g;V++)M[V-1]=arguments[V];r("error",F,M)}}function r(F,g,M){{var V=e.ReactDebugCurrentFrame,L=V.getStackAddendum();L!==""&&(g+="%s",M=M.concat([L]));var R=M.map(function(W){return String(W)});R.unshift("Warning: "+g),Function.prototype.apply.call(console[F],console,R)}}function s(F,g){return F===g&&(F!==0||1/F===1/g)||F!==F&&g!==g}var i=typeof Object.is=="function"?Object.is:s,o=n.useState,c=n.useEffect,f=n.useLayoutEffect,a=n.useDebugValue,h=!1,l=!1;function v(F,g,M){h||n.startTransition!==void 0&&(h=!0,t("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 V=g();if(!l){var L=g();i(V,L)||(t("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var R=o({inst:{value:V,getSnapshot:g}}),W=R[0].inst,P=R[1];return f(function(){W.value=V,W.getSnapshot=g,y(W)&&P({inst:W})},[F,V,g]),c(function(){y(W)&&P({inst:W});var $=function(){y(W)&&P({inst:W})};return F($)},[F]),a(V),V}function y(F){var g=F.getSnapshot,M=F.value;try{var V=g();return!i(M,V)}catch{return!0}}function w(F,g,M){return g()}var E=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x=!E,b=x?w:v,T=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:b;pn.useSyncExternalStore=T,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),pn}(function(n){process.env.NODE_ENV==="production"?n.exports=Di():n.exports=Li()})(xr);const xe=()=>{},ue=xe(),vn=Object,k=n=>n===ue,ge=n=>typeof n=="function",Ae=(n,e)=>({...n,...e}),Ni=n=>ge(n.then),Tt=new WeakMap;let Fi=0;const nt=n=>{const e=typeof n,t=n&&n.constructor,r=t==Date;let s,i;if(vn(n)===n&&!r&&t!=RegExp){if(s=Tt.get(n),s)return s;if(s=++Fi+"~",Tt.set(n,s),t==Array){for(s="@",i=0;i<n.length;i++)s+=nt(n[i])+",";Tt.set(n,s)}if(t==vn){s="#";const o=vn.keys(n).sort();for(;!k(i=o.pop());)k(n[i])||(s+=i+":"+nt(n[i])+",");Tt.set(n,s)}}else s=r?n.toJSON():e=="symbol"?n.toString():e=="string"?JSON.stringify(n):""+n;return s},be=new WeakMap,yn={},Ot={},mn="undefined",xt=typeof window!=mn,gn=typeof document!=mn,Pi=()=>xt&&typeof window.requestAnimationFrame!=mn,Dr=(n,e)=>{const t=be.get(n);return[()=>!k(e)&&n.get(e)||yn,r=>{if(!k(e)){const s=n.get(e);e in Ot||(Ot[e]=s),t[5](e,Ae(s,r),s||yn)}},t[6],()=>!k(e)&&e in Ot?Ot[e]:!k(e)&&n.get(e)||yn]};let bn=!0;const Bi=()=>bn,[_n,wn]=xt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[xe,xe],Ii=()=>{const n=gn&&document.visibilityState;return k(n)||n!=="hidden"},Ui=n=>(gn&&document.addEventListener("visibilitychange",n),_n("focus",n),()=>{gn&&document.removeEventListener("visibilitychange",n),wn("focus",n)}),Vi=n=>{const e=()=>{bn=!0,n()},t=()=>{bn=!1};return _n("online",e),_n("offline",t),()=>{wn("online",e),wn("offline",t)}},ji={isOnline:Bi,isVisible:Ii},Mi={initFocus:Ui,initReconnect:Vi},Lr=!Le.default.useId,rt=!xt||"Deno"in window,Wi=n=>Pi()?window.requestAnimationFrame(n):setTimeout(n,1),En=rt?d.useEffect:d.useLayoutEffect,Sn=typeof navigator<"u"&&navigator.connection,Nr=!rt&&Sn&&(["slow-2g","2g"].includes(Sn.effectiveType)||Sn.saveData),Rn=n=>{if(ge(n))try{n=n()}catch{n=""}const e=n;return n=typeof n=="string"?n:(Array.isArray(n)?n.length:n)?nt(n):"",[n,e]};let Hi=0;const Cn=()=>++Hi,Fr=0,Pr=1,Br=2;var st={__proto__:null,ERROR_REVALIDATE_EVENT:3,FOCUS_EVENT:Fr,MUTATE_EVENT:Br,RECONNECT_EVENT:Pr};async function Ir(...n){const[e,t,r,s]=n,i=Ae({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let o=i.populateCache;const c=i.rollbackOnError;let f=i.optimisticData;const a=i.revalidate!==!1,h=y=>typeof c=="function"?c(y):c!==!1,l=i.throwOnError;if(ge(t)){const y=t,w=[],E=e.keys();for(const x of E)!/^\$(inf|sub)\$/.test(x)&&y(e.get(x)._k)&&w.push(x);return Promise.all(w.map(v))}return v(t);async function v(y){const[w]=Rn(y);if(!w)return;const[E,x]=Dr(e,w),[b,T,F,g]=be.get(e),M=b[w],V=()=>a&&(delete F[w],delete g[w],M&&M[0])?M[0](Br).then(()=>E().data):E().data;if(n.length<3)return V();let L=r,R;const W=Cn();T[w]=[W,0];const P=!k(f),$=E(),te=$.data,ee=$._c,H=k(ee)?te:ee;if(P&&(f=ge(f)?f(H,te):f,x({data:f,_c:H})),ge(L))try{L=L(H)}catch(we){R=we}if(L&&Ni(L))if(L=await L.catch(we=>{R=we}),W!==T[w][0]){if(R)throw R;return L}else R&&P&&h(R)&&(o=!0,L=H,x({data:L,_c:ue}));o&&(R||(ge(o)&&(L=o(L,H)),x({data:L,error:ue,_c:ue}))),T[w][1]=Cn();const _e=await V();if(x({_c:ue}),R){if(l)throw R;return}return o?_e:L}}const Ur=(n,e)=>{for(const t in n)n[t][0]&&n[t][0](e)},qi=(n,e)=>{if(!be.has(n)){const t=Ae(Mi,e),r={},s=Ir.bind(ue,n);let i=xe;const o={},c=(h,l)=>{const v=o[h]||[];return o[h]=v,v.push(l),()=>v.splice(v.indexOf(l),1)},f=(h,l,v)=>{n.set(h,l);const y=o[h];if(y)for(const w of y)w(l,v)},a=()=>{if(!be.has(n)&&(be.set(n,[r,{},{},{},s,f,c]),!rt)){const h=t.initFocus(setTimeout.bind(ue,Ur.bind(ue,r,Fr))),l=t.initReconnect(setTimeout.bind(ue,Ur.bind(ue,r,Pr)));i=()=>{h&&h(),l&&l(),be.delete(n)}}};return a(),[n,s,a,i]}return[n,be.get(n)[4]]},Yi=(n,e,t,r,s)=>{const i=t.errorRetryCount,o=s.retryCount,c=~~((Math.random()+.5)*(1<<(o<8?o:8)))*t.errorRetryInterval;!k(i)&&o>i||setTimeout(r,c,s)},Ji=(n,e)=>nt(n)==nt(e),[Vr,zi]=qi(new Map),Ki=Ae({onLoadingSlow:xe,onSuccess:xe,onError:xe,onErrorRetry:Yi,onDiscarded:xe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Nr?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Nr?5e3:3e3,compare:Ji,isPaused:()=>!1,cache:Vr,mutate:zi,fallback:{}},ji),Gi=(n,e)=>{const t=Ae(n,e);if(e){const{use:r,fallback:s}=n,{use:i,fallback:o}=e;r&&i&&(t.use=r.concat(i)),s&&o&&(t.fallback=Ae(s,o))}return t},Xi=d.createContext({}),jr=xt&&window.__SWR_DEVTOOLS_USE__,Qi=jr?window.__SWR_DEVTOOLS_USE__:[],Zi=()=>{jr&&(window.__SWR_DEVTOOLS_REACT__=Le.default)},$i=n=>ge(n[1])?[n[0],n[1],n[2]||{}]:[n[0],null,(n[1]===null?n[2]:n[1])||{}],eo=()=>Ae(Ki,d.useContext(Xi)),to=n=>(e,t,r)=>n(e,t&&((...i)=>{const[o]=Rn(e),[,,,c]=be.get(Vr),f=c[o];return k(f)?t(...i):(delete c[o],f)}),r),no=Qi.concat(to),ro=n=>function(...t){const r=eo(),[s,i,o]=$i(t),c=Gi(r,o);let f=n;const{use:a}=c,h=(a||[]).concat(no);for(let l=h.length;l--;)f=h[l](f);return f(s,i||c.fetcher||null,c)},so=(n,e,t)=>{const r=e[n]||(e[n]=[]);return r.push(t),()=>{const s=r.indexOf(t);s>=0&&(r[s]=r[r.length-1],r.pop())}};Zi();const Mr=Le.default.use||(n=>{if(n.status==="pending")throw n;if(n.status==="fulfilled")return n.value;throw n.status==="rejected"?n.reason:(n.status="pending",n.then(e=>{n.status="fulfilled",n.value=e},e=>{n.status="rejected",n.reason=e}),n)}),Tn={dedupe:!0},it=ro((n,e,t)=>{const{cache:r,compare:s,suspense:i,fallbackData:o,revalidateOnMount:c,revalidateIfStale:f,refreshInterval:a,refreshWhenHidden:h,refreshWhenOffline:l,keepPreviousData:v}=t,[y,w,E,x]=be.get(r),[b,T]=Rn(n),F=d.useRef(!1),g=d.useRef(!1),M=d.useRef(b),V=d.useRef(e),L=d.useRef(t),R=()=>L.current,W=()=>R().isVisible()&&R().isOnline(),[P,$,te,ee]=Dr(r,b),H=d.useRef({}).current,_e=k(o)?t.fallback[b]:o,we=(B,I)=>{for(const X in H){const j=X;if(j==="data"){if(!s(B[j],I[j])&&(!k(B[j])||!s(He,I[j])))return!1}else if(I[j]!==B[j])return!1}return!0},lt=d.useMemo(()=>{const B=(()=>!b||!e?!1:k(c)?R().isPaused()||i?!1:k(f)?!0:f:c)(),I=K=>{const he=Ae(K);return delete he._k,B?{isValidating:!0,isLoading:!0,...he}:he},X=P(),j=ee(),ne=I(X),Ce=X===j?ne:I(j);let z=ne;return[()=>{const K=I(P());return we(K,z)?(z.data=K.data,z.isLoading=K.isLoading,z.isValidating=K.isValidating,z.error=K.error,z):(z=K,K)},()=>Ce]},[r,b]),Ee=xr.exports.useSyncExternalStore(d.useCallback(B=>te(b,(I,X)=>{we(X,I)||B()}),[r,b]),lt[0],lt[1]),ft=!F.current,Bt=y[b]&&y[b].length>0,Se=Ee.data,Re=k(Se)?_e:Se,Pe=Ee.error,It=d.useRef(Re),He=v?k(Se)?It.current:Se:Re,qe=(()=>Bt&&!k(Pe)?!1:ft&&!k(c)?c:R().isPaused()?!1:i?k(Re)?!1:f:k(Re)||f)(),Ye=!!(b&&e&&ft&&qe),Je=k(Ee.isValidating)?Ye:Ee.isValidating,ht=k(Ee.isLoading)?Ye:Ee.isLoading,me=d.useCallback(async B=>{const I=V.current;if(!b||!I||g.current||R().isPaused())return!1;let X,j,ne=!0;const Ce=B||{},z=!E[b]||!Ce.dedupe,K=()=>Lr?!g.current&&b===M.current&&F.current:b===M.current,he={isValidating:!1,isLoading:!1},Vt=()=>{$(he)},ze=()=>{const ie=E[b];ie&&ie[1]===j&&delete E[b]},jt={isValidating:!0};k(P().data)&&(jt.isLoading=!0);try{if(z&&($(jt),t.loadingTimeout&&k(P().data)&&setTimeout(()=>{ne&&K()&&R().onLoadingSlow(b,t)},t.loadingTimeout),E[b]=[I(T),Cn()]),[X,j]=E[b],X=await X,z&&setTimeout(ze,t.dedupingInterval),!E[b]||E[b][1]!==j)return z&&K()&&R().onDiscarded(b),!1;he.error=ue;const ie=w[b];if(!k(ie)&&(j<=ie[0]||j<=ie[1]||ie[1]===0))return Vt(),z&&K()&&R().onDiscarded(b),!1;const ce=P().data;he.data=s(ce,X)?ce:X,z&&K()&&R().onSuccess(X,b,t)}catch(ie){ze();const ce=R(),{shouldRetryOnError:Ke}=ce;ce.isPaused()||(he.error=ie,z&&K()&&(ce.onError(ie,b,ce),(Ke===!0||ge(Ke)&&Ke(ie))&&W()&&ce.onErrorRetry(ie,b,ce,Be=>{const dt=y[b];dt&&dt[0]&&dt[0](st.ERROR_REVALIDATE_EVENT,Be)},{retryCount:(Ce.retryCount||0)+1,dedupe:!0})))}return ne=!1,Vt(),!0},[b,r]),Ut=d.useCallback((...B)=>Ir(r,M.current,...B),[]);if(En(()=>{V.current=e,L.current=t,k(Se)||(It.current=Se)}),En(()=>{if(!b)return;const B=me.bind(ue,Tn);let I=0;const j=so(b,y,(ne,Ce={})=>{if(ne==st.FOCUS_EVENT){const z=Date.now();R().revalidateOnFocus&&z>I&&W()&&(I=z+R().focusThrottleInterval,B())}else if(ne==st.RECONNECT_EVENT)R().revalidateOnReconnect&&W()&&B();else{if(ne==st.MUTATE_EVENT)return me();if(ne==st.ERROR_REVALIDATE_EVENT)return me(Ce)}});return g.current=!1,M.current=b,F.current=!0,$({_k:T}),qe&&(k(Re)||rt?B():Wi(B)),()=>{g.current=!0,j()}},[b]),En(()=>{let B;function I(){const j=ge(a)?a(P().data):a;j&&B!==-1&&(B=setTimeout(X,j))}function X(){!P().error&&(h||R().isVisible())&&(l||R().isOnline())?me(Tn).then(I):I()}return I(),()=>{B&&(clearTimeout(B),B=-1)}},[a,h,l,b]),d.useDebugValue(He),i&&k(Re)&&b){if(!Lr&&rt)throw new Error("Fallback data is required when using suspense in SSR.");V.current=e,L.current=t,g.current=!1;const B=x[b];if(!k(B)){const I=Ut(B);Mr(I)}if(k(Pe)){const I=me(Tn);k(He)||(I.status="fulfilled",I.value=!0),Mr(I)}else throw Pe}return{mutate:Ut,get data(){return H.data=!0,He},get error(){return H.error=!0,Pe},get isValidating(){return H.isValidating=!0,Je},get isLoading(){return H.isLoading=!0,ht}}}),ve=Object.create(null);ve.open="0",ve.close="1",ve.ping="2",ve.pong="3",ve.message="4",ve.upgrade="5",ve.noop="6";const At=Object.create(null);Object.keys(ve).forEach(n=>{At[ve[n]]=n});const io={type:"error",data:"parser error"},oo=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ao=typeof ArrayBuffer=="function",uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Wr=({type:n,data:e},t,r)=>oo&&e instanceof Blob?t?r(e):Hr(e,r):ao&&(e instanceof ArrayBuffer||uo(e))?t?r(e):Hr(new Blob([e]),r):r(ve[n]+(e||"")),Hr=(n,e)=>{const t=new FileReader;return t.onload=function(){const r=t.result.split(",")[1];e("b"+(r||""))},t.readAsDataURL(n)},qr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ot=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<qr.length;n++)ot[qr.charCodeAt(n)]=n;const co=n=>{let e=n.length*.75,t=n.length,r,s=0,i,o,c,f;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const a=new ArrayBuffer(e),h=new Uint8Array(a);for(r=0;r<t;r+=4)i=ot[n.charCodeAt(r)],o=ot[n.charCodeAt(r+1)],c=ot[n.charCodeAt(r+2)],f=ot[n.charCodeAt(r+3)],h[s++]=i<<2|o>>4,h[s++]=(o&15)<<4|c>>2,h[s++]=(c&3)<<6|f&63;return a},lo=typeof ArrayBuffer=="function",Yr=(n,e)=>{if(typeof n!="string")return{type:"message",data:Jr(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:fo(n.substring(1),e)}:At[t]?n.length>1?{type:At[t],data:n.substring(1)}:{type:At[t]}:io},fo=(n,e)=>{if(lo){const t=co(n);return Jr(t,e)}else return{base64:!0,data:n}},Jr=(n,e)=>{switch(e){case"blob":return n instanceof ArrayBuffer?new Blob([n]):n;case"arraybuffer":default:return n}},zr=String.fromCharCode(30),ho=(n,e)=>{const t=n.length,r=new Array(t);let s=0;n.forEach((i,o)=>{Wr(i,!1,c=>{r[o]=c,++s===t&&e(r.join(zr))})})},po=(n,e)=>{const t=n.split(zr),r=[];for(let s=0;s<t.length;s++){const i=Yr(t[s],e);if(r.push(i),i.type==="error")break}return r},Kr=4;function J(n){if(n)return vo(n)}function vo(n){for(var e in J.prototype)n[e]=J.prototype[e];return n}J.prototype.on=J.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this},J.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this},J.prototype.off=J.prototype.removeListener=J.prototype.removeAllListeners=J.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+n],this},J.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this},J.prototype.emitReserved=J.prototype.emit,J.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},J.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ke=(()=>typeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Gr(n,...e){return e.reduce((t,r)=>(n.hasOwnProperty(r)&&(t[r]=n[r]),t),{})}const yo=setTimeout,mo=clearTimeout;function kt(n,e){e.useNativeTimers?(n.setTimeoutFn=yo.bind(ke),n.clearTimeoutFn=mo.bind(ke)):(n.setTimeoutFn=setTimeout.bind(ke),n.clearTimeoutFn=clearTimeout.bind(ke))}const go=1.33;function bo(n){return typeof n=="string"?_o(n):Math.ceil((n.byteLength||n.size)*go)}function _o(n){let e=0,t=0;for(let r=0,s=n.length;r<s;r++)e=n.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}class wo extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class Xr extends J{constructor(e){super(),this.writable=!1,kt(this,e),this.opts=e,this.query=e.query,this.readyState="",this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new wo(e,t,r)),this}open(){return(this.readyState==="closed"||this.readyState==="")&&(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 t=Yr(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}}const Qr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),On=64,Eo={};let Zr=0,Dt=0,$r;function es(n){let e="";do e=Qr[n%On]+e,n=Math.floor(n/On);while(n>0);return e}function ts(){const n=es(+new Date);return n!==$r?(Zr=0,$r=n):n+"."+es(Zr++)}for(;Dt<On;Dt++)Eo[Qr[Dt]]=Dt;function ns(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function So(n){let e={},t=n.split("&");for(let r=0,s=t.length;r<s;r++){let i=t[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}let rs=!1;try{rs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ro=rs;function ss(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ro))return new XMLHttpRequest}catch{}if(!e)try{return new ke[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Co(){}const To=function(){return new ss({xdomain:!1}).responseType!=null}();class Oo extends Xr{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const r=location.protocol==="https:";let s=location.port;s||(s=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port,this.xs=e.secure!==r}const t=e&&e.forceBase64;this.supportsBinary=To&&!t}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||t()})),this.writable||(r++,this.once("drain",function(){--r||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=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)};po(e,this.socket.binaryType).forEach(t),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,ho(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const t=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=ts()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(t==="https"&&Number(this.opts.port)!==443||t==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ye(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}}class ye extends J{constructor(e,t){super(),kt(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.create()}create(){const e=Gr(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const t=this.xhr=new ss(e);try{t.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&t.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in t&&(t.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(t.timeout=this.opts.requestTimeout),t.onreadystatechange=()=>{t.readyState===4&&(t.status===200||t.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof t.status=="number"?t.status:0)},0))},t.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ye.requestsCount++,ye.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=Co,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ye.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(ye.requestsCount=0,ye.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",is);else if(typeof addEventListener=="function"){const n="onpagehide"in ke?"pagehide":"unload";addEventListener(n,is,!1)}}function is(){for(let n in ye.requests)ye.requests.hasOwnProperty(n)&&ye.requests[n].abort()}const xo=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0))(),Lt=ke.WebSocket||ke.MozWebSocket,os=!0,Ao="arraybuffer",as=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ko extends Xr{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=as?{}:Gr(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=os&&!as?t?new Lt(e,t):new Lt(e):new Lt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType||Ao,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 t=0;t<e.length;t++){const r=e[t],s=t===e.length-1;Wr(r,this.supportsBinary,i=>{const o={};try{os&&this.ws.send(i)}catch{}s&&xo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const t=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(t==="wss"&&Number(this.opts.port)!==443||t==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=ts()),this.supportsBinary||(e.b64=1);const s=ns(e),i=this.opts.hostname.indexOf(":")!==-1;return t+"://"+(i?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(s.length?"?"+s:"")}check(){return!!Lt}}const Do={websocket:ko,polling:Oo},Lo=/^(?:(?![^:@]+:[^:@\/]*@)(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 xn(n){const e=n,t=n.indexOf("["),r=n.indexOf("]");t!=-1&&r!=-1&&(n=n.substring(0,t)+n.substring(t,r).replace(/:/g,";")+n.substring(r,n.length));let s=Lo.exec(n||""),i={},o=14;for(;o--;)i[No[o]]=s[o]||"";return t!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=Fo(i,i.path),i.queryKey=Po(i,i.query),i}function Fo(n,e){const t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Po(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(t[s]=i)}),t}class De extends J{constructor(e,t={}){super(),e&&typeof e=="object"&&(t=e,e=null),e?(e=xn(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=xn(t.host).host),kt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!0},t),this.opts.path=this.opts.path.replace(/\/$/,"")+"/",typeof this.opts.query=="string"&&(this.opts.query=So(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 t=Object.assign({},this.opts.query);t.EIO=Kr,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new Do[e](r)}open(){let e;if(this.opts.rememberUpgrade&&De.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",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),r=!1;De.priorWebsocketSuccess=!1;const s=()=>{r||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!r)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;De.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=t.name,this.emitReserved("upgradeError",v)}}))};function i(){r||(r=!0,h(),t.close(),t=null)}const o=l=>{const v=new Error("probe error: "+l);v.transport=t.name,i(),this.emitReserved("upgradeError",v)};function c(){o("transport closed")}function f(){o("socket closed")}function a(l){t&&l.name!==t.name&&i()}const h=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",f),this.off("upgrading",a)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",f),this.once("upgrading",a),t.open()}onOpen(){if(this.readyState="open",De.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade&&this.transport.pause){let e=0;const t=this.upgrades.length;for(;e<t;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"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);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 t=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(t+=bo(s)),r>0&&t>this.maxPayload)return this.writeBuffer.slice(0,r);t+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};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){De.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(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,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}}De.protocol=Kr;function Bo(n,e="",t){let r=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),r=xn(n)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(t&&t.port===r.port?"":":"+r.port),r}const Io=typeof ArrayBuffer=="function",Uo=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,us=Object.prototype.toString,Vo=typeof Blob=="function"||typeof Blob<"u"&&us.call(Blob)==="[object BlobConstructor]",jo=typeof File=="function"||typeof File<"u"&&us.call(File)==="[object FileConstructor]";function An(n){return Io&&(n instanceof ArrayBuffer||Uo(n))||Vo&&n instanceof Blob||jo&&n instanceof File}function Nt(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,r=n.length;t<r;t++)if(Nt(n[t]))return!0;return!1}if(An(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Nt(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Nt(n[t]))return!0;return!1}function Mo(n){const e=[],t=n.data,r=n;return r.data=kn(t,e),r.attachments=e.length,{packet:r,buffers:e}}function kn(n,e){if(!n)return n;if(An(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let r=0;r<n.length;r++)t[r]=kn(n[r],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=kn(n[r],e));return t}return n}function Wo(n,e){return n.data=Dn(n.data,e),delete n.attachments,n}function Dn(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Dn(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Dn(n[t],e));return n}const Ho=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],qo=5;var S;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(S||(S={}));class Yo{constructor(e){this.replacer=e}encode(e){return(e.type===S.EVENT||e.type===S.ACK)&&Nt(e)?this.encodeAsBinary({type:e.type===S.EVENT?S.BINARY_EVENT:S.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===S.BINARY_EVENT||e.type===S.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Mo(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}}function cs(n){return Object.prototype.toString.call(n)==="[object Object]"}class Ln extends J{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const r=t.type===S.BINARY_EVENT;r||t.type===S.BINARY_ACK?(t.type=r?S.EVENT:S.ACK,this.reconstructor=new Jo(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(An(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const r={type:Number(e.charAt(0))};if(S[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===S.BINARY_EVENT||r.type===S.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(i,t)}else r.nsp="/";const s=e.charAt(t+1);if(s!==""&&Number(s)==s){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Ln.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case S.CONNECT:return cs(t);case S.DISCONNECT:return t===void 0;case S.CONNECT_ERROR:return typeof t=="string"||cs(t);case S.EVENT:case S.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ho.indexOf(t[0])===-1);case S.ACK:case S.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Jo{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Wo(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zo=Object.freeze(Object.defineProperty({__proto__:null,protocol:qo,get PacketType(){return S},Encoder:Yo,Decoder:Ln},Symbol.toStringTag,{value:"Module"}));function fe(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ko=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ls extends J{constructor(e,t,r){super(),this.connected=!1,this.receiveBuffer=[],this.sendBuffer=[],this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[fe(e,"open",this.onopen.bind(this)),fe(e,"packet",this.onpacket.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(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,...t){if(Ko.hasOwnProperty(e))throw new Error('"'+e+'" is a reserved event name');t.unshift(e);const r={type:S.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,c=t.pop();this._registerAckCallback(o,c),r.id=o}const s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,t){const r=this.flags.timeout;if(r===void 0){this.acks[e]=t;return}const s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let i=0;i<this.sendBuffer.length;i++)this.sendBuffer[i].id===e&&this.sendBuffer.splice(i,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...i)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...i])}}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this.packet({type:S.CONNECT,data:e})}):this.packet({type:S.CONNECT,data:this.auth})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case S.CONNECT:if(e.data&&e.data.sid){const s=e.data.sid;this.onconnect(s)}else 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 S.EVENT:case S.BINARY_EVENT:this.onevent(e);break;case S.ACK:case S.BINARY_ACK:this.onack(e);break;case S.DISCONNECT:this.ondisconnect();break;case S.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 t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e)}ack(e){const t=this;let r=!1;return function(...s){r||(r=!0,t.packet({type:S.ACK,id:e,data:s}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e){this.id=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect")}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:S.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 t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.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 t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const r of t)r.apply(this,e.data)}}}function We(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}We.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0},We.prototype.reset=function(){this.attempts=0},We.prototype.setMin=function(n){this.ms=n},We.prototype.setMax=function(n){this.max=n},We.prototype.setJitter=function(n){this.jitter=n};class Nn extends J{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,kt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new We({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||zo;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.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 t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.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 De(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=fe(t,"open",function(){r.onopen(),e&&e()}),i=fe(t,"error",o=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",o),e?e(o):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const o=this._timeout;o===0&&s();const c=this.setTimeoutFn(()=>{s(),t.close(),t.emit("error",new Error("timeout"))},o);this.opts.autoUnref&&c.unref(),this.subs.push(function(){clearTimeout(c)})}return this.subs.push(s),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(fe(e,"ping",this.onping.bind(this)),fe(e,"data",this.ondata.bind(this)),fe(e,"error",this.onerror.bind(this)),fe(e,"close",this.onclose.bind(this)),fe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){this.decoder.add(e)}ondecoded(e){this.emitReserved("packet",e)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r||(r=new ls(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const r of t)if(this.nsps[r].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[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,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),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 t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const at={};function Ft(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=Bo(n,e.path||"/socket.io"),r=t.source,s=t.id,i=t.path,o=at[s]&&i in at[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let f;return c?f=new Nn(r,e):(at[s]||(at[s]=new Nn(r,e)),f=at[s]),t.query&&!e.query&&(e.query=t.queryKey),f.socket(t.path,e)}Object.assign(Ft,{Manager:Nn,Socket:ls,io:Ft,connect:Ft});class Go{constructor(e,t){Ie(this,"socket_port");Ie(this,"host");Ie(this,"port");Ie(this,"protocol");Ie(this,"url");Ie(this,"socket");var r,s;this.socket_port=t!=null?t:"9000",this.host=(r=window.location)==null?void 0:r.hostname,this.port=(s=window.location)!=null&&s.port?`:${this.socket_port}`:"",this.protocol=this.port?"http":"https",this.url=e||`${this.protocol}://${this.host}${this.port}`,this.socket=Ft(this.url,{withCredentials:!0})}}var fs={exports:{}},ut={};/**
19
19
  * @license React
20
20
  * react-jsx-runtime.production.min.js
21
21
  *
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
26
- */var hs;function Xo(){if(hs)return ut;hs=1;var n=Le.default,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,h,a){var f,l={},y=null,v=null;a!==void 0&&(y=""+a),h.key!==void 0&&(y=""+h.key),h.ref!==void 0&&(v=h.ref);for(f in h)r.call(h,f)&&!i.hasOwnProperty(f)&&(l[f]=h[f]);if(c&&c.defaultProps)for(f in h=c.defaultProps,h)l[f]===void 0&&(l[f]=h[f]);return{$$typeof:e,type:c,key:y,ref:v,props:l,_owner:s.current}}return ut.Fragment=t,ut.jsx=o,ut.jsxs=o,ut}var ct={};/**
26
+ */var hs;function Xo(){if(hs)return ut;hs=1;var n=Le.default,e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,f,a){var h,l={},v=null,y=null;a!==void 0&&(v=""+a),f.key!==void 0&&(v=""+f.key),f.ref!==void 0&&(y=f.ref);for(h in f)r.call(f,h)&&!i.hasOwnProperty(h)&&(l[h]=f[h]);if(c&&c.defaultProps)for(h in f=c.defaultProps,f)l[h]===void 0&&(l[h]=f[h]);return{$$typeof:e,type:c,key:v,ref:y,props:l,_owner:s.current}}return ut.Fragment=t,ut.jsx=o,ut.jsxs=o,ut}var ct={};/**
27
27
  * @license React
28
28
  * react-jsx-runtime.development.js
29
29
  *
@@ -31,14 +31,14 @@
31
31
  *
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
- */var ds;function Qo(){return ds||(ds=1,process.env.NODE_ENV!=="production"&&function(){var n=Le.default,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.offscreen"),w=Symbol.iterator,E="@@iterator";function U(u){if(u===null||typeof u!="object")return null;var p=w&&u[w]||u[E];return typeof p=="function"?p:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(u){{for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_<p;_++)m[_-1]=arguments[_];k("error",u,m)}}function k(u,p,m){{var _=b.ReactDebugCurrentFrame,D=_.getStackAddendum();D!==""&&(p+="%s",m=m.concat([D]));var I=m.map(function(O){return String(O)});I.unshift("Warning: "+p),Function.prototype.apply.call(console[u],console,I)}}var g=!1,M=!1,V=!1,L=!1,R=!1,W;W=Symbol.for("react.module.reference");function F(u){return!!(typeof u=="string"||typeof u=="function"||u===r||u===i||R||u===s||u===a||u===f||L||u===v||g||M||V||typeof u=="object"&&u!==null&&(u.$$typeof===y||u.$$typeof===l||u.$$typeof===o||u.$$typeof===c||u.$$typeof===h||u.$$typeof===W||u.getModuleId!==void 0))}function $(u,p,m){var _=u.displayName;if(_)return _;var D=p.displayName||p.name||"";return D!==""?m+"("+D+")":m}function te(u){return u.displayName||"Context"}function ee(u){if(u==null)return null;if(typeof u.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case r:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case a:return"Suspense";case f:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case c:var p=u;return te(p)+".Consumer";case o:var m=u;return te(m._context)+".Provider";case h:return $(u,u.render,"ForwardRef");case l:var _=u.displayName||null;return _!==null?_:ee(u.type)||"Memo";case y:{var D=u,I=D._payload,O=D._init;try{return ee(O(I))}catch{return null}}}return null}var H=Object.assign,_e=0,we,lt,Ee,ft,Bt,Se,Re;function Pe(){}Pe.__reactDisabledLog=!0;function It(){{if(_e===0){we=console.log,lt=console.info,Ee=console.warn,ft=console.error,Bt=console.group,Se=console.groupCollapsed,Re=console.groupEnd;var u={configurable:!0,enumerable:!0,value:Pe,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}_e++}}function He(){{if(_e--,_e===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},u,{value:we}),info:H({},u,{value:lt}),warn:H({},u,{value:Ee}),error:H({},u,{value:ft}),group:H({},u,{value:Bt}),groupCollapsed:H({},u,{value:Se}),groupEnd:H({},u,{value:Re})})}_e<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var qe=b.ReactCurrentDispatcher,Ye;function Je(u,p,m){{if(Ye===void 0)try{throw Error()}catch(D){var _=D.stack.trim().match(/\n( *(at )?)/);Ye=_&&_[1]||""}return`
35
- `+Ye+u}}var ht=!1,me;{var Ut=typeof WeakMap=="function"?WeakMap:Map;me=new Ut}function P(u,p){if(!u||ht)return"";{var m=me.get(u);if(m!==void 0)return m}var _;ht=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var I;I=qe.current,qe.current=null,It();try{if(p){var O=function(){throw Error()};if(Object.defineProperty(O.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(O,[])}catch(Te){_=Te}Reflect.construct(u,[],O)}else{try{O.call()}catch(Te){_=Te}u.call(O.prototype)}}else{try{throw Error()}catch(Te){_=Te}u()}}catch(Te){if(Te&&_&&typeof Te.stack=="string"){for(var C=Te.stack.split(`
34
+ */var ds;function Qo(){return ds||(ds=1,process.env.NODE_ENV!=="production"&&function(){var n=Le.default,e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),l=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),w=Symbol.iterator,E="@@iterator";function x(u){if(u===null||typeof u!="object")return null;var p=w&&u[w]||u[E];return typeof p=="function"?p:null}var b=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(u){{for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_<p;_++)m[_-1]=arguments[_];F("error",u,m)}}function F(u,p,m){{var _=b.ReactDebugCurrentFrame,D=_.getStackAddendum();D!==""&&(p+="%s",m=m.concat([D]));var U=m.map(function(O){return String(O)});U.unshift("Warning: "+p),Function.prototype.apply.call(console[u],console,U)}}var g=!1,M=!1,V=!1,L=!1,R=!1,W;W=Symbol.for("react.module.reference");function P(u){return!!(typeof u=="string"||typeof u=="function"||u===r||u===i||R||u===s||u===a||u===h||L||u===y||g||M||V||typeof u=="object"&&u!==null&&(u.$$typeof===v||u.$$typeof===l||u.$$typeof===o||u.$$typeof===c||u.$$typeof===f||u.$$typeof===W||u.getModuleId!==void 0))}function $(u,p,m){var _=u.displayName;if(_)return _;var D=p.displayName||p.name||"";return D!==""?m+"("+D+")":m}function te(u){return u.displayName||"Context"}function ee(u){if(u==null)return null;if(typeof u.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case r:return"Fragment";case t:return"Portal";case i:return"Profiler";case s:return"StrictMode";case a:return"Suspense";case h:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case c:var p=u;return te(p)+".Consumer";case o:var m=u;return te(m._context)+".Provider";case f:return $(u,u.render,"ForwardRef");case l:var _=u.displayName||null;return _!==null?_:ee(u.type)||"Memo";case v:{var D=u,U=D._payload,O=D._init;try{return ee(O(U))}catch{return null}}}return null}var H=Object.assign,_e=0,we,lt,Ee,ft,Bt,Se,Re;function Pe(){}Pe.__reactDisabledLog=!0;function It(){{if(_e===0){we=console.log,lt=console.info,Ee=console.warn,ft=console.error,Bt=console.group,Se=console.groupCollapsed,Re=console.groupEnd;var u={configurable:!0,enumerable:!0,value:Pe,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}_e++}}function He(){{if(_e--,_e===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:H({},u,{value:we}),info:H({},u,{value:lt}),warn:H({},u,{value:Ee}),error:H({},u,{value:ft}),group:H({},u,{value:Bt}),groupCollapsed:H({},u,{value:Se}),groupEnd:H({},u,{value:Re})})}_e<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var qe=b.ReactCurrentDispatcher,Ye;function Je(u,p,m){{if(Ye===void 0)try{throw Error()}catch(D){var _=D.stack.trim().match(/\n( *(at )?)/);Ye=_&&_[1]||""}return`
35
+ `+Ye+u}}var ht=!1,me;{var Ut=typeof WeakMap=="function"?WeakMap:Map;me=new Ut}function B(u,p){if(!u||ht)return"";{var m=me.get(u);if(m!==void 0)return m}var _;ht=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var U;U=qe.current,qe.current=null,It();try{if(p){var O=function(){throw Error()};if(Object.defineProperty(O.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(O,[])}catch(Te){_=Te}Reflect.construct(u,[],O)}else{try{O.call()}catch(Te){_=Te}u.call(O.prototype)}}else{try{throw Error()}catch(Te){_=Te}u()}}catch(Te){if(Te&&_&&typeof Te.stack=="string"){for(var C=Te.stack.split(`
36
36
  `),re=_.stack.split(`
37
37
  `),q=C.length-1,G=re.length-1;q>=1&&G>=0&&C[q]!==re[G];)G--;for(;q>=1&&G>=0;q--,G--)if(C[q]!==re[G]){if(q!==1||G!==1)do if(q--,G--,G<0||C[q]!==re[G]){var le=`
38
- `+C[q].replace(" at new "," at ");return u.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",u.displayName)),typeof u=="function"&&me.set(u,le),le}while(q>=1&&G>=0);break}}}finally{ht=!1,qe.current=I,He(),Error.prepareStackTrace=D}var Xe=u?u.displayName||u.name:"",Cs=Xe?Je(Xe):"";return typeof u=="function"&&me.set(u,Cs),Cs}function B(u,p,m){return P(u,!1)}function X(u){var p=u.prototype;return!!(p&&p.isReactComponent)}function j(u,p,m){if(u==null)return"";if(typeof u=="function")return P(u,X(u));if(typeof u=="string")return Je(u);switch(u){case a:return Je("Suspense");case f:return Je("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case h:return B(u.render);case l:return j(u.type,p,m);case y:{var _=u,D=_._payload,I=_._init;try{return j(I(D),p,m)}catch{}}}return""}var ne=Object.prototype.hasOwnProperty,Ce={},z=b.ReactDebugCurrentFrame;function K(u){if(u){var p=u._owner,m=j(u.type,u._source,p?p.type:null);z.setExtraStackFrame(m)}else z.setExtraStackFrame(null)}function he(u,p,m,_,D){{var I=Function.call.bind(ne);for(var O in u)if(I(u,O)){var C=void 0;try{if(typeof u[O]!="function"){var re=Error((_||"React class")+": "+m+" type `"+O+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[O]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw re.name="Invariant Violation",re}C=u[O](p,O,_,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(q){C=q}C&&!(C instanceof Error)&&(K(D),T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_||"React class",m,O,typeof C),K(null)),C instanceof Error&&!(C.message in Ce)&&(Ce[C.message]=!0,K(D),T("Failed %s type: %s",m,C.message),K(null))}}}var Vt=Array.isArray;function ze(u){return Vt(u)}function jt(u){{var p=typeof Symbol=="function"&&Symbol.toStringTag,m=p&&u[Symbol.toStringTag]||u.constructor.name||"Object";return m}}function ie(u){try{return ce(u),!1}catch{return!0}}function ce(u){return""+u}function Ke(u){if(ie(u))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jt(u)),ce(u)}var Be=b.ReactCurrentOwner,dt={key:!0,ref:!0,__self:!0,__source:!0},ms,gs,Pn;Pn={};function va(u){if(ne.call(u,"ref")){var p=Object.getOwnPropertyDescriptor(u,"ref").get;if(p&&p.isReactWarning)return!1}return u.ref!==void 0}function ya(u){if(ne.call(u,"key")){var p=Object.getOwnPropertyDescriptor(u,"key").get;if(p&&p.isReactWarning)return!1}return u.key!==void 0}function ma(u,p){if(typeof u.ref=="string"&&Be.current&&p&&Be.current.stateNode!==p){var m=ee(Be.current.type);Pn[m]||(T('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ee(Be.current.type),u.ref),Pn[m]=!0)}}function ga(u,p){{var m=function(){ms||(ms=!0,T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};m.isReactWarning=!0,Object.defineProperty(u,"key",{get:m,configurable:!0})}}function ba(u,p){{var m=function(){gs||(gs=!0,T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};m.isReactWarning=!0,Object.defineProperty(u,"ref",{get:m,configurable:!0})}}var _a=function(u,p,m,_,D,I,O){var C={$$typeof:e,type:u,key:p,ref:m,props:O,_owner:I};return C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(C,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.defineProperty(C,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C};function wa(u,p,m,_,D){{var I,O={},C=null,re=null;m!==void 0&&(Ke(m),C=""+m),ya(p)&&(Ke(p.key),C=""+p.key),va(p)&&(re=p.ref,ma(p,D));for(I in p)ne.call(p,I)&&!dt.hasOwnProperty(I)&&(O[I]=p[I]);if(u&&u.defaultProps){var q=u.defaultProps;for(I in q)O[I]===void 0&&(O[I]=q[I])}if(C||re){var G=typeof u=="function"?u.displayName||u.name||"Unknown":u;C&&ga(O,G),re&&ba(O,G)}return _a(u,C,re,D,_,Be.current,O)}}var Bn=b.ReactCurrentOwner,bs=b.ReactDebugCurrentFrame;function Ge(u){if(u){var p=u._owner,m=j(u.type,u._source,p?p.type:null);bs.setExtraStackFrame(m)}else bs.setExtraStackFrame(null)}var In;In=!1;function Un(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}function _s(){{if(Bn.current){var u=ee(Bn.current.type);if(u)return`
38
+ `+C[q].replace(" at new "," at ");return u.displayName&&le.includes("<anonymous>")&&(le=le.replace("<anonymous>",u.displayName)),typeof u=="function"&&me.set(u,le),le}while(q>=1&&G>=0);break}}}finally{ht=!1,qe.current=U,He(),Error.prepareStackTrace=D}var Xe=u?u.displayName||u.name:"",Cs=Xe?Je(Xe):"";return typeof u=="function"&&me.set(u,Cs),Cs}function I(u,p,m){return B(u,!1)}function X(u){var p=u.prototype;return!!(p&&p.isReactComponent)}function j(u,p,m){if(u==null)return"";if(typeof u=="function")return B(u,X(u));if(typeof u=="string")return Je(u);switch(u){case a:return Je("Suspense");case h:return Je("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case f:return I(u.render);case l:return j(u.type,p,m);case v:{var _=u,D=_._payload,U=_._init;try{return j(U(D),p,m)}catch{}}}return""}var ne=Object.prototype.hasOwnProperty,Ce={},z=b.ReactDebugCurrentFrame;function K(u){if(u){var p=u._owner,m=j(u.type,u._source,p?p.type:null);z.setExtraStackFrame(m)}else z.setExtraStackFrame(null)}function he(u,p,m,_,D){{var U=Function.call.bind(ne);for(var O in u)if(U(u,O)){var C=void 0;try{if(typeof u[O]!="function"){var re=Error((_||"React class")+": "+m+" type `"+O+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[O]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw re.name="Invariant Violation",re}C=u[O](p,O,_,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(q){C=q}C&&!(C instanceof Error)&&(K(D),T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",_||"React class",m,O,typeof C),K(null)),C instanceof Error&&!(C.message in Ce)&&(Ce[C.message]=!0,K(D),T("Failed %s type: %s",m,C.message),K(null))}}}var Vt=Array.isArray;function ze(u){return Vt(u)}function jt(u){{var p=typeof Symbol=="function"&&Symbol.toStringTag,m=p&&u[Symbol.toStringTag]||u.constructor.name||"Object";return m}}function ie(u){try{return ce(u),!1}catch{return!0}}function ce(u){return""+u}function Ke(u){if(ie(u))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",jt(u)),ce(u)}var Be=b.ReactCurrentOwner,dt={key:!0,ref:!0,__self:!0,__source:!0},ms,gs,Pn;Pn={};function va(u){if(ne.call(u,"ref")){var p=Object.getOwnPropertyDescriptor(u,"ref").get;if(p&&p.isReactWarning)return!1}return u.ref!==void 0}function ya(u){if(ne.call(u,"key")){var p=Object.getOwnPropertyDescriptor(u,"key").get;if(p&&p.isReactWarning)return!1}return u.key!==void 0}function ma(u,p){if(typeof u.ref=="string"&&Be.current&&p&&Be.current.stateNode!==p){var m=ee(Be.current.type);Pn[m]||(T('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ee(Be.current.type),u.ref),Pn[m]=!0)}}function ga(u,p){{var m=function(){ms||(ms=!0,T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};m.isReactWarning=!0,Object.defineProperty(u,"key",{get:m,configurable:!0})}}function ba(u,p){{var m=function(){gs||(gs=!0,T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",p))};m.isReactWarning=!0,Object.defineProperty(u,"ref",{get:m,configurable:!0})}}var _a=function(u,p,m,_,D,U,O){var C={$$typeof:e,type:u,key:p,ref:m,props:O,_owner:U};return C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(C,"_self",{configurable:!1,enumerable:!1,writable:!1,value:_}),Object.defineProperty(C,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C};function wa(u,p,m,_,D){{var U,O={},C=null,re=null;m!==void 0&&(Ke(m),C=""+m),ya(p)&&(Ke(p.key),C=""+p.key),va(p)&&(re=p.ref,ma(p,D));for(U in p)ne.call(p,U)&&!dt.hasOwnProperty(U)&&(O[U]=p[U]);if(u&&u.defaultProps){var q=u.defaultProps;for(U in q)O[U]===void 0&&(O[U]=q[U])}if(C||re){var G=typeof u=="function"?u.displayName||u.name||"Unknown":u;C&&ga(O,G),re&&ba(O,G)}return _a(u,C,re,D,_,Be.current,O)}}var Bn=b.ReactCurrentOwner,bs=b.ReactDebugCurrentFrame;function Ge(u){if(u){var p=u._owner,m=j(u.type,u._source,p?p.type:null);bs.setExtraStackFrame(m)}else bs.setExtraStackFrame(null)}var In;In=!1;function Un(u){return typeof u=="object"&&u!==null&&u.$$typeof===e}function _s(){{if(Bn.current){var u=ee(Bn.current.type);if(u)return`
39
39
 
40
40
  Check the render method of \``+u+"`."}return""}}function Ea(u){{if(u!==void 0){var p=u.fileName.replace(/^.*[\\\/]/,""),m=u.lineNumber;return`
41
41
 
42
42
  Check your code at `+p+":"+m+"."}return""}}var ws={};function Sa(u){{var p=_s();if(!p){var m=typeof u=="string"?u:u.displayName||u.name;m&&(p=`
43
43
 
44
- Check the top-level render call using <`+m+">.")}return p}}function Es(u,p){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var m=Sa(p);if(ws[m])return;ws[m]=!0;var _="";u&&u._owner&&u._owner!==Bn.current&&(_=" It was passed a child from "+ee(u._owner.type)+"."),Ge(u),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,_),Ge(null)}}function Ss(u,p){{if(typeof u!="object")return;if(ze(u))for(var m=0;m<u.length;m++){var _=u[m];Un(_)&&Es(_,p)}else if(Un(u))u._store&&(u._store.validated=!0);else if(u){var D=U(u);if(typeof D=="function"&&D!==u.entries)for(var I=D.call(u),O;!(O=I.next()).done;)Un(O.value)&&Es(O.value,p)}}}function Ra(u){{var p=u.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===h||p.$$typeof===l))m=p.propTypes;else return;if(m){var _=ee(p);he(m,u.props,"prop",_,u)}else if(p.PropTypes!==void 0&&!In){In=!0;var D=ee(p);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ca(u){{for(var p=Object.keys(u.props),m=0;m<p.length;m++){var _=p[m];if(_!=="children"&&_!=="key"){Ge(u),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),Ge(null);break}}u.ref!==null&&(Ge(u),T("Invalid attribute `ref` supplied to `React.Fragment`."),Ge(null))}}function Rs(u,p,m,_,D,I){{var O=F(u);if(!O){var C="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=Ea(D);re?C+=re:C+=_s();var q;u===null?q="null":ze(u)?q="array":u!==void 0&&u.$$typeof===e?(q="<"+(ee(u.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):q=typeof u,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,C)}var G=wa(u,p,m,D,I);if(G==null)return G;if(O){var le=p.children;if(le!==void 0)if(_)if(ze(le)){for(var Xe=0;Xe<le.length;Xe++)Ss(le[Xe],u);Object.freeze&&Object.freeze(le)}else T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ss(le,u)}return u===r?Ca(G):Ra(G),G}}function Ta(u,p,m){return Rs(u,p,m,!0)}function Oa(u,p,m){return Rs(u,p,m,!1)}var xa=Oa,Aa=Ta;ct.Fragment=r,ct.jsx=xa,ct.jsxs=Aa}()),ct}(function(n){process.env.NODE_ENV==="production"?n.exports=Xo():n.exports=Qo()})(fs);const Zo=fs.exports.jsx,Z=d.createContext(null),$o=({url:n="",tokenParams:e,socketPort:t,children:r})=>{const s=d.useMemo(()=>{const i=new ki.FrappeApp(n,e);return{url:n,tokenParams:e,app:i,auth:i.auth(),db:i.db(),call:i.call(),file:i.file(),socket:new Go(n,t).socket}},[n,e,t]);return Zo(Z.Provider,{value:s,children:r})},ea=n=>{const{url:e,auth:t,tokenParams:r}=d.useContext(Z),[s,i]=d.useState(),o=d.useCallback(()=>{const w=document.cookie.split(";").find(E=>E.trim().startsWith("user_id="));if(w){const E=w.split("=")[1];i(E&&E!=="Guest"?E:null)}else i(null)},[]);d.useEffect(()=>{r&&r.useToken?i(null):o()},[]);const{data:c,error:h,isLoading:a,isValidating:f,mutate:l}=it(()=>r&&r.useToken||s?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>t.getLoggedInUser(),{onError:()=>{i(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...n}),y=d.useCallback(async(w,E)=>t.loginWithUsernamePassword({username:w,password:E}).then(U=>{o()}),[]),v=d.useCallback(async()=>t.logout().then(()=>l(null)).then(()=>i(null)),[]);return{isLoading:s===void 0||a,currentUser:c,isValidating:f,error:h,login:y,logout:v,updateCurrentUser:l,getUserCookie:o}},Fn=(n,e,t)=>{let r=`${e}/api/resource/`;return t?r+=`${n}/${t}`:r+=`${n}`,r},ta=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?Fn(n,s,e):t,()=>i.getDoc(n,e),r)}},ps=n=>{var t,r,s;let e="";if(n!=null&&n.fields&&(e+="fields="+JSON.stringify(n==null?void 0:n.fields)+"&"),n!=null&&n.filters&&(e+="filters="+JSON.stringify(n==null?void 0:n.filters)+"&"),n!=null&&n.orFilters&&(e+="or_filters="+JSON.stringify(n==null?void 0:n.orFilters)+"&"),n!=null&&n.limit_start&&(e+="limit_start="+JSON.stringify(n==null?void 0:n.limit_start)+"&"),n!=null&&n.limit&&(e+="limit="+JSON.stringify(n==null?void 0:n.limit)+"&"),n!=null&&n.groupBy&&(e+="group_by="+String(n.groupBy)+"&"),n!=null&&n.orderBy){const i=`${String((t=n.orderBy)==null?void 0:t.field)} ${(s=(r=n.orderBy)==null?void 0:r.order)!=null?s:"asc"}`;e+="order_by="+i+"&"}return n!=null&&n.asDict&&(e+="as_dict="+n.asDict),e},na=(n,e,t,r)=>{var c;const{url:s,db:i}=d.useContext(Z);return(c=e==null?void 0:e.fields)!=null,{...it(t===void 0?`${Fn(n,s)}?${ps(e)}`:t,()=>i.getDocList(n,e),r)}},ra=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{createDoc:d.useCallback(async(a,f)=>(s(null),o(!1),t(!0),n.createDoc(a,f).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,isCompleted:i,reset:c}},sa=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{updateDoc:d.useCallback(async(a,f,l)=>(s(null),o(!1),t(!0),n.updateDoc(a,f,l).then(y=>(t(!1),o(!0),y)).catch(y=>{throw t(!1),o(!1),s(y),y})),[]),loading:e,error:r,reset:c,isCompleted:i}},ia=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{deleteDoc:d.useCallback(async(a,f)=>(s(null),o(!1),t(!0),n.deleteDoc(a,f).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,reset:c,isCompleted:i}};function vs(n){const e=[];for(let t in n)e.push(encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e.join("&")}const oa=(n,e,t=!1,r=!1,s,i)=>{const{url:o,db:c}=d.useContext(Z);return{...it(s===void 0?(()=>{const f=vs(t?{doctype:n,filters:e!=null?e:[],cache:t,debug:r}:{doctype:n,filters:e!=null?e:[],debug:r});return`${o}/api/method/frappe.client.get_count?${f}`})():s,()=>c.getCount(n,e,t,r),i)}},ys=(n,e,t,r)=>{const{call:s}=d.useContext(Z),i=vs(e!=null?e:{}),o=`${n}?${i}`;return{...it(t===void 0?o:t,()=>s.get(n,e),r)}},aa=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[h,a]=d.useState(!1),f=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async y=>(c(null),a(!1),i(!0),r(null),e.post(n,y).then(v=>(r(v),i(!1),a(!0),v)).catch(v=>{throw i(!1),a(!1),c(v),v})),[]),result:t,loading:s,error:o,reset:f,isCompleted:h}},ua=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[h,a]=d.useState(!1),f=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async y=>(c(null),a(!1),i(!0),r(null),e.put(n,y).then(v=>(r(v),i(!1),a(!0),v)).catch(v=>{throw i(!1),a(!1),c(v),v})),[]),result:t,loading:s,error:o,reset:f,isCompleted:h}},ca=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[h,a]=d.useState(!1),f=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async y=>(c(null),a(!1),i(!0),r(null),e.delete(n,y).then(v=>(r(v),i(!1),a(!0),v)).catch(v=>{throw i(!1),a(!1),c(v),v})),[]),result:t,loading:s,error:o,reset:f,isCompleted:h}},la=()=>{const{file:n}=d.useContext(Z),[e,t]=d.useState(0),[r,s]=d.useState(!1),[i,o]=d.useState(null),[c,h]=d.useState(!1),a=d.useCallback(async(l,y)=>(f(),s(!0),n.uploadFile(l,y,(v,w)=>t(Math.round(v/w*100))).then(v=>(h(!0),t(100),s(!1),v.data.message)).catch(v=>{throw console.error(v),o(v),s(!1),v})),[]),f=d.useCallback(()=>{t(0),s(!1),o(null),h(!1)},[]);return{upload:a,progress:e,loading:r,isCompleted:c,error:i,reset:f}},fa=(n,e,t=[],r=20,s=250)=>{const i=ha(e,s);return ys("frappe.desk.search.search_link",{doctype:n,page_length:r,txt:i,filters:JSON.stringify(t!=null?t:[])})},ha=(n,e)=>{const[t,r]=d.useState(n);return d.useEffect(()=>{const s=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(s)}},[n,e]),t},Pt=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>{let r=t.on(n,e);return()=>{r.off(n)}},[n,e])},da=(n,e,t=!0,r)=>{const{socket:s}=d.useContext(Z),[i,o]=d.useState([]);d.useEffect(()=>(s.emit("doc_subscribe",n,e),t&&s.emit("doc_open",n,e),()=>{s.emit("doc_unsubscribe",n,e),t&&s.emit("doc_close",n,e)}),[n,e,t]),Pt("doc_update",r);const c=d.useCallback(()=>{s.emit("doc_open",n,e)},[n,e]),h=d.useCallback(()=>{s.emit("doc_close",n,e)},[n,e]),a=d.useCallback(f=>{f.doctype===n&&f.docname===e&&o(f.users)},[n,e]);return Pt("doc_viewers",a),{viewers:i,emitDocOpen:c,emitDocClose:h}},pa=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>(t.emit("doctype_subscribe",n),()=>{t.emit("doctype_unsubscribe",n)}),[n]),Pt("list_update",e)};x.FrappeContext=Z,x.FrappeProvider=$o,x.getDocListQueryString=ps,x.getRequestURL=Fn,x.useFrappeAuth=ea,x.useFrappeCreateDoc=ra,x.useFrappeDeleteCall=ca,x.useFrappeDeleteDoc=ia,x.useFrappeDocTypeEventListener=pa,x.useFrappeDocumentEventListener=da,x.useFrappeEventListener=Pt,x.useFrappeFileUpload=la,x.useFrappeGetCall=ys,x.useFrappeGetDoc=ta,x.useFrappeGetDocCount=oa,x.useFrappeGetDocList=na,x.useFrappePostCall=aa,x.useFrappePutCall=ua,x.useFrappeUpdateDoc=sa,x.useSearch=fa,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
44
+ Check the top-level render call using <`+m+">.")}return p}}function Es(u,p){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var m=Sa(p);if(ws[m])return;ws[m]=!0;var _="";u&&u._owner&&u._owner!==Bn.current&&(_=" It was passed a child from "+ee(u._owner.type)+"."),Ge(u),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,_),Ge(null)}}function Ss(u,p){{if(typeof u!="object")return;if(ze(u))for(var m=0;m<u.length;m++){var _=u[m];Un(_)&&Es(_,p)}else if(Un(u))u._store&&(u._store.validated=!0);else if(u){var D=x(u);if(typeof D=="function"&&D!==u.entries)for(var U=D.call(u),O;!(O=U.next()).done;)Un(O.value)&&Es(O.value,p)}}}function Ra(u){{var p=u.type;if(p==null||typeof p=="string")return;var m;if(typeof p=="function")m=p.propTypes;else if(typeof p=="object"&&(p.$$typeof===f||p.$$typeof===l))m=p.propTypes;else return;if(m){var _=ee(p);he(m,u.props,"prop",_,u)}else if(p.PropTypes!==void 0&&!In){In=!0;var D=ee(p);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof p.getDefaultProps=="function"&&!p.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ca(u){{for(var p=Object.keys(u.props),m=0;m<p.length;m++){var _=p[m];if(_!=="children"&&_!=="key"){Ge(u),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",_),Ge(null);break}}u.ref!==null&&(Ge(u),T("Invalid attribute `ref` supplied to `React.Fragment`."),Ge(null))}}function Rs(u,p,m,_,D,U){{var O=P(u);if(!O){var C="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(C+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=Ea(D);re?C+=re:C+=_s();var q;u===null?q="null":ze(u)?q="array":u!==void 0&&u.$$typeof===e?(q="<"+(ee(u.type)||"Unknown")+" />",C=" Did you accidentally export a JSX literal instead of a component?"):q=typeof u,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",q,C)}var G=wa(u,p,m,D,U);if(G==null)return G;if(O){var le=p.children;if(le!==void 0)if(_)if(ze(le)){for(var Xe=0;Xe<le.length;Xe++)Ss(le[Xe],u);Object.freeze&&Object.freeze(le)}else T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ss(le,u)}return u===r?Ca(G):Ra(G),G}}function Ta(u,p,m){return Rs(u,p,m,!0)}function Oa(u,p,m){return Rs(u,p,m,!1)}var xa=Oa,Aa=Ta;ct.Fragment=r,ct.jsx=xa,ct.jsxs=Aa}()),ct}(function(n){process.env.NODE_ENV==="production"?n.exports=Xo():n.exports=Qo()})(fs);const Zo=fs.exports.jsx,Z=d.createContext(null),$o=({url:n="",tokenParams:e,socketPort:t,children:r})=>{const s=d.useMemo(()=>{const i=new ki.FrappeApp(n,e);return{url:n,tokenParams:e,app:i,auth:i.auth(),db:i.db(),call:i.call(),file:i.file(),socket:new Go(n,t).socket}},[n,e,t]);return Zo(Z.Provider,{value:s,children:r})},ea=n=>{const{url:e,auth:t,tokenParams:r}=d.useContext(Z),[s,i]=d.useState(),o=d.useCallback(()=>{const w=document.cookie.split(";").find(E=>E.trim().startsWith("user_id="));if(w){const E=w.split("=")[1];i(E&&E!=="Guest"?E:null)}else i(null)},[]);d.useEffect(()=>{r&&r.useToken?i(null):o()},[]);const{data:c,error:f,isLoading:a,isValidating:h,mutate:l}=it(()=>r&&r.useToken||s?`${e}/api/method/frappe.auth.get_logged_user`:null,()=>t.getLoggedInUser(),{onError:()=>{i(null)},shouldRetryOnError:!1,revalidateOnFocus:!1,...n}),v=d.useCallback(async(w,E)=>t.loginWithUsernamePassword({username:w,password:E}).then(x=>{o()}),[]),y=d.useCallback(async()=>t.logout().then(()=>l(null)).then(()=>i(null)),[]);return{isLoading:s===void 0||a,currentUser:c,isValidating:h,error:f,login:v,logout:y,updateCurrentUser:l,getUserCookie:o}},Fn=(n,e,t)=>{let r=`${e}/api/resource/`;return t?r+=`${n}/${t}`:r+=`${n}`,r},ta=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?Fn(n,s,e):t,()=>i.getDoc(n,e),r)}},ps=n=>{var t,r,s;let e="";if(n!=null&&n.fields&&(e+="fields="+JSON.stringify(n==null?void 0:n.fields)+"&"),n!=null&&n.filters&&(e+="filters="+JSON.stringify(n==null?void 0:n.filters)+"&"),n!=null&&n.orFilters&&(e+="or_filters="+JSON.stringify(n==null?void 0:n.orFilters)+"&"),n!=null&&n.limit_start&&(e+="limit_start="+JSON.stringify(n==null?void 0:n.limit_start)+"&"),n!=null&&n.limit&&(e+="limit="+JSON.stringify(n==null?void 0:n.limit)+"&"),n!=null&&n.groupBy&&(e+="group_by="+String(n.groupBy)+"&"),n!=null&&n.orderBy){const i=`${String((t=n.orderBy)==null?void 0:t.field)} ${(s=(r=n.orderBy)==null?void 0:r.order)!=null?s:"asc"}`;e+="order_by="+i+"&"}return n!=null&&n.asDict&&(e+="as_dict="+n.asDict),e},na=(n,e,t,r)=>{const{url:s,db:i}=d.useContext(Z);return{...it(t===void 0?`${Fn(n,s)}?${ps(e)}`:t,()=>i.getDocList(n,e),r)}},ra=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{createDoc:d.useCallback(async(a,h)=>(s(null),o(!1),t(!0),n.createDoc(a,h).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,isCompleted:i,reset:c}},sa=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{updateDoc:d.useCallback(async(a,h,l)=>(s(null),o(!1),t(!0),n.updateDoc(a,h,l).then(v=>(t(!1),o(!0),v)).catch(v=>{throw t(!1),o(!1),s(v),v})),[]),loading:e,error:r,reset:c,isCompleted:i}},ia=()=>{const{db:n}=d.useContext(Z),[e,t]=d.useState(!1),[r,s]=d.useState(null),[i,o]=d.useState(!1),c=d.useCallback(()=>{t(!1),s(null),o(!1)},[]);return{deleteDoc:d.useCallback(async(a,h)=>(s(null),o(!1),t(!0),n.deleteDoc(a,h).then(l=>(t(!1),o(!0),l)).catch(l=>{throw t(!1),o(!1),s(l),l})),[]),loading:e,error:r,reset:c,isCompleted:i}};function vs(n){const e=[];for(let t in n)e.push(encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e.join("&")}const oa=(n,e,t=!1,r=!1,s,i)=>{const{url:o,db:c}=d.useContext(Z);return{...it(s===void 0?(()=>{const h=vs(t?{doctype:n,filters:e!=null?e:[],cache:t,debug:r}:{doctype:n,filters:e!=null?e:[],debug:r});return`${o}/api/method/frappe.client.get_count?${h}`})():s,()=>c.getCount(n,e,t,r),i)}},ys=(n,e,t,r)=>{const{call:s}=d.useContext(Z),i=vs(e!=null?e:{}),o=`${n}?${i}`;return{...it(t===void 0?o:t,()=>s.get(n,e),r)}},aa=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.post(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},ua=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.put(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},ca=n=>{const{call:e}=d.useContext(Z),[t,r]=d.useState(null),[s,i]=d.useState(!1),[o,c]=d.useState(null),[f,a]=d.useState(!1),h=d.useCallback(()=>{r(null),i(!1),c(null),a(!1)},[]);return{call:d.useCallback(async v=>(c(null),a(!1),i(!0),r(null),e.delete(n,v).then(y=>(r(y),i(!1),a(!0),y)).catch(y=>{throw i(!1),a(!1),c(y),y})),[]),result:t,loading:s,error:o,reset:h,isCompleted:f}},la=()=>{const{file:n}=d.useContext(Z),[e,t]=d.useState(0),[r,s]=d.useState(!1),[i,o]=d.useState(null),[c,f]=d.useState(!1),a=d.useCallback(async(l,v)=>(h(),s(!0),n.uploadFile(l,v,(y,w)=>t(Math.round(y/w*100))).then(y=>(f(!0),t(100),s(!1),y.data.message)).catch(y=>{throw console.error(y),o(y),s(!1),y})),[]),h=d.useCallback(()=>{t(0),s(!1),o(null),f(!1)},[]);return{upload:a,progress:e,loading:r,isCompleted:c,error:i,reset:h}},fa=(n,e,t=[],r=20,s=250)=>{const i=ha(e,s);return ys("frappe.desk.search.search_link",{doctype:n,page_length:r,txt:i,filters:JSON.stringify(t!=null?t:[])})},ha=(n,e)=>{const[t,r]=d.useState(n);return d.useEffect(()=>{const s=setTimeout(()=>{r(n)},e);return()=>{clearTimeout(s)}},[n,e]),t},Pt=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>{let r=t.on(n,e);return()=>{r.off(n)}},[n,e])},da=(n,e,t=!0,r)=>{const{socket:s}=d.useContext(Z),[i,o]=d.useState([]);d.useEffect(()=>(s.emit("doc_subscribe",n,e),t&&s.emit("doc_open",n,e),()=>{s.emit("doc_unsubscribe",n,e),t&&s.emit("doc_close",n,e)}),[n,e,t]),Pt("doc_update",r);const c=d.useCallback(()=>{s.emit("doc_open",n,e)},[n,e]),f=d.useCallback(()=>{s.emit("doc_close",n,e)},[n,e]),a=d.useCallback(h=>{h.doctype===n&&h.docname===e&&o(h.users)},[n,e]);return Pt("doc_viewers",a),{viewers:i,emitDocOpen:c,emitDocClose:f}},pa=(n,e)=>{const{socket:t}=d.useContext(Z);d.useEffect(()=>(t.emit("doctype_subscribe",n),()=>{t.emit("doctype_unsubscribe",n)}),[n]),Pt("list_update",e)};A.FrappeContext=Z,A.FrappeProvider=$o,A.getDocListQueryString=ps,A.getRequestURL=Fn,A.useFrappeAuth=ea,A.useFrappeCreateDoc=ra,A.useFrappeDeleteCall=ca,A.useFrappeDeleteDoc=ia,A.useFrappeDocTypeEventListener=pa,A.useFrappeDocumentEventListener=da,A.useFrappeEventListener=Pt,A.useFrappeFileUpload=la,A.useFrappeGetCall=ys,A.useFrappeGetDoc=ta,A.useFrappeGetDocCount=oa,A.useFrappeGetDocList=na,A.useFrappePostCall=aa,A.useFrappePutCall=ua,A.useFrappeUpdateDoc=sa,A.useSearch=fa,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});