UNPKG

react-hooks-toolbox

Version:

React hooks toolbox

13 lines 42.9 kB
/*! * react-hooks-toolbox v0.1.9 * MIT Licensed */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.HooksToolbox=t(require("react")):e.HooksToolbox=t(e.React)}(window,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=13)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(7),o=r(15),i=Object.prototype.toString;function a(e){return"[object Array]"===i.call(e)}function u(e){return null!==e&&"object"==typeof e}function s(e){return"[object Function]"===i.call(e)}function c(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),a(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}e.exports={isArray:a,isArrayBuffer:function(e){return"[object ArrayBuffer]"===i.call(e)},isBuffer:o,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:u,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===i.call(e)},isFile:function(e){return"[object File]"===i.call(e)},isBlob:function(e){return"[object Blob]"===i.call(e)},isFunction:s,isStream:function(e){return u(e)&&s(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,o=arguments.length;n<o;n++)c(arguments[n],r);return t},extend:function(e,t,r){return c(t,function(t,o){e[o]=r&&"function"==typeof t?n(t,r):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){"use strict";(function(e){var r,n="undefined"!=typeof Symbol?Symbol("immer-nothing"):((r={})["immer-nothing"]=!0,r),o="undefined"!=typeof Symbol?Symbol.for("immer-draftable"):"__$immer_draftable",i="undefined"!=typeof Symbol?Symbol.for("immer-state"):"__$immer_state";function a(e){return!!e&&!!e[i]}function u(e){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype||(!!e[o]||!!e.constructor[o])}var s=Object.assign||function(e,t){for(var r in t)h(t,r)&&(e[r]=t[r]);return e},c="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function f(e,t){if(void 0===t&&(t=!1),Array.isArray(e))return e.slice();var r=Object.create(Object.getPrototypeOf(e));return c(e).forEach(function(n){if(n!==i){var o=Object.getOwnPropertyDescriptor(e,n),a=o.value;if(o.get){if(!t)throw new Error("Immer drafts cannot have computed properties");a=o.get.call(e)}o.enumerable?r[n]=a:Object.defineProperty(r,n,{value:a,writable:!0,configurable:!0})}}),r}function l(e,t){if(Array.isArray(e))for(var r=0;r<e.length;r++)t(r,e[r],e);else c(e).forEach(function(r){return t(r,e[r],e)})}function p(e,t){return Object.getOwnPropertyDescriptor(e,t).enumerable}function h(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}var v=function(e){this.drafts=[],this.parent=e,this.canAutoFreeze=!0,this.patches=null};function y(e){e[i].revoke()}v.prototype.usePatches=function(e){e&&(this.patches=[],this.inversePatches=[],this.patchListener=e)},v.prototype.revoke=function(){this.leave(),this.drafts.forEach(y),this.drafts=null},v.prototype.leave=function(){this===v.current&&(v.current=this.parent)},v.current=null,v.enter=function(){return this.current=new v(this.current)};var m={};function g(e,t){var r=Array.isArray(e),n=T(e);l(n,function(t){!function(e,t,r){var n=m[t];n?n.enumerable=r:m[t]=n={configurable:!0,enumerable:r,get:function(){return function(e,t){E(e);var r=x(w(e),t);if(e.finalizing)return r;if(r===x(e.base,t)&&u(r))return j(e),e.copy[t]=g(r,e);return r}(this[i],t)},set:function(e){!function(e,t,r){if(E(e),e.assigned[t]=!0,!e.modified){if(d(r,x(w(e),t)))return;O(e),j(e)}e.copy[t]=r}(this[i],t,e)}};Object.defineProperty(e,t,n)}(n,t,r||p(e,t))});var o=t?t.scope:v.current;return function(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0})}(n,i,{scope:o,modified:!1,finalizing:!1,finalized:!1,assigned:{},parent:t,base:e,draft:n,copy:null,revoke:b,revoked:!1}),o.drafts.push(n),n}function b(){this.revoked=!0}function w(e){return e.copy||e.base}function x(e,t){var r=e[i];if(r&&!r.finalizing){r.finalizing=!0;var n=e[t];return r.finalizing=!1,n}return e[t]}function O(e){e.modified||(e.modified=!0,e.parent&&O(e.parent))}function j(e){e.copy||(e.copy=T(e.base))}function T(e){var t=e&&e[i];if(t){t.finalizing=!0;var r=f(t.draft,!0);return t.finalizing=!1,r}return f(e)}function E(e){if(!0===e.revoked)throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+JSON.stringify(w(e)))}function P(e){for(var t=e.length-1;t>=0;t--){var r=e[t][i];r.modified||(Array.isArray(r.base)?A(r)&&O(r):S(r)&&O(r))}}function S(e){for(var t=e.base,r=e.draft,n=Object.keys(r),o=n.length-1;o>=0;o--){var a=n[o],u=t[a];if(void 0===u&&!h(t,a))return!0;var s=r[a],c=s&&s[i];if(c?c.base!==u:!d(s,u))return!0}return n.length!==Object.keys(t).length}function A(e){var t=e.draft;if(t.length!==e.base.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}var _=Object.freeze({willFinalize:function(e,t,r){e.drafts.forEach(function(e){e[i].finalizing=!0}),r?a(t)&&t[i].scope===e&&P(e.drafts):(e.patches&&function e(t){if(t&&"object"==typeof t){var r=t[i];if(r){var n=r.base,o=r.draft,a=r.assigned;if(Array.isArray(t)){if(A(r)){if(O(r),a.length=!0,o.length<n.length)for(var u=o.length;u<n.length;u++)a[u]=!1;else for(var s=n.length;s<o.length;s++)a[s]=!0;for(var c=0;c<o.length;c++)void 0===a[c]&&e(o[c])}}else Object.keys(o).forEach(function(t){void 0!==n[t]||h(n,t)?a[t]||e(o[t]):(a[t]=!0,O(r))}),Object.keys(n).forEach(function(e){void 0!==o[e]||h(o,e)||(a[e]=!1,O(r))})}}}(e.drafts[0]),P(e.drafts))},createProxy:g});function C(e,t){var r=t?t.scope:v.current,n={scope:r,modified:!1,finalized:!1,assigned:{},parent:t,base:e,draft:null,drafts:{},copy:null,revoke:null},o=Array.isArray(e)?Proxy.revocable([n],L):Proxy.revocable(n,k),i=o.revoke,a=o.proxy;return n.draft=a,n.revoke=i,r.drafts.push(a),a}var k={get:function(e,t){if(t===i)return e;var r=e.drafts;if(!e.modified&&h(r,t))return r[t];var n=R(e)[t];if(e.finalized||!u(n))return n;if(e.modified){if(n!==F(e.base,t))return n;r=e.copy}return r[t]=C(n,e)},has:function(e,t){return t in R(e)},ownKeys:function(e){return Reflect.ownKeys(R(e))},set:function(e,t,r){if(!e.modified){var n=F(e.base,t),o=r?d(n,r)||r===e.drafts[t]:d(n,r)&&t in e.base;if(o)return!0;N(e)}return e.assigned[t]=!0,e.copy[t]=r,!0},deleteProperty:function(e,t){(void 0!==F(e.base,t)||t in e.base)&&(e.assigned[t]=!1,N(e));e.copy&&delete e.copy[t];return!0},getOwnPropertyDescriptor:function(e,t){var r=R(e),n=Reflect.getOwnPropertyDescriptor(r,t);n&&(n.writable=!0,n.configurable=!Array.isArray(r)||"length"!==t);return n},defineProperty:function(){throw new Error("Object.defineProperty() cannot be used on an Immer draft")},getPrototypeOf:function(e){return Object.getPrototypeOf(e.base)},setPrototypeOf:function(){throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft")}},L={};function R(e){return e.copy||e.base}function F(e,t){var r=e[i],n=Reflect.getOwnPropertyDescriptor(r?R(r):e,t);return n&&n.value}function N(e){e.modified||(e.modified=!0,e.copy=s(f(e.base),e.drafts),e.drafts=null,e.parent&&N(e.parent))}l(k,function(e,t){L[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),L.deleteProperty=function(e,t){if(isNaN(parseInt(t)))throw new Error("Immer only supports deleting array indices");return k.deleteProperty.call(this,e[0],t)},L.set=function(e,t,r){if("length"!==t&&isNaN(parseInt(t)))throw new Error("Immer only supports setting array indices and the 'length' property");return k.set.call(this,e[0],t,r)};var D=Object.freeze({willFinalize:function(){},createProxy:C});function I(e,t,r,n){Array.isArray(e.base)?function(e,t,r,n){var o,i,a=e.base,u=e.copy,s=e.assigned;u.length<a.length&&(a=(o=[u,a])[0],u=o[1],r=(i=[n,r])[0],n=i[1]);var c=u.length-a.length,f=0;for(;a[f]===u[f]&&f<a.length;)++f;var l=a.length;for(;l>f&&a[l-1]===u[l+c-1];)--l;for(var p=f;p<l;++p)if(s[p]&&u[p]!==a[p]){var h=t.concat([p]);r.push({op:"replace",path:h,value:u[p]}),n.push({op:"replace",path:h,value:a[p]})}for(var d=l!=a.length,v=r.length,y=l+c-1;y>=l;--y){var m=t.concat([y]);r[v+y-l]={op:"add",path:m,value:u[y]},d&&n.push({op:"remove",path:m})}d||n.push({op:"replace",path:t.concat(["length"]),value:a.length})}(e,t,r,n):function(e,t,r,n){var o=e.base,i=e.copy;l(e.assigned,function(e,a){var u=o[e],s=i[e],c=a?e in o?"replace":"add":"remove";if(u!==s||"replace"!==c){var f=t.concat(e);r.push("remove"===c?{op:c,path:f}:{op:c,path:f,value:s}),n.push("add"===c?{op:"remove",path:f}:"remove"===c?{op:"add",path:f,value:u}:{op:"replace",path:f,value:u})}})}(e,t,r,n)}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r],o=n.path;if(0===o.length&&"replace"===n.op)e=n.value;else{for(var i=e,a=0;a<o.length-1;a++)if(!(i=i[o[a]])||"object"!=typeof i)throw new Error("Cannot apply patch, path doesn't resolve: "+o.join("/"));var u=o[o.length-1];switch(n.op){case"replace":i[u]=n.value;break;case"add":Array.isArray(i)?i.splice(u,0,n.value):i[u]=n.value;break;case"remove":Array.isArray(i)?i.splice(u,1):delete i[u];break;default:throw new Error("Unsupported patch operation: "+n.op)}}}return e}var U={useProxies:"undefined"!=typeof Proxy&&"undefined"!=typeof Reflect,autoFreeze:void 0===e&&"verifyMinified"===function(){}.name,onAssign:null,onDelete:null,onCopy:null},B=function(e){s(this,U,e),this.setUseProxies(this.useProxies),this.produce=this.produce.bind(this)};B.prototype.produce=function(e,t,r){var o,i=this;if("function"==typeof e&&"function"!=typeof t){var a=t;return t=e,function(e){void 0===e&&(e=a);for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];return i.produce(e,function(e){return t.call.apply(t,[e,e].concat(r))})}}if("function"!=typeof t)throw new Error("The first or second argument to `produce` must be a function");if(void 0!==r&&"function"!=typeof r)throw new Error("The third argument to `produce` must be a function or undefined");if(u(e)){var s=v.enter(),c=this.createProxy(e),f=!0;try{o=t.call(c,c),f=!1}finally{f?s.revoke():s.leave()}return o instanceof Promise?o.then(function(e){return s.usePatches(r),i.processResult(e,s)},function(e){throw s.revoke(),e}):(s.usePatches(r),this.processResult(o,s))}return void 0===(o=t(e))?e:o!==n?o:void 0},B.prototype.createDraft=function(e){if(!u(e))throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object");var t=v.enter(),r=this.createProxy(e);return r[i].isManual=!0,t.leave(),r},B.prototype.finishDraft=function(e,t){var r=e&&e[i];if(!r||!r.isManual)throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`");if(r.finalized)throw new Error("The given draft is already finalized");var n=r.scope;return n.usePatches(t),this.processResult(void 0,n)},B.prototype.setAutoFreeze=function(e){this.autoFreeze=e},B.prototype.setUseProxies=function(e){this.useProxies=e,s(this,e?D:_)},B.prototype.applyPatches=function(e,t){return a(e)?z(e,t):this.produce(e,function(e){return z(e,t)})},B.prototype.processResult=function(e,t){var r=t.drafts[0],o=void 0!==e&&e!==r;if(this.willFinalize(t,e,o),o){if(r[i].modified)throw t.revoke(),new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");u(e)&&(e=this.finalize(e,null,t)),t.patches&&(t.patches.push({op:"replace",path:[],value:e}),t.inversePatches.push({op:"replace",path:[],value:r[i].base}))}else e=this.finalize(r,[],t);return t.revoke(),t.patches&&t.patchListener(t.patches,t.inversePatches),e!==n?e:void 0},B.prototype.finalize=function(e,t,r){var n=this,o=e[i];if(!o)return Object.isFrozen(e)?e:this.finalizeTree(e,null,r);if(o.scope!==r)return e;if(!o.modified)return o.base;if(!o.finalized){if(o.finalized=!0,this.finalizeTree(o.draft,t,r),this.onDelete)if(this.useProxies){var a=o.assigned;for(var u in a)a[u]||this.onDelete(o,u)}else{var s=o.base,c=o.copy;l(s,function(e){h(c,e)||n.onDelete(o,e)})}this.onCopy&&this.onCopy(o),this.autoFreeze&&r.canAutoFreeze&&Object.freeze(o.copy),t&&r.patches&&I(o,t,r.patches,r.inversePatches)}return o.copy},B.prototype.finalizeTree=function(e,t,r){var n=this,o=e[i];o&&(this.useProxies||(o.copy=f(o.draft,!0)),e=o.copy);var s=!!t&&!!r.patches,c=function(i,f,h){if(f===h)throw Error("Immer forbids circular references");var v=!!o&&h===e;if(a(f)){var y=v&&s&&!o.assigned[i]?t.concat(i):null;if(a(f=n.finalize(f,y,r))&&(r.canAutoFreeze=!1),Array.isArray(h)||p(h,i)?h[i]=f:Object.defineProperty(h,i,{value:f}),v&&f===o.base[i])return}else{if(v&&d(f,o.base[i]))return;u(f)&&!Object.isFrozen(f)&&l(f,c)}v&&n.onAssign&&n.onAssign(o,i,f)};return l(e,c),e};var q=new B,G=q.produce;q.setAutoFreeze.bind(q),q.setUseProxies.bind(q),q.applyPatches.bind(q),q.createDraft.bind(q),q.finishDraft.bind(q);t.a=G}).call(this,r(6))},function(e,t,r){e.exports=r(14)},function(e,t,r){"use strict";(function(t){var n=r(1),o=r(17),i={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var u={adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=r(8):void 0!==t&&(e=r(8)),e}(),transformRequest:[function(e,t){return o(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(a(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};n.forEach(["delete","get","head"],function(e){u.headers[e]={}}),n.forEach(["post","put","patch"],function(e){u.headers[e]=n.merge(i)}),e.exports=u}).call(this,r(6))},function(e,t,r){e.exports=r(31)},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var s,c=[],f=!1,l=-1;function p(){f&&s&&(f=!1,s.length?c=s.concat(c):l=-1,c.length&&h())}function h(){if(!f){var e=u(p);f=!0;for(var t=c.length;t;){for(s=c,c=[];++l<t;)s&&s[l].run();l=-1,t=c.length}s=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||f||u(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t,r){"use strict";var n=r(1),o=r(18),i=r(20),a=r(21),u=r(22),s=r(9);e.exports=function(e){return new Promise(function(t,c){var f=e.data,l=e.headers;n.isFormData(f)&&delete l["Content-Type"];var p=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",d=e.auth.password||"";l.Authorization="Basic "+btoa(h+":"+d)}if(p.open(e.method.toUpperCase(),i(e.url,e.params,e.paramsSerializer),!0),p.timeout=e.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in p?a(p.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:e,request:p};o(t,c,n),p=null}},p.onerror=function(){c(s("Network Error",e,null,p)),p=null},p.ontimeout=function(){c(s("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",p)),p=null},n.isStandardBrowserEnv()){var v=r(23),y=(e.withCredentials||u(e.url))&&e.xsrfCookieName?v.read(e.xsrfCookieName):void 0;y&&(l[e.xsrfHeaderName]=y)}if("setRequestHeader"in p&&n.forEach(l,function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete l[t]:p.setRequestHeader(t,e)}),e.withCredentials&&(p.withCredentials=!0),e.responseType)try{p.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&p.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){p&&(p.abort(),c(e),p=null)}),void 0===f&&(f=null),p.send(f)})}},function(e,t,r){"use strict";var n=r(19);e.exports=function(e,t,r,o,i){var a=new Error(e);return n(a,t,r,o,i)}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){window,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}({"./xmlParser.js":function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,(n=[{key:"_parseFromString",value:function(e){var t=this,r=e.replace(/\s{2,}/g," ").replace(/\\t\\n\\r/g,"").replace(/>/g,">\n"),n=[];return r.split("\n").map(function(e){if((e=e.trim())&&!(e.indexOf("?xml")>-1))if(0==e.indexOf("<")&&e.indexOf("CDATA")<0){var r=t._parseTag(e);n.push(r),e.match(/\/\s*>$/)&&n.push(t._parseTag("</"+r.name+">"))}else n[n.length-1].value=t._parseValue(e)}),this._convertTagsArrayToTree(n)[0]}},{key:"_getElementsByTagName",value:function(e){var t=[];return"*"!=e&&this.name.toLowerCase()!==e.toLowerCase()||t.push(this),this.children.map(function(r){t=t.concat(r.getElementsByTagName(e))}),t}},{key:"_parseTag",value:function(e,t){var r=e.match(/([^\s]*)=('([^']*?)'|"([^"]*?)")|([\/?\w\-\:]+)/g),n={name:r.shift().replace(/\/\s*$/,""),attributes:{},children:[],value:"",getElementsByTagName:this._getElementsByTagName};return r.map(function(e){var t=e.split("=");if(!(t.length<2)){var r=t[0],o="";o=2===t.length?t[1]:(t=t.slice(1)).join("="),n.attributes[r]="string"==typeof o?o.replace(/^"/g,"").replace(/^'/g,"").replace(/"$/g,"").replace(/'$/g,"").trim():o}}),n}},{key:"_parseValue",value:function(e){return e.indexOf("CDATA")<0?e.trim():e.substring(e.lastIndexOf("[")+1,e.indexOf("]"))}},{key:"_convertTagsArrayToTree",value:function(e){var t=[];if(0==e.length)return t;var r=e.shift();return r.value.indexOf("</")>-1||r.name.match(/\/$/)?(r.name=r.name.replace(/\/$/,"").trim(),r.value=r.value.substring(0,r.value.indexOf("</")),t.push(r),t=t.concat(this._convertTagsArrayToTree(e))):0==r.name.indexOf("/")?t:(t.push(r),r.children=this._convertTagsArrayToTree(e),t=t.concat(this._convertTagsArrayToTree(e)))}},{key:"_toString",value:function(e){var t=this,r=this._convertTagToText(e);return e.children.length>0&&(e.children.map(function(e){r+=t._toString(e)}),r+="</"+e.name+">"),r}},{key:"_convertTagToText",value:function(e){var t="<"+e.name;for(var r in e.attributes)t+=" "+r+'="'+e.attributes[r]+'"';return e.value.length>0?t+=">"+e.value+"</"+e.name+">":t+=">",0===e.children.length&&(t+="</"+e.name+">"),t}},{key:"parseFromString",value:function(e){return this._parseFromString(e)}},{key:"toString",value:function(e){return this._toString(e)}}])&&r(t.prototype,n),e}()},0:function(e,t,r){e.exports=r("./xmlParser.js")}})},function(e,t,r){e.exports=r(33)},function(e,t,r){"use strict";var n=r(1),o=r(7),i=r(16),a=r(4);function u(e){var t=new i(e),r=o(i.prototype.request,t);return n.extend(r,i.prototype,t),n.extend(r,t),r}var s=u(a);s.Axios=i,s.create=function(e){return u(n.merge(a,e))},s.Cancel=r(11),s.CancelToken=r(29),s.isCancel=r(10),s.all=function(e){return Promise.all(e)},s.spread=r(30),e.exports=s,e.exports.default=s},function(e,t){ /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */ e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,r){"use strict";var n=r(4),o=r(1),i=r(24),a=r(25);function u(e){this.defaults=e,this.interceptors={request:new i,response:new i}}u.prototype.request=function(e){"string"==typeof e&&(e=o.merge({url:arguments[0]},arguments[1])),(e=o.merge(n,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[a,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r},o.forEach(["delete","get","head","options"],function(e){u.prototype[e]=function(t,r){return this.request(o.merge(r||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){u.prototype[e]=function(t,r,n){return this.request(o.merge(n||{},{method:e,url:t,data:r}))}}),e.exports=u},function(e,t,r){"use strict";var n=r(1);e.exports=function(e,t){n.forEach(e,function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])})}},function(e,t,r){"use strict";var n=r(9);e.exports=function(e,t,r){var o=r.config.validateStatus;r.status&&o&&!o(r.status)?t(n("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}},function(e,t,r){"use strict";e.exports=function(e,t,r,n,o){return e.config=t,r&&(e.code=r),e.request=n,e.response=o,e}},function(e,t,r){"use strict";var n=r(1);function o(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(n.isURLSearchParams(t))i=t.toString();else{var a=[];n.forEach(t,function(e,t){null!==e&&void 0!==e&&(n.isArray(e)?t+="[]":e=[e],n.forEach(e,function(e){n.isDate(e)?e=e.toISOString():n.isObject(e)&&(e=JSON.stringify(e)),a.push(o(t)+"="+o(e))}))}),i=a.join("&")}return i&&(e+=(-1===e.indexOf("?")?"?":"&")+i),e}},function(e,t,r){"use strict";var n=r(1),o=["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"];e.exports=function(e){var t,r,i,a={};return e?(n.forEach(e.split("\n"),function(e){if(i=e.indexOf(":"),t=n.trim(e.substr(0,i)).toLowerCase(),r=n.trim(e.substr(i+1)),t){if(a[t]&&o.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([r]):a[t]?a[t]+", "+r:r}}),a):a}},function(e,t,r){"use strict";var n=r(1);e.exports=n.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function o(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{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 e=o(window.location.href),function(t){var r=n.isString(t)?o(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},function(e,t,r){"use strict";var n=r(1);e.exports=n.isStandardBrowserEnv()?{write:function(e,t,r,o,i,a){var u=[];u.push(e+"="+encodeURIComponent(t)),n.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),n.isString(o)&&u.push("path="+o),n.isString(i)&&u.push("domain="+i),!0===a&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(e,t,r){"use strict";var n=r(1);function o(){this.handlers=[]}o.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){n.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=o},function(e,t,r){"use strict";var n=r(1),o=r(26),i=r(10),a=r(4),u=r(27),s=r(28);function c(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return c(e),e.baseURL&&!u(e.url)&&(e.url=s(e.baseURL,e.url)),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),n.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||a.adapter)(e).then(function(t){return c(e),t.data=o(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(c(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,r){"use strict";var n=r(1);e.exports=function(e,t,r){return n.forEach(r,function(r){e=r(e,t)}),e}},function(e,t,r){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,r){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,r){"use strict";var n=r(11);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var r=this;e(function(e){r.reason||(r.reason=new n(e),t(r.reason))})}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o(function(t){e=t}),cancel:e}},e.exports=o},function(e,t,r){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,e.exports=r(32),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";var r,n=Object.prototype,o=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag",c="object"==typeof e,f=t.regeneratorRuntime;if(f)c&&(e.exports=f);else{(f=t.regeneratorRuntime=c?e.exports:{}).wrap=w;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",v={},y={};y[a]=function(){return this};var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==n&&o.call(g,a)&&(y=g);var b=T.prototype=O.prototype=Object.create(y);j.prototype=b.constructor=T,T.constructor=j,T[s]=j.displayName="GeneratorFunction",f.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===j||"GeneratorFunction"===(t.displayName||t.name))},f.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,T):(e.__proto__=T,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(b),e},f.awrap=function(e){return{__await:e}},E(P.prototype),P.prototype[u]=function(){return this},f.AsyncIterator=P,f.async=function(e,t,r,n){var o=new P(w(e,t,r,n));return f.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},E(b),b[s]="Generator",b[a]=function(){return this},b.toString=function(){return"[object Generator]"},f.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},f.values=k,C.prototype={constructor:C,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return u.type="throw",u.arg=e,t.next=n,o&&(t.method="next",t.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),v}}}function w(e,t,r,n){var o=t&&t.prototype instanceof O?t:O,i=Object.create(o.prototype),a=new C(n||[]);return i._invoke=function(e,t,r){var n=l;return function(o,i){if(n===h)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return L()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=S(a,r);if(u){if(u===v)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=x(e,t,r);if("normal"===s.type){if(n=r.done?d:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}(e,r,a),i}function x(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function O(){}function j(){}function T(){}function E(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function P(e){var t;this._invoke=function(r,n){function i(){return new Promise(function(t,i){!function t(r,n,i,a){var u=x(e[r],e,n);if("throw"!==u.type){var s=u.arg,c=s.value;return c&&"object"==typeof c&&o.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,i,a)},function(e){t("throw",e,i,a)}):Promise.resolve(c).then(function(e){s.value=e,i(s)},a)}a(u.arg)}(r,n,t,i)})}return t=t?t.then(i,i):i()}}function S(e,t){var n=e.iterator[t.method];if(n===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=r,S(e,t),"throw"===t.method))return v;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=x(n,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,v;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,v):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function k(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=r,t.done=!0,t};return i.next=i}}return{next:L}}function L(){return{value:r,done:!0}}}(function(){return this}()||Function("return this")())},function(e,t,r){"use strict";r.r(t);var n=r(0);function o(e){return{type:"CHANGE_SIGNED_STATUS",signed:e}}function i(e){return{type:"CHANGE_GAPI_STATUS",status:e,error:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null}}var a=r(2);function u(e,t){switch(t.type){case"CHANGE_SIGNED_STATUS":var r=t.signed,n=null;if(r){var o=window.gapi.auth2.getAuthInstance().currentUser.get(),i=o.getBasicProfile(),u=o.getAuthResponse().id_token;n=function(e,t,r,n,o,i,a){return{id:e,name:t,givenName:r,familyName:n,imageUrl:o,email:i,token:a}}(i.getId(),i.getName(),i.getGivenName(),i.getFamilyName(),i.getImageUrl(),i.getEmail(),u)}return Object(a.a)(e,function(e){e.signed=r,e.userProfile=n});case"CHANGE_GAPI_STATUS":return Object(a.a)(e,function(e){e.gapiStatus=t.status,e.gapiError=t.error});default:return e}}var s={gapiStatus:"init",gapiError:null,signed:!1,userProfile:null};function c(e){var t=Object(n.useReducer)(u,s),r=t[0],a=t[1],c=Object(n.useCallback)(function(){var t=document.createElement("script");t.src="https://apis.google.com/js/api.js",document.body.appendChild(t),t.onerror=function(){a(i("error","Failed to load api.js script. "))},t.onload=function(){var t=window.gapi;t.load("client:auth2",{callback:function(){t.client.init(e).then(function(){a(i("success")),t.auth2.getAuthInstance().isSignedIn.listen(function(e){return a(o(e))}),a(o(t.auth2.getAuthInstance().isSignedIn.get()))},function(e){a(i("error",e))})},onerror:function(e){a(i("error",e))}})}},[e]);return Object(n.useEffect)(function(){a(i("loading")),c()},[c]),r}var f=r(3),l=r.n(f),p=r(12),h=r.n(p);function d(e){return"https://localhost:"+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:41951)+"/DYMO/DLS/Printing/"+e}var v=l.a.create({transformRequest:[function(e,t){return delete t.common,e}]});function y(e,t){var r=Object(n.useRef)(),o=Object(n.useState)(e),i=o[0],a=o[1],u=void 0;try{u=JSON.stringify(e)}catch(e){}return Object(n.useEffect)(function(){return r.current=setTimeout(function(){a(e)},t),function(){clearTimeout(r.current)}},[u,t]),i}var m=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function g(e){var t=e.url,r=void 0===t?"":t,n=e.options,o=void 0===n?{}:n,i=e.controlledFetch,a=e.delay,u=void 0===a?0:a,s=e.axiosInstance,c=e.onlyDispatchIf,f=e.successCb,l=e.failedCb,p=y({url:r,method:"GET",options:o,controlledFetch:i,onlyDispatchIf:c},u);return L(m({},p,{axiosInstance:s,successCb:f,failedCb:l}))}function b(){return g({url:d("StatusConnected",arguments.length>0&&void 0!==arguments[0]?arguments[0]:41951),axiosInstance:v}).status}function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"LabelWriterPrinter",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:41951,o=Object(n.useState)([]),i=o[0],a=o[1],u=Object(n.useState)("init"),s=u[0],c=u[1],f=g({url:d("GetPrinters",r),axiosInstance:v,onlyDispatchIf:"success"===e}),l=f.status,p=f.response;return Object(n.useEffect)(function(){"success"===l&&p?(a(function(e,t){var r=[];return(new h.a).parseFromString(e).getElementsByTagName(t).map(function(e){var t={};e.children.map(function(e){t[e.name.charAt(0).toLowerCase()+e.name.slice(1)]=e.value}),r.push(t)}),r}(p,t)),c(l)):c(l)},[t,p,l]),{statusDymoFetchPrinters:s,printers:i}}var x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function O(e){var t=e.url,r=void 0===t?"":t,n=e.options,o=void 0===n?{}:n,i=e.controlledFetch,a=e.delay,u=void 0===a?0:a,s=e.axiosInstance,c=e.successCb,f=e.failedCb,l=y({url:r,method:"POST",options:o,controlledFetch:i,onlyDispatchIf:e.onlyDispatchIf},u);return L(x({},l,{axiosInstance:s,successCb:c,failedCb:f}))}function j(e,t){var r=O({url:d("RenderLabel",arguments.length>2&&void 0!==arguments[2]?arguments[2]:41951),options:{data:"labelXml="+encodeURIComponent(t)+"&renderParamsXml=&printerName="},axiosInstance:v,onlyDispatchIf:"success"===e,delay:500}),n=r.status;return{label:r.response,statusOpenLabel:n,errorOpenLabel:r.error}}var T=r(5),E=r.n(T),P={status:"init",response:null,error:null};function S(e,t){switch(t.type){case"FETCH_START":return Object(a.a)(e,function(e){e.status="loading",e.error=null,e.response=null});case"FETCH_SUCCESS":return Object(a.a)(e,function(e){e.status="success",e.error=null,e.response=t.payload});case"FETCH_FAILURE":return Object(a.a)(e,function(e){e.status="error",e.error=t.error,e.response=null})}}var A=function(){return{type:"FETCH_START"}},_=function(e){return{type:"FETCH_SUCCESS",payload:e}},C=function(e){return{type:"FETCH_FAILURE",error:e}},k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};function L(e){var t=this,r=e.url,o=e.method,i=e.options,a=void 0===i?{}:i,u=e.controlledFetch,s=void 0!==u&&u,c=e.axiosInstance,f=void 0===c?l.a:c,p=e.successCb,h=void 0===p?function(){}:p,d=e.failedCb,v=void 0===d?function(){}:d,y=e.onlyDispatchIf,m=void 0===y||y,g=Object(n.useReducer)(S,P),b=g[0],w=g[1],x=Object(n.useState)(null),O=x[0],j=x[1],T=Object(n.useRef)(),L=void 0;try{L=JSON.stringify(a)}catch(e){}var R=s?[O]:[o,L,r,m];return Object(n.useEffect)(function(){if(m&&(O||!s))return function(){var e=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){return function n(o,i){try{var a=t[o](i),u=a.value}catch(e){return void r(e)}if(!a.done)return Promise.resolve(u).then(function(e){n("next",e)},function(e){n("throw",e)});e(u)}("next")})}}(E.a.mark(function e(){var n,i;return E.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return w(A()),T.current&&T.current.cancel(),T.current=l.a.CancelToken.source(),e.prev=3,n=JSON.parse(L),e.next=7,f.request(k({url:r,method:o,cancelToken:T.current.token},n));case 7:i=e.sent,h(i.data),w(_(i.data)),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(3),v(e.t0),l.a.isCancel(e.t0)||w(C(e.t0));case 16:case"end":return e.stop()}},e,t,[[3,12]])}));return function(){return e.apply(this,arguments)}}()(),function(){T.current&&T.current.cancel()}},R),k({},b,{dispatchFetch:function(){j(+new Date)}})}r.d(t,"useGoogleApiInit",function(){return c}),r.d(t,"useDymoCheckService",function(){return b}),r.d(t,"useDymoFetchPrinters",function(){return w}),r.d(t,"useDymoOpenLabel",function(){return j}),r.d(t,"useAxios",function(){return L}),r.d(t,"useAxiosGet",function(){return g}),r.d(t,"useAxiosPost",function(){return O}),r.d(t,"useDebounce",function(){return y})}]).default}); //# sourceMappingURL=react-hooks-toolbox.min.js.map