frappe-react-sdk 1.4.0 → 1.4.2

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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ React hooks library for a [Frappe Framework](https://frappeframework.com) backen
4
4
 
5
5
  <br />
6
6
  <p align="center">
7
- <a href="https://github.com/nikkothari22/frappe-react-sdk"><img src="https://img.shields.io/maintenance/yes/2023?style=flat-square" /></a>
7
+ <a href="https://github.com/nikkothari22/frappe-react-sdk"><img src="https://img.shields.io/maintenance/yes/2024?style=flat-square" /></a>
8
8
  <a href="https://github.com/nikkothari22/frappe-react-sdk"><img src="https://img.shields.io/github/license/nikkothari22/frappe-react-sdk?style=flat-square" /></a>
9
9
  <a href="https://www.npmjs.com/package/frappe-react-sdk"><img src="https://img.shields.io/npm/v/frappe-react-sdk?style=flat-square" /></a>
10
10
  <a href="https://www.npmjs.com/package/frappe-react-sdk"><img src="https://img.shields.io/npm/dw/frappe-react-sdk?style=flat-square" /></a>
@@ -110,12 +110,21 @@ var Ys = function() {
110
110
  }
111
111
  return n.prototype.get = function(e, t) {
112
112
  return xt(this, void 0, void 0, function() {
113
- return At(this, function(r) {
114
- return [2, this.axios.get("/api/method/".concat(e), { params: t }).then(function(s) {
115
- return s.data;
116
- }).catch(function(s) {
117
- var i, o;
118
- throw ue(ue({}, 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 : "" });
113
+ var r;
114
+ return At(this, function(s) {
115
+ return r = new URLSearchParams(), t && Object.entries(t).forEach(function(i) {
116
+ var o = i[0], c = i[1];
117
+ if (c != null) {
118
+ var l = typeof c == "object" ? JSON.stringify(c) : c;
119
+ r.set(o, l);
120
+ }
121
+ }), [2, this.axios.get("/api/method/".concat(e), {
122
+ params: r
123
+ }).then(function(i) {
124
+ return i.data;
125
+ }).catch(function(i) {
126
+ var o, c;
127
+ throw ue(ue({}, 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.", exception: (c = i.response.data.exception) !== null && c !== void 0 ? c : "" });
119
128
  })];
120
129
  });
121
130
  });
@@ -1,4 +1,4 @@
1
- (function(C,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],p):(C=typeof globalThis<"u"?globalThis:C||self,p(C["Frappe React"]={},C.React))})(this,function(C,p){"use strict";var ec=Object.defineProperty;var tc=(C,p,Ve)=>p in C?ec(C,p,{enumerable:!0,configurable:!0,writable:!0,value:Ve}):C[p]=Ve;var Ne=(C,p,Ve)=>(tc(C,typeof p!="symbol"?p+"":p,Ve),Ve);const Fe=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(p);var P=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Zt={},et={},tt={},oe=P&&P.__assign||function(){return oe=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},oe.apply(this,arguments)},wt=P&&P.__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(h){o(h)}}function l(f){try{a(r.throw(f))}catch(h){o(h)}}function a(f){f.done?i(f.value):s(f.value).then(c,l)}a((r=r.apply(n,e||[])).next())})},_t=P&&P.__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 l([a,f])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(t=0)),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(tt,"__esModule",{value:!0}),tt.FrappeCall=void 0;var As=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 wt(this,void 0,void 0,function(){return _t(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 oe(oe({},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 wt(this,void 0,void 0,function(){return _t(this,function(r){return[2,this.axios.post("/api/method/".concat(e),oe({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw oe(oe({},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 wt(this,void 0,void 0,function(){return _t(this,function(r){return[2,this.axios.put("/api/method/".concat(e),oe({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw oe(oe({},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 wt(this,void 0,void 0,function(){return _t(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 oe(oe({},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}();tt.FrappeCall=As;var nt={},J=P&&P.__assign||function(){return J=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},J.apply(this,arguments)},Pe=P&&P.__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(h){o(h)}}function l(f){try{a(r.throw(f))}catch(h){o(h)}}function a(f){f.done?i(f.value):s(f.value).then(c,l)}a((r=r.apply(n,e||[])).next())})},Be=P&&P.__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 l([a,f])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(t=0)),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(nt,"__esModule",{value:!0}),nt.FrappeDB=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.getDoc=function(e,t){return t===void 0&&(t=""),Pe(this,void 0,void 0,function(){return Be(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 J(J({},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 Pe(this,void 0,void 0,function(){var s,i,o,c,l,a,f,h,v,b,y;return Be(this,function(m){return s={},t&&(i=t.fields,o=t.filters,c=t.orFilters,l=t.orderBy,a=t.limit,f=t.limit_start,h=t.groupBy,v=t.asDict,b=v===void 0?!0:v,y=l?"".concat(String(l==null?void 0:l.field)," ").concat((r=l==null?void 0:l.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:y,group_by:h,limit:a,limit_start:f,as_dict:b}),[2,this.axios.get("/api/resource/".concat(e),{params:s}).then(function(S){return S.data.data}).catch(function(S){var _,O;throw J(J({},S.response.data),{httpStatus:S.response.status,httpStatusText:S.response.statusText,message:"There was an error while fetching the documents.",exception:(O=(_=S.response.data.exception)!==null&&_!==void 0?_:S.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},n.prototype.createDoc=function(e,t){return Pe(this,void 0,void 0,function(){return Be(this,function(r){return[2,this.axios.post("/api/resource/".concat(e),J({},t)).then(function(s){return s.data.data}).catch(function(s){var i,o,c;throw J(J({},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 Pe(this,void 0,void 0,function(){return Be(this,function(s){return[2,this.axios.put("/api/resource/".concat(e,"/").concat(t),J({},r)).then(function(i){return i.data.data}).catch(function(i){var o,c,l;throw J(J({},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:(l=(c=i.response.data.exception)!==null&&c!==void 0?c:i.response.data.exc_type)!==null&&l!==void 0?l:""})})]})})},n.prototype.deleteDoc=function(e,t){return Pe(this,void 0,void 0,function(){return Be(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 J(J({},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),Pe(this,void 0,void 0,function(){var i;return Be(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 l,a;throw J(J({},c.response.data),{httpStatus:c.response.status,httpStatusText:c.response.statusText,message:"There was an error while getting the count.",exception:(a=(l=c.response.data.exception)!==null&&l!==void 0?l:c.response.data.exc_type)!==null&&a!==void 0?a:""})})]})})},n.prototype.getLastDoc=function(e,t){return Pe(this,void 0,void 0,function(){var r,s;return Be(this,function(i){switch(i.label){case 0:return r={orderBy:{field:"creation",order:"desc"}},t&&(r=J(J({},r),t)),[4,this.getDocList(e,J(J({},r),{limit:1,fields:["name"]}))];case 1:return s=i.sent(),s.length>0?[2,this.getDoc(e,s[0].name)]:[2,{}]}})})},n}();nt.FrappeDB=ks;var rt={},Et=P&&P.__assign||function(){return Et=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},Et.apply(this,arguments)},Ds=P&&P.__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(h){o(h)}}function l(f){try{a(r.throw(f))}catch(h){o(h)}}function a(f){f.done?i(f.value):s(f.value).then(c,l)}a((r=r.apply(n,e||[])).next())})},Ls=P&&P.__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 l([a,f])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(t=0)),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(rt,"__esModule",{value:!0}),rt.FrappeFileUpload=void 0;var Ns=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,s){return s===void 0&&(s="upload_file"),Ds(this,void 0,void 0,function(){var i,o,c,l,a,f,h,v;return Ls(this,function(b){return i=new FormData,e&&i.append("file",e,e.name),o=t.isPrivate,c=t.folder,l=t.file_url,a=t.doctype,f=t.docname,h=t.fieldname,v=t.otherData,o&&i.append("is_private","1"),c&&i.append("folder",c),l&&i.append("file_url",l),a&&f&&(i.append("doctype",a),i.append("docname",f),h&&i.append("fieldname",h)),v&&Object.keys(v).forEach(function(y){var m=v[y];i.append(y,m)}),[2,this.axios.post("/api/method/".concat(s),i,{onUploadProgress:function(y){r&&r(y.loaded,y.total,y)}}).catch(function(y){var m,S;throw Et(Et({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:(m=y.response.data.message)!==null&&m!==void 0?m:"There was an error while uploading the file.",exception:(S=y.response.data.exception)!==null&&S!==void 0?S:""})})]})})},n}();rt.FrappeFileUpload=Ns;var Me={};function Yn(n,e){return function(){return n.apply(e,arguments)}}const{toString:Fs}=Object.prototype,{getPrototypeOf:$t}=Object,St=(n=>e=>{const t=Fs.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),de=n=>(n=n.toLowerCase(),e=>St(e)===n),Rt=n=>e=>typeof e===n,{isArray:We}=Array,st=Rt("undefined");function Ps(n){return n!==null&&!st(n)&&n.constructor!==null&&!st(n.constructor)&&ae(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Gn=de("ArrayBuffer");function Bs(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Gn(n.buffer),e}const Us=Rt("string"),ae=Rt("function"),Xn=Rt("number"),Tt=n=>n!==null&&typeof n=="object",Is=n=>n===!0||n===!1,Ot=n=>{if(St(n)!=="object")return!1;const e=$t(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},js=de("Date"),Vs=de("File"),Ms=de("Blob"),Ws=de("FileList"),Hs=n=>Tt(n)&&ae(n.pipe),Js=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||ae(n.append)&&((e=St(n))==="formdata"||e==="object"&&ae(n.toString)&&n.toString()==="[object FormData]"))},qs=de("URLSearchParams"),zs=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function it(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),We(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let c;for(r=0;r<o;r++)c=i[r],e.call(null,n[c],c,n)}}function Qn(n,e){e=e.toLowerCase();const t=Object.keys(n);let r=t.length,s;for(;r-- >0;)if(s=t[r],e===s.toLowerCase())return s;return null}const Zn=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:P)(),$n=n=>!st(n)&&n!==Zn;function en(){const{caseless:n}=$n(this)&&this||{},e={},t=(r,s)=>{const i=n&&Qn(e,s)||s;Ot(e[i])&&Ot(r)?e[i]=en(e[i],r):Ot(r)?e[i]=en({},r):We(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&it(arguments[r],t);return e}const Ks=(n,e,t,{allOwnKeys:r}={})=>(it(e,(s,i)=>{t&&ae(s)?n[i]=Yn(s,t):n[i]=s},{allOwnKeys:r}),n),Ys=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Gs=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Xs=(n,e,t,r)=>{let s,i,o;const c={};if(e=e||{},n==null)return e;do{for(s=Object.getOwnPropertyNames(n),i=s.length;i-- >0;)o=s[i],(!r||r(o,n,e))&&!c[o]&&(e[o]=n[o],c[o]=!0);n=t!==!1&&$t(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Qs=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},Zs=n=>{if(!n)return null;if(We(n))return n;let e=n.length;if(!Xn(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},$s=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&$t(Uint8Array)),ei=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(n,i[0],i[1])}},ti=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},ni=de("HTMLFormElement"),ri=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,s){return r.toUpperCase()+s}),er=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),si=de("RegExp"),tr=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};it(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},ii=n=>{tr(n,(e,t)=>{if(ae(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(!!ae(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},oi=(n,e)=>{const t={},r=s=>{s.forEach(i=>{t[i]=!0})};return We(n)?r(n):r(String(n).split(e)),t},ai=()=>{},ci=(n,e)=>(n=+n,Number.isFinite(n)?n:e),tn="abcdefghijklmnopqrstuvwxyz",nr="0123456789",rr={DIGIT:nr,ALPHA:tn,ALPHA_DIGIT:tn+tn.toUpperCase()+nr},ui=(n=16,e=rr.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function li(n){return!!(n&&ae(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const fi=n=>{const e=new Array(10),t=(r,s)=>{if(Tt(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const i=We(r)?[]:{};return it(r,(o,c)=>{const l=t(o,s+1);!st(l)&&(i[c]=l)}),e[s]=void 0,i}}return r};return t(n,0)},hi=de("AsyncFunction");var d={isArray:We,isArrayBuffer:Gn,isBuffer:Ps,isFormData:Js,isArrayBufferView:Bs,isString:Us,isNumber:Xn,isBoolean:Is,isObject:Tt,isPlainObject:Ot,isUndefined:st,isDate:js,isFile:Vs,isBlob:Ms,isRegExp:si,isFunction:ae,isStream:Hs,isURLSearchParams:qs,isTypedArray:$s,isFileList:Ws,forEach:it,merge:en,extend:Ks,trim:zs,stripBOM:Ys,inherits:Gs,toFlatObject:Xs,kindOf:St,kindOfTest:de,endsWith:Qs,toArray:Zs,forEachEntry:ei,matchAll:ti,isHTMLForm:ni,hasOwnProperty:er,hasOwnProp:er,reduceDescriptors:tr,freezeMethods:ii,toObjectSet:oi,toCamelCase:ri,noop:ai,toFiniteNumber:ci,findKey:Qn,global:Zn,isContextDefined:$n,ALPHABET:rr,generateString:ui,isSpecCompliantForm:li,toJSONObject:fi,isAsyncFn:hi,isThenable:n=>n&&(Tt(n)||ae(n))&&ae(n.then)&&ae(n.catch)};function x(n,e,t,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),s&&(this.response=s)}d.inherits(x,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const sr=x.prototype,ir={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{ir[n]={value:n}}),Object.defineProperties(x,ir),Object.defineProperty(sr,"isAxiosError",{value:!0}),x.from=(n,e,t,r,s,i)=>{const o=Object.create(sr);return d.toFlatObject(n,o,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),x.call(o,n.message,e,t,r,s),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};var di=null;function nn(n){return d.isPlainObject(n)||d.isArray(n)}function or(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function ar(n,e,t){return n?n.concat(e).map(function(s,i){return s=or(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function pi(n){return d.isArray(n)&&!n.some(nn)}const yi=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Ct(n,e,t){if(!d.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,S){return!d.isUndefined(S[m])});const r=t.metaTokens,s=t.visitor||f,i=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(s))throw new TypeError("visitor must be a function");function a(y){if(y===null)return"";if(d.isDate(y))return y.toISOString();if(!l&&d.isBlob(y))throw new x("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(y)||d.isTypedArray(y)?l&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,m,S){let _=y;if(y&&!S&&typeof y=="object"){if(d.endsWith(m,"{}"))m=r?m:m.slice(0,-2),y=JSON.stringify(y);else if(d.isArray(y)&&pi(y)||(d.isFileList(y)||d.endsWith(m,"[]"))&&(_=d.toArray(y)))return m=or(m),_.forEach(function(A,k){!(d.isUndefined(A)||A===null)&&e.append(o===!0?ar([m],k,i):o===null?m:m+"[]",a(A))}),!1}return nn(y)?!0:(e.append(ar(S,m,i),a(y)),!1)}const h=[],v=Object.assign(yi,{defaultVisitor:f,convertValue:a,isVisitable:nn});function b(y,m){if(!d.isUndefined(y)){if(h.indexOf(y)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(y),d.forEach(y,function(_,O){(!(d.isUndefined(_)||_===null)&&s.call(e,_,d.isString(O)?O.trim():O,m,v))===!0&&b(_,m?m.concat(O):[O])}),h.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return b(n),e}function cr(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function rn(n,e){this._pairs=[],n&&Ct(n,this,e)}const ur=rn.prototype;ur.append=function(e,t){this._pairs.push([e,t])},ur.toString=function(e){const t=e?function(r){return e.call(this,r,cr)}:cr;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function mi(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lr(n,e,t){if(!e)return n;const r=t&&t.encode||mi,s=t&&t.serialize;let i;if(s?i=s(e,t):i=d.isURLSearchParams(e)?e.toString():new rn(e,t).toString(r),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class gi{constructor(){this.handlers=[]}use(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}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(r){r!==null&&e(r)})}}var fr=gi,hr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vi=typeof URLSearchParams<"u"?URLSearchParams:rn,bi=typeof FormData<"u"?FormData:null,wi=typeof Blob<"u"?Blob:null,_i={isBrowser:!0,classes:{URLSearchParams:vi,FormData:bi,Blob:wi},protocols:["http","https","file","blob","url","data"]};const dr=typeof window<"u"&&typeof document<"u",Ei=(n=>dr&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),Si=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")();var Ri=Object.freeze({__proto__:null,hasBrowserEnv:dr,hasStandardBrowserWebWorkerEnv:Si,hasStandardBrowserEnv:Ei}),pe={...Ri,..._i};function Ti(n,e){return Ct(n,new pe.classes.URLSearchParams,Object.assign({visitor:function(t,r,s,i){return pe.isNode&&d.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function Oi(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ci(n){const e={},t=Object.keys(n);let r;const s=t.length;let i;for(r=0;r<s;r++)i=t[r],e[i]=n[i];return e}function pr(n){function e(t,r,s,i){let o=t[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),l=i>=t.length;return o=!o&&d.isArray(s)?s.length:o,l?(d.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!d.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&d.isArray(s[o])&&(s[o]=Ci(s[o])),!c)}if(d.isFormData(n)&&d.isFunction(n.entries)){const t={};return d.forEachEntry(n,(r,s)=>{e(Oi(r),s,t,0)}),t}return null}function xi(n,e,t){if(d.isString(n))try{return(e||JSON.parse)(n),d.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const sn={transitional:hr,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=d.isObject(e);if(i&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return s?JSON.stringify(pr(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ti(e,this.formSerializer).toString();if((c=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Ct(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),xi(e)):e}],transformResponse:[function(e){const t=this.transitional||sn.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(e&&d.isString(e)&&(r&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(c){if(o)throw c.name==="SyntaxError"?x.from(c,x.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{sn.headers[n]={}});var on=sn;const Ai=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var ki=n=>{const e={};let t,r,s;return n&&n.split(`
1
+ (function(C,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],p):(C=typeof globalThis<"u"?globalThis:C||self,p(C["Frappe React"]={},C.React))})(this,function(C,p){"use strict";var ec=Object.defineProperty;var tc=(C,p,Ve)=>p in C?ec(C,p,{enumerable:!0,configurable:!0,writable:!0,value:Ve}):C[p]=Ve;var Ne=(C,p,Ve)=>(tc(C,typeof p!="symbol"?p+"":p,Ve),Ve);const Fe=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(p);var P=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Zt={},et={},tt={},oe=P&&P.__assign||function(){return oe=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},oe.apply(this,arguments)},wt=P&&P.__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(h){o(h)}}function l(f){try{a(r.throw(f))}catch(h){o(h)}}function a(f){f.done?i(f.value):s(f.value).then(c,l)}a((r=r.apply(n,e||[])).next())})},_t=P&&P.__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 l([a,f])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(t=0)),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(tt,"__esModule",{value:!0}),tt.FrappeCall=void 0;var As=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 wt(this,void 0,void 0,function(){var r;return _t(this,function(s){return r=new URLSearchParams,t&&Object.entries(t).forEach(function(i){var o=i[0],c=i[1];if(c!=null){var l=typeof c=="object"?JSON.stringify(c):c;r.set(o,l)}}),[2,this.axios.get("/api/method/".concat(e),{params:r}).then(function(i){return i.data}).catch(function(i){var o,c;throw oe(oe({},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.",exception:(c=i.response.data.exception)!==null&&c!==void 0?c:""})})]})})},n.prototype.post=function(e,t){return wt(this,void 0,void 0,function(){return _t(this,function(r){return[2,this.axios.post("/api/method/".concat(e),oe({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw oe(oe({},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 wt(this,void 0,void 0,function(){return _t(this,function(r){return[2,this.axios.put("/api/method/".concat(e),oe({},t)).then(function(s){return s.data}).catch(function(s){var i,o;throw oe(oe({},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 wt(this,void 0,void 0,function(){return _t(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 oe(oe({},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}();tt.FrappeCall=As;var nt={},J=P&&P.__assign||function(){return J=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},J.apply(this,arguments)},Pe=P&&P.__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(h){o(h)}}function l(f){try{a(r.throw(f))}catch(h){o(h)}}function a(f){f.done?i(f.value):s(f.value).then(c,l)}a((r=r.apply(n,e||[])).next())})},Be=P&&P.__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 l([a,f])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(t=0)),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(nt,"__esModule",{value:!0}),nt.FrappeDB=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.getDoc=function(e,t){return t===void 0&&(t=""),Pe(this,void 0,void 0,function(){return Be(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 J(J({},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 Pe(this,void 0,void 0,function(){var s,i,o,c,l,a,f,h,v,b,y;return Be(this,function(m){return s={},t&&(i=t.fields,o=t.filters,c=t.orFilters,l=t.orderBy,a=t.limit,f=t.limit_start,h=t.groupBy,v=t.asDict,b=v===void 0?!0:v,y=l?"".concat(String(l==null?void 0:l.field)," ").concat((r=l==null?void 0:l.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:y,group_by:h,limit:a,limit_start:f,as_dict:b}),[2,this.axios.get("/api/resource/".concat(e),{params:s}).then(function(S){return S.data.data}).catch(function(S){var _,O;throw J(J({},S.response.data),{httpStatus:S.response.status,httpStatusText:S.response.statusText,message:"There was an error while fetching the documents.",exception:(O=(_=S.response.data.exception)!==null&&_!==void 0?_:S.response.data.exc_type)!==null&&O!==void 0?O:""})})]})})},n.prototype.createDoc=function(e,t){return Pe(this,void 0,void 0,function(){return Be(this,function(r){return[2,this.axios.post("/api/resource/".concat(e),J({},t)).then(function(s){return s.data.data}).catch(function(s){var i,o,c;throw J(J({},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 Pe(this,void 0,void 0,function(){return Be(this,function(s){return[2,this.axios.put("/api/resource/".concat(e,"/").concat(t),J({},r)).then(function(i){return i.data.data}).catch(function(i){var o,c,l;throw J(J({},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:(l=(c=i.response.data.exception)!==null&&c!==void 0?c:i.response.data.exc_type)!==null&&l!==void 0?l:""})})]})})},n.prototype.deleteDoc=function(e,t){return Pe(this,void 0,void 0,function(){return Be(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 J(J({},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),Pe(this,void 0,void 0,function(){var i;return Be(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 l,a;throw J(J({},c.response.data),{httpStatus:c.response.status,httpStatusText:c.response.statusText,message:"There was an error while getting the count.",exception:(a=(l=c.response.data.exception)!==null&&l!==void 0?l:c.response.data.exc_type)!==null&&a!==void 0?a:""})})]})})},n.prototype.getLastDoc=function(e,t){return Pe(this,void 0,void 0,function(){var r,s;return Be(this,function(i){switch(i.label){case 0:return r={orderBy:{field:"creation",order:"desc"}},t&&(r=J(J({},r),t)),[4,this.getDocList(e,J(J({},r),{limit:1,fields:["name"]}))];case 1:return s=i.sent(),s.length>0?[2,this.getDoc(e,s[0].name)]:[2,{}]}})})},n}();nt.FrappeDB=ks;var rt={},Et=P&&P.__assign||function(){return Et=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},Et.apply(this,arguments)},Ds=P&&P.__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(h){o(h)}}function l(f){try{a(r.throw(f))}catch(h){o(h)}}function a(f){f.done?i(f.value):s(f.value).then(c,l)}a((r=r.apply(n,e||[])).next())})},Ls=P&&P.__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 l([a,f])}}function l(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(t=0)),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(rt,"__esModule",{value:!0}),rt.FrappeFileUpload=void 0;var Ns=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,s){return s===void 0&&(s="upload_file"),Ds(this,void 0,void 0,function(){var i,o,c,l,a,f,h,v;return Ls(this,function(b){return i=new FormData,e&&i.append("file",e,e.name),o=t.isPrivate,c=t.folder,l=t.file_url,a=t.doctype,f=t.docname,h=t.fieldname,v=t.otherData,o&&i.append("is_private","1"),c&&i.append("folder",c),l&&i.append("file_url",l),a&&f&&(i.append("doctype",a),i.append("docname",f),h&&i.append("fieldname",h)),v&&Object.keys(v).forEach(function(y){var m=v[y];i.append(y,m)}),[2,this.axios.post("/api/method/".concat(s),i,{onUploadProgress:function(y){r&&r(y.loaded,y.total,y)}}).catch(function(y){var m,S;throw Et(Et({},y.response.data),{httpStatus:y.response.status,httpStatusText:y.response.statusText,message:(m=y.response.data.message)!==null&&m!==void 0?m:"There was an error while uploading the file.",exception:(S=y.response.data.exception)!==null&&S!==void 0?S:""})})]})})},n}();rt.FrappeFileUpload=Ns;var Me={};function Yn(n,e){return function(){return n.apply(e,arguments)}}const{toString:Fs}=Object.prototype,{getPrototypeOf:$t}=Object,St=(n=>e=>{const t=Fs.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),de=n=>(n=n.toLowerCase(),e=>St(e)===n),Rt=n=>e=>typeof e===n,{isArray:We}=Array,st=Rt("undefined");function Ps(n){return n!==null&&!st(n)&&n.constructor!==null&&!st(n.constructor)&&ae(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Gn=de("ArrayBuffer");function Bs(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Gn(n.buffer),e}const Us=Rt("string"),ae=Rt("function"),Xn=Rt("number"),Tt=n=>n!==null&&typeof n=="object",Is=n=>n===!0||n===!1,Ot=n=>{if(St(n)!=="object")return!1;const e=$t(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},js=de("Date"),Vs=de("File"),Ms=de("Blob"),Ws=de("FileList"),Hs=n=>Tt(n)&&ae(n.pipe),Js=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||ae(n.append)&&((e=St(n))==="formdata"||e==="object"&&ae(n.toString)&&n.toString()==="[object FormData]"))},qs=de("URLSearchParams"),zs=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function it(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),We(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let c;for(r=0;r<o;r++)c=i[r],e.call(null,n[c],c,n)}}function Qn(n,e){e=e.toLowerCase();const t=Object.keys(n);let r=t.length,s;for(;r-- >0;)if(s=t[r],e===s.toLowerCase())return s;return null}const Zn=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:P)(),$n=n=>!st(n)&&n!==Zn;function en(){const{caseless:n}=$n(this)&&this||{},e={},t=(r,s)=>{const i=n&&Qn(e,s)||s;Ot(e[i])&&Ot(r)?e[i]=en(e[i],r):Ot(r)?e[i]=en({},r):We(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&it(arguments[r],t);return e}const Ks=(n,e,t,{allOwnKeys:r}={})=>(it(e,(s,i)=>{t&&ae(s)?n[i]=Yn(s,t):n[i]=s},{allOwnKeys:r}),n),Ys=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Gs=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Xs=(n,e,t,r)=>{let s,i,o;const c={};if(e=e||{},n==null)return e;do{for(s=Object.getOwnPropertyNames(n),i=s.length;i-- >0;)o=s[i],(!r||r(o,n,e))&&!c[o]&&(e[o]=n[o],c[o]=!0);n=t!==!1&&$t(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Qs=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},Zs=n=>{if(!n)return null;if(We(n))return n;let e=n.length;if(!Xn(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},$s=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&$t(Uint8Array)),ei=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(n,i[0],i[1])}},ti=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},ni=de("HTMLFormElement"),ri=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,s){return r.toUpperCase()+s}),er=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),si=de("RegExp"),tr=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};it(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},ii=n=>{tr(n,(e,t)=>{if(ae(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(!!ae(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},oi=(n,e)=>{const t={},r=s=>{s.forEach(i=>{t[i]=!0})};return We(n)?r(n):r(String(n).split(e)),t},ai=()=>{},ci=(n,e)=>(n=+n,Number.isFinite(n)?n:e),tn="abcdefghijklmnopqrstuvwxyz",nr="0123456789",rr={DIGIT:nr,ALPHA:tn,ALPHA_DIGIT:tn+tn.toUpperCase()+nr},ui=(n=16,e=rr.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function li(n){return!!(n&&ae(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const fi=n=>{const e=new Array(10),t=(r,s)=>{if(Tt(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const i=We(r)?[]:{};return it(r,(o,c)=>{const l=t(o,s+1);!st(l)&&(i[c]=l)}),e[s]=void 0,i}}return r};return t(n,0)},hi=de("AsyncFunction");var d={isArray:We,isArrayBuffer:Gn,isBuffer:Ps,isFormData:Js,isArrayBufferView:Bs,isString:Us,isNumber:Xn,isBoolean:Is,isObject:Tt,isPlainObject:Ot,isUndefined:st,isDate:js,isFile:Vs,isBlob:Ms,isRegExp:si,isFunction:ae,isStream:Hs,isURLSearchParams:qs,isTypedArray:$s,isFileList:Ws,forEach:it,merge:en,extend:Ks,trim:zs,stripBOM:Ys,inherits:Gs,toFlatObject:Xs,kindOf:St,kindOfTest:de,endsWith:Qs,toArray:Zs,forEachEntry:ei,matchAll:ti,isHTMLForm:ni,hasOwnProperty:er,hasOwnProp:er,reduceDescriptors:tr,freezeMethods:ii,toObjectSet:oi,toCamelCase:ri,noop:ai,toFiniteNumber:ci,findKey:Qn,global:Zn,isContextDefined:$n,ALPHABET:rr,generateString:ui,isSpecCompliantForm:li,toJSONObject:fi,isAsyncFn:hi,isThenable:n=>n&&(Tt(n)||ae(n))&&ae(n.then)&&ae(n.catch)};function x(n,e,t,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),s&&(this.response=s)}d.inherits(x,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const sr=x.prototype,ir={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{ir[n]={value:n}}),Object.defineProperties(x,ir),Object.defineProperty(sr,"isAxiosError",{value:!0}),x.from=(n,e,t,r,s,i)=>{const o=Object.create(sr);return d.toFlatObject(n,o,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),x.call(o,n.message,e,t,r,s),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};var di=null;function nn(n){return d.isPlainObject(n)||d.isArray(n)}function or(n){return d.endsWith(n,"[]")?n.slice(0,-2):n}function ar(n,e,t){return n?n.concat(e).map(function(s,i){return s=or(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function pi(n){return d.isArray(n)&&!n.some(nn)}const yi=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function Ct(n,e,t){if(!d.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=d.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,S){return!d.isUndefined(S[m])});const r=t.metaTokens,s=t.visitor||f,i=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(s))throw new TypeError("visitor must be a function");function a(y){if(y===null)return"";if(d.isDate(y))return y.toISOString();if(!l&&d.isBlob(y))throw new x("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(y)||d.isTypedArray(y)?l&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,m,S){let _=y;if(y&&!S&&typeof y=="object"){if(d.endsWith(m,"{}"))m=r?m:m.slice(0,-2),y=JSON.stringify(y);else if(d.isArray(y)&&pi(y)||(d.isFileList(y)||d.endsWith(m,"[]"))&&(_=d.toArray(y)))return m=or(m),_.forEach(function(A,k){!(d.isUndefined(A)||A===null)&&e.append(o===!0?ar([m],k,i):o===null?m:m+"[]",a(A))}),!1}return nn(y)?!0:(e.append(ar(S,m,i),a(y)),!1)}const h=[],v=Object.assign(yi,{defaultVisitor:f,convertValue:a,isVisitable:nn});function b(y,m){if(!d.isUndefined(y)){if(h.indexOf(y)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(y),d.forEach(y,function(_,O){(!(d.isUndefined(_)||_===null)&&s.call(e,_,d.isString(O)?O.trim():O,m,v))===!0&&b(_,m?m.concat(O):[O])}),h.pop()}}if(!d.isObject(n))throw new TypeError("data must be an object");return b(n),e}function cr(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function rn(n,e){this._pairs=[],n&&Ct(n,this,e)}const ur=rn.prototype;ur.append=function(e,t){this._pairs.push([e,t])},ur.toString=function(e){const t=e?function(r){return e.call(this,r,cr)}:cr;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};function mi(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lr(n,e,t){if(!e)return n;const r=t&&t.encode||mi,s=t&&t.serialize;let i;if(s?i=s(e,t):i=d.isURLSearchParams(e)?e.toString():new rn(e,t).toString(r),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class gi{constructor(){this.handlers=[]}use(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}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(r){r!==null&&e(r)})}}var fr=gi,hr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vi=typeof URLSearchParams<"u"?URLSearchParams:rn,bi=typeof FormData<"u"?FormData:null,wi=typeof Blob<"u"?Blob:null,_i={isBrowser:!0,classes:{URLSearchParams:vi,FormData:bi,Blob:wi},protocols:["http","https","file","blob","url","data"]};const dr=typeof window<"u"&&typeof document<"u",Ei=(n=>dr&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),Si=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")();var Ri=Object.freeze({__proto__:null,hasBrowserEnv:dr,hasStandardBrowserWebWorkerEnv:Si,hasStandardBrowserEnv:Ei}),pe={...Ri,..._i};function Ti(n,e){return Ct(n,new pe.classes.URLSearchParams,Object.assign({visitor:function(t,r,s,i){return pe.isNode&&d.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function Oi(n){return d.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Ci(n){const e={},t=Object.keys(n);let r;const s=t.length;let i;for(r=0;r<s;r++)i=t[r],e[i]=n[i];return e}function pr(n){function e(t,r,s,i){let o=t[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),l=i>=t.length;return o=!o&&d.isArray(s)?s.length:o,l?(d.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!d.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&d.isArray(s[o])&&(s[o]=Ci(s[o])),!c)}if(d.isFormData(n)&&d.isFunction(n.entries)){const t={};return d.forEachEntry(n,(r,s)=>{e(Oi(r),s,t,0)}),t}return null}function xi(n,e,t){if(d.isString(n))try{return(e||JSON.parse)(n),d.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const sn={transitional:hr,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=d.isObject(e);if(i&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return s?JSON.stringify(pr(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ti(e,this.formSerializer).toString();if((c=d.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Ct(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),xi(e)):e}],transformResponse:[function(e){const t=this.transitional||sn.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(e&&d.isString(e)&&(r&&!this.responseType||s)){const o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(c){if(o)throw c.name==="SyntaxError"?x.from(c,x.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],n=>{sn.headers[n]={}});var on=sn;const Ai=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var ki=n=>{const e={};let t,r,s;return n&&n.split(`
2
2
  `).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!t||e[t]&&Ai[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e};const yr=Symbol("internals");function ot(n){return n&&String(n).trim().toLowerCase()}function xt(n){return n===!1||n==null?n:d.isArray(n)?n.map(xt):String(n)}function Di(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const Li=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function an(n,e,t,r,s){if(d.isFunction(r))return r.call(this,e,t);if(s&&(e=t),!!d.isString(e)){if(d.isString(r))return e.indexOf(r)!==-1;if(d.isRegExp(r))return r.test(e)}}function Ni(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function Fi(n,e){const t=d.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}class At{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function i(c,l,a){const f=ot(l);if(!f)throw new Error("header name must be a non-empty string");const h=d.findKey(s,f);(!h||s[h]===void 0||a===!0||a===void 0&&s[h]!==!1)&&(s[h||l]=xt(c))}const o=(c,l)=>d.forEach(c,(a,f)=>i(a,f,l));return d.isPlainObject(e)||e instanceof this.constructor?o(e,t):d.isString(e)&&(e=e.trim())&&!Li(e)?o(ki(e),t):e!=null&&i(t,e,r),this}get(e,t){if(e=ot(e),e){const r=d.findKey(this,e);if(r){const s=this[r];if(!t)return s;if(t===!0)return Di(s);if(d.isFunction(t))return t.call(this,s,r);if(d.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ot(e),e){const r=d.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||an(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let s=!1;function i(o){if(o=ot(o),o){const c=d.findKey(r,o);c&&(!t||an(r,r[c],c,t))&&(delete r[c],s=!0)}}return d.isArray(e)?e.forEach(i):i(e),s}clear(e){const t=Object.keys(this);let r=t.length,s=!1;for(;r--;){const i=t[r];(!e||an(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const t=this,r={};return d.forEach(this,(s,i)=>{const o=d.findKey(r,i);if(o){t[o]=xt(s),delete t[i];return}const c=e?Ni(i):String(i).trim();c!==i&&delete t[i],t[c]=xt(s),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return d.forEach(this,(r,s)=>{r!=null&&r!==!1&&(t[s]=e&&d.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
3
3
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[yr]=this[yr]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=ot(o);r[c]||(Fi(s,o),r[c]=!0)}return d.isArray(e)?e.forEach(i):i(e),this}}At.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),d.reduceDescriptors(At.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}}),d.freezeMethods(At);var Ee=At;function cn(n,e){const t=this||on,r=e||t,s=Ee.from(r.headers);let i=r.data;return d.forEach(n,function(c){i=c.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function mr(n){return!!(n&&n.__CANCEL__)}function at(n,e,t){x.call(this,n==null?"canceled":n,x.ERR_CANCELED,e,t),this.name="CanceledError"}d.inherits(at,x,{__CANCEL__:!0});function Pi(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new x("Request failed with status code "+t.status,[x.ERR_BAD_REQUEST,x.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}var Bi=pe.hasStandardBrowserEnv?{write(n,e,t,r,s,i){const o=[n+"="+encodeURIComponent(e)];d.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),d.isString(r)&&o.push("path="+r),d.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Ui(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Ii(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function gr(n,e){return n&&!Ui(e)?Ii(n,e):e}var ji=pe.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function s(i){let o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=s(window.location.href),function(o){const c=d.isString(o)?s(o):o;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function Vi(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Mi(n,e){n=n||10;const t=new Array(n),r=new Array(n);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const a=Date.now(),f=r[i];o||(o=a),t[s]=l,r[s]=a;let h=i,v=0;for(;h!==s;)v+=t[h++],h=h%n;if(s=(s+1)%n,s===i&&(i=(i+1)%n),a-o<e)return;const b=f&&a-f;return b?Math.round(v*1e3/b):void 0}}function vr(n,e){let t=0;const r=Mi(50,250);return s=>{const i=s.loaded,o=s.lengthComputable?s.total:void 0,c=i-t,l=r(c),a=i<=o;t=i;const f={loaded:i,total:o,progress:o?i/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o&&a?(o-i)/l:void 0,event:s};f[e?"download":"upload"]=!0,n(f)}}var Wi=typeof XMLHttpRequest<"u"&&function(n){return new Promise(function(t,r){let s=n.data;const i=Ee.from(n.headers).normalize();let{responseType:o,withXSRFToken:c}=n,l;function a(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let f;if(d.isFormData(s)){if(pe.hasStandardBrowserEnv||pe.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if((f=i.getContentType())!==!1){const[m,...S]=f?f.split(";").map(_=>_.trim()).filter(Boolean):[];i.setContentType([m||"multipart/form-data",...S].join("; "))}}let h=new XMLHttpRequest;if(n.auth){const m=n.auth.username||"",S=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";i.set("Authorization","Basic "+btoa(m+":"+S))}const v=gr(n.baseURL,n.url);h.open(n.method.toUpperCase(),lr(v,n.params,n.paramsSerializer),!0),h.timeout=n.timeout;function b(){if(!h)return;const m=Ee.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:m,config:n,request:h};Pi(function(A){t(A),a()},function(A){r(A),a()},_),h=null}if("onloadend"in h?h.onloadend=b:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(b)},h.onabort=function(){!h||(r(new x("Request aborted",x.ECONNABORTED,n,h)),h=null)},h.onerror=function(){r(new x("Network Error",x.ERR_NETWORK,n,h)),h=null},h.ontimeout=function(){let S=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const _=n.transitional||hr;n.timeoutErrorMessage&&(S=n.timeoutErrorMessage),r(new x(S,_.clarifyTimeoutError?x.ETIMEDOUT:x.ECONNABORTED,n,h)),h=null},pe.hasStandardBrowserEnv&&(c&&d.isFunction(c)&&(c=c(n)),c||c!==!1&&ji(v))){const m=n.xsrfHeaderName&&n.xsrfCookieName&&Bi.read(n.xsrfCookieName);m&&i.set(n.xsrfHeaderName,m)}s===void 0&&i.setContentType(null),"setRequestHeader"in h&&d.forEach(i.toJSON(),function(S,_){h.setRequestHeader(_,S)}),d.isUndefined(n.withCredentials)||(h.withCredentials=!!n.withCredentials),o&&o!=="json"&&(h.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&h.addEventListener("progress",vr(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",vr(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=m=>{!h||(r(!m||m.type?new at(null,n,h):m),h.abort(),h=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const y=Vi(v);if(y&&pe.protocols.indexOf(y)===-1){r(new x("Unsupported protocol "+y+":",x.ERR_BAD_REQUEST,n));return}h.send(s||null)})};const un={http:di,xhr:Wi};d.forEach(un,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const br=n=>`- ${n}`,Hi=n=>d.isFunction(n)||n===null||n===!1;var wr={getAdapter:n=>{n=d.isArray(n)?n:[n];const{length:e}=n;let t,r;const s={};for(let i=0;i<e;i++){t=n[i];let o;if(r=t,!Hi(t)&&(r=un[(o=String(t)).toLowerCase()],r===void 0))throw new x(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){const i=Object.entries(s).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
4
4
  `+i.map(br).join(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "frappe-react-sdk",
3
3
  "description": "React hooks for Frappe Framework",
4
- "version": "1.4.0",
4
+ "version": "1.4.2",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "The Commit Company",
@@ -89,7 +89,7 @@
89
89
  }
90
90
  },
91
91
  "dependencies": {
92
- "frappe-js-sdk": "^1.4.0",
92
+ "frappe-js-sdk": "^1.4.2",
93
93
  "socket.io-client": "4.7.1",
94
94
  "swr": "^2.2.5"
95
95
  }