@craftercms/classes
Advanced tools
Comparing version 4.1.8 to 4.2.0
@@ -1,1 +0,1 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("rxjs"),require("rxjs/operators"),require("@craftercms/utils"),require("@craftercms/models"),require("rxjs/ajax")):"function"==typeof define&&define.amd?define("@craftercms/classes",["exports","rxjs","rxjs/operators","@craftercms/utils","@craftercms/models","rxjs/ajax"],factory):factory(((global=global||self).craftercms=global.craftercms||{},global.craftercms.classes={}),global.rxjs,global.rxjs.operators,global.craftercms.utils,global.craftercms.models,global.rxjs.ajax)}(this,function(exports,rxjs,operators,utils,models,ajax){"use strict";var Messenger=function(){function Messenger(){var _this=this;this.targets=[],this.origins=[];var multiCaster=new rxjs.Subject,messages=rxjs.fromEvent(window,"message").pipe(operators.tap(function(event){return!_this.originAllowed(event.origin)&&console.log("Messenger: Message received from a disallowed origin.",event)}),operators.filter(function(event){return _this.originAllowed(event.origin)&&"object"==typeof event.data&&"topic"in event.data&&"data"in event.data&&"scope"in event.data}),operators.map(function(event){return{topic:event.data.topic,data:event.data.data,scope:event.data.scope||models.MessageScope.Broadcast}}),operators.multicast(multiCaster),operators.refCount());this.messages$=messages,this.multiCaster$=multiCaster}return Messenger.prototype.subscribe=function(observerOrNext){for(var operators=[],_i=1;_i<arguments.length;_i++)operators[_i-1]=arguments[_i];return this.messages$.pipe.apply(this.messages$,operators).subscribe(observerOrNext)},Messenger.prototype.subscribeTo=function(topic,subscriber,scope){for(var operations=[],_i=3;_i<arguments.length;_i++)operations[_i-3]=arguments[_i];var ops=[];return utils.notNullOrUndefined(scope)?ops.push(operators.filter(function(message){return message.topic===topic})):ops.push(operators.filter(function(message){return message.scope===scope&&message.topic===topic})),this.messages$.pipe.apply(this.messages$,ops.concat(operations)).subscribe(subscriber)},Messenger.prototype.addTarget=function(target){this.removeTarget(target),this.targets.push(target)},Messenger.prototype.resetTargets=function(){this.targets=[]},Messenger.prototype.removeTarget=function(target){this.targets=this.targets.filter(function(item){return item!==target})},Messenger.prototype.addOrigin=function(origin){this.removeOrigin(origin),this.origins.push(origin)},Messenger.prototype.resetOrigins=function(){this.origins=[]},Messenger.prototype.removeOrigin=function(origin){this.origins=this.origins.filter(function(item){return item!==origin})},Messenger.prototype.publish=function(topicOrMessage,data,scope){var message;switch(void 0===data&&(data=null),void 0===scope&&(scope=models.MessageScope.Broadcast),message="string"==typeof topicOrMessage&&topicOrMessage in models.MessageTopic?{topic:topicOrMessage,data:data,scope:scope}:topicOrMessage,scope){case models.MessageScope.Local:this.multiCaster$.next(message);break;case models.MessageScope.External:this.sendMessage(message);break;case models.MessageScope.Broadcast:this.multiCaster$.next(message),this.sendMessage(message)}},Messenger.prototype.sendMessage=function(message,targetOrigin){var _this=this;void 0===targetOrigin&&(targetOrigin="*"),this.targets.forEach(function(target){target.postMessage||(target=target.contentWindow),target&&target.postMessage?target.postMessage(message,targetOrigin):_this.removeTarget(target)})},Messenger.prototype.originAllowed=function(origin){for(var origins=this.origins,i=0,l=origins.length;i<l;++i)if(origins[i]===origin)return!0;return!1},Messenger}(),extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])})(d,b)};function __extends(d,b){if("function"!=typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function __values(o){var s="function"==typeof Symbol&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&"number"==typeof o.length)return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,n){var m="function"==typeof Symbol&&o[Symbol.iterator];if(!m)return o;var r,e,i=m.call(o),ar=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error:error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar}function __spreadArray(to,from,pack){if(pack||2===arguments.length)for(var ar,i=0,l=from.length;i<l;i++)!ar&&i in from||(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,g=generator.apply(thisArg,_arguments||[]),q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){q.push([n,v,a,b])>1||resume(n,v)})})}function resume(n,v){try{(r=g[n](v)).value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}catch(e){settle(q[0][3],e)}var r}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,m=o[Symbol.asyncIterator];return m?m.call(o):(o=__values(o),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){(function(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)})(resolve,reject,(v=o[n](v)).done,v.value)})}}}"function"==typeof SuppressedError&&SuppressedError;function isFunction(value){return"function"==typeof value}var ctorFunc,UnsubscriptionError=((ctorFunc=function(_super){return function(errors){_super(this),this.message=errors?errors.length+" errors occurred during unsubscription:\n"+errors.map(function(err,i){return i+1+") "+err.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=errors}}(function(instance){Error.call(instance),instance.stack=(new Error).stack})).prototype=Object.create(Error.prototype),ctorFunc.prototype.constructor=ctorFunc,ctorFunc);function arrRemove(arr,item){if(arr){var index=arr.indexOf(item);0<=index&&arr.splice(index,1)}}var Subscription=function(){function Subscription(initialTeardown){this.initialTeardown=initialTeardown,this.closed=!1,this._parentage=null,this._finalizers=null}var empty;return Subscription.prototype.unsubscribe=function(){var e_1,_a,e_2,_b,errors;if(!this.closed){this.closed=!0;var _parentage=this._parentage;if(_parentage)if(this._parentage=null,Array.isArray(_parentage))try{for(var _parentage_1=__values(_parentage),_parentage_1_1=_parentage_1.next();!_parentage_1_1.done;_parentage_1_1=_parentage_1.next()){_parentage_1_1.value.remove(this)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{_parentage_1_1&&!_parentage_1_1.done&&(_a=_parentage_1.return)&&_a.call(_parentage_1)}finally{if(e_1)throw e_1.error}}else _parentage.remove(this);var initialFinalizer=this.initialTeardown;if(isFunction(initialFinalizer))try{initialFinalizer()}catch(e){errors=e instanceof UnsubscriptionError?e.errors:[e]}var _finalizers=this._finalizers;if(_finalizers){this._finalizers=null;try{for(var _finalizers_1=__values(_finalizers),_finalizers_1_1=_finalizers_1.next();!_finalizers_1_1.done;_finalizers_1_1=_finalizers_1.next()){var finalizer=_finalizers_1_1.value;try{execFinalizer(finalizer)}catch(err){errors=null!==errors&&void 0!==errors?errors:[],err instanceof UnsubscriptionError?errors=__spreadArray(__spreadArray([],__read(errors)),__read(err.errors)):errors.push(err)}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{_finalizers_1_1&&!_finalizers_1_1.done&&(_b=_finalizers_1.return)&&_b.call(_finalizers_1)}finally{if(e_2)throw e_2.error}}}if(errors)throw new UnsubscriptionError(errors)}},Subscription.prototype.add=function(teardown){var _a;if(teardown&&teardown!==this)if(this.closed)execFinalizer(teardown);else{if(teardown instanceof Subscription){if(teardown.closed||teardown._hasParent(this))return;teardown._addParent(this)}(this._finalizers=null!==(_a=this._finalizers)&&void 0!==_a?_a:[]).push(teardown)}},Subscription.prototype._hasParent=function(parent){var _parentage=this._parentage;return _parentage===parent||Array.isArray(_parentage)&&_parentage.includes(parent)},Subscription.prototype._addParent=function(parent){var _parentage=this._parentage;this._parentage=Array.isArray(_parentage)?(_parentage.push(parent),_parentage):_parentage?[_parentage,parent]:parent},Subscription.prototype._removeParent=function(parent){var _parentage=this._parentage;_parentage===parent?this._parentage=null:Array.isArray(_parentage)&&arrRemove(_parentage,parent)},Subscription.prototype.remove=function(teardown){var _finalizers=this._finalizers;_finalizers&&arrRemove(_finalizers,teardown),teardown instanceof Subscription&&teardown._removeParent(this)},Subscription.EMPTY=((empty=new Subscription).closed=!0,empty),Subscription}();function isSubscription(value){return value instanceof Subscription||value&&"closed"in value&&isFunction(value.remove)&&isFunction(value.add)&&isFunction(value.unsubscribe)}function execFinalizer(finalizer){isFunction(finalizer)?finalizer():finalizer.unsubscribe()}var config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(handler,timeout){for(var args=[],_i=2;_i<arguments.length;_i++)args[_i-2]=arguments[_i];var delegate=timeoutProvider.delegate;return(null===delegate||void 0===delegate?void 0:delegate.setTimeout)?delegate.setTimeout.apply(delegate,__spreadArray([handler,timeout],__read(args))):setTimeout.apply(void 0,__spreadArray([handler,timeout],__read(args)))},clearTimeout:function(handle){var delegate=timeoutProvider.delegate;return((null===delegate||void 0===delegate?void 0:delegate.clearTimeout)||clearTimeout)(handle)},delegate:void 0};function reportUnhandledError(err){timeoutProvider.setTimeout(function(){throw err})}function noop(){}var Subscriber=function(_super){function Subscriber(destination){var _this=_super.call(this)||this;return _this.isStopped=!1,destination?(_this.destination=destination,isSubscription(destination)&&destination.add(_this)):_this.destination=EMPTY_OBSERVER,_this}return __extends(Subscriber,_super),Subscriber.create=function(next,error,complete){return new SafeSubscriber(next,error,complete)},Subscriber.prototype.next=function(value){this.isStopped||this._next(value)},Subscriber.prototype.error=function(err){this.isStopped||(this.isStopped=!0,this._error(err))},Subscriber.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Subscriber.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,_super.prototype.unsubscribe.call(this),this.destination=null)},Subscriber.prototype._next=function(value){this.destination.next(value)},Subscriber.prototype._error=function(err){try{this.destination.error(err)}finally{this.unsubscribe()}},Subscriber.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Subscriber}(Subscription),_bind=Function.prototype.bind;function bind(fn,thisArg){return _bind.call(fn,thisArg)}var ConsumerObserver=function(){function ConsumerObserver(partialObserver){this.partialObserver=partialObserver}return ConsumerObserver.prototype.next=function(value){var partialObserver=this.partialObserver;if(partialObserver.next)try{partialObserver.next(value)}catch(error){handleUnhandledError(error)}},ConsumerObserver.prototype.error=function(err){var partialObserver=this.partialObserver;if(partialObserver.error)try{partialObserver.error(err)}catch(error){handleUnhandledError(error)}else handleUnhandledError(err)},ConsumerObserver.prototype.complete=function(){var partialObserver=this.partialObserver;if(partialObserver.complete)try{partialObserver.complete()}catch(error){handleUnhandledError(error)}},ConsumerObserver}(),SafeSubscriber=function(_super){function SafeSubscriber(observerOrNext,error,complete){var partialObserver,context_1,_this=_super.call(this)||this;isFunction(observerOrNext)||!observerOrNext?partialObserver={next:null!==observerOrNext&&void 0!==observerOrNext?observerOrNext:void 0,error:null!==error&&void 0!==error?error:void 0,complete:null!==complete&&void 0!==complete?complete:void 0}:_this&&config.useDeprecatedNextContext?((context_1=Object.create(observerOrNext)).unsubscribe=function(){return _this.unsubscribe()},partialObserver={next:observerOrNext.next&&bind(observerOrNext.next,context_1),error:observerOrNext.error&&bind(observerOrNext.error,context_1),complete:observerOrNext.complete&&bind(observerOrNext.complete,context_1)}):partialObserver=observerOrNext;return _this.destination=new ConsumerObserver(partialObserver),_this}return __extends(SafeSubscriber,_super),SafeSubscriber}(Subscriber);function handleUnhandledError(error){reportUnhandledError(error)}var EMPTY_OBSERVER={closed:!0,next:noop,error:function(err){throw err},complete:noop};var OperatorSubscriber=function(_super){function OperatorSubscriber(destination,onNext,onComplete,onError,onFinalize,shouldUnsubscribe){var _this=_super.call(this,destination)||this;return _this.onFinalize=onFinalize,_this.shouldUnsubscribe=shouldUnsubscribe,_this._next=onNext?function(value){try{onNext(value)}catch(err){destination.error(err)}}:_super.prototype._next,_this._error=onError?function(err){try{onError(err)}catch(err){destination.error(err)}finally{this.unsubscribe()}}:_super.prototype._error,_this._complete=onComplete?function(){try{onComplete()}catch(err){destination.error(err)}finally{this.unsubscribe()}}:_super.prototype._complete,_this}return __extends(OperatorSubscriber,_super),OperatorSubscriber.prototype.unsubscribe=function(){var _a;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var closed_1=this.closed;_super.prototype.unsubscribe.call(this),!closed_1&&(null===(_a=this.onFinalize)||void 0===_a||_a.call(this))}},OperatorSubscriber}(Subscriber),observable="function"==typeof Symbol&&Symbol.observable||"@@observable";function identity(x){return x}var Observable=function(){function Observable(subscribe){subscribe&&(this._subscribe=subscribe)}return Observable.prototype.lift=function(operator){var observable=new Observable;return observable.source=this,observable.operator=operator,observable},Observable.prototype.subscribe=function(observerOrNext,error,complete){var value,_this=this,subscriber=(value=observerOrNext)&&value instanceof Subscriber||function(value){return value&&isFunction(value.next)&&isFunction(value.error)&&isFunction(value.complete)}(value)&&isSubscription(value)?observerOrNext:new SafeSubscriber(observerOrNext,error,complete);return function(){var _a=_this,operator=_a.operator,source=_a.source;subscriber.add(operator?operator.call(subscriber,source):source?_this._subscribe(subscriber):_this._trySubscribe(subscriber))}(),subscriber},Observable.prototype._trySubscribe=function(sink){try{return this._subscribe(sink)}catch(err){sink.error(err)}},Observable.prototype.forEach=function(next,promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))(function(resolve,reject){var subscriber=new SafeSubscriber({next:function(value){try{next(value)}catch(err){reject(err),subscriber.unsubscribe()}},error:reject,complete:resolve});_this.subscribe(subscriber)})},Observable.prototype._subscribe=function(subscriber){var _a;return null===(_a=this.source)||void 0===_a?void 0:_a.subscribe(subscriber)},Observable.prototype[observable]=function(){return this},Observable.prototype.pipe=function(){for(var fns,operations=[],_i=0;_i<arguments.length;_i++)operations[_i]=arguments[_i];return(0===(fns=operations).length?identity:1===fns.length?fns[0]:function(input){return fns.reduce(function(prev,fn){return fn(prev)},input)})(this)},Observable.prototype.toPromise=function(promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))(function(resolve,reject){var value;_this.subscribe(function(x){return value=x},function(err){return reject(err)},function(){return resolve(value)})})},Observable.create=function(subscribe){return new Observable(subscribe)},Observable}();function getPromiseCtor(promiseCtor){var _a;return null!==(_a=null!==promiseCtor&&void 0!==promiseCtor?promiseCtor:config.Promise)&&void 0!==_a?_a:Promise}var isArrayLike=function(x){return x&&"number"==typeof x.length&&"function"!=typeof x};var iterator="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function innerFrom(input){if(input instanceof Observable)return input;if(null!=input){if(function(input){return isFunction(input[observable])}(input))return obj=input,new Observable(function(subscriber){var obs=obj[observable]();if(isFunction(obs.subscribe))return obs.subscribe(subscriber);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(isArrayLike(input))return array=input,new Observable(function(subscriber){for(var i=0;i<array.length&&!subscriber.closed;i++)subscriber.next(array[i]);subscriber.complete()});if(isFunction(null===(value=input)||void 0===value?void 0:value.then))return promise=input,new Observable(function(subscriber){promise.then(function(value){subscriber.closed||(subscriber.next(value),subscriber.complete())},function(err){return subscriber.error(err)}).then(null,reportUnhandledError)});if(function(obj){return Symbol.asyncIterator&&isFunction(null===obj||void 0===obj?void 0:obj[Symbol.asyncIterator])}(input))return fromAsyncIterable(input);if(function(input){return isFunction(null===input||void 0===input?void 0:input[iterator])}(input))return iterable=input,new Observable(function(subscriber){var e_1,_a;try{for(var iterable_1=__values(iterable),iterable_1_1=iterable_1.next();!iterable_1_1.done;iterable_1_1=iterable_1.next()){var value=iterable_1_1.value;if(subscriber.next(value),subscriber.closed)return}}catch(e_1_1){e_1={error:e_1_1}}finally{try{iterable_1_1&&!iterable_1_1.done&&(_a=iterable_1.return)&&_a.call(iterable_1)}finally{if(e_1)throw e_1.error}}subscriber.complete()});if(function(obj){return isFunction(null===obj||void 0===obj?void 0:obj.getReader)}(input))return fromAsyncIterable(function(readableStream){return __asyncGenerator(this,arguments,function(){var reader,_a,value;return __generator(this,function(_b){switch(_b.label){case 0:reader=readableStream.getReader(),_b.label=1;case 1:_b.trys.push([1,,9,10]),_b.label=2;case 2:return[4,__await(reader.read())];case 3:return _a=_b.sent(),value=_a.value,_a.done?[4,__await(void 0)]:[3,5];case 4:return[2,_b.sent()];case 5:return[4,__await(value)];case 6:return[4,_b.sent()];case 7:return _b.sent(),[3,2];case 8:return[3,10];case 9:return reader.releaseLock(),[7];case 10:return[2]}})})}(input))}var iterable,promise,value,array,obj;throw function(input){return new TypeError("You provided "+(null!==input&&"object"==typeof input?"an invalid object":"'"+input+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(input)}function fromAsyncIterable(asyncIterable){return new Observable(function(subscriber){(function(asyncIterable,subscriber){var asyncIterable_1,asyncIterable_1_1,e_2,_a;return __awaiter(this,void 0,void 0,function(){var value,e_2_1;return __generator(this,function(_b){switch(_b.label){case 0:_b.trys.push([0,5,6,11]),asyncIterable_1=__asyncValues(asyncIterable),_b.label=1;case 1:return[4,asyncIterable_1.next()];case 2:if((asyncIterable_1_1=_b.sent()).done)return[3,4];if(value=asyncIterable_1_1.value,subscriber.next(value),subscriber.closed)return[2];_b.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return e_2_1=_b.sent(),e_2={error:e_2_1},[3,11];case 6:return _b.trys.push([6,,9,10]),asyncIterable_1_1&&!asyncIterable_1_1.done&&(_a=asyncIterable_1.return)?[4,_a.call(asyncIterable_1)]:[3,8];case 7:_b.sent(),_b.label=8;case 8:return[3,10];case 9:if(e_2)throw e_2.error;return[7];case 10:return[7];case 11:return subscriber.complete(),[2]}})})})(asyncIterable,subscriber).catch(function(err){return subscriber.error(err)})})}function fromFetch(input,initWithSelector){void 0===initWithSelector&&(initWithSelector={});var selector=initWithSelector.selector,init=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t}(initWithSelector,["selector"]);return new Observable(function(subscriber){var controller=new AbortController,signal=controller.signal,abortable=!0,outerSignal=init.signal;if(outerSignal)if(outerSignal.aborted)controller.abort();else{var outerSignalHandler_1=function(){signal.aborted||controller.abort()};outerSignal.addEventListener("abort",outerSignalHandler_1),subscriber.add(function(){return outerSignal.removeEventListener("abort",outerSignalHandler_1)})}var perSubscriberInit=__assign(__assign({},init),{signal:signal}),handleError=function(err){abortable=!1,subscriber.error(err)};return fetch(input,perSubscriberInit).then(function(response){var onFinalize;selector?innerFrom(selector(response)).subscribe(new OperatorSubscriber(subscriber,void 0,function(){abortable=!1,subscriber.complete()},handleError,onFinalize)):(abortable=!1,subscriber.next(response),subscriber.complete())}).catch(handleError),function(){abortable&&controller.abort()}})}var strictUriEncode=str=>encodeURIComponent(str).replace(/[!'()*]/g,x=>`%${x.charCodeAt(0).toString(16).toUpperCase()}`),singleMatcher=new RegExp("(%[a-f0-9]{2})|([^%]+?)","gi"),multiMatcher=new RegExp("(%[a-f0-9]{2})+","gi");function decodeComponents(components,split){try{return[decodeURIComponent(components.join(""))]}catch(err){}if(1===components.length)return components;split=split||1;var left=components.slice(0,split),right=components.slice(split);return Array.prototype.concat.call([],decodeComponents(left),decodeComponents(right))}function decode(input){try{return decodeURIComponent(input)}catch(err){for(var tokens=input.match(singleMatcher)||[],i=1;i<tokens.length;i++)tokens=(input=decodeComponents(tokens,i).join("")).match(singleMatcher)||[];return input}}var module,decodeUriComponent=function(encodedURI){if("string"!=typeof encodedURI)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof encodedURI+"`");try{return encodedURI=encodedURI.replace(/\+/g," "),decodeURIComponent(encodedURI)}catch(err){return function(input){for(var replaceMap={"%FE%FF":"��","%FF%FE":"��"},match=multiMatcher.exec(input);match;){try{replaceMap[match[0]]=decodeURIComponent(match[0])}catch(err){var result=decode(match[0]);result!==match[0]&&(replaceMap[match[0]]=result)}match=multiMatcher.exec(input)}replaceMap["%C2"]="�";for(var entries=Object.keys(replaceMap),i=0;i<entries.length;i++){var key=entries[i];input=input.replace(new RegExp(key,"g"),replaceMap[key])}return input}(encodedURI)}},splitOnFirst=(string,separator)=>{if("string"!=typeof string||"string"!=typeof separator)throw new TypeError("Expected the arguments to be of type `string`");if(""===separator)return[string];const separatorIndex=string.indexOf(separator);return-1===separatorIndex?[string]:[string.slice(0,separatorIndex),string.slice(separatorIndex+separator.length)]},queryString=(function(module,exports){const encodeFragmentIdentifier=Symbol("encodeFragmentIdentifier");function validateArrayFormatSeparator(value){if("string"!=typeof value||1!==value.length)throw new TypeError("arrayFormatSeparator must be single character string")}function encode(value,options){return options.encode?options.strict?strictUriEncode(value):encodeURIComponent(value):value}function decode(value,options){return options.decode?decodeUriComponent(value):value}function removeHash(input){const hashStart=input.indexOf("#");return-1!==hashStart&&(input=input.slice(0,hashStart)),input}function extract(input){const queryStart=(input=removeHash(input)).indexOf("?");return-1===queryStart?"":input.slice(queryStart+1)}function parseValue(value,options){return options.parseNumbers&&!Number.isNaN(Number(value))&&"string"==typeof value&&""!==value.trim()?value=Number(value):!options.parseBooleans||null===value||"true"!==value.toLowerCase()&&"false"!==value.toLowerCase()||(value="true"===value.toLowerCase()),value}function parse(query,options){validateArrayFormatSeparator((options=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},options)).arrayFormatSeparator);const formatter=function(options){let result;switch(options.arrayFormat){case"index":return(key,value,accumulator)=>{result=/\[(\d*)\]$/.exec(key),key=key.replace(/\[\d*\]$/,""),result?(void 0===accumulator[key]&&(accumulator[key]={}),accumulator[key][result[1]]=value):accumulator[key]=value};case"bracket":return(key,value,accumulator)=>{result=/(\[\])$/.exec(key),key=key.replace(/\[\]$/,""),result?void 0!==accumulator[key]?accumulator[key]=[].concat(accumulator[key],value):accumulator[key]=[value]:accumulator[key]=value};case"colon-list-separator":return(key,value,accumulator)=>{result=/(:list)$/.exec(key),key=key.replace(/:list$/,""),result?void 0!==accumulator[key]?accumulator[key]=[].concat(accumulator[key],value):accumulator[key]=[value]:accumulator[key]=value};case"comma":case"separator":return(key,value,accumulator)=>{const isArray="string"==typeof value&&value.includes(options.arrayFormatSeparator),isEncodedArray="string"==typeof value&&!isArray&&decode(value,options).includes(options.arrayFormatSeparator);value=isEncodedArray?decode(value,options):value;const newValue=isArray||isEncodedArray?value.split(options.arrayFormatSeparator).map(item=>decode(item,options)):null===value?value:decode(value,options);accumulator[key]=newValue};case"bracket-separator":return(key,value,accumulator)=>{const isArray=/(\[\])$/.test(key);if(key=key.replace(/\[\]$/,""),!isArray)return void(accumulator[key]=value?decode(value,options):value);const arrayValue=null===value?[]:value.split(options.arrayFormatSeparator).map(item=>decode(item,options));void 0!==accumulator[key]?accumulator[key]=[].concat(accumulator[key],arrayValue):accumulator[key]=arrayValue};default:return(key,value,accumulator)=>{void 0!==accumulator[key]?accumulator[key]=[].concat(accumulator[key],value):accumulator[key]=value}}}(options),ret=Object.create(null);if("string"!=typeof query)return ret;if(!(query=query.trim().replace(/^[?#&]/,"")))return ret;for(const param of query.split("&")){if(""===param)continue;let[key,value]=splitOnFirst(options.decode?param.replace(/\+/g," "):param,"=");value=void 0===value?null:["comma","separator","bracket-separator"].includes(options.arrayFormat)?value:decode(value,options),formatter(decode(key,options),value,ret)}for(const key of Object.keys(ret)){const value=ret[key];if("object"==typeof value&&null!==value)for(const k of Object.keys(value))value[k]=parseValue(value[k],options);else ret[key]=parseValue(value,options)}return!1===options.sort?ret:(!0===options.sort?Object.keys(ret).sort():Object.keys(ret).sort(options.sort)).reduce((result,key)=>{const value=ret[key];return Boolean(value)&&"object"==typeof value&&!Array.isArray(value)?result[key]=function keysSorter(input){return Array.isArray(input)?input.sort():"object"==typeof input?keysSorter(Object.keys(input)).sort((a,b)=>Number(a)-Number(b)).map(key=>input[key]):input}(value):result[key]=value,result},Object.create(null))}exports.extract=extract,exports.parse=parse,exports.stringify=((object,options)=>{if(!object)return"";validateArrayFormatSeparator((options=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},options)).arrayFormatSeparator);const shouldFilter=key=>options.skipNull&&(value=>null===value||void 0===value)(object[key])||options.skipEmptyString&&""===object[key],formatter=function(options){switch(options.arrayFormat){case"index":return key=>(result,value)=>{const index=result.length;return void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,[encode(key,options),"[",index,"]"].join("")]:[...result,[encode(key,options),"[",encode(index,options),"]=",encode(value,options)].join("")]};case"bracket":return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,[encode(key,options),"[]"].join("")]:[...result,[encode(key,options),"[]=",encode(value,options)].join("")];case"colon-list-separator":return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,[encode(key,options),":list="].join("")]:[...result,[encode(key,options),":list=",encode(value,options)].join("")];case"comma":case"separator":case"bracket-separator":{const keyValueSep="bracket-separator"===options.arrayFormat?"[]=":"=";return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:(value=null===value?"":value,0===result.length?[[encode(key,options),keyValueSep,encode(value,options)].join("")]:[[result,encode(value,options)].join(options.arrayFormatSeparator)])}default:return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,encode(key,options)]:[...result,[encode(key,options),"=",encode(value,options)].join("")]}}(options),objectCopy={};for(const key of Object.keys(object))shouldFilter(key)||(objectCopy[key]=object[key]);const keys=Object.keys(objectCopy);return!1!==options.sort&&keys.sort(options.sort),keys.map(key=>{const value=object[key];return void 0===value?"":null===value?encode(key,options):Array.isArray(value)?0===value.length&&"bracket-separator"===options.arrayFormat?encode(key,options)+"[]":value.reduce(formatter(key),[]).join("&"):encode(key,options)+"="+encode(value,options)}).filter(x=>x.length>0).join("&")}),exports.parseUrl=((url,options)=>{options=Object.assign({decode:!0},options);const[url_,hash]=splitOnFirst(url,"#");return Object.assign({url:url_.split("?")[0]||"",query:parse(extract(url),options)},options&&options.parseFragmentIdentifier&&hash?{fragmentIdentifier:decode(hash,options)}:{})}),exports.stringifyUrl=((object,options)=>{options=Object.assign({encode:!0,strict:!0,[encodeFragmentIdentifier]:!0},options);const url=removeHash(object.url).split("?")[0]||"",queryFromUrl=exports.extract(object.url),parsedQueryFromUrl=exports.parse(queryFromUrl,{sort:!1}),query=Object.assign(parsedQueryFromUrl,object.query);let queryString=exports.stringify(query,options);queryString&&(queryString=`?${queryString}`);let hash=function(url){let hash="";const hashStart=url.indexOf("#");return-1!==hashStart&&(hash=url.slice(hashStart)),hash}(object.url);return object.fragmentIdentifier&&(hash=`#${options[encodeFragmentIdentifier]?encode(object.fragmentIdentifier,options):object.fragmentIdentifier}`),`${url}${queryString}${hash}`}),exports.pick=((input,filter,options)=>{options=Object.assign({parseFragmentIdentifier:!0,[encodeFragmentIdentifier]:!1},options);const{url:url,query:query,fragmentIdentifier:fragmentIdentifier}=exports.parseUrl(input,options);return exports.stringifyUrl({url:url,query:function(obj,predicate){for(var ret={},keys=Object.keys(obj),isArr=Array.isArray(predicate),i=0;i<keys.length;i++){var key=keys[i],val=obj[key];(isArr?-1!==predicate.indexOf(key):predicate(key,val,obj))&&(ret[key]=val)}return ret}(query,filter),fragmentIdentifier:fragmentIdentifier},options)}),exports.exclude=((input,filter,options)=>{const exclusionFilter=Array.isArray(filter)?key=>!filter.includes(key):(key,value)=>!filter(key,value);return exports.pick(input,exclusionFilter,options)})}(module={exports:{}},module.exports),module.exports),queryString_3=(queryString.extract,queryString.parse,queryString.stringify),DEFAULTS=(queryString.parseUrl,queryString.stringifyUrl,queryString.pick,queryString.exclude,{site:"",baseUrl:"",searchId:null,endpoints:{GET_ITEM_URL:"/api/1/site/content_store/item.json",GET_DESCRIPTOR:"/api/1/site/content_store/descriptor.json",GET_CHILDREN:"/api/1/site/content_store/children.json",GET_TREE:"/api/1/site/content_store/tree.json",GET_NAV_TREE:"/api/1/site/navigation/tree.json",GET_BREADCRUMB:"/api/1/site/navigation/breadcrumb.json",TRANSFORM_URL:"/api/1/site/url/transform.json",SEARCH:"/api/1/site/search/search.json"},fetchConfig:{},contentTypeRegistry:{},headers:{}}),crafterConf=new(function(){function ConfigManager(){this.config=__assign({},DEFAULTS),this.config$=new rxjs.BehaviorSubject(__assign({},DEFAULTS))}return ConfigManager.prototype.publishConfig=function(config){this.config=__assign({},config),this.config$.next(__assign({},config))},ConfigManager.prototype.subscribe=function(observerOrNext){for(var operators=[],_i=1;_i<arguments.length;_i++)operators[_i-1]=arguments[_i];return this.config$.pipe.apply(this.config$,operators).subscribe(observerOrNext)},ConfigManager.prototype.entry=function(propPath,nextValue){var _a,config=this.config;if(!propPath)return __assign({},config);var getter=null==nextValue,path=propPath.split("."),prop=!getter&&path.pop(),value=function(){try{var l_1=path.length-1;return path.length?path.reduce(function(cfg,property,i){return getter&&l_1===i&&utils.isPlainObject(cfg[property])?__assign({},cfg[property]):cfg[property]},config):config}catch(e){return utils.log("Error retrieving crafter config prop '".concat(propPath,"': ").concat(e.message||e),utils.log.WARN),null}}();if(getter)return value;(prop in value||"contentTypeRegistry"===path[path.length-1])&&this.publishConfig(__assign(__assign({},value),((_a={})[prop]=nextValue,_a)))},ConfigManager.prototype.getConfig=function(){return __assign({},this.config)},ConfigManager.prototype.mix=function(mixin){var _a;if(void 0===mixin&&(mixin={}),"cors"in mixin){var cors=mixin.cors;mixin.fetchConfig=null!==(_a=mixin.fetchConfig)&&void 0!==_a?_a:{},mixin.fetchConfig.mode="boolean"==typeof cors?cors?"cors":"no-cors":cors,console.log("%c[CrafterCMS] The `crafterConf.cors` property is deprecated and will be removed in following versions. Use `fetchConfig.mode` instead.","color:red")}return utils.extendDeepExistingProps(__assign({},this.config),mixin)},ConfigManager.prototype.configure=function(nextConfig){this.publishConfig(this.mix(nextConfig))},ConfigManager}());function httpGet(requestURL,params,headers){var _a;void 0===params&&(params={});var fetchConfig=null!==(_a=crafterConf.getConfig().fetchConfig)&&void 0!==_a?_a:{};return fromFetch("".concat(requestURL,"?").concat(queryString_3(params)),__assign(__assign({},fetchConfig),{method:"GET",headers:__assign(__assign({},fetchConfig.headers),headers),selector:function(response){return response.json()}}))}function httpPost(requestURL,body,headers){return void 0===body&&(body={}),ajax.ajax.post(requestURL,body,__assign({"Content-Type":"application/json"},headers)).pipe(operators.pluck("response"))}var SDKService={httpGet:httpGet,httpPost:httpPost};exports.Messenger=Messenger,exports.SDKService=SDKService,exports.crafterConf=crafterConf,exports.httpGet=httpGet,exports.httpPost=httpPost,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("rxjs"),require("rxjs/operators"),require("@craftercms/utils"),require("@craftercms/models"),require("rxjs/ajax")):"function"==typeof define&&define.amd?define("@craftercms/classes",["exports","rxjs","rxjs/operators","@craftercms/utils","@craftercms/models","rxjs/ajax"],factory):factory(((global="undefined"!=typeof globalThis?globalThis:global||self).craftercms=global.craftercms||{},global.craftercms.classes={}),global.rxjs,global.rxjs.operators,global.craftercms.utils,global.craftercms.models,global.rxjs.ajax)}(this,(function(exports,rxjs,operators,utils,models,ajax){"use strict";var Messenger=function(){function Messenger(){var _this=this;this.targets=[],this.origins=[];var multiCaster=new rxjs.Subject,messages=rxjs.fromEvent(window,"message").pipe(operators.tap((function(event){return!_this.originAllowed(event.origin)&&console.log("Messenger: Message received from a disallowed origin.",event)})),operators.filter((function(event){return _this.originAllowed(event.origin)&&"object"==typeof event.data&&"topic"in event.data&&"data"in event.data&&"scope"in event.data})),operators.map((function(event){return{topic:event.data.topic,data:event.data.data,scope:event.data.scope||models.MessageScope.Broadcast}})),operators.multicast(multiCaster),operators.refCount());this.messages$=messages,this.multiCaster$=multiCaster}return Messenger.prototype.subscribe=function(observerOrNext){for(var operators=[],_i=1;_i<arguments.length;_i++)operators[_i-1]=arguments[_i];return this.messages$.pipe.apply(this.messages$,operators).subscribe(observerOrNext)},Messenger.prototype.subscribeTo=function(topic,subscriber,scope){for(var operations=[],_i=3;_i<arguments.length;_i++)operations[_i-3]=arguments[_i];var ops=[];return utils.notNullOrUndefined(scope)?ops.push(operators.filter((function(message){return message.topic===topic}))):ops.push(operators.filter((function(message){return message.scope===scope&&message.topic===topic}))),this.messages$.pipe.apply(this.messages$,ops.concat(operations)).subscribe(subscriber)},Messenger.prototype.addTarget=function(target){this.removeTarget(target),this.targets.push(target)},Messenger.prototype.resetTargets=function(){this.targets=[]},Messenger.prototype.removeTarget=function(target){this.targets=this.targets.filter((function(item){return item!==target}))},Messenger.prototype.addOrigin=function(origin){this.removeOrigin(origin),this.origins.push(origin)},Messenger.prototype.resetOrigins=function(){this.origins=[]},Messenger.prototype.removeOrigin=function(origin){this.origins=this.origins.filter((function(item){return item!==origin}))},Messenger.prototype.publish=function(topicOrMessage,data,scope){var message;switch(void 0===data&&(data=null),void 0===scope&&(scope=models.MessageScope.Broadcast),message="string"==typeof topicOrMessage&&topicOrMessage in models.MessageTopic?{topic:topicOrMessage,data:data,scope:scope}:topicOrMessage,scope){case models.MessageScope.Local:this.multiCaster$.next(message);break;case models.MessageScope.External:this.sendMessage(message);break;case models.MessageScope.Broadcast:this.multiCaster$.next(message),this.sendMessage(message)}},Messenger.prototype.sendMessage=function(message,targetOrigin){var _this=this;void 0===targetOrigin&&(targetOrigin="*"),this.targets.forEach((function(target){target.postMessage||(target=target.contentWindow),target&&target.postMessage?target.postMessage(message,targetOrigin):_this.removeTarget(target)}))},Messenger.prototype.originAllowed=function(origin){for(var origins=this.origins,i=0,l=origins.length;i<l;++i)if(origins[i]===origin)return!0;return!1},Messenger}(),extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};function __extends(d,b){if("function"!=typeof b&&null!==b)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__assign.apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function __values(o){var s="function"==typeof Symbol&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&"number"==typeof o.length)return{next:function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,n){var m="function"==typeof Symbol&&o[Symbol.iterator];if(!m)return o;var r,e,i=m.call(o),ar=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error:error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar}function __spreadArray(to,from,pack){if(pack||2===arguments.length)for(var ar,i=0,l=from.length;i<l;i++)!ar&&i in from||(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,g=generator.apply(thisArg,_arguments||[]),q=[];return i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;function verb(n){g[n]&&(i[n]=function(v){return new Promise((function(a,b){q.push([n,v,a,b])>1||resume(n,v)}))})}function resume(n,v){try{(r=g[n](v)).value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}catch(e){settle(q[0][3],e)}var r}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,m=o[Symbol.asyncIterator];return m?m.call(o):(o=__values(o),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);function verb(n){i[n]=o[n]&&function(v){return new Promise((function(resolve,reject){(function(resolve,reject,d,v){Promise.resolve(v).then((function(v){resolve({value:v,done:d})}),reject)})(resolve,reject,(v=o[n](v)).done,v.value)}))}}}function isFunction(value){return"function"==typeof value}"function"==typeof SuppressedError&&SuppressedError;var ctorFunc,UnsubscriptionError=((ctorFunc=function(_super){return function(errors){_super(this),this.message=errors?errors.length+" errors occurred during unsubscription:\n"+errors.map((function(err,i){return i+1+") "+err.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=errors}}((function(instance){Error.call(instance),instance.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),ctorFunc.prototype.constructor=ctorFunc,ctorFunc);function arrRemove(arr,item){if(arr){var index=arr.indexOf(item);0<=index&&arr.splice(index,1)}}var Subscription=function(){function Subscription(initialTeardown){this.initialTeardown=initialTeardown,this.closed=!1,this._parentage=null,this._finalizers=null}var empty;return Subscription.prototype.unsubscribe=function(){var e_1,_a,e_2,_b,errors;if(!this.closed){this.closed=!0;var _parentage=this._parentage;if(_parentage)if(this._parentage=null,Array.isArray(_parentage))try{for(var _parentage_1=__values(_parentage),_parentage_1_1=_parentage_1.next();!_parentage_1_1.done;_parentage_1_1=_parentage_1.next()){_parentage_1_1.value.remove(this)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{_parentage_1_1&&!_parentage_1_1.done&&(_a=_parentage_1.return)&&_a.call(_parentage_1)}finally{if(e_1)throw e_1.error}}else _parentage.remove(this);var initialFinalizer=this.initialTeardown;if(isFunction(initialFinalizer))try{initialFinalizer()}catch(e){errors=e instanceof UnsubscriptionError?e.errors:[e]}var _finalizers=this._finalizers;if(_finalizers){this._finalizers=null;try{for(var _finalizers_1=__values(_finalizers),_finalizers_1_1=_finalizers_1.next();!_finalizers_1_1.done;_finalizers_1_1=_finalizers_1.next()){var finalizer=_finalizers_1_1.value;try{execFinalizer(finalizer)}catch(err){errors=null!=errors?errors:[],err instanceof UnsubscriptionError?errors=__spreadArray(__spreadArray([],__read(errors)),__read(err.errors)):errors.push(err)}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{_finalizers_1_1&&!_finalizers_1_1.done&&(_b=_finalizers_1.return)&&_b.call(_finalizers_1)}finally{if(e_2)throw e_2.error}}}if(errors)throw new UnsubscriptionError(errors)}},Subscription.prototype.add=function(teardown){var _a;if(teardown&&teardown!==this)if(this.closed)execFinalizer(teardown);else{if(teardown instanceof Subscription){if(teardown.closed||teardown._hasParent(this))return;teardown._addParent(this)}(this._finalizers=null!==(_a=this._finalizers)&&void 0!==_a?_a:[]).push(teardown)}},Subscription.prototype._hasParent=function(parent){var _parentage=this._parentage;return _parentage===parent||Array.isArray(_parentage)&&_parentage.includes(parent)},Subscription.prototype._addParent=function(parent){var _parentage=this._parentage;this._parentage=Array.isArray(_parentage)?(_parentage.push(parent),_parentage):_parentage?[_parentage,parent]:parent},Subscription.prototype._removeParent=function(parent){var _parentage=this._parentage;_parentage===parent?this._parentage=null:Array.isArray(_parentage)&&arrRemove(_parentage,parent)},Subscription.prototype.remove=function(teardown){var _finalizers=this._finalizers;_finalizers&&arrRemove(_finalizers,teardown),teardown instanceof Subscription&&teardown._removeParent(this)},Subscription.EMPTY=((empty=new Subscription).closed=!0,empty),Subscription}();function isSubscription(value){return value instanceof Subscription||value&&"closed"in value&&isFunction(value.remove)&&isFunction(value.add)&&isFunction(value.unsubscribe)}function execFinalizer(finalizer){isFunction(finalizer)?finalizer():finalizer.unsubscribe()}Subscription.EMPTY;var config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(handler,timeout){for(var args=[],_i=2;_i<arguments.length;_i++)args[_i-2]=arguments[_i];return setTimeout.apply(void 0,__spreadArray([handler,timeout],__read(args)))},clearTimeout:function(handle){return clearTimeout(handle)},delegate:void 0};function reportUnhandledError(err){timeoutProvider.setTimeout((function(){throw err}))}function noop(){}var Subscriber=function(_super){function Subscriber(destination){var _this=_super.call(this)||this;return _this.isStopped=!1,destination?(_this.destination=destination,isSubscription(destination)&&destination.add(_this)):_this.destination=EMPTY_OBSERVER,_this}return __extends(Subscriber,_super),Subscriber.create=function(next,error,complete){return new SafeSubscriber(next,error,complete)},Subscriber.prototype.next=function(value){this.isStopped||this._next(value)},Subscriber.prototype.error=function(err){this.isStopped||(this.isStopped=!0,this._error(err))},Subscriber.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Subscriber.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,_super.prototype.unsubscribe.call(this),this.destination=null)},Subscriber.prototype._next=function(value){this.destination.next(value)},Subscriber.prototype._error=function(err){try{this.destination.error(err)}finally{this.unsubscribe()}},Subscriber.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},Subscriber}(Subscription),_bind=Function.prototype.bind;function bind(fn,thisArg){return _bind.call(fn,thisArg)}var ConsumerObserver=function(){function ConsumerObserver(partialObserver){this.partialObserver=partialObserver}return ConsumerObserver.prototype.next=function(value){var partialObserver=this.partialObserver;if(partialObserver.next)try{partialObserver.next(value)}catch(error){handleUnhandledError(error)}},ConsumerObserver.prototype.error=function(err){var partialObserver=this.partialObserver;if(partialObserver.error)try{partialObserver.error(err)}catch(error){handleUnhandledError(error)}else handleUnhandledError(err)},ConsumerObserver.prototype.complete=function(){var partialObserver=this.partialObserver;if(partialObserver.complete)try{partialObserver.complete()}catch(error){handleUnhandledError(error)}},ConsumerObserver}(),SafeSubscriber=function(_super){function SafeSubscriber(observerOrNext,error,complete){var partialObserver,context_1,_this=_super.call(this)||this;isFunction(observerOrNext)||!observerOrNext?partialObserver={next:null!=observerOrNext?observerOrNext:void 0,error:null!=error?error:void 0,complete:null!=complete?complete:void 0}:_this&&config.useDeprecatedNextContext?((context_1=Object.create(observerOrNext)).unsubscribe=function(){return _this.unsubscribe()},partialObserver={next:observerOrNext.next&&bind(observerOrNext.next,context_1),error:observerOrNext.error&&bind(observerOrNext.error,context_1),complete:observerOrNext.complete&&bind(observerOrNext.complete,context_1)}):partialObserver=observerOrNext;return _this.destination=new ConsumerObserver(partialObserver),_this}return __extends(SafeSubscriber,_super),SafeSubscriber}(Subscriber);function handleUnhandledError(error){reportUnhandledError(error)}var EMPTY_OBSERVER={closed:!0,next:noop,error:function(err){throw err},complete:noop};var OperatorSubscriber=function(_super){function OperatorSubscriber(destination,onNext,onComplete,onError,onFinalize,shouldUnsubscribe){var _this=_super.call(this,destination)||this;return _this.onFinalize=onFinalize,_this.shouldUnsubscribe=shouldUnsubscribe,_this._next=onNext?function(value){try{onNext(value)}catch(err){destination.error(err)}}:_super.prototype._next,_this._error=onError?function(err){try{onError(err)}catch(err){destination.error(err)}finally{this.unsubscribe()}}:_super.prototype._error,_this._complete=onComplete?function(){try{onComplete()}catch(err){destination.error(err)}finally{this.unsubscribe()}}:_super.prototype._complete,_this}return __extends(OperatorSubscriber,_super),OperatorSubscriber.prototype.unsubscribe=function(){var _a;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var closed_1=this.closed;_super.prototype.unsubscribe.call(this),!closed_1&&(null===(_a=this.onFinalize)||void 0===_a||_a.call(this))}},OperatorSubscriber}(Subscriber),observable="function"==typeof Symbol&&Symbol.observable||"@@observable";function identity(x){return x}var Observable=function(){function Observable(subscribe){subscribe&&(this._subscribe=subscribe)}return Observable.prototype.lift=function(operator){var observable=new Observable;return observable.source=this,observable.operator=operator,observable},Observable.prototype.subscribe=function(observerOrNext,error,complete){var value,_this=this,subscriber=(value=observerOrNext)&&value instanceof Subscriber||function(value){return value&&isFunction(value.next)&&isFunction(value.error)&&isFunction(value.complete)}(value)&&isSubscription(value)?observerOrNext:new SafeSubscriber(observerOrNext,error,complete);return function(){var _a=_this,operator=_a.operator,source=_a.source;subscriber.add(operator?operator.call(subscriber,source):source?_this._subscribe(subscriber):_this._trySubscribe(subscriber))}(),subscriber},Observable.prototype._trySubscribe=function(sink){try{return this._subscribe(sink)}catch(err){sink.error(err)}},Observable.prototype.forEach=function(next,promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))((function(resolve,reject){var subscriber=new SafeSubscriber({next:function(value){try{next(value)}catch(err){reject(err),subscriber.unsubscribe()}},error:reject,complete:resolve});_this.subscribe(subscriber)}))},Observable.prototype._subscribe=function(subscriber){var _a;return null===(_a=this.source)||void 0===_a?void 0:_a.subscribe(subscriber)},Observable.prototype[observable]=function(){return this},Observable.prototype.pipe=function(){for(var fns,operations=[],_i=0;_i<arguments.length;_i++)operations[_i]=arguments[_i];return(0===(fns=operations).length?identity:1===fns.length?fns[0]:function(input){return fns.reduce((function(prev,fn){return fn(prev)}),input)})(this)},Observable.prototype.toPromise=function(promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))((function(resolve,reject){var value;_this.subscribe((function(x){return value=x}),(function(err){return reject(err)}),(function(){return resolve(value)}))}))},Observable.create=function(subscribe){return new Observable(subscribe)},Observable}();function getPromiseCtor(promiseCtor){var _a;return null!==(_a=null!=promiseCtor?promiseCtor:config.Promise)&&void 0!==_a?_a:Promise}var isArrayLike=function(x){return x&&"number"==typeof x.length&&"function"!=typeof x};var iterator="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function innerFrom(input){if(input instanceof Observable)return input;if(null!=input){if(function(input){return isFunction(input[observable])}(input))return obj=input,new Observable((function(subscriber){var obs=obj[observable]();if(isFunction(obs.subscribe))return obs.subscribe(subscriber);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(isArrayLike(input))return array=input,new Observable((function(subscriber){for(var i=0;i<array.length&&!subscriber.closed;i++)subscriber.next(array[i]);subscriber.complete()}));if(isFunction(null==(value=input)?void 0:value.then))return promise=input,new Observable((function(subscriber){promise.then((function(value){subscriber.closed||(subscriber.next(value),subscriber.complete())}),(function(err){return subscriber.error(err)})).then(null,reportUnhandledError)}));if(function(obj){return Symbol.asyncIterator&&isFunction(null==obj?void 0:obj[Symbol.asyncIterator])}(input))return fromAsyncIterable(input);if(function(input){return isFunction(null==input?void 0:input[iterator])}(input))return iterable=input,new Observable((function(subscriber){var e_1,_a;try{for(var iterable_1=__values(iterable),iterable_1_1=iterable_1.next();!iterable_1_1.done;iterable_1_1=iterable_1.next()){var value=iterable_1_1.value;if(subscriber.next(value),subscriber.closed)return}}catch(e_1_1){e_1={error:e_1_1}}finally{try{iterable_1_1&&!iterable_1_1.done&&(_a=iterable_1.return)&&_a.call(iterable_1)}finally{if(e_1)throw e_1.error}}subscriber.complete()}));if(function(obj){return isFunction(null==obj?void 0:obj.getReader)}(input))return fromAsyncIterable(function(readableStream){return __asyncGenerator(this,arguments,(function(){var reader,_a,value;return __generator(this,(function(_b){switch(_b.label){case 0:reader=readableStream.getReader(),_b.label=1;case 1:_b.trys.push([1,,9,10]),_b.label=2;case 2:return[4,__await(reader.read())];case 3:return _a=_b.sent(),value=_a.value,_a.done?[4,__await(void 0)]:[3,5];case 4:return[2,_b.sent()];case 5:return[4,__await(value)];case 6:return[4,_b.sent()];case 7:return _b.sent(),[3,2];case 8:return[3,10];case 9:return reader.releaseLock(),[7];case 10:return[2]}}))}))}(input))}var iterable,promise,value,array,obj;throw function(input){return new TypeError("You provided "+(null!==input&&"object"==typeof input?"an invalid object":"'"+input+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(input)}function fromAsyncIterable(asyncIterable){return new Observable((function(subscriber){(function(asyncIterable,subscriber){var asyncIterable_1,asyncIterable_1_1,e_2,_a;return __awaiter(this,void 0,void 0,(function(){var value,e_2_1;return __generator(this,(function(_b){switch(_b.label){case 0:_b.trys.push([0,5,6,11]),asyncIterable_1=__asyncValues(asyncIterable),_b.label=1;case 1:return[4,asyncIterable_1.next()];case 2:if((asyncIterable_1_1=_b.sent()).done)return[3,4];if(value=asyncIterable_1_1.value,subscriber.next(value),subscriber.closed)return[2];_b.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return e_2_1=_b.sent(),e_2={error:e_2_1},[3,11];case 6:return _b.trys.push([6,,9,10]),asyncIterable_1_1&&!asyncIterable_1_1.done&&(_a=asyncIterable_1.return)?[4,_a.call(asyncIterable_1)]:[3,8];case 7:_b.sent(),_b.label=8;case 8:return[3,10];case 9:if(e_2)throw e_2.error;return[7];case 10:return[7];case 11:return subscriber.complete(),[2]}}))}))})(asyncIterable,subscriber).catch((function(err){return subscriber.error(err)}))}))}function fromFetch(input,initWithSelector){void 0===initWithSelector&&(initWithSelector={});var selector=initWithSelector.selector,init=function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t}(initWithSelector,["selector"]);return new Observable((function(subscriber){var controller=new AbortController,signal=controller.signal,abortable=!0,outerSignal=init.signal;if(outerSignal)if(outerSignal.aborted)controller.abort();else{var outerSignalHandler_1=function(){signal.aborted||controller.abort()};outerSignal.addEventListener("abort",outerSignalHandler_1),subscriber.add((function(){return outerSignal.removeEventListener("abort",outerSignalHandler_1)}))}var perSubscriberInit=__assign(__assign({},init),{signal:signal}),handleError=function(err){abortable=!1,subscriber.error(err)};return fetch(input,perSubscriberInit).then((function(response){var onFinalize;selector?innerFrom(selector(response)).subscribe(new OperatorSubscriber(subscriber,void 0,(function(){abortable=!1,subscriber.complete()}),handleError,onFinalize)):(abortable=!1,subscriber.next(response),subscriber.complete())})).catch(handleError),function(){abortable&&controller.abort()}}))}const singleMatcher=new RegExp("(%[a-f0-9]{2})|([^%]+?)","gi"),multiMatcher=new RegExp("(%[a-f0-9]{2})+","gi");function decodeComponents(components,split){try{return[decodeURIComponent(components.join(""))]}catch{}if(1===components.length)return components;split=split||1;const left=components.slice(0,split),right=components.slice(split);return Array.prototype.concat.call([],decodeComponents(left),decodeComponents(right))}function decode$1(input){try{return decodeURIComponent(input)}catch{let tokens=input.match(singleMatcher)||[];for(let i=1;i<tokens.length;i++)tokens=(input=decodeComponents(tokens,i).join("")).match(singleMatcher)||[];return input}}function decodeUriComponent(encodedURI){if("string"!=typeof encodedURI)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof encodedURI+"`");try{return decodeURIComponent(encodedURI)}catch{return function(input){const replaceMap={"%FE%FF":"��","%FF%FE":"��"};let match=multiMatcher.exec(input);for(;match;){try{replaceMap[match[0]]=decodeURIComponent(match[0])}catch{const result=decode$1(match[0]);result!==match[0]&&(replaceMap[match[0]]=result)}match=multiMatcher.exec(input)}replaceMap["%C2"]="�";const entries=Object.keys(replaceMap);for(const key of entries)input=input.replace(new RegExp(key,"g"),replaceMap[key]);return input}(encodedURI)}}function includeKeys(object,predicate){const result={};if(Array.isArray(predicate))for(const key of predicate){const descriptor=Object.getOwnPropertyDescriptor(object,key);descriptor?.enumerable&&Object.defineProperty(result,key,descriptor)}else for(const key of Reflect.ownKeys(object)){const descriptor=Object.getOwnPropertyDescriptor(object,key);if(descriptor.enumerable){predicate(key,object[key],object)&&Object.defineProperty(result,key,descriptor)}}return result}function splitOnFirst(string,separator){if("string"!=typeof string||"string"!=typeof separator)throw new TypeError("Expected the arguments to be of type `string`");if(""===string||""===separator)return[];const separatorIndex=string.indexOf(separator);return-1===separatorIndex?[]:[string.slice(0,separatorIndex),string.slice(separatorIndex+separator.length)]}const isNullOrUndefined=value=>null==value,strictUriEncode=string=>encodeURIComponent(string).replaceAll(/[!'()*]/g,(x=>`%${x.charCodeAt(0).toString(16).toUpperCase()}`)),encodeFragmentIdentifier=Symbol("encodeFragmentIdentifier");function validateArrayFormatSeparator(value){if("string"!=typeof value||1!==value.length)throw new TypeError("arrayFormatSeparator must be single character string")}function encode(value,options){return options.encode?options.strict?strictUriEncode(value):encodeURIComponent(value):value}function decode(value,options){return options.decode?decodeUriComponent(value):value}function keysSorter(input){return Array.isArray(input)?input.sort():"object"==typeof input?keysSorter(Object.keys(input)).sort(((a,b)=>Number(a)-Number(b))).map((key=>input[key])):input}function removeHash(input){const hashStart=input.indexOf("#");return-1!==hashStart&&(input=input.slice(0,hashStart)),input}function parseValue(value,options,type){return"string"===type&&"string"==typeof value?value:"function"==typeof type&&"string"==typeof value?type(value):!options.parseBooleans||null===value||"true"!==value.toLowerCase()&&"false"!==value.toLowerCase()?"number"!==type||Number.isNaN(Number(value))||"string"!=typeof value||""===value.trim()?options.parseNumbers&&!Number.isNaN(Number(value))&&"string"==typeof value&&""!==value.trim()?Number(value):value:Number(value):"true"===value.toLowerCase()}function extract(input){const queryStart=(input=removeHash(input)).indexOf("?");return-1===queryStart?"":input.slice(queryStart+1)}function parse(query,options){validateArrayFormatSeparator((options={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...options}).arrayFormatSeparator);const formatter=function(options){let result;switch(options.arrayFormat){case"index":return(key,value,accumulator)=>{result=/\[(\d*)]$/.exec(key),key=key.replace(/\[\d*]$/,""),result?(void 0===accumulator[key]&&(accumulator[key]={}),accumulator[key][result[1]]=value):accumulator[key]=value};case"bracket":return(key,value,accumulator)=>{result=/(\[])$/.exec(key),key=key.replace(/\[]$/,""),result?void 0!==accumulator[key]?accumulator[key]=[...accumulator[key],value]:accumulator[key]=[value]:accumulator[key]=value};case"colon-list-separator":return(key,value,accumulator)=>{result=/(:list)$/.exec(key),key=key.replace(/:list$/,""),result?void 0!==accumulator[key]?accumulator[key]=[...accumulator[key],value]:accumulator[key]=[value]:accumulator[key]=value};case"comma":case"separator":return(key,value,accumulator)=>{const isArray="string"==typeof value&&value.includes(options.arrayFormatSeparator),isEncodedArray="string"==typeof value&&!isArray&&decode(value,options).includes(options.arrayFormatSeparator);value=isEncodedArray?decode(value,options):value;const newValue=isArray||isEncodedArray?value.split(options.arrayFormatSeparator).map((item=>decode(item,options))):null===value?value:decode(value,options);accumulator[key]=newValue};case"bracket-separator":return(key,value,accumulator)=>{const isArray=/(\[])$/.test(key);if(key=key.replace(/\[]$/,""),!isArray)return void(accumulator[key]=value?decode(value,options):value);const arrayValue=null===value?[]:value.split(options.arrayFormatSeparator).map((item=>decode(item,options)));void 0!==accumulator[key]?accumulator[key]=[...accumulator[key],...arrayValue]:accumulator[key]=arrayValue};default:return(key,value,accumulator)=>{void 0!==accumulator[key]?accumulator[key]=[...[accumulator[key]].flat(),value]:accumulator[key]=value}}}(options),returnValue=Object.create(null);if("string"!=typeof query)return returnValue;if(!(query=query.trim().replace(/^[?#&]/,"")))return returnValue;for(const parameter of query.split("&")){if(""===parameter)continue;const parameter_=options.decode?parameter.replaceAll("+"," "):parameter;let[key,value]=splitOnFirst(parameter_,"=");void 0===key&&(key=parameter_),value=void 0===value?null:["comma","separator","bracket-separator"].includes(options.arrayFormat)?value:decode(value,options),formatter(decode(key,options),value,returnValue)}for(const[key,value]of Object.entries(returnValue))if("object"==typeof value&&null!==value&&"string"!==options.types[key])for(const[key2,value2]of Object.entries(value)){const type=options.types[key]?options.types[key].replace("[]",""):void 0;value[key2]=parseValue(value2,options,type)}else"object"==typeof value&&null!==value&&"string"===options.types[key]?returnValue[key]=Object.values(value).join(options.arrayFormatSeparator):returnValue[key]=parseValue(value,options,options.types[key]);return!1===options.sort?returnValue:(!0===options.sort?Object.keys(returnValue).sort():Object.keys(returnValue).sort(options.sort)).reduce(((result,key)=>{const value=returnValue[key];return result[key]=Boolean(value)&&"object"==typeof value&&!Array.isArray(value)?keysSorter(value):value,result}),Object.create(null))}function stringify(object,options){if(!object)return"";validateArrayFormatSeparator((options={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...options}).arrayFormatSeparator);const shouldFilter=key=>options.skipNull&&isNullOrUndefined(object[key])||options.skipEmptyString&&""===object[key],formatter=function(options){switch(options.arrayFormat){case"index":return key=>(result,value)=>{const index=result.length;return void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,[encode(key,options),"[",index,"]"].join("")]:[...result,[encode(key,options),"[",encode(index,options),"]=",encode(value,options)].join("")]};case"bracket":return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,[encode(key,options),"[]"].join("")]:[...result,[encode(key,options),"[]=",encode(value,options)].join("")];case"colon-list-separator":return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,[encode(key,options),":list="].join("")]:[...result,[encode(key,options),":list=",encode(value,options)].join("")];case"comma":case"separator":case"bracket-separator":{const keyValueSeparator="bracket-separator"===options.arrayFormat?"[]=":"=";return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:(value=null===value?"":value,0===result.length?[[encode(key,options),keyValueSeparator,encode(value,options)].join("")]:[[result,encode(value,options)].join(options.arrayFormatSeparator)])}default:return key=>(result,value)=>void 0===value||options.skipNull&&null===value||options.skipEmptyString&&""===value?result:null===value?[...result,encode(key,options)]:[...result,[encode(key,options),"=",encode(value,options)].join("")]}}(options),objectCopy={};for(const[key,value]of Object.entries(object))shouldFilter(key)||(objectCopy[key]=value);const keys=Object.keys(objectCopy);return!1!==options.sort&&keys.sort(options.sort),keys.map((key=>{const value=object[key];return void 0===value?"":null===value?encode(key,options):Array.isArray(value)?0===value.length&&"bracket-separator"===options.arrayFormat?encode(key,options)+"[]":value.reduce(formatter(key),[]).join("&"):encode(key,options)+"="+encode(value,options)})).filter((x=>x.length>0)).join("&")}function parseUrl(url,options){options={decode:!0,...options};let[url_,hash]=splitOnFirst(url,"#");return void 0===url_&&(url_=url),{url:url_?.split("?")?.[0]??"",query:parse(extract(url),options),...options&&options.parseFragmentIdentifier&&hash?{fragmentIdentifier:decode(hash,options)}:{}}}function stringifyUrl(object,options){options={encode:!0,strict:!0,[encodeFragmentIdentifier]:!0,...options};const url=removeHash(object.url).split("?")[0]||"";let queryString=stringify({...parse(extract(object.url),{sort:!1}),...object.query},options);queryString&&=`?${queryString}`;let hash=function(url){let hash="";const hashStart=url.indexOf("#");return-1!==hashStart&&(hash=url.slice(hashStart)),hash}(object.url);if("string"==typeof object.fragmentIdentifier){const urlObjectForFragmentEncode=new URL(url);urlObjectForFragmentEncode.hash=object.fragmentIdentifier,hash=options[encodeFragmentIdentifier]?urlObjectForFragmentEncode.hash:`#${object.fragmentIdentifier}`}return`${url}${queryString}${hash}`}function pick(input,filter,options){options={parseFragmentIdentifier:!0,[encodeFragmentIdentifier]:!1,...options};const{url:url,query:query,fragmentIdentifier:fragmentIdentifier}=parseUrl(input,options);return stringifyUrl({url:url,query:includeKeys(query,filter),fragmentIdentifier:fragmentIdentifier},options)}var queryString=Object.freeze({__proto__:null,extract:extract,parse:parse,stringify:stringify,parseUrl:parseUrl,stringifyUrl:stringifyUrl,pick:pick,exclude:function(input,filter,options){return pick(input,Array.isArray(filter)?key=>!filter.includes(key):(key,value)=>!filter(key,value),options)}}),DEFAULTS={site:"",baseUrl:"",searchId:null,endpoints:{GET_ITEM_URL:"/api/1/site/content_store/item.json",GET_DESCRIPTOR:"/api/1/site/content_store/descriptor.json",GET_CHILDREN:"/api/1/site/content_store/children.json",GET_TREE:"/api/1/site/content_store/tree.json",GET_NAV_TREE:"/api/1/site/navigation/tree.json",GET_BREADCRUMB:"/api/1/site/navigation/breadcrumb.json",TRANSFORM_URL:"/api/1/site/url/transform.json",SEARCH:"/api/1/site/search/search.json"},fetchConfig:{},contentTypeRegistry:{},headers:{}},ConfigManager=function(){function ConfigManager(){this.config=__assign({},DEFAULTS),this.config$=new rxjs.BehaviorSubject(__assign({},DEFAULTS))}return ConfigManager.prototype.publishConfig=function(config){this.config=__assign({},config),this.config$.next(__assign({},config))},ConfigManager.prototype.subscribe=function(observerOrNext){for(var operators=[],_i=1;_i<arguments.length;_i++)operators[_i-1]=arguments[_i];return this.config$.pipe.apply(this.config$,operators).subscribe(observerOrNext)},ConfigManager.prototype.entry=function(propPath,nextValue){var _a,config=this.config;if(!propPath)return __assign({},config);var getter=null==nextValue,path=propPath.split("."),prop=!getter&&path.pop(),value=function(){try{var l_1=path.length-1;return path.length?path.reduce((function(cfg,property,i){return getter&&l_1===i&&utils.isPlainObject(cfg[property])?__assign({},cfg[property]):cfg[property]}),config):config}catch(e){return utils.log("Error retrieving crafter config prop '".concat(propPath,"': ").concat(e.message||e),utils.log.WARN),null}}();if(getter)return value;(prop in value||"contentTypeRegistry"===path[path.length-1])&&this.publishConfig(__assign(__assign({},value),((_a={})[prop]=nextValue,_a)))},ConfigManager.prototype.getConfig=function(){return __assign({},this.config)},ConfigManager.prototype.mix=function(mixin){var _a;if(void 0===mixin&&(mixin={}),"cors"in mixin){var cors=mixin.cors;mixin.fetchConfig=null!==(_a=mixin.fetchConfig)&&void 0!==_a?_a:{},mixin.fetchConfig.mode="boolean"==typeof cors?cors?"cors":"no-cors":cors,console.log("%c[CrafterCMS] The `crafterConf.cors` property is deprecated and will be removed in following versions. Use `fetchConfig.mode` instead.","color:red")}return utils.extendDeepExistingProps(__assign({},this.config),mixin)},ConfigManager.prototype.configure=function(nextConfig){this.publishConfig(this.mix(nextConfig))},ConfigManager}(),crafterConf=new ConfigManager;function httpGet(requestURL,params,headers){var _a;void 0===params&&(params={});var fetchConfig=null!==(_a=crafterConf.getConfig().fetchConfig)&&void 0!==_a?_a:{};return fromFetch("".concat(requestURL,"?").concat(queryString.stringify(params)),__assign(__assign({},fetchConfig),{method:"GET",headers:__assign(__assign({},fetchConfig.headers),headers),selector:function(response){return response.json()}}))}function httpPost(requestURL,body,headers){return void 0===body&&(body={}),ajax.ajax.post(requestURL,body,__assign({"Content-Type":"application/json"},headers)).pipe(operators.pluck("response"))}var SDKService={httpGet:httpGet,httpPost:httpPost};exports.Messenger=Messenger,exports.SDKService=SDKService,exports.crafterConf=crafterConf,exports.httpGet=httpGet,exports.httpPost=httpPost,Object.defineProperty(exports,"__esModule",{value:!0})})); |
@@ -19,3 +19,3 @@ /* | ||
import { ajax } from 'rxjs/ajax'; | ||
import { stringify } from 'query-string'; | ||
import qs from 'query-string'; | ||
import { crafterConf } from './config'; | ||
@@ -25,3 +25,3 @@ export function httpGet(requestURL, params = {}, headers) { | ||
const fetchConfig = (_a = crafterConf.getConfig().fetchConfig) !== null && _a !== void 0 ? _a : {}; | ||
return fromFetch(`${requestURL}?${stringify(params)}`, Object.assign(Object.assign({}, fetchConfig), { method: 'GET', headers: Object.assign(Object.assign({}, fetchConfig.headers), headers), selector: response => response.json() })); | ||
return fromFetch(`${requestURL}?${qs.stringify(params)}`, Object.assign(Object.assign({}, fetchConfig), { method: 'GET', headers: Object.assign(Object.assign({}, fetchConfig.headers), headers), selector: response => response.json() })); | ||
} | ||
@@ -28,0 +28,0 @@ export function httpPost(requestURL, body = {}, headers) { |
@@ -20,3 +20,3 @@ /* | ||
import { ajax } from 'rxjs/ajax'; | ||
import { stringify } from 'query-string'; | ||
import qs from 'query-string'; | ||
import { crafterConf } from './config'; | ||
@@ -27,3 +27,3 @@ export function httpGet(requestURL, params, headers) { | ||
var fetchConfig = (_a = crafterConf.getConfig().fetchConfig) !== null && _a !== void 0 ? _a : {}; | ||
return fromFetch("".concat(requestURL, "?").concat(stringify(params)), __assign(__assign({}, fetchConfig), { method: 'GET', headers: __assign(__assign({}, fetchConfig.headers), headers), selector: function (response) { return response.json(); } })); | ||
return fromFetch("".concat(requestURL, "?").concat(qs.stringify(params)), __assign(__assign({}, fetchConfig), { method: 'GET', headers: __assign(__assign({}, fetchConfig.headers), headers), selector: function (response) { return response.json(); } })); | ||
} | ||
@@ -30,0 +30,0 @@ export function httpPost(requestURL, body, headers) { |
@@ -164,143 +164,143 @@ /* | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __values(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __spreadArray(to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
} | ||
function __await(v) { | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
} | ||
function __asyncGenerator(thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
} | ||
function __asyncValues(o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
} | ||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
@@ -465,2 +465,3 @@ | ||
}()); | ||
Subscription.EMPTY; | ||
function isSubscription(value) { | ||
@@ -1099,12 +1100,6 @@ return (value instanceof Subscription || | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
const token = '%[a-f0-9]{2}'; | ||
const singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
const multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
var token = '%[a-f0-9]{2}'; | ||
var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
var multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
function decodeComponents(components, split) { | ||
@@ -1114,3 +1109,3 @@ try { | ||
return [decodeURIComponent(components.join(''))]; | ||
} catch (err) { | ||
} catch { | ||
// Do nothing | ||
@@ -1126,4 +1121,4 @@ } | ||
// Split the array in 2 parts | ||
var left = components.slice(0, split); | ||
var right = components.slice(split); | ||
const left = components.slice(0, split); | ||
const right = components.slice(split); | ||
@@ -1133,9 +1128,9 @@ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); | ||
function decode(input) { | ||
function decode$1(input) { | ||
try { | ||
return decodeURIComponent(input); | ||
} catch (err) { | ||
var tokens = input.match(singleMatcher) || []; | ||
} catch { | ||
let tokens = input.match(singleMatcher) || []; | ||
for (var i = 1; i < tokens.length; i++) { | ||
for (let i = 1; i < tokens.length; i++) { | ||
input = decodeComponents(tokens, i).join(''); | ||
@@ -1152,8 +1147,8 @@ | ||
// Keep track of all the replacements and prefill the map with the `BOM` | ||
var replaceMap = { | ||
const replaceMap = { | ||
'%FE%FF': '\uFFFD\uFFFD', | ||
'%FF%FE': '\uFFFD\uFFFD' | ||
'%FF%FE': '\uFFFD\uFFFD', | ||
}; | ||
var match = multiMatcher.exec(input); | ||
let match = multiMatcher.exec(input); | ||
while (match) { | ||
@@ -1163,4 +1158,4 @@ try { | ||
replaceMap[match[0]] = decodeURIComponent(match[0]); | ||
} catch (err) { | ||
var result = decode(match[0]); | ||
} catch { | ||
const result = decode$1(match[0]); | ||
@@ -1178,7 +1173,6 @@ if (result !== match[0]) { | ||
var entries = Object.keys(replaceMap); | ||
const entries = Object.keys(replaceMap); | ||
for (var i = 0; i < entries.length; i++) { | ||
for (const key of entries) { | ||
// Replace all decoded components | ||
var key = entries[i]; | ||
input = input.replace(new RegExp(key, 'g'), replaceMap[key]); | ||
@@ -1190,3 +1184,3 @@ } | ||
var decodeUriComponent = function (encodedURI) { | ||
function decodeUriComponent(encodedURI) { | ||
if (typeof encodedURI !== 'string') { | ||
@@ -1197,13 +1191,37 @@ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); | ||
try { | ||
encodedURI = encodedURI.replace(/\+/g, ' '); | ||
// Try the built in decoder first | ||
return decodeURIComponent(encodedURI); | ||
} catch (err) { | ||
} catch { | ||
// Fallback to a more advanced decoder | ||
return customDecodeURIComponent(encodedURI); | ||
} | ||
}; | ||
} | ||
var splitOnFirst = (string, separator) => { | ||
function includeKeys(object, predicate) { | ||
const result = {}; | ||
if (Array.isArray(predicate)) { | ||
for (const key of predicate) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor?.enumerable) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} else { | ||
// `Reflect.ownKeys()` is required to retrieve symbol properties | ||
for (const key of Reflect.ownKeys(object)) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor.enumerable) { | ||
const value = object[key]; | ||
if (predicate(key, value, object)) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
function splitOnFirst(string, separator) { | ||
if (!(typeof string === 'string' && typeof separator === 'string')) { | ||
@@ -1213,4 +1231,4 @@ throw new TypeError('Expected the arguments to be of type `string`'); | ||
if (separator === '') { | ||
return [string]; | ||
if (string === '' || separator === '') { | ||
return []; | ||
} | ||
@@ -1221,3 +1239,3 @@ | ||
if (separatorIndex === -1) { | ||
return [string]; | ||
return []; | ||
} | ||
@@ -1229,29 +1247,9 @@ | ||
]; | ||
}; | ||
} | ||
var filterObj = function (obj, predicate) { | ||
var ret = {}; | ||
var keys = Object.keys(obj); | ||
var isArr = Array.isArray(predicate); | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var val = obj[key]; | ||
// eslint-disable-next-line unicorn/prefer-code-point | ||
const strictUriEncode = string => encodeURIComponent(string).replaceAll(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) { | ||
ret[key] = val; | ||
} | ||
} | ||
return ret; | ||
}; | ||
var queryString = createCommonjsModule(function (module, exports) { | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier'); | ||
@@ -1261,3 +1259,3 @@ | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return key => (result, value) => { | ||
@@ -1267,5 +1265,5 @@ const index = result.length; | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1276,3 +1274,5 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[', index, ']'].join('')]; | ||
return [ | ||
...result, [encode(key, options), '[', index, ']'].join(''), | ||
]; | ||
} | ||
@@ -1282,12 +1282,13 @@ | ||
...result, | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('') | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1298,14 +1299,21 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[]'].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]'].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1316,7 +1324,14 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), ':list='].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list='].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
@@ -1326,11 +1341,11 @@ case 'comma': | ||
case 'bracket-separator': { | ||
const keyValueSep = options.arrayFormat === 'bracket-separator' ? | ||
'[]=' : | ||
'='; | ||
const keyValueSeparator = options.arrayFormat === 'bracket-separator' | ||
? '[]=' | ||
: '='; | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1344,3 +1359,3 @@ return result; | ||
if (result.length === 0) { | ||
return [[encode(key, options), keyValueSep, encode(value, options)].join('')]; | ||
return [[encode(key, options), keyValueSeparator, encode(value, options)].join('')]; | ||
} | ||
@@ -1352,8 +1367,8 @@ | ||
default: | ||
default: { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1364,7 +1379,14 @@ return result; | ||
if (value === null) { | ||
return [...result, encode(key, options)]; | ||
return [ | ||
...result, | ||
encode(key, options), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
} | ||
@@ -1377,7 +1399,7 @@ } | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return (key, value, accumulator) => { | ||
result = /\[(\d*)\]$/.exec(key); | ||
result = /\[(\d*)]$/.exec(key); | ||
key = key.replace(/\[\d*\]$/, ''); | ||
key = key.replace(/\[\d*]$/, ''); | ||
@@ -1395,7 +1417,8 @@ if (!result) { | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return (key, value, accumulator) => { | ||
result = /(\[\])$/.exec(key); | ||
key = key.replace(/\[\]$/, ''); | ||
result = /(\[])$/.exec(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1412,6 +1435,7 @@ if (!result) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1431,7 +1455,8 @@ result = /(:list)$/.exec(key); | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'comma': | ||
case 'separator': | ||
case 'separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1441,10 +1466,11 @@ const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator); | ||
value = isEncodedArray ? decode(value, options) : value; | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options); | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : (value === null ? value : decode(value, options)); | ||
accumulator[key] = newValue; | ||
}; | ||
} | ||
case 'bracket-separator': | ||
case 'bracket-separator': { | ||
return (key, value, accumulator) => { | ||
const isArray = /(\[\])$/.test(key); | ||
key = key.replace(/\[\]$/, ''); | ||
const isArray = /(\[])$/.test(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1456,5 +1482,5 @@ if (!isArray) { | ||
const arrayValue = value === null ? | ||
[] : | ||
value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
const arrayValue = value === null | ||
? [] | ||
: value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
@@ -1466,6 +1492,7 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], arrayValue); | ||
accumulator[key] = [...accumulator[key], ...arrayValue]; | ||
}; | ||
} | ||
default: | ||
default: { | ||
return (key, value, accumulator) => { | ||
@@ -1477,4 +1504,5 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...[accumulator[key]].flat(), value]; | ||
}; | ||
} | ||
} | ||
@@ -1538,2 +1566,26 @@ } | ||
function parseValue(value, options, type) { | ||
if (type === 'string' && typeof value === 'string') { | ||
return value; | ||
} | ||
if (typeof type === 'function' && typeof value === 'string') { | ||
return type(value); | ||
} | ||
if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
return value.toLowerCase() === 'true'; | ||
} | ||
if (type === 'number' && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
return value; | ||
} | ||
function extract(input) { | ||
@@ -1549,14 +1601,4 @@ input = removeHash(input); | ||
function parseValue(value, options) { | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
value = Number(value); | ||
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
value = value.toLowerCase() === 'true'; | ||
} | ||
return value; | ||
} | ||
function parse(query, options) { | ||
options = Object.assign({ | ||
options = { | ||
decode: true, | ||
@@ -1567,4 +1609,6 @@ sort: true, | ||
parseNumbers: false, | ||
parseBooleans: false | ||
}, options); | ||
parseBooleans: false, | ||
types: Object.create(null), | ||
...options, | ||
}; | ||
@@ -1576,6 +1620,6 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
// Create an object with no prototype | ||
const ret = Object.create(null); | ||
const returnValue = Object.create(null); | ||
if (typeof query !== 'string') { | ||
return ret; | ||
return returnValue; | ||
} | ||
@@ -1586,26 +1630,34 @@ | ||
if (!query) { | ||
return ret; | ||
return returnValue; | ||
} | ||
for (const param of query.split('&')) { | ||
if (param === '') { | ||
for (const parameter of query.split('&')) { | ||
if (parameter === '') { | ||
continue; | ||
} | ||
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '='); | ||
const parameter_ = options.decode ? parameter.replaceAll('+', ' ') : parameter; | ||
let [key, value] = splitOnFirst(parameter_, '='); | ||
if (key === undefined) { | ||
key = parameter_; | ||
} | ||
// Missing `=` should be `null`: | ||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters | ||
value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options); | ||
formatter(decode(key, options), value, ret); | ||
value = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options)); | ||
formatter(decode(key, options), value, returnValue); | ||
} | ||
for (const key of Object.keys(ret)) { | ||
const value = ret[key]; | ||
if (typeof value === 'object' && value !== null) { | ||
for (const k of Object.keys(value)) { | ||
value[k] = parseValue(value[k], options); | ||
for (const [key, value] of Object.entries(returnValue)) { | ||
if (typeof value === 'object' && value !== null && options.types[key] !== 'string') { | ||
for (const [key2, value2] of Object.entries(value)) { | ||
const type = options.types[key] ? options.types[key].replace('[]', '') : undefined; | ||
value[key2] = parseValue(value2, options, type); | ||
} | ||
} else if (typeof value === 'object' && value !== null && options.types[key] === 'string') { | ||
returnValue[key] = Object.values(value).join(options.arrayFormatSeparator); | ||
} else { | ||
ret[key] = parseValue(value, options); | ||
returnValue[key] = parseValue(value, options, options.types[key]); | ||
} | ||
@@ -1615,14 +1667,10 @@ } | ||
if (options.sort === false) { | ||
return ret; | ||
return returnValue; | ||
} | ||
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => { | ||
const value = ret[key]; | ||
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) { | ||
// Sort object keys, not values | ||
result[key] = keysSorter(value); | ||
} else { | ||
result[key] = value; | ||
} | ||
// TODO: Remove the use of `reduce`. | ||
// eslint-disable-next-line unicorn/no-array-reduce | ||
return (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => { | ||
const value = returnValue[key]; | ||
result[key] = Boolean(value) && typeof value === 'object' && !Array.isArray(value) ? keysSorter(value) : value; | ||
return result; | ||
@@ -1632,6 +1680,3 @@ }, Object.create(null)); | ||
exports.extract = extract; | ||
exports.parse = parse; | ||
exports.stringify = (object, options) => { | ||
function stringify(object, options) { | ||
if (!object) { | ||
@@ -1641,8 +1686,9 @@ return ''; | ||
options = Object.assign({ | ||
options = { | ||
encode: true, | ||
strict: true, | ||
arrayFormat: 'none', | ||
arrayFormatSeparator: ',' | ||
}, options); | ||
arrayFormatSeparator: ',', | ||
...options, | ||
}; | ||
@@ -1652,4 +1698,4 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
const shouldFilter = key => ( | ||
(options.skipNull && isNullOrUndefined(object[key])) || | ||
(options.skipEmptyString && object[key] === '') | ||
(options.skipNull && isNullOrUndefined(object[key])) | ||
|| (options.skipEmptyString && object[key] === '') | ||
); | ||
@@ -1661,5 +1707,5 @@ | ||
for (const key of Object.keys(object)) { | ||
for (const [key, value] of Object.entries(object)) { | ||
if (!shouldFilter(key)) { | ||
objectCopy[key] = object[key]; | ||
objectCopy[key] = value; | ||
} | ||
@@ -1697,72 +1743,84 @@ } | ||
}).filter(x => x.length > 0).join('&'); | ||
}; | ||
} | ||
exports.parseUrl = (url, options) => { | ||
options = Object.assign({ | ||
decode: true | ||
}, options); | ||
function parseUrl(url, options) { | ||
options = { | ||
decode: true, | ||
...options, | ||
}; | ||
const [url_, hash] = splitOnFirst(url, '#'); | ||
let [url_, hash] = splitOnFirst(url, '#'); | ||
return Object.assign( | ||
{ | ||
url: url_.split('?')[0] || '', | ||
query: parse(extract(url), options) | ||
}, | ||
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {} | ||
); | ||
}; | ||
if (url_ === undefined) { | ||
url_ = url; | ||
} | ||
exports.stringifyUrl = (object, options) => { | ||
options = Object.assign({ | ||
return { | ||
url: url_?.split('?')?.[0] ?? '', | ||
query: parse(extract(url), options), | ||
...(options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}), | ||
}; | ||
} | ||
function stringifyUrl(object, options) { | ||
options = { | ||
encode: true, | ||
strict: true, | ||
[encodeFragmentIdentifier]: true | ||
}, options); | ||
[encodeFragmentIdentifier]: true, | ||
...options, | ||
}; | ||
const url = removeHash(object.url).split('?')[0] || ''; | ||
const queryFromUrl = exports.extract(object.url); | ||
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false}); | ||
const queryFromUrl = extract(object.url); | ||
const query = Object.assign(parsedQueryFromUrl, object.query); | ||
let queryString = exports.stringify(query, options); | ||
if (queryString) { | ||
queryString = `?${queryString}`; | ||
} | ||
const query = { | ||
...parse(queryFromUrl, {sort: false}), | ||
...object.query, | ||
}; | ||
let queryString = stringify(query, options); | ||
queryString &&= `?${queryString}`; | ||
let hash = getHash(object.url); | ||
if (object.fragmentIdentifier) { | ||
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`; | ||
if (typeof object.fragmentIdentifier === 'string') { | ||
const urlObjectForFragmentEncode = new URL(url); | ||
urlObjectForFragmentEncode.hash = object.fragmentIdentifier; | ||
hash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`; | ||
} | ||
return `${url}${queryString}${hash}`; | ||
}; | ||
} | ||
exports.pick = (input, filter, options) => { | ||
options = Object.assign({ | ||
function pick(input, filter, options) { | ||
options = { | ||
parseFragmentIdentifier: true, | ||
[encodeFragmentIdentifier]: false | ||
}, options); | ||
[encodeFragmentIdentifier]: false, | ||
...options, | ||
}; | ||
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options); | ||
return exports.stringifyUrl({ | ||
const {url, query, fragmentIdentifier} = parseUrl(input, options); | ||
return stringifyUrl({ | ||
url, | ||
query: filterObj(query, filter), | ||
fragmentIdentifier | ||
query: includeKeys(query, filter), | ||
fragmentIdentifier, | ||
}, options); | ||
}; | ||
} | ||
exports.exclude = (input, filter, options) => { | ||
function exclude(input, filter, options) { | ||
const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value); | ||
return exports.pick(input, exclusionFilter, options); | ||
}; | ||
return pick(input, exclusionFilter, options); | ||
} | ||
var queryString = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
extract: extract, | ||
parse: parse, | ||
stringify: stringify, | ||
parseUrl: parseUrl, | ||
stringifyUrl: stringifyUrl, | ||
pick: pick, | ||
exclude: exclude | ||
}); | ||
var queryString_1 = queryString.extract; | ||
var queryString_2 = queryString.parse; | ||
var queryString_3 = queryString.stringify; | ||
var queryString_4 = queryString.parseUrl; | ||
var queryString_5 = queryString.stringifyUrl; | ||
var queryString_6 = queryString.pick; | ||
var queryString_7 = queryString.exclude; | ||
@@ -1878,3 +1936,3 @@ /* | ||
const fetchConfig = (_a = crafterConf.getConfig().fetchConfig) !== null && _a !== void 0 ? _a : {}; | ||
return fromFetch(`${requestURL}?${queryString_3(params)}`, Object.assign(Object.assign({}, fetchConfig), { method: 'GET', headers: Object.assign(Object.assign({}, fetchConfig.headers), headers), selector: response => response.json() })); | ||
return fromFetch(`${requestURL}?${queryString.stringify(params)}`, Object.assign(Object.assign({}, fetchConfig), { method: 'GET', headers: Object.assign(Object.assign({}, fetchConfig.headers), headers), selector: response => response.json() })); | ||
} | ||
@@ -1881,0 +1939,0 @@ function httpPost(requestURL, body = {}, headers) { |
@@ -164,143 +164,143 @@ /* | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __values(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __spreadArray(to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
} | ||
function __await(v) { | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
} | ||
function __asyncGenerator(thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
} | ||
function __asyncValues(o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
} | ||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
@@ -465,2 +465,3 @@ | ||
}()); | ||
Subscription.EMPTY; | ||
function isSubscription(value) { | ||
@@ -1099,12 +1100,6 @@ return (value instanceof Subscription || | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
const token = '%[a-f0-9]{2}'; | ||
const singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
const multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
var token = '%[a-f0-9]{2}'; | ||
var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
var multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
function decodeComponents(components, split) { | ||
@@ -1114,3 +1109,3 @@ try { | ||
return [decodeURIComponent(components.join(''))]; | ||
} catch (err) { | ||
} catch { | ||
// Do nothing | ||
@@ -1126,4 +1121,4 @@ } | ||
// Split the array in 2 parts | ||
var left = components.slice(0, split); | ||
var right = components.slice(split); | ||
const left = components.slice(0, split); | ||
const right = components.slice(split); | ||
@@ -1133,9 +1128,9 @@ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); | ||
function decode(input) { | ||
function decode$1(input) { | ||
try { | ||
return decodeURIComponent(input); | ||
} catch (err) { | ||
var tokens = input.match(singleMatcher) || []; | ||
} catch { | ||
let tokens = input.match(singleMatcher) || []; | ||
for (var i = 1; i < tokens.length; i++) { | ||
for (let i = 1; i < tokens.length; i++) { | ||
input = decodeComponents(tokens, i).join(''); | ||
@@ -1152,8 +1147,8 @@ | ||
// Keep track of all the replacements and prefill the map with the `BOM` | ||
var replaceMap = { | ||
const replaceMap = { | ||
'%FE%FF': '\uFFFD\uFFFD', | ||
'%FF%FE': '\uFFFD\uFFFD' | ||
'%FF%FE': '\uFFFD\uFFFD', | ||
}; | ||
var match = multiMatcher.exec(input); | ||
let match = multiMatcher.exec(input); | ||
while (match) { | ||
@@ -1163,4 +1158,4 @@ try { | ||
replaceMap[match[0]] = decodeURIComponent(match[0]); | ||
} catch (err) { | ||
var result = decode(match[0]); | ||
} catch { | ||
const result = decode$1(match[0]); | ||
@@ -1178,7 +1173,6 @@ if (result !== match[0]) { | ||
var entries = Object.keys(replaceMap); | ||
const entries = Object.keys(replaceMap); | ||
for (var i = 0; i < entries.length; i++) { | ||
for (const key of entries) { | ||
// Replace all decoded components | ||
var key = entries[i]; | ||
input = input.replace(new RegExp(key, 'g'), replaceMap[key]); | ||
@@ -1190,3 +1184,3 @@ } | ||
var decodeUriComponent = function (encodedURI) { | ||
function decodeUriComponent(encodedURI) { | ||
if (typeof encodedURI !== 'string') { | ||
@@ -1197,13 +1191,37 @@ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); | ||
try { | ||
encodedURI = encodedURI.replace(/\+/g, ' '); | ||
// Try the built in decoder first | ||
return decodeURIComponent(encodedURI); | ||
} catch (err) { | ||
} catch { | ||
// Fallback to a more advanced decoder | ||
return customDecodeURIComponent(encodedURI); | ||
} | ||
}; | ||
} | ||
var splitOnFirst = (string, separator) => { | ||
function includeKeys(object, predicate) { | ||
const result = {}; | ||
if (Array.isArray(predicate)) { | ||
for (const key of predicate) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor?.enumerable) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} else { | ||
// `Reflect.ownKeys()` is required to retrieve symbol properties | ||
for (const key of Reflect.ownKeys(object)) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor.enumerable) { | ||
const value = object[key]; | ||
if (predicate(key, value, object)) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
function splitOnFirst(string, separator) { | ||
if (!(typeof string === 'string' && typeof separator === 'string')) { | ||
@@ -1213,4 +1231,4 @@ throw new TypeError('Expected the arguments to be of type `string`'); | ||
if (separator === '') { | ||
return [string]; | ||
if (string === '' || separator === '') { | ||
return []; | ||
} | ||
@@ -1221,3 +1239,3 @@ | ||
if (separatorIndex === -1) { | ||
return [string]; | ||
return []; | ||
} | ||
@@ -1229,29 +1247,9 @@ | ||
]; | ||
}; | ||
} | ||
var filterObj = function (obj, predicate) { | ||
var ret = {}; | ||
var keys = Object.keys(obj); | ||
var isArr = Array.isArray(predicate); | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var val = obj[key]; | ||
// eslint-disable-next-line unicorn/prefer-code-point | ||
const strictUriEncode = string => encodeURIComponent(string).replaceAll(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) { | ||
ret[key] = val; | ||
} | ||
} | ||
return ret; | ||
}; | ||
var queryString = createCommonjsModule(function (module, exports) { | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier'); | ||
@@ -1261,3 +1259,3 @@ | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return key => (result, value) => { | ||
@@ -1267,5 +1265,5 @@ const index = result.length; | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1276,3 +1274,5 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[', index, ']'].join('')]; | ||
return [ | ||
...result, [encode(key, options), '[', index, ']'].join(''), | ||
]; | ||
} | ||
@@ -1282,12 +1282,13 @@ | ||
...result, | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('') | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1298,14 +1299,21 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[]'].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]'].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1316,7 +1324,14 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), ':list='].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list='].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
@@ -1326,11 +1341,11 @@ case 'comma': | ||
case 'bracket-separator': { | ||
const keyValueSep = options.arrayFormat === 'bracket-separator' ? | ||
'[]=' : | ||
'='; | ||
const keyValueSeparator = options.arrayFormat === 'bracket-separator' | ||
? '[]=' | ||
: '='; | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1344,3 +1359,3 @@ return result; | ||
if (result.length === 0) { | ||
return [[encode(key, options), keyValueSep, encode(value, options)].join('')]; | ||
return [[encode(key, options), keyValueSeparator, encode(value, options)].join('')]; | ||
} | ||
@@ -1352,8 +1367,8 @@ | ||
default: | ||
default: { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1364,7 +1379,14 @@ return result; | ||
if (value === null) { | ||
return [...result, encode(key, options)]; | ||
return [ | ||
...result, | ||
encode(key, options), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
} | ||
@@ -1377,7 +1399,7 @@ } | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return (key, value, accumulator) => { | ||
result = /\[(\d*)\]$/.exec(key); | ||
result = /\[(\d*)]$/.exec(key); | ||
key = key.replace(/\[\d*\]$/, ''); | ||
key = key.replace(/\[\d*]$/, ''); | ||
@@ -1395,7 +1417,8 @@ if (!result) { | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return (key, value, accumulator) => { | ||
result = /(\[\])$/.exec(key); | ||
key = key.replace(/\[\]$/, ''); | ||
result = /(\[])$/.exec(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1412,6 +1435,7 @@ if (!result) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1431,7 +1455,8 @@ result = /(:list)$/.exec(key); | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'comma': | ||
case 'separator': | ||
case 'separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1441,10 +1466,11 @@ const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator); | ||
value = isEncodedArray ? decode(value, options) : value; | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options); | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : (value === null ? value : decode(value, options)); | ||
accumulator[key] = newValue; | ||
}; | ||
} | ||
case 'bracket-separator': | ||
case 'bracket-separator': { | ||
return (key, value, accumulator) => { | ||
const isArray = /(\[\])$/.test(key); | ||
key = key.replace(/\[\]$/, ''); | ||
const isArray = /(\[])$/.test(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1456,5 +1482,5 @@ if (!isArray) { | ||
const arrayValue = value === null ? | ||
[] : | ||
value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
const arrayValue = value === null | ||
? [] | ||
: value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
@@ -1466,6 +1492,7 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], arrayValue); | ||
accumulator[key] = [...accumulator[key], ...arrayValue]; | ||
}; | ||
} | ||
default: | ||
default: { | ||
return (key, value, accumulator) => { | ||
@@ -1477,4 +1504,5 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...[accumulator[key]].flat(), value]; | ||
}; | ||
} | ||
} | ||
@@ -1538,2 +1566,26 @@ } | ||
function parseValue(value, options, type) { | ||
if (type === 'string' && typeof value === 'string') { | ||
return value; | ||
} | ||
if (typeof type === 'function' && typeof value === 'string') { | ||
return type(value); | ||
} | ||
if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
return value.toLowerCase() === 'true'; | ||
} | ||
if (type === 'number' && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
return value; | ||
} | ||
function extract(input) { | ||
@@ -1549,14 +1601,4 @@ input = removeHash(input); | ||
function parseValue(value, options) { | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
value = Number(value); | ||
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
value = value.toLowerCase() === 'true'; | ||
} | ||
return value; | ||
} | ||
function parse(query, options) { | ||
options = Object.assign({ | ||
options = { | ||
decode: true, | ||
@@ -1567,4 +1609,6 @@ sort: true, | ||
parseNumbers: false, | ||
parseBooleans: false | ||
}, options); | ||
parseBooleans: false, | ||
types: Object.create(null), | ||
...options, | ||
}; | ||
@@ -1576,6 +1620,6 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
// Create an object with no prototype | ||
const ret = Object.create(null); | ||
const returnValue = Object.create(null); | ||
if (typeof query !== 'string') { | ||
return ret; | ||
return returnValue; | ||
} | ||
@@ -1586,26 +1630,34 @@ | ||
if (!query) { | ||
return ret; | ||
return returnValue; | ||
} | ||
for (const param of query.split('&')) { | ||
if (param === '') { | ||
for (const parameter of query.split('&')) { | ||
if (parameter === '') { | ||
continue; | ||
} | ||
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '='); | ||
const parameter_ = options.decode ? parameter.replaceAll('+', ' ') : parameter; | ||
let [key, value] = splitOnFirst(parameter_, '='); | ||
if (key === undefined) { | ||
key = parameter_; | ||
} | ||
// Missing `=` should be `null`: | ||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters | ||
value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options); | ||
formatter(decode(key, options), value, ret); | ||
value = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options)); | ||
formatter(decode(key, options), value, returnValue); | ||
} | ||
for (const key of Object.keys(ret)) { | ||
const value = ret[key]; | ||
if (typeof value === 'object' && value !== null) { | ||
for (const k of Object.keys(value)) { | ||
value[k] = parseValue(value[k], options); | ||
for (const [key, value] of Object.entries(returnValue)) { | ||
if (typeof value === 'object' && value !== null && options.types[key] !== 'string') { | ||
for (const [key2, value2] of Object.entries(value)) { | ||
const type = options.types[key] ? options.types[key].replace('[]', '') : undefined; | ||
value[key2] = parseValue(value2, options, type); | ||
} | ||
} else if (typeof value === 'object' && value !== null && options.types[key] === 'string') { | ||
returnValue[key] = Object.values(value).join(options.arrayFormatSeparator); | ||
} else { | ||
ret[key] = parseValue(value, options); | ||
returnValue[key] = parseValue(value, options, options.types[key]); | ||
} | ||
@@ -1615,14 +1667,10 @@ } | ||
if (options.sort === false) { | ||
return ret; | ||
return returnValue; | ||
} | ||
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => { | ||
const value = ret[key]; | ||
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) { | ||
// Sort object keys, not values | ||
result[key] = keysSorter(value); | ||
} else { | ||
result[key] = value; | ||
} | ||
// TODO: Remove the use of `reduce`. | ||
// eslint-disable-next-line unicorn/no-array-reduce | ||
return (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => { | ||
const value = returnValue[key]; | ||
result[key] = Boolean(value) && typeof value === 'object' && !Array.isArray(value) ? keysSorter(value) : value; | ||
return result; | ||
@@ -1632,6 +1680,3 @@ }, Object.create(null)); | ||
exports.extract = extract; | ||
exports.parse = parse; | ||
exports.stringify = (object, options) => { | ||
function stringify(object, options) { | ||
if (!object) { | ||
@@ -1641,8 +1686,9 @@ return ''; | ||
options = Object.assign({ | ||
options = { | ||
encode: true, | ||
strict: true, | ||
arrayFormat: 'none', | ||
arrayFormatSeparator: ',' | ||
}, options); | ||
arrayFormatSeparator: ',', | ||
...options, | ||
}; | ||
@@ -1652,4 +1698,4 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
const shouldFilter = key => ( | ||
(options.skipNull && isNullOrUndefined(object[key])) || | ||
(options.skipEmptyString && object[key] === '') | ||
(options.skipNull && isNullOrUndefined(object[key])) | ||
|| (options.skipEmptyString && object[key] === '') | ||
); | ||
@@ -1661,5 +1707,5 @@ | ||
for (const key of Object.keys(object)) { | ||
for (const [key, value] of Object.entries(object)) { | ||
if (!shouldFilter(key)) { | ||
objectCopy[key] = object[key]; | ||
objectCopy[key] = value; | ||
} | ||
@@ -1697,72 +1743,84 @@ } | ||
}).filter(x => x.length > 0).join('&'); | ||
}; | ||
} | ||
exports.parseUrl = (url, options) => { | ||
options = Object.assign({ | ||
decode: true | ||
}, options); | ||
function parseUrl(url, options) { | ||
options = { | ||
decode: true, | ||
...options, | ||
}; | ||
const [url_, hash] = splitOnFirst(url, '#'); | ||
let [url_, hash] = splitOnFirst(url, '#'); | ||
return Object.assign( | ||
{ | ||
url: url_.split('?')[0] || '', | ||
query: parse(extract(url), options) | ||
}, | ||
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {} | ||
); | ||
}; | ||
if (url_ === undefined) { | ||
url_ = url; | ||
} | ||
exports.stringifyUrl = (object, options) => { | ||
options = Object.assign({ | ||
return { | ||
url: url_?.split('?')?.[0] ?? '', | ||
query: parse(extract(url), options), | ||
...(options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}), | ||
}; | ||
} | ||
function stringifyUrl(object, options) { | ||
options = { | ||
encode: true, | ||
strict: true, | ||
[encodeFragmentIdentifier]: true | ||
}, options); | ||
[encodeFragmentIdentifier]: true, | ||
...options, | ||
}; | ||
const url = removeHash(object.url).split('?')[0] || ''; | ||
const queryFromUrl = exports.extract(object.url); | ||
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false}); | ||
const queryFromUrl = extract(object.url); | ||
const query = Object.assign(parsedQueryFromUrl, object.query); | ||
let queryString = exports.stringify(query, options); | ||
if (queryString) { | ||
queryString = `?${queryString}`; | ||
} | ||
const query = { | ||
...parse(queryFromUrl, {sort: false}), | ||
...object.query, | ||
}; | ||
let queryString = stringify(query, options); | ||
queryString &&= `?${queryString}`; | ||
let hash = getHash(object.url); | ||
if (object.fragmentIdentifier) { | ||
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`; | ||
if (typeof object.fragmentIdentifier === 'string') { | ||
const urlObjectForFragmentEncode = new URL(url); | ||
urlObjectForFragmentEncode.hash = object.fragmentIdentifier; | ||
hash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`; | ||
} | ||
return `${url}${queryString}${hash}`; | ||
}; | ||
} | ||
exports.pick = (input, filter, options) => { | ||
options = Object.assign({ | ||
function pick(input, filter, options) { | ||
options = { | ||
parseFragmentIdentifier: true, | ||
[encodeFragmentIdentifier]: false | ||
}, options); | ||
[encodeFragmentIdentifier]: false, | ||
...options, | ||
}; | ||
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options); | ||
return exports.stringifyUrl({ | ||
const {url, query, fragmentIdentifier} = parseUrl(input, options); | ||
return stringifyUrl({ | ||
url, | ||
query: filterObj(query, filter), | ||
fragmentIdentifier | ||
query: includeKeys(query, filter), | ||
fragmentIdentifier, | ||
}, options); | ||
}; | ||
} | ||
exports.exclude = (input, filter, options) => { | ||
function exclude(input, filter, options) { | ||
const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value); | ||
return exports.pick(input, exclusionFilter, options); | ||
}; | ||
return pick(input, exclusionFilter, options); | ||
} | ||
var queryString = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
extract: extract, | ||
parse: parse, | ||
stringify: stringify, | ||
parseUrl: parseUrl, | ||
stringifyUrl: stringifyUrl, | ||
pick: pick, | ||
exclude: exclude | ||
}); | ||
var queryString_1 = queryString.extract; | ||
var queryString_2 = queryString.parse; | ||
var queryString_3 = queryString.stringify; | ||
var queryString_4 = queryString.parseUrl; | ||
var queryString_5 = queryString.stringifyUrl; | ||
var queryString_6 = queryString.pick; | ||
var queryString_7 = queryString.exclude; | ||
@@ -1878,3 +1936,3 @@ /* | ||
const fetchConfig = (_a = crafterConf.getConfig().fetchConfig) !== null && _a !== void 0 ? _a : {}; | ||
return fromFetch(`${requestURL}?${queryString_3(params)}`, Object.assign(Object.assign({}, fetchConfig), { method: 'GET', headers: Object.assign(Object.assign({}, fetchConfig.headers), headers), selector: response => response.json() })); | ||
return fromFetch(`${requestURL}?${queryString.stringify(params)}`, Object.assign(Object.assign({}, fetchConfig), { method: 'GET', headers: Object.assign(Object.assign({}, fetchConfig.headers), headers), selector: response => response.json() })); | ||
} | ||
@@ -1881,0 +1939,0 @@ function httpPost(requestURL, body = {}, headers) { |
@@ -184,143 +184,143 @@ /* | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __values(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __spreadArray(to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
} | ||
function __await(v) { | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
} | ||
function __asyncGenerator(thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
} | ||
function __asyncValues(o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
} | ||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
@@ -485,2 +485,3 @@ | ||
}()); | ||
Subscription.EMPTY; | ||
function isSubscription(value) { | ||
@@ -1119,12 +1120,6 @@ return (value instanceof Subscription || | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
const token = '%[a-f0-9]{2}'; | ||
const singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
const multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
var token = '%[a-f0-9]{2}'; | ||
var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
var multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
function decodeComponents(components, split) { | ||
@@ -1134,3 +1129,3 @@ try { | ||
return [decodeURIComponent(components.join(''))]; | ||
} catch (err) { | ||
} catch { | ||
// Do nothing | ||
@@ -1146,4 +1141,4 @@ } | ||
// Split the array in 2 parts | ||
var left = components.slice(0, split); | ||
var right = components.slice(split); | ||
const left = components.slice(0, split); | ||
const right = components.slice(split); | ||
@@ -1153,9 +1148,9 @@ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); | ||
function decode(input) { | ||
function decode$1(input) { | ||
try { | ||
return decodeURIComponent(input); | ||
} catch (err) { | ||
var tokens = input.match(singleMatcher) || []; | ||
} catch { | ||
let tokens = input.match(singleMatcher) || []; | ||
for (var i = 1; i < tokens.length; i++) { | ||
for (let i = 1; i < tokens.length; i++) { | ||
input = decodeComponents(tokens, i).join(''); | ||
@@ -1172,8 +1167,8 @@ | ||
// Keep track of all the replacements and prefill the map with the `BOM` | ||
var replaceMap = { | ||
const replaceMap = { | ||
'%FE%FF': '\uFFFD\uFFFD', | ||
'%FF%FE': '\uFFFD\uFFFD' | ||
'%FF%FE': '\uFFFD\uFFFD', | ||
}; | ||
var match = multiMatcher.exec(input); | ||
let match = multiMatcher.exec(input); | ||
while (match) { | ||
@@ -1183,4 +1178,4 @@ try { | ||
replaceMap[match[0]] = decodeURIComponent(match[0]); | ||
} catch (err) { | ||
var result = decode(match[0]); | ||
} catch { | ||
const result = decode$1(match[0]); | ||
@@ -1198,7 +1193,6 @@ if (result !== match[0]) { | ||
var entries = Object.keys(replaceMap); | ||
const entries = Object.keys(replaceMap); | ||
for (var i = 0; i < entries.length; i++) { | ||
for (const key of entries) { | ||
// Replace all decoded components | ||
var key = entries[i]; | ||
input = input.replace(new RegExp(key, 'g'), replaceMap[key]); | ||
@@ -1210,3 +1204,3 @@ } | ||
var decodeUriComponent = function (encodedURI) { | ||
function decodeUriComponent(encodedURI) { | ||
if (typeof encodedURI !== 'string') { | ||
@@ -1217,13 +1211,37 @@ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); | ||
try { | ||
encodedURI = encodedURI.replace(/\+/g, ' '); | ||
// Try the built in decoder first | ||
return decodeURIComponent(encodedURI); | ||
} catch (err) { | ||
} catch { | ||
// Fallback to a more advanced decoder | ||
return customDecodeURIComponent(encodedURI); | ||
} | ||
}; | ||
} | ||
var splitOnFirst = (string, separator) => { | ||
function includeKeys(object, predicate) { | ||
const result = {}; | ||
if (Array.isArray(predicate)) { | ||
for (const key of predicate) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor?.enumerable) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} else { | ||
// `Reflect.ownKeys()` is required to retrieve symbol properties | ||
for (const key of Reflect.ownKeys(object)) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor.enumerable) { | ||
const value = object[key]; | ||
if (predicate(key, value, object)) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
function splitOnFirst(string, separator) { | ||
if (!(typeof string === 'string' && typeof separator === 'string')) { | ||
@@ -1233,4 +1251,4 @@ throw new TypeError('Expected the arguments to be of type `string`'); | ||
if (separator === '') { | ||
return [string]; | ||
if (string === '' || separator === '') { | ||
return []; | ||
} | ||
@@ -1241,3 +1259,3 @@ | ||
if (separatorIndex === -1) { | ||
return [string]; | ||
return []; | ||
} | ||
@@ -1249,29 +1267,9 @@ | ||
]; | ||
}; | ||
} | ||
var filterObj = function (obj, predicate) { | ||
var ret = {}; | ||
var keys = Object.keys(obj); | ||
var isArr = Array.isArray(predicate); | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var val = obj[key]; | ||
// eslint-disable-next-line unicorn/prefer-code-point | ||
const strictUriEncode = string => encodeURIComponent(string).replaceAll(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) { | ||
ret[key] = val; | ||
} | ||
} | ||
return ret; | ||
}; | ||
var queryString = createCommonjsModule(function (module, exports) { | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier'); | ||
@@ -1281,3 +1279,3 @@ | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return key => (result, value) => { | ||
@@ -1287,5 +1285,5 @@ const index = result.length; | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1296,3 +1294,5 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[', index, ']'].join('')]; | ||
return [ | ||
...result, [encode(key, options), '[', index, ']'].join(''), | ||
]; | ||
} | ||
@@ -1302,12 +1302,13 @@ | ||
...result, | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('') | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1318,14 +1319,21 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[]'].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]'].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1336,7 +1344,14 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), ':list='].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list='].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
@@ -1346,11 +1361,11 @@ case 'comma': | ||
case 'bracket-separator': { | ||
const keyValueSep = options.arrayFormat === 'bracket-separator' ? | ||
'[]=' : | ||
'='; | ||
const keyValueSeparator = options.arrayFormat === 'bracket-separator' | ||
? '[]=' | ||
: '='; | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1364,3 +1379,3 @@ return result; | ||
if (result.length === 0) { | ||
return [[encode(key, options), keyValueSep, encode(value, options)].join('')]; | ||
return [[encode(key, options), keyValueSeparator, encode(value, options)].join('')]; | ||
} | ||
@@ -1372,8 +1387,8 @@ | ||
default: | ||
default: { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1384,7 +1399,14 @@ return result; | ||
if (value === null) { | ||
return [...result, encode(key, options)]; | ||
return [ | ||
...result, | ||
encode(key, options), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
} | ||
@@ -1397,7 +1419,7 @@ } | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return (key, value, accumulator) => { | ||
result = /\[(\d*)\]$/.exec(key); | ||
result = /\[(\d*)]$/.exec(key); | ||
key = key.replace(/\[\d*\]$/, ''); | ||
key = key.replace(/\[\d*]$/, ''); | ||
@@ -1415,7 +1437,8 @@ if (!result) { | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return (key, value, accumulator) => { | ||
result = /(\[\])$/.exec(key); | ||
key = key.replace(/\[\]$/, ''); | ||
result = /(\[])$/.exec(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1432,6 +1455,7 @@ if (!result) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1451,7 +1475,8 @@ result = /(:list)$/.exec(key); | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'comma': | ||
case 'separator': | ||
case 'separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1461,10 +1486,11 @@ const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator); | ||
value = isEncodedArray ? decode(value, options) : value; | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options); | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : (value === null ? value : decode(value, options)); | ||
accumulator[key] = newValue; | ||
}; | ||
} | ||
case 'bracket-separator': | ||
case 'bracket-separator': { | ||
return (key, value, accumulator) => { | ||
const isArray = /(\[\])$/.test(key); | ||
key = key.replace(/\[\]$/, ''); | ||
const isArray = /(\[])$/.test(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1476,5 +1502,5 @@ if (!isArray) { | ||
const arrayValue = value === null ? | ||
[] : | ||
value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
const arrayValue = value === null | ||
? [] | ||
: value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
@@ -1486,6 +1512,7 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], arrayValue); | ||
accumulator[key] = [...accumulator[key], ...arrayValue]; | ||
}; | ||
} | ||
default: | ||
default: { | ||
return (key, value, accumulator) => { | ||
@@ -1497,4 +1524,5 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...[accumulator[key]].flat(), value]; | ||
}; | ||
} | ||
} | ||
@@ -1558,2 +1586,26 @@ } | ||
function parseValue(value, options, type) { | ||
if (type === 'string' && typeof value === 'string') { | ||
return value; | ||
} | ||
if (typeof type === 'function' && typeof value === 'string') { | ||
return type(value); | ||
} | ||
if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
return value.toLowerCase() === 'true'; | ||
} | ||
if (type === 'number' && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
return value; | ||
} | ||
function extract(input) { | ||
@@ -1569,14 +1621,4 @@ input = removeHash(input); | ||
function parseValue(value, options) { | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
value = Number(value); | ||
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
value = value.toLowerCase() === 'true'; | ||
} | ||
return value; | ||
} | ||
function parse(query, options) { | ||
options = Object.assign({ | ||
options = { | ||
decode: true, | ||
@@ -1587,4 +1629,6 @@ sort: true, | ||
parseNumbers: false, | ||
parseBooleans: false | ||
}, options); | ||
parseBooleans: false, | ||
types: Object.create(null), | ||
...options, | ||
}; | ||
@@ -1596,6 +1640,6 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
// Create an object with no prototype | ||
const ret = Object.create(null); | ||
const returnValue = Object.create(null); | ||
if (typeof query !== 'string') { | ||
return ret; | ||
return returnValue; | ||
} | ||
@@ -1606,26 +1650,34 @@ | ||
if (!query) { | ||
return ret; | ||
return returnValue; | ||
} | ||
for (const param of query.split('&')) { | ||
if (param === '') { | ||
for (const parameter of query.split('&')) { | ||
if (parameter === '') { | ||
continue; | ||
} | ||
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '='); | ||
const parameter_ = options.decode ? parameter.replaceAll('+', ' ') : parameter; | ||
let [key, value] = splitOnFirst(parameter_, '='); | ||
if (key === undefined) { | ||
key = parameter_; | ||
} | ||
// Missing `=` should be `null`: | ||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters | ||
value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options); | ||
formatter(decode(key, options), value, ret); | ||
value = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options)); | ||
formatter(decode(key, options), value, returnValue); | ||
} | ||
for (const key of Object.keys(ret)) { | ||
const value = ret[key]; | ||
if (typeof value === 'object' && value !== null) { | ||
for (const k of Object.keys(value)) { | ||
value[k] = parseValue(value[k], options); | ||
for (const [key, value] of Object.entries(returnValue)) { | ||
if (typeof value === 'object' && value !== null && options.types[key] !== 'string') { | ||
for (const [key2, value2] of Object.entries(value)) { | ||
const type = options.types[key] ? options.types[key].replace('[]', '') : undefined; | ||
value[key2] = parseValue(value2, options, type); | ||
} | ||
} else if (typeof value === 'object' && value !== null && options.types[key] === 'string') { | ||
returnValue[key] = Object.values(value).join(options.arrayFormatSeparator); | ||
} else { | ||
ret[key] = parseValue(value, options); | ||
returnValue[key] = parseValue(value, options, options.types[key]); | ||
} | ||
@@ -1635,14 +1687,10 @@ } | ||
if (options.sort === false) { | ||
return ret; | ||
return returnValue; | ||
} | ||
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => { | ||
const value = ret[key]; | ||
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) { | ||
// Sort object keys, not values | ||
result[key] = keysSorter(value); | ||
} else { | ||
result[key] = value; | ||
} | ||
// TODO: Remove the use of `reduce`. | ||
// eslint-disable-next-line unicorn/no-array-reduce | ||
return (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => { | ||
const value = returnValue[key]; | ||
result[key] = Boolean(value) && typeof value === 'object' && !Array.isArray(value) ? keysSorter(value) : value; | ||
return result; | ||
@@ -1652,6 +1700,3 @@ }, Object.create(null)); | ||
exports.extract = extract; | ||
exports.parse = parse; | ||
exports.stringify = (object, options) => { | ||
function stringify(object, options) { | ||
if (!object) { | ||
@@ -1661,8 +1706,9 @@ return ''; | ||
options = Object.assign({ | ||
options = { | ||
encode: true, | ||
strict: true, | ||
arrayFormat: 'none', | ||
arrayFormatSeparator: ',' | ||
}, options); | ||
arrayFormatSeparator: ',', | ||
...options, | ||
}; | ||
@@ -1672,4 +1718,4 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
const shouldFilter = key => ( | ||
(options.skipNull && isNullOrUndefined(object[key])) || | ||
(options.skipEmptyString && object[key] === '') | ||
(options.skipNull && isNullOrUndefined(object[key])) | ||
|| (options.skipEmptyString && object[key] === '') | ||
); | ||
@@ -1681,5 +1727,5 @@ | ||
for (const key of Object.keys(object)) { | ||
for (const [key, value] of Object.entries(object)) { | ||
if (!shouldFilter(key)) { | ||
objectCopy[key] = object[key]; | ||
objectCopy[key] = value; | ||
} | ||
@@ -1717,72 +1763,84 @@ } | ||
}).filter(x => x.length > 0).join('&'); | ||
}; | ||
} | ||
exports.parseUrl = (url, options) => { | ||
options = Object.assign({ | ||
decode: true | ||
}, options); | ||
function parseUrl(url, options) { | ||
options = { | ||
decode: true, | ||
...options, | ||
}; | ||
const [url_, hash] = splitOnFirst(url, '#'); | ||
let [url_, hash] = splitOnFirst(url, '#'); | ||
return Object.assign( | ||
{ | ||
url: url_.split('?')[0] || '', | ||
query: parse(extract(url), options) | ||
}, | ||
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {} | ||
); | ||
}; | ||
if (url_ === undefined) { | ||
url_ = url; | ||
} | ||
exports.stringifyUrl = (object, options) => { | ||
options = Object.assign({ | ||
return { | ||
url: url_?.split('?')?.[0] ?? '', | ||
query: parse(extract(url), options), | ||
...(options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}), | ||
}; | ||
} | ||
function stringifyUrl(object, options) { | ||
options = { | ||
encode: true, | ||
strict: true, | ||
[encodeFragmentIdentifier]: true | ||
}, options); | ||
[encodeFragmentIdentifier]: true, | ||
...options, | ||
}; | ||
const url = removeHash(object.url).split('?')[0] || ''; | ||
const queryFromUrl = exports.extract(object.url); | ||
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false}); | ||
const queryFromUrl = extract(object.url); | ||
const query = Object.assign(parsedQueryFromUrl, object.query); | ||
let queryString = exports.stringify(query, options); | ||
if (queryString) { | ||
queryString = `?${queryString}`; | ||
} | ||
const query = { | ||
...parse(queryFromUrl, {sort: false}), | ||
...object.query, | ||
}; | ||
let queryString = stringify(query, options); | ||
queryString &&= `?${queryString}`; | ||
let hash = getHash(object.url); | ||
if (object.fragmentIdentifier) { | ||
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`; | ||
if (typeof object.fragmentIdentifier === 'string') { | ||
const urlObjectForFragmentEncode = new URL(url); | ||
urlObjectForFragmentEncode.hash = object.fragmentIdentifier; | ||
hash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`; | ||
} | ||
return `${url}${queryString}${hash}`; | ||
}; | ||
} | ||
exports.pick = (input, filter, options) => { | ||
options = Object.assign({ | ||
function pick(input, filter, options) { | ||
options = { | ||
parseFragmentIdentifier: true, | ||
[encodeFragmentIdentifier]: false | ||
}, options); | ||
[encodeFragmentIdentifier]: false, | ||
...options, | ||
}; | ||
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options); | ||
return exports.stringifyUrl({ | ||
const {url, query, fragmentIdentifier} = parseUrl(input, options); | ||
return stringifyUrl({ | ||
url, | ||
query: filterObj(query, filter), | ||
fragmentIdentifier | ||
query: includeKeys(query, filter), | ||
fragmentIdentifier, | ||
}, options); | ||
}; | ||
} | ||
exports.exclude = (input, filter, options) => { | ||
function exclude(input, filter, options) { | ||
const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value); | ||
return exports.pick(input, exclusionFilter, options); | ||
}; | ||
return pick(input, exclusionFilter, options); | ||
} | ||
var queryString = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
extract: extract, | ||
parse: parse, | ||
stringify: stringify, | ||
parseUrl: parseUrl, | ||
stringifyUrl: stringifyUrl, | ||
pick: pick, | ||
exclude: exclude | ||
}); | ||
var queryString_1 = queryString.extract; | ||
var queryString_2 = queryString.parse; | ||
var queryString_3 = queryString.stringify; | ||
var queryString_4 = queryString.parseUrl; | ||
var queryString_5 = queryString.stringifyUrl; | ||
var queryString_6 = queryString.pick; | ||
var queryString_7 = queryString.exclude; | ||
@@ -1908,3 +1966,3 @@ /* | ||
var fetchConfig = (_a = crafterConf.getConfig().fetchConfig) !== null && _a !== void 0 ? _a : {}; | ||
return fromFetch("".concat(requestURL, "?").concat(queryString_3(params)), __assign(__assign({}, fetchConfig), { method: 'GET', headers: __assign(__assign({}, fetchConfig.headers), headers), selector: function (response) { return response.json(); } })); | ||
return fromFetch("".concat(requestURL, "?").concat(queryString.stringify(params)), __assign(__assign({}, fetchConfig), { method: 'GET', headers: __assign(__assign({}, fetchConfig.headers), headers), selector: function (response) { return response.json(); } })); | ||
} | ||
@@ -1911,0 +1969,0 @@ function httpPost(requestURL, body, headers) { |
@@ -184,143 +184,143 @@ /* | ||
var extendStatics = function(d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
function __extends(d, b) { | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
if (typeof b !== "function" && b !== null) | ||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
} | ||
var __assign = function() { | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
__assign = Object.assign || function __assign(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
function __rest(s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
} | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
} | ||
function __values(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __spreadArray(to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
} | ||
function __await(v) { | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
} | ||
function __asyncGenerator(thisArg, _arguments, generator) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var g = generator.apply(thisArg, _arguments || []), i, q = []; | ||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; | ||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } | ||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } | ||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } | ||
function fulfill(value) { resume("next", value); } | ||
function reject(value) { resume("throw", value); } | ||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||
} | ||
function __asyncValues(o) { | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||
var m = o[Symbol.asyncIterator], i; | ||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||
} | ||
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { | ||
var e = new Error(message); | ||
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; | ||
}; | ||
@@ -485,2 +485,3 @@ | ||
}()); | ||
Subscription.EMPTY; | ||
function isSubscription(value) { | ||
@@ -1119,12 +1120,6 @@ return (value instanceof Subscription || | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
const token = '%[a-f0-9]{2}'; | ||
const singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
const multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
var strictUriEncode = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
var token = '%[a-f0-9]{2}'; | ||
var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi'); | ||
var multiMatcher = new RegExp('(' + token + ')+', 'gi'); | ||
function decodeComponents(components, split) { | ||
@@ -1134,3 +1129,3 @@ try { | ||
return [decodeURIComponent(components.join(''))]; | ||
} catch (err) { | ||
} catch { | ||
// Do nothing | ||
@@ -1146,4 +1141,4 @@ } | ||
// Split the array in 2 parts | ||
var left = components.slice(0, split); | ||
var right = components.slice(split); | ||
const left = components.slice(0, split); | ||
const right = components.slice(split); | ||
@@ -1153,9 +1148,9 @@ return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); | ||
function decode(input) { | ||
function decode$1(input) { | ||
try { | ||
return decodeURIComponent(input); | ||
} catch (err) { | ||
var tokens = input.match(singleMatcher) || []; | ||
} catch { | ||
let tokens = input.match(singleMatcher) || []; | ||
for (var i = 1; i < tokens.length; i++) { | ||
for (let i = 1; i < tokens.length; i++) { | ||
input = decodeComponents(tokens, i).join(''); | ||
@@ -1172,8 +1167,8 @@ | ||
// Keep track of all the replacements and prefill the map with the `BOM` | ||
var replaceMap = { | ||
const replaceMap = { | ||
'%FE%FF': '\uFFFD\uFFFD', | ||
'%FF%FE': '\uFFFD\uFFFD' | ||
'%FF%FE': '\uFFFD\uFFFD', | ||
}; | ||
var match = multiMatcher.exec(input); | ||
let match = multiMatcher.exec(input); | ||
while (match) { | ||
@@ -1183,4 +1178,4 @@ try { | ||
replaceMap[match[0]] = decodeURIComponent(match[0]); | ||
} catch (err) { | ||
var result = decode(match[0]); | ||
} catch { | ||
const result = decode$1(match[0]); | ||
@@ -1198,7 +1193,6 @@ if (result !== match[0]) { | ||
var entries = Object.keys(replaceMap); | ||
const entries = Object.keys(replaceMap); | ||
for (var i = 0; i < entries.length; i++) { | ||
for (const key of entries) { | ||
// Replace all decoded components | ||
var key = entries[i]; | ||
input = input.replace(new RegExp(key, 'g'), replaceMap[key]); | ||
@@ -1210,3 +1204,3 @@ } | ||
var decodeUriComponent = function (encodedURI) { | ||
function decodeUriComponent(encodedURI) { | ||
if (typeof encodedURI !== 'string') { | ||
@@ -1217,13 +1211,37 @@ throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`'); | ||
try { | ||
encodedURI = encodedURI.replace(/\+/g, ' '); | ||
// Try the built in decoder first | ||
return decodeURIComponent(encodedURI); | ||
} catch (err) { | ||
} catch { | ||
// Fallback to a more advanced decoder | ||
return customDecodeURIComponent(encodedURI); | ||
} | ||
}; | ||
} | ||
var splitOnFirst = (string, separator) => { | ||
function includeKeys(object, predicate) { | ||
const result = {}; | ||
if (Array.isArray(predicate)) { | ||
for (const key of predicate) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor?.enumerable) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} else { | ||
// `Reflect.ownKeys()` is required to retrieve symbol properties | ||
for (const key of Reflect.ownKeys(object)) { | ||
const descriptor = Object.getOwnPropertyDescriptor(object, key); | ||
if (descriptor.enumerable) { | ||
const value = object[key]; | ||
if (predicate(key, value, object)) { | ||
Object.defineProperty(result, key, descriptor); | ||
} | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
function splitOnFirst(string, separator) { | ||
if (!(typeof string === 'string' && typeof separator === 'string')) { | ||
@@ -1233,4 +1251,4 @@ throw new TypeError('Expected the arguments to be of type `string`'); | ||
if (separator === '') { | ||
return [string]; | ||
if (string === '' || separator === '') { | ||
return []; | ||
} | ||
@@ -1241,3 +1259,3 @@ | ||
if (separatorIndex === -1) { | ||
return [string]; | ||
return []; | ||
} | ||
@@ -1249,29 +1267,9 @@ | ||
]; | ||
}; | ||
} | ||
var filterObj = function (obj, predicate) { | ||
var ret = {}; | ||
var keys = Object.keys(obj); | ||
var isArr = Array.isArray(predicate); | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
for (var i = 0; i < keys.length; i++) { | ||
var key = keys[i]; | ||
var val = obj[key]; | ||
// eslint-disable-next-line unicorn/prefer-code-point | ||
const strictUriEncode = string => encodeURIComponent(string).replaceAll(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); | ||
if (isArr ? predicate.indexOf(key) !== -1 : predicate(key, val, obj)) { | ||
ret[key] = val; | ||
} | ||
} | ||
return ret; | ||
}; | ||
var queryString = createCommonjsModule(function (module, exports) { | ||
const isNullOrUndefined = value => value === null || value === undefined; | ||
const encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier'); | ||
@@ -1281,3 +1279,3 @@ | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return key => (result, value) => { | ||
@@ -1287,5 +1285,5 @@ const index = result.length; | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1296,3 +1294,5 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[', index, ']'].join('')]; | ||
return [ | ||
...result, [encode(key, options), '[', index, ']'].join(''), | ||
]; | ||
} | ||
@@ -1302,12 +1302,13 @@ | ||
...result, | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('') | ||
[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1318,14 +1319,21 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), '[]'].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]'].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '[]=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '[]=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1336,7 +1344,14 @@ return result; | ||
if (value === null) { | ||
return [...result, [encode(key, options), ':list='].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list='].join(''), | ||
]; | ||
} | ||
return [...result, [encode(key, options), ':list=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), ':list=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
@@ -1346,11 +1361,11 @@ case 'comma': | ||
case 'bracket-separator': { | ||
const keyValueSep = options.arrayFormat === 'bracket-separator' ? | ||
'[]=' : | ||
'='; | ||
const keyValueSeparator = options.arrayFormat === 'bracket-separator' | ||
? '[]=' | ||
: '='; | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1364,3 +1379,3 @@ return result; | ||
if (result.length === 0) { | ||
return [[encode(key, options), keyValueSep, encode(value, options)].join('')]; | ||
return [[encode(key, options), keyValueSeparator, encode(value, options)].join('')]; | ||
} | ||
@@ -1372,8 +1387,8 @@ | ||
default: | ||
default: { | ||
return key => (result, value) => { | ||
if ( | ||
value === undefined || | ||
(options.skipNull && value === null) || | ||
(options.skipEmptyString && value === '') | ||
value === undefined | ||
|| (options.skipNull && value === null) | ||
|| (options.skipEmptyString && value === '') | ||
) { | ||
@@ -1384,7 +1399,14 @@ return result; | ||
if (value === null) { | ||
return [...result, encode(key, options)]; | ||
return [ | ||
...result, | ||
encode(key, options), | ||
]; | ||
} | ||
return [...result, [encode(key, options), '=', encode(value, options)].join('')]; | ||
return [ | ||
...result, | ||
[encode(key, options), '=', encode(value, options)].join(''), | ||
]; | ||
}; | ||
} | ||
} | ||
@@ -1397,7 +1419,7 @@ } | ||
switch (options.arrayFormat) { | ||
case 'index': | ||
case 'index': { | ||
return (key, value, accumulator) => { | ||
result = /\[(\d*)\]$/.exec(key); | ||
result = /\[(\d*)]$/.exec(key); | ||
key = key.replace(/\[\d*\]$/, ''); | ||
key = key.replace(/\[\d*]$/, ''); | ||
@@ -1415,7 +1437,8 @@ if (!result) { | ||
}; | ||
} | ||
case 'bracket': | ||
case 'bracket': { | ||
return (key, value, accumulator) => { | ||
result = /(\[\])$/.exec(key); | ||
key = key.replace(/\[\]$/, ''); | ||
result = /(\[])$/.exec(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1432,6 +1455,7 @@ if (!result) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'colon-list-separator': | ||
case 'colon-list-separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1451,7 +1475,8 @@ result = /(:list)$/.exec(key); | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...accumulator[key], value]; | ||
}; | ||
} | ||
case 'comma': | ||
case 'separator': | ||
case 'separator': { | ||
return (key, value, accumulator) => { | ||
@@ -1461,10 +1486,11 @@ const isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator); | ||
value = isEncodedArray ? decode(value, options) : value; | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : value === null ? value : decode(value, options); | ||
const newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : (value === null ? value : decode(value, options)); | ||
accumulator[key] = newValue; | ||
}; | ||
} | ||
case 'bracket-separator': | ||
case 'bracket-separator': { | ||
return (key, value, accumulator) => { | ||
const isArray = /(\[\])$/.test(key); | ||
key = key.replace(/\[\]$/, ''); | ||
const isArray = /(\[])$/.test(key); | ||
key = key.replace(/\[]$/, ''); | ||
@@ -1476,5 +1502,5 @@ if (!isArray) { | ||
const arrayValue = value === null ? | ||
[] : | ||
value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
const arrayValue = value === null | ||
? [] | ||
: value.split(options.arrayFormatSeparator).map(item => decode(item, options)); | ||
@@ -1486,6 +1512,7 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], arrayValue); | ||
accumulator[key] = [...accumulator[key], ...arrayValue]; | ||
}; | ||
} | ||
default: | ||
default: { | ||
return (key, value, accumulator) => { | ||
@@ -1497,4 +1524,5 @@ if (accumulator[key] === undefined) { | ||
accumulator[key] = [].concat(accumulator[key], value); | ||
accumulator[key] = [...[accumulator[key]].flat(), value]; | ||
}; | ||
} | ||
} | ||
@@ -1558,2 +1586,26 @@ } | ||
function parseValue(value, options, type) { | ||
if (type === 'string' && typeof value === 'string') { | ||
return value; | ||
} | ||
if (typeof type === 'function' && typeof value === 'string') { | ||
return type(value); | ||
} | ||
if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
return value.toLowerCase() === 'true'; | ||
} | ||
if (type === 'number' && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
return Number(value); | ||
} | ||
return value; | ||
} | ||
function extract(input) { | ||
@@ -1569,14 +1621,4 @@ input = removeHash(input); | ||
function parseValue(value, options) { | ||
if (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) { | ||
value = Number(value); | ||
} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { | ||
value = value.toLowerCase() === 'true'; | ||
} | ||
return value; | ||
} | ||
function parse(query, options) { | ||
options = Object.assign({ | ||
options = { | ||
decode: true, | ||
@@ -1587,4 +1629,6 @@ sort: true, | ||
parseNumbers: false, | ||
parseBooleans: false | ||
}, options); | ||
parseBooleans: false, | ||
types: Object.create(null), | ||
...options, | ||
}; | ||
@@ -1596,6 +1640,6 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
// Create an object with no prototype | ||
const ret = Object.create(null); | ||
const returnValue = Object.create(null); | ||
if (typeof query !== 'string') { | ||
return ret; | ||
return returnValue; | ||
} | ||
@@ -1606,26 +1650,34 @@ | ||
if (!query) { | ||
return ret; | ||
return returnValue; | ||
} | ||
for (const param of query.split('&')) { | ||
if (param === '') { | ||
for (const parameter of query.split('&')) { | ||
if (parameter === '') { | ||
continue; | ||
} | ||
let [key, value] = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '='); | ||
const parameter_ = options.decode ? parameter.replaceAll('+', ' ') : parameter; | ||
let [key, value] = splitOnFirst(parameter_, '='); | ||
if (key === undefined) { | ||
key = parameter_; | ||
} | ||
// Missing `=` should be `null`: | ||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters | ||
value = value === undefined ? null : ['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options); | ||
formatter(decode(key, options), value, ret); | ||
value = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options)); | ||
formatter(decode(key, options), value, returnValue); | ||
} | ||
for (const key of Object.keys(ret)) { | ||
const value = ret[key]; | ||
if (typeof value === 'object' && value !== null) { | ||
for (const k of Object.keys(value)) { | ||
value[k] = parseValue(value[k], options); | ||
for (const [key, value] of Object.entries(returnValue)) { | ||
if (typeof value === 'object' && value !== null && options.types[key] !== 'string') { | ||
for (const [key2, value2] of Object.entries(value)) { | ||
const type = options.types[key] ? options.types[key].replace('[]', '') : undefined; | ||
value[key2] = parseValue(value2, options, type); | ||
} | ||
} else if (typeof value === 'object' && value !== null && options.types[key] === 'string') { | ||
returnValue[key] = Object.values(value).join(options.arrayFormatSeparator); | ||
} else { | ||
ret[key] = parseValue(value, options); | ||
returnValue[key] = parseValue(value, options, options.types[key]); | ||
} | ||
@@ -1635,14 +1687,10 @@ } | ||
if (options.sort === false) { | ||
return ret; | ||
return returnValue; | ||
} | ||
return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce((result, key) => { | ||
const value = ret[key]; | ||
if (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) { | ||
// Sort object keys, not values | ||
result[key] = keysSorter(value); | ||
} else { | ||
result[key] = value; | ||
} | ||
// TODO: Remove the use of `reduce`. | ||
// eslint-disable-next-line unicorn/no-array-reduce | ||
return (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => { | ||
const value = returnValue[key]; | ||
result[key] = Boolean(value) && typeof value === 'object' && !Array.isArray(value) ? keysSorter(value) : value; | ||
return result; | ||
@@ -1652,6 +1700,3 @@ }, Object.create(null)); | ||
exports.extract = extract; | ||
exports.parse = parse; | ||
exports.stringify = (object, options) => { | ||
function stringify(object, options) { | ||
if (!object) { | ||
@@ -1661,8 +1706,9 @@ return ''; | ||
options = Object.assign({ | ||
options = { | ||
encode: true, | ||
strict: true, | ||
arrayFormat: 'none', | ||
arrayFormatSeparator: ',' | ||
}, options); | ||
arrayFormatSeparator: ',', | ||
...options, | ||
}; | ||
@@ -1672,4 +1718,4 @@ validateArrayFormatSeparator(options.arrayFormatSeparator); | ||
const shouldFilter = key => ( | ||
(options.skipNull && isNullOrUndefined(object[key])) || | ||
(options.skipEmptyString && object[key] === '') | ||
(options.skipNull && isNullOrUndefined(object[key])) | ||
|| (options.skipEmptyString && object[key] === '') | ||
); | ||
@@ -1681,5 +1727,5 @@ | ||
for (const key of Object.keys(object)) { | ||
for (const [key, value] of Object.entries(object)) { | ||
if (!shouldFilter(key)) { | ||
objectCopy[key] = object[key]; | ||
objectCopy[key] = value; | ||
} | ||
@@ -1717,72 +1763,84 @@ } | ||
}).filter(x => x.length > 0).join('&'); | ||
}; | ||
} | ||
exports.parseUrl = (url, options) => { | ||
options = Object.assign({ | ||
decode: true | ||
}, options); | ||
function parseUrl(url, options) { | ||
options = { | ||
decode: true, | ||
...options, | ||
}; | ||
const [url_, hash] = splitOnFirst(url, '#'); | ||
let [url_, hash] = splitOnFirst(url, '#'); | ||
return Object.assign( | ||
{ | ||
url: url_.split('?')[0] || '', | ||
query: parse(extract(url), options) | ||
}, | ||
options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {} | ||
); | ||
}; | ||
if (url_ === undefined) { | ||
url_ = url; | ||
} | ||
exports.stringifyUrl = (object, options) => { | ||
options = Object.assign({ | ||
return { | ||
url: url_?.split('?')?.[0] ?? '', | ||
query: parse(extract(url), options), | ||
...(options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}), | ||
}; | ||
} | ||
function stringifyUrl(object, options) { | ||
options = { | ||
encode: true, | ||
strict: true, | ||
[encodeFragmentIdentifier]: true | ||
}, options); | ||
[encodeFragmentIdentifier]: true, | ||
...options, | ||
}; | ||
const url = removeHash(object.url).split('?')[0] || ''; | ||
const queryFromUrl = exports.extract(object.url); | ||
const parsedQueryFromUrl = exports.parse(queryFromUrl, {sort: false}); | ||
const queryFromUrl = extract(object.url); | ||
const query = Object.assign(parsedQueryFromUrl, object.query); | ||
let queryString = exports.stringify(query, options); | ||
if (queryString) { | ||
queryString = `?${queryString}`; | ||
} | ||
const query = { | ||
...parse(queryFromUrl, {sort: false}), | ||
...object.query, | ||
}; | ||
let queryString = stringify(query, options); | ||
queryString &&= `?${queryString}`; | ||
let hash = getHash(object.url); | ||
if (object.fragmentIdentifier) { | ||
hash = `#${options[encodeFragmentIdentifier] ? encode(object.fragmentIdentifier, options) : object.fragmentIdentifier}`; | ||
if (typeof object.fragmentIdentifier === 'string') { | ||
const urlObjectForFragmentEncode = new URL(url); | ||
urlObjectForFragmentEncode.hash = object.fragmentIdentifier; | ||
hash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`; | ||
} | ||
return `${url}${queryString}${hash}`; | ||
}; | ||
} | ||
exports.pick = (input, filter, options) => { | ||
options = Object.assign({ | ||
function pick(input, filter, options) { | ||
options = { | ||
parseFragmentIdentifier: true, | ||
[encodeFragmentIdentifier]: false | ||
}, options); | ||
[encodeFragmentIdentifier]: false, | ||
...options, | ||
}; | ||
const {url, query, fragmentIdentifier} = exports.parseUrl(input, options); | ||
return exports.stringifyUrl({ | ||
const {url, query, fragmentIdentifier} = parseUrl(input, options); | ||
return stringifyUrl({ | ||
url, | ||
query: filterObj(query, filter), | ||
fragmentIdentifier | ||
query: includeKeys(query, filter), | ||
fragmentIdentifier, | ||
}, options); | ||
}; | ||
} | ||
exports.exclude = (input, filter, options) => { | ||
function exclude(input, filter, options) { | ||
const exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value); | ||
return exports.pick(input, exclusionFilter, options); | ||
}; | ||
return pick(input, exclusionFilter, options); | ||
} | ||
var queryString = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
extract: extract, | ||
parse: parse, | ||
stringify: stringify, | ||
parseUrl: parseUrl, | ||
stringifyUrl: stringifyUrl, | ||
pick: pick, | ||
exclude: exclude | ||
}); | ||
var queryString_1 = queryString.extract; | ||
var queryString_2 = queryString.parse; | ||
var queryString_3 = queryString.stringify; | ||
var queryString_4 = queryString.parseUrl; | ||
var queryString_5 = queryString.stringifyUrl; | ||
var queryString_6 = queryString.pick; | ||
var queryString_7 = queryString.exclude; | ||
@@ -1908,3 +1966,3 @@ /* | ||
var fetchConfig = (_a = crafterConf.getConfig().fetchConfig) !== null && _a !== void 0 ? _a : {}; | ||
return fromFetch("".concat(requestURL, "?").concat(queryString_3(params)), __assign(__assign({}, fetchConfig), { method: 'GET', headers: __assign(__assign({}, fetchConfig.headers), headers), selector: function (response) { return response.json(); } })); | ||
return fromFetch("".concat(requestURL, "?").concat(queryString.stringify(params)), __assign(__assign({}, fetchConfig), { method: 'GET', headers: __assign(__assign({}, fetchConfig.headers), headers), selector: function (response) { return response.json(); } })); | ||
} | ||
@@ -1911,0 +1969,0 @@ function httpPost(requestURL, body, headers) { |
{ | ||
"name": "@craftercms/classes", | ||
"version": "4.1.8", | ||
"version": "4.2.0", | ||
"description": "Crafter CMS utility classes for developing sites and applications", | ||
@@ -11,3 +11,3 @@ "main": "./bundles/classes.umd.js", | ||
"type": "git", | ||
"url": "git+https://github.com/craftercms/craftercms-sdk-js.git" | ||
"url": "https://github.com/craftercms/craftercms-sdk-js.git" | ||
}, | ||
@@ -25,16 +25,23 @@ "keywords": [ | ||
"clean:ts": "../../node_modules/rimraf/bin.js ts-out", | ||
"build": "npm run build:ts && npm run rollup && npm run clean:ts" | ||
"build": "npm run build:ts && npm run rollup && npm run clean:ts", | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"@craftercms/models": "4.1.8", | ||
"@craftercms/utils": "4.1.8", | ||
"query-string": "^7.1.3" | ||
"@craftercms/models": "4.2.0", | ||
"@craftercms/utils": "4.2.0", | ||
"query-string": "^9.1.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^11.1.0", | ||
"@rollup/plugin-node-resolve": "^7.1.3", | ||
"rollup": "^1.32.1", | ||
"rollup-plugin-sourcemaps": "^0.5.0", | ||
"uglify-es": "^3.3.10" | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"chai": "^5.1.1", | ||
"mocha": "^10.2.0", | ||
"nock": "^13.3.4", | ||
"node-fetch": "2", | ||
"rollup": "^2.79.1", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"terser": "^5.30.1", | ||
"url-search-params-polyfill": "^5.0.0", | ||
"xhr2": "^0.2.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1513322
9378
11
+ Added@craftercms/models@4.2.0(transitive)
+ Added@craftercms/utils@4.2.0(transitive)
+ Addeddecode-uri-component@0.4.1(transitive)
+ Addedfilter-obj@5.1.0(transitive)
+ Addedquery-string@9.1.1(transitive)
+ Addedsplit-on-first@3.0.0(transitive)
- Removed@craftercms/models@4.1.8(transitive)
- Removed@craftercms/utils@4.1.8(transitive)
- Removeddecode-uri-component@0.2.2(transitive)
- Removedfilter-obj@1.1.0(transitive)
- Removedquery-string@7.1.3(transitive)
- Removedsplit-on-first@1.1.0(transitive)
- Removedstrict-uri-encode@2.0.0(transitive)
Updated@craftercms/models@4.2.0
Updated@craftercms/utils@4.2.0
Updatedquery-string@^9.1.0