8e468f659747f663052abe600407bfabdcc8aeb7
[motion2.git] / snippet / 3.0.0 / scripts / vendor-urlMatcher.js
1 (self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["vendor-urlMatcher"],{"./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js":(e,t,r)=>{"use strict";r.d(t,{x:()=>m});var n=r("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=r("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=r("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),o=r("./node_modules/@uirouter/core/lib-esm/params/param.js"),s=r("./node_modules/@uirouter/core/lib-esm/common/strings.js"),c=r("./node_modules/@uirouter/core/lib-esm/common/index.js");function u(e,t){var r=["",""],n=e.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!t)return n;switch(t.squash){case!1:r=["(",")"+(t.isOptional?"?":"")];break;case!0:n=n.replace(/\/$/,""),r=["(?:/(",")|/)?"];break;default:r=["("+t.squash+"|",")?"]}return n+r[0]+t.type.pattern.source+r[1]}var p=(0,s.PX)("/"),h={state:{params:{}},strict:!0,caseInsensitive:!0,decodeParams:!0},m=function(){function e(t,r,i,o){var s=this;this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.config=o=(0,c.ce)(o,h),this.pattern=t;for(var p,m,d,l=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,f=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,g=[],v=0,_=function(r){if(!e.nameValidator.test(r))throw new Error("Invalid parameter name '"+r+"' in pattern '"+t+"'");if((0,n.sE)(s._params,(0,a.OH)("id",r)))throw new Error("Duplicate parameter name '"+r+"' in pattern '"+t+"'")},y=function(e,a){var i,o=e[2]||e[3],c=a?e[4]:e[4]||("*"===e[1]?"[\\s\\S]*":null);return{id:o,regexp:c,segment:t.substring(v,e.index),type:c?r.type(c)||(i=c,(0,n.ED)(r.type(a?"query":"path"),{pattern:new RegExp(i,s.config.caseInsensitive?"i":void 0)})):null}};(p=l.exec(t))&&!((m=y(p,!1)).segment.indexOf("?")>=0);)_(m.id),this._params.push(i.fromPath(m.id,m.type,o.state)),this._segments.push(m.segment),g.push([m.segment,(0,n.Gb)(this._params)]),v=l.lastIndex;var w=(d=t.substring(v)).indexOf("?");if(w>=0){var b=d.substring(w);if(d=d.substring(0,w),b.length>0)for(v=0;p=f.exec(b);)_((m=y(p,!0)).id),this._params.push(i.fromSearch(m.id,m.type,o.state)),v=l.lastIndex}this._segments.push(d),this._compiled=g.map((function(e){return u.apply(null,e)})).concat(u(d))}return e.encodeDashes=function(e){return encodeURIComponent(e).replace(/-/g,(function(e){return"%5C%"+e.charCodeAt(0).toString(16).toUpperCase()}))},e.pathSegmentsAndParams=function(e){var t=e._segments,r=e._params.filter((function(e){return e.location===o._.PATH}));return(0,n.ym)(t,r.concat(void 0)).reduce(n.M7,[]).filter((function(e){return""!==e&&(0,i.$K)(e)}))},e.queryParams=function(e){return e._params.filter((function(e){return e.location===o._.SEARCH}))},e.compare=function(t,r){var a=function(t){return t._cache.weights=t._cache.weights||function(t){return t._cache.segments=t._cache.segments||t._cache.path.map(e.pathSegmentsAndParams).reduce(n.M7,[]).reduce(s.iV,[]).map((function(e){return(0,i.HD)(e)?p(e):e})).reduce(n.M7,[])}(t).map((function(e){return"/"===e?1:(0,i.HD)(e)?2:e instanceof o.d?3:void 0}))},c=a(t),u=a(r);!function(e,t,r){for(var n=Math.max(e.length,t.length);e.length<n;)e.push(0);for(;t.length<n;)t.push(0)}(c,u);var h,m,d=(0,n.ym)(c,u);for(m=0;m<d.length;m++)if(0!=(h=d[m][0]-d[m][1]))return h;return 0},e.prototype.append=function(e){return this._children.push(e),e._cache={path:this._cache.path.concat(e),parent:this,pattern:null},e},e.prototype.isRoot=function(){return this._cache.path[0]===this},e.prototype.toString=function(){return this.pattern},e.prototype._getDecodedParamValue=function(e,t){return(0,i.$K)(e)&&(this.config.decodeParams&&!t.type.raw&&(e=(0,i.kJ)(e)?e.map((function(e){return decodeURIComponent(e)})):decodeURIComponent(e)),e=t.type.decode(e)),t.value(e)},e.prototype.exec=function(e,t,r,i){var o=this;void 0===t&&(t={}),void 0===i&&(i={});var s,c,u,p=(s=this._cache,c="pattern",u=function(){return new RegExp(["^",(0,n.UW)(o._cache.path.map((0,a.vg)("_compiled"))).join(""),!1===o.config.strict?"/?":"","$"].join(""),o.config.caseInsensitive?"i":void 0)},s[c]=s[c]||u()).exec(e);if(!p)return null;var h,m,d,l=this.parameters(),f=l.filter((function(e){return!e.isSearch()})),g=l.filter((function(e){return e.isSearch()})),v=this._cache.path.map((function(e){return e._segments.length-1})).reduce((function(e,t){return e+t})),_={};if(v!==p.length-1)throw new Error("Unbalanced capture group in route '"+this.pattern+"'");for(var y=0;y<v;y++){for(var w=f[y],b=p[y+1],x=0;x<w.replace.length;x++)w.replace[x].from===b&&(b=w.replace[x].to);b&&!0===w.array&&(void 0,void 0,void 0,m=(h=function(e){return e.split("").reverse().join("")})(b).split(/-(?!\\)/),d=(0,n.UI)(m,h),b=(0,n.UI)(d,(function(e){return e.replace(/\\-/g,"-")})).reverse()),_[w.id]=this._getDecodedParamValue(b,w)}return g.forEach((function(e){for(var r=t[e.id],n=0;n<e.replace.length;n++)e.replace[n].from===r&&(r=e.replace[n].to);_[e.id]=o._getDecodedParamValue(r,e)})),r&&(_["#"]=r),_},e.prototype.parameters=function(e){return void 0===e&&(e={}),!1===e.inherit?this._params:(0,n.UW)(this._cache.path.map((function(e){return e._params})))},e.prototype.parameter=function(e,t){var r=this;void 0===t&&(t={});var n=this._cache.parent;return function(){for(var t=0,n=r._params;t<n.length;t++){var a=n[t];if(a.id===e)return a}}()||!1!==t.inherit&&n&&n.parameter(e,t)||null},e.prototype.validates=function(e){return e=e||{},this.parameters().filter((function(t){return e.hasOwnProperty(t.id)})).map((function(t){return r=t,n=e[t.id],!r||r.validates(n);var r,n})).reduce(n.XC,!0)},e.prototype.format=function(t){void 0===t&&(t={});var r=this._cache.path,a=r.map(e.pathSegmentsAndParams).reduce(n.M7,[]).map((function(e){return(0,i.HD)(e)?e:s(e)})),o=r.map(e.queryParams).reduce(n.M7,[]).map(s);if(a.concat(o).filter((function(e){return!1===e.isValid})).length)return null;function s(e){var r=e.value(t[e.id]),n=e.validates(r),a=e.isDefaultValue(r),i=!!a&&e.squash,o=e.type.encode(r);return{param:e,value:r,isValid:n,isDefaultValue:a,squash:i,encoded:o}}var c=a.reduce((function(t,r){if((0,i.HD)(r))return t+r;var a=r.squash,o=r.encoded,s=r.param;return!0===a?t.match(/\/$/)?t.slice(0,-1):t:(0,i.HD)(a)?t+a:!1!==a||null==o?t:(0,i.kJ)(o)?t+(0,n.UI)(o,e.encodeDashes).join("-"):s.raw?t+o:t+encodeURIComponent(o)}),""),u=o.map((function(e){var t=e.param,r=e.squash,a=e.encoded,o=e.isDefaultValue;if(!(null==a||o&&!1!==r)&&((0,i.kJ)(a)||(a=[a]),0!==a.length))return t.raw||(a=(0,n.UI)(a,encodeURIComponent)),a.map((function(e){return t.id+"="+e}))})).filter(n.yR).reduce(n.M7,[]).join("&");return c+(u?"?"+u:"")+(t["#"]?"#"+t["#"]:"")},e.nameValidator=/^\w+([-.]+\w+)*(?:\[\])?$/,e}()}}]);
2 //# sourceMappingURL=vendor-urlMatcher.js.map