mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
Updating to use injector & removing storybook
This commit is contained in:
parent
fac6a03aef
commit
5aed71b8b3
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
composer.lock
|
||||
vendor
|
||||
framework
|
||||
node_modules/
|
||||
/**/*.js.map
|
||||
/**/*.css.map
|
||||
|
1928
client/dist/js/bundle.js
vendored
1928
client/dist/js/bundle.js
vendored
@ -1 +1,1927 @@
|
||||
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s="./client/src/bundles/bundle.js")}({"./client/src/bundles/bundle.js":function(t,e,n){"use strict";n("./client/src/legacy/entwine/TagField.js")},"./client/src/components/TagField.js":function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(0),p=r(c),f=n(3),d=r(f),m=n(1),y=r(m),v=n("./node_modules/url/url.js"),b=r(v),g=function(t){function e(t){a(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={value:t.value},n.onChange=n.onChange.bind(n),n.getOptions=n.getOptions.bind(n),n}return h(e,t),l(e,[{key:"onChange",value:function(t){this.setState({value:t}),"function"==typeof this.props.onChange&&this.props.onChange(t)}},{key:"getOptions",value:function(t){var e=this.props,n=e.lazyLoad,r=e.options,o=e.optionUrl,a=e.labelKey,i=e.valueKey;if(!n)return Promise.resolve({options:r});if(!t)return Promise.resolve({options:[]});var h=b.default.parse(o,!0);return h.query.term=t,(0,y.default)(b.default.format(h),{credentials:"same-origin"}).then(function(t){return t.json()}).then(function(t){return{options:t.items.map(function(t){var e;return e={},s(e,a,t.id),s(e,i,t.text),e})}})}},{key:"render",value:function(){var t=this.props,e=t.lazyLoad,n=t.options,r=t.creatable,s=o(t,["lazyLoad","options","creatable"]),a=e?{loadOptions:this.getOptions}:{options:n},i=d.default;return e&&r?i=d.default.AsyncCreatable:e?i=d.default.Async:r&&(i=d.default.Creatable),s.value=this.state.value,p.default.createElement(i,u({},s,{onChange:this.onChange,inputProps:{className:"no-change-track"}},a))}}]),e}(c.Component);g.propTypes={name:c.PropTypes.string.isRequired,labelKey:c.PropTypes.string.isRequired,valueKey:c.PropTypes.string.isRequired,lazyLoad:c.PropTypes.bool.isRequired,creatable:c.PropTypes.bool.isRequired,multi:c.PropTypes.bool.isRequired,disabled:c.PropTypes.bool,options:c.PropTypes.arrayOf(c.PropTypes.object),optionUrl:c.PropTypes.string,value:c.PropTypes.any,onChange:c.PropTypes.func,onBlur:c.PropTypes.func},g.defaultProps={labelKey:"Title",valueKey:"Value",disabled:!1},e.default=g},"./client/src/legacy/entwine/TagField.js":function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=n(0),a=r(s),i=n(2),h=r(i),u=n("./client/src/components/TagField.js"),l=r(u);window.jQuery.entwine("ss",function(t){t(".js-injector-boot .ss-tag-field").entwine({onmatch:function(){var t=this,e=o({},this.data("schema"),{onBlur:function(){t.parents(".cms-edit-form:first").trigger("change")}});h.default.render(a.default.createElement(l.default,e),this[0])},onunmatch:function(){h.default.unmountComponentAtNode(this[0])}})})},"./node_modules/punycode/punycode.js":function(t,e,n){(function(t,r){var o;!function(r){function s(t){throw new RangeError(R[t])}function a(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function i(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(T,"."),r+a(t.split("."),e).join(".")}function h(t){for(var e,n,r=[],o=0,s=t.length;o<s;)e=t.charCodeAt(o++),e>=55296&&e<=56319&&o<s?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function u(t){return a(t,function(t){var e="";return t>65535&&(t-=65536,e+=U(t>>>10&1023|55296),t=56320|1023&t),e+=U(t)}).join("")}function l(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:g}function c(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function p(t,e,n){var r=0;for(t=n?k(t/x):t>>1,t+=k(t/e);t>I*O>>1;r+=g)t=k(t/I);return k(r+(I+1)*t/(t+w))}function f(t){var e,n,r,o,a,i,h,c,f,d,m=[],y=t.length,v=0,w=P,x=C;for(n=t.lastIndexOf(_),n<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&s("not-basic"),m.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<y;){for(a=v,i=1,h=g;o>=y&&s("invalid-input"),c=l(t.charCodeAt(o++)),(c>=g||c>k((b-v)/i))&&s("overflow"),v+=c*i,f=h<=x?j:h>=x+O?O:h-x,!(c<f);h+=g)d=g-f,i>k(b/d)&&s("overflow"),i*=d;e=m.length+1,x=p(v-a,e,0==a),k(v/e)>b-w&&s("overflow"),w+=k(v/e),v%=e,m.splice(v++,0,w)}return u(m)}function d(t){var e,n,r,o,a,i,u,l,f,d,m,y,v,w,x,q=[];for(t=h(t),y=t.length,e=P,n=0,a=C,i=0;i<y;++i)(m=t[i])<128&&q.push(U(m));for(r=o=q.length,o&&q.push(_);r<y;){for(u=b,i=0;i<y;++i)(m=t[i])>=e&&m<u&&(u=m);for(v=r+1,u-e>k((b-n)/v)&&s("overflow"),n+=(u-e)*v,e=u,i=0;i<y;++i)if(m=t[i],m<e&&++n>b&&s("overflow"),m==e){for(l=n,f=g;d=f<=a?j:f>=a+O?O:f-a,!(l<d);f+=g)x=l-d,w=g-d,q.push(U(c(d+x%w,0))),l=k(x/w);q.push(U(c(l,0))),a=p(n,v,r==o),n=0,++r}++n,++e}return q.join("")}function m(t){return i(t,function(t){return q.test(t)?f(t.slice(4).toLowerCase()):t})}function y(t){return i(t,function(t){return A.test(t)?"xn--"+d(t):t})}var v,b=("object"==typeof e&&e&&e.nodeType,"object"==typeof t&&t&&t.nodeType,2147483647),g=36,j=1,O=26,w=38,x=700,C=72,P=128,_="-",q=/^xn--/,A=/[^\x20-\x7E]/,T=/[\x2E\u3002\uFF0E\uFF61]/g,R={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=g-j,k=Math.floor,U=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:h,encode:u},decode:f,encode:d,toASCII:y,toUnicode:m},void 0!==(o=function(){return v}.call(e,n,e,t))&&(t.exports=o)}()}).call(e,n("./node_modules/webpack/buildin/module.js")(t),n("./node_modules/webpack/buildin/global.js"))},"./node_modules/querystring-es3/decode.js":function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,s){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var i=/\+/g;t=t.split(e);var h=1e3;s&&"number"==typeof s.maxKeys&&(h=s.maxKeys);var u=t.length;h>0&&u>h&&(u=h);for(var l=0;l<u;++l){var c,p,f,d,m=t[l].replace(i,"%20"),y=m.indexOf(n);y>=0?(c=m.substr(0,y),p=m.substr(y+1)):(c=m,p=""),f=decodeURIComponent(c),d=decodeURIComponent(p),r(a,f)?o(a[f])?a[f].push(d):a[f]=[a[f],d]:a[f]=d}return a};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},"./node_modules/querystring-es3/encode.js":function(t,e,n){"use strict";function r(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var o=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,i){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?r(a(t),function(a){var i=encodeURIComponent(o(a))+n;return s(t[a])?r(t[a],function(t){return i+encodeURIComponent(o(t))}).join(e):i+encodeURIComponent(o(t[a]))}).join(e):i?encodeURIComponent(o(i))+n+encodeURIComponent(o(t)):""};var s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},"./node_modules/querystring-es3/index.js":function(t,e,n){"use strict";e.decode=e.parse=n("./node_modules/querystring-es3/decode.js"),e.encode=e.stringify=n("./node_modules/querystring-es3/encode.js")},"./node_modules/url/url.js":function(t,e,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(t,e,n){if(t&&u.isObject(t)&&t instanceof r)return t;var o=new r;return o.parse(t,e,n),o}function s(t){return u.isString(t)&&(t=o(t)),t instanceof r?t.format():r.prototype.format.call(t)}function a(t,e){return o(t,!1,!0).resolve(e)}function i(t,e){return t?o(t,!1,!0).resolveObject(e):e}var h=n("./node_modules/punycode/punycode.js"),u=n("./node_modules/url/util.js");e.parse=o,e.resolve=a,e.resolveObject=i,e.format=s,e.Url=r;var l=/^([a-z0-9.+-]+:)/i,c=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(f),m=["'"].concat(d),y=["%","/","?",";","#"].concat(m),v=["/","?","#"],b=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,j={javascript:!0,"javascript:":!0},O={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},x=n("./node_modules/querystring-es3/index.js");r.prototype.parse=function(t,e,n){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t.indexOf("?"),o=-1!==r&&r<t.indexOf("#")?"?":"#",s=t.split(o),a=/\\/g;s[0]=s[0].replace(a,"/"),t=s.join(o);var i=t;if(i=i.trim(),!n&&1===t.split("#").length){var c=p.exec(i);if(c)return this.path=i,this.href=i,this.pathname=c[1],c[2]?(this.search=c[2],this.query=e?x.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var f=l.exec(i);if(f){f=f[0];var d=f.toLowerCase();this.protocol=d,i=i.substr(f.length)}if(n||f||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var C="//"===i.substr(0,2);!C||f&&O[f]||(i=i.substr(2),this.slashes=!0)}if(!O[f]&&(C||f&&!w[f])){for(var P=-1,_=0;_<v.length;_++){var q=i.indexOf(v[_]);-1!==q&&(-1===P||q<P)&&(P=q)}var A,T;T=-1===P?i.lastIndexOf("@"):i.lastIndexOf("@",P),-1!==T&&(A=i.slice(0,T),i=i.slice(T+1),this.auth=decodeURIComponent(A)),P=-1;for(var _=0;_<y.length;_++){var q=i.indexOf(y[_]);-1!==q&&(-1===P||q<P)&&(P=q)}-1===P&&(P=i.length),this.host=i.slice(0,P),i=i.slice(P),this.parseHost(),this.hostname=this.hostname||"";var R="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!R)for(var I=this.hostname.split(/\./),_=0,k=I.length;_<k;_++){var U=I[_];if(U&&!U.match(b)){for(var S="",F=0,E=U.length;F<E;F++)U.charCodeAt(F)>127?S+="x":S+=U[F];if(!S.match(b)){var N=I.slice(0,_),K=I.slice(_+1),z=U.match(g);z&&(N.push(z[1]),K.unshift(z[2])),K.length&&(i="/"+K.join(".")+i),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),R||(this.hostname=h.toASCII(this.hostname));var L=this.port?":"+this.port:"",M=this.hostname||"";this.host=M+L,this.href+=this.host,R&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==i[0]&&(i="/"+i))}if(!j[d])for(var _=0,k=m.length;_<k;_++){var $=m[_];if(-1!==i.indexOf($)){var B=encodeURIComponent($);B===$&&(B=escape($)),i=i.split($).join(B)}}var H=i.indexOf("#");-1!==H&&(this.hash=i.substr(H),i=i.slice(0,H));var Z=i.indexOf("?");if(-1!==Z?(this.search=i.substr(Z),this.query=i.substr(Z+1),e&&(this.query=x.parse(this.query)),i=i.slice(0,Z)):e&&(this.search="",this.query={}),i&&(this.pathname=i),w[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var L=this.pathname||"",D=this.search||"";this.path=L+D}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,s="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&u.isObject(this.query)&&Object.keys(this.query).length&&(s=x.stringify(this.query));var a=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||w[e])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),a=a.replace("#","%23"),e+o+n+a+r},r.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(u.isString(t)){var e=new r;e.parse(t,!1,!0),t=e}for(var n=new r,o=Object.keys(this),s=0;s<o.length;s++){var a=o[s];n[a]=this[a]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var i=Object.keys(t),h=0;h<i.length;h++){var l=i[h];"protocol"!==l&&(n[l]=t[l])}return w[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!w[t.protocol]){for(var c=Object.keys(t),p=0;p<c.length;p++){var f=c[p];n[f]=t[f]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||O[t.protocol])n.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",y=n.search||"";n.path=m+y}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),b=t.host||t.pathname&&"/"===t.pathname.charAt(0),g=b||v||n.host&&t.pathname,j=g,x=n.pathname&&n.pathname.split("/")||[],d=t.pathname&&t.pathname.split("/")||[],C=n.protocol&&!w[n.protocol];if(C&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),g=g&&(""===d[0]||""===x[0])),b)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,x=d;else if(d.length)x||(x=[]),x.pop(),x=x.concat(d),n.search=t.search,n.query=t.query;else if(!u.isNullOrUndefined(t.search)){if(C){n.hostname=n.host=x.shift();var P=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return n.search=t.search,n.query=t.query,u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var _=x.slice(-1)[0],q=(n.host||t.host||x.length>1)&&("."===_||".."===_)||""===_,A=0,T=x.length;T>=0;T--)_=x[T],"."===_?x.splice(T,1):".."===_?(x.splice(T,1),A++):A&&(x.splice(T,1),A--);if(!g&&!j)for(;A--;A)x.unshift("..");!g||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),q&&"/"!==x.join("/").substr(-1)&&x.push("");var R=""===x[0]||x[0]&&"/"===x[0].charAt(0);if(C){n.hostname=n.host=R?"":x.length?x.shift():"";var P=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");P&&(n.auth=P.shift(),n.host=n.hostname=P.shift())}return g=g||n.host&&x.length,g&&!R&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),u.isNull(n.pathname)&&u.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=c.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},"./node_modules/url/util.js":function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"./node_modules/webpack/buildin/module.js":function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},0:function(t,e){t.exports=React},1:function(t,e){t.exports=IsomorphicFetch},2:function(t,e){t.exports=ReactDom},3:function(t,e){t.exports=ReactSelect}});
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // identity function for calling harmony imports with the correct context
|
||||
/******/ __webpack_require__.i = function(value) { return value; };
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, {
|
||||
/******/ configurable: false,
|
||||
/******/ enumerable: true,
|
||||
/******/ get: getter
|
||||
/******/ });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = "./client/src/bundles/bundle.js");
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ "./client/src/boot/index.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
var _registerComponents = __webpack_require__("./client/src/boot/registerComponents.js");
|
||||
|
||||
var _registerComponents2 = _interopRequireDefault(_registerComponents);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
window.document.addEventListener('DOMContentLoaded', function () {
|
||||
(0, _registerComponents2.default)();
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./client/src/boot/registerComponents.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _Injector = __webpack_require__(0);
|
||||
|
||||
var _Injector2 = _interopRequireDefault(_Injector);
|
||||
|
||||
var _TagField = __webpack_require__("./client/src/components/TagField.js");
|
||||
|
||||
var _TagField2 = _interopRequireDefault(_TagField);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.default = function () {
|
||||
_Injector2.default.component.registerMany({
|
||||
TagField: _TagField2.default
|
||||
});
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./client/src/bundles/bundle.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
__webpack_require__("./client/src/legacy/entwine/TagField.js");
|
||||
__webpack_require__("./client/src/boot/index.js");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./client/src/components/TagField.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _react = __webpack_require__(1);
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _reactSelect = __webpack_require__(4);
|
||||
|
||||
var _reactSelect2 = _interopRequireDefault(_reactSelect);
|
||||
|
||||
var _isomorphicFetch = __webpack_require__(2);
|
||||
|
||||
var _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch);
|
||||
|
||||
var _url = __webpack_require__("./node_modules/url/url.js");
|
||||
|
||||
var _url2 = _interopRequireDefault(_url);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var TagField = function (_Component) {
|
||||
_inherits(TagField, _Component);
|
||||
|
||||
function TagField(props) {
|
||||
_classCallCheck(this, TagField);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (TagField.__proto__ || Object.getPrototypeOf(TagField)).call(this, props));
|
||||
|
||||
_this.state = {
|
||||
value: props.value
|
||||
};
|
||||
|
||||
_this.onChange = _this.onChange.bind(_this);
|
||||
_this.getOptions = _this.getOptions.bind(_this);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(TagField, [{
|
||||
key: 'onChange',
|
||||
value: function onChange(value) {
|
||||
this.setState({
|
||||
value: value
|
||||
});
|
||||
|
||||
if (typeof this.props.onChange === 'function') {
|
||||
this.props.onChange(value);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'getOptions',
|
||||
value: function getOptions(input) {
|
||||
var _props = this.props,
|
||||
lazyLoad = _props.lazyLoad,
|
||||
options = _props.options,
|
||||
optionUrl = _props.optionUrl,
|
||||
labelKey = _props.labelKey,
|
||||
valueKey = _props.valueKey;
|
||||
|
||||
|
||||
if (!lazyLoad) {
|
||||
return Promise.resolve({ options: options });
|
||||
}
|
||||
|
||||
if (!input) {
|
||||
return Promise.resolve({ options: [] });
|
||||
}
|
||||
|
||||
var fetchURL = _url2.default.parse(optionUrl, true);
|
||||
fetchURL.query.term = input;
|
||||
|
||||
return (0, _isomorphicFetch2.default)(_url2.default.format(fetchURL), { credentials: 'same-origin' }).then(function (response) {
|
||||
return response.json();
|
||||
}).then(function (json) {
|
||||
return {
|
||||
options: json.items.map(function (item) {
|
||||
var _ref;
|
||||
|
||||
return _ref = {}, _defineProperty(_ref, labelKey, item.id), _defineProperty(_ref, valueKey, item.text), _ref;
|
||||
})
|
||||
};
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'render',
|
||||
value: function render() {
|
||||
var _props2 = this.props,
|
||||
lazyLoad = _props2.lazyLoad,
|
||||
options = _props2.options,
|
||||
creatable = _props2.creatable,
|
||||
passThroughAttributes = _objectWithoutProperties(_props2, ['lazyLoad', 'options', 'creatable']);
|
||||
|
||||
var optionAttributes = lazyLoad ? { loadOptions: this.getOptions } : { options: options };
|
||||
|
||||
var SelectComponent = _reactSelect2.default;
|
||||
if (lazyLoad && creatable) {
|
||||
SelectComponent = _reactSelect2.default.AsyncCreatable;
|
||||
} else if (lazyLoad) {
|
||||
SelectComponent = _reactSelect2.default.Async;
|
||||
} else if (creatable) {
|
||||
SelectComponent = _reactSelect2.default.Creatable;
|
||||
}
|
||||
|
||||
passThroughAttributes.value = this.state.value;
|
||||
|
||||
return _react2.default.createElement(SelectComponent, _extends({}, passThroughAttributes, {
|
||||
onChange: this.onChange,
|
||||
inputProps: { className: 'no-change-track' }
|
||||
}, optionAttributes));
|
||||
}
|
||||
}]);
|
||||
|
||||
return TagField;
|
||||
}(_react.Component);
|
||||
|
||||
TagField.propTypes = {
|
||||
name: _react.PropTypes.string.isRequired,
|
||||
labelKey: _react.PropTypes.string.isRequired,
|
||||
valueKey: _react.PropTypes.string.isRequired,
|
||||
lazyLoad: _react.PropTypes.bool.isRequired,
|
||||
creatable: _react.PropTypes.bool.isRequired,
|
||||
multi: _react.PropTypes.bool.isRequired,
|
||||
disabled: _react.PropTypes.bool,
|
||||
options: _react.PropTypes.arrayOf(_react.PropTypes.object),
|
||||
optionUrl: _react.PropTypes.string,
|
||||
value: _react.PropTypes.any,
|
||||
onChange: _react.PropTypes.func,
|
||||
onBlur: _react.PropTypes.func
|
||||
};
|
||||
|
||||
TagField.defaultProps = {
|
||||
labelKey: 'Title',
|
||||
valueKey: 'Value',
|
||||
disabled: false
|
||||
};
|
||||
|
||||
exports.default = TagField;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./client/src/legacy/entwine/TagField.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
var _react = __webpack_require__(1);
|
||||
|
||||
var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _reactDom = __webpack_require__(3);
|
||||
|
||||
var _reactDom2 = _interopRequireDefault(_reactDom);
|
||||
|
||||
var _Injector = __webpack_require__(0);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
window.jQuery.entwine('ss', function ($) {
|
||||
$('.js-injector-boot .ss-tag-field').entwine({
|
||||
onmatch: function onmatch() {
|
||||
var _this = this;
|
||||
|
||||
var cmsContent = this.closest('.cms-content').attr('id');
|
||||
var context = cmsContent ? { context: cmsContent } : {};
|
||||
var TagField = (0, _Injector.loadComponent)('TagField', context);
|
||||
var dataSchema = _extends({}, this.data('schema'), {
|
||||
onBlur: function onBlur() {
|
||||
_this.parents('.cms-edit-form:first').trigger('change');
|
||||
}
|
||||
});
|
||||
|
||||
_reactDom2.default.render(_react2.default.createElement(TagField, dataSchema), this[0]);
|
||||
},
|
||||
onunmatch: function onunmatch() {
|
||||
_reactDom2.default.unmountComponentAtNode(this[0]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/punycode/punycode.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
|
||||
;(function(root) {
|
||||
|
||||
/** Detect free variables */
|
||||
var freeExports = typeof exports == 'object' && exports &&
|
||||
!exports.nodeType && exports;
|
||||
var freeModule = typeof module == 'object' && module &&
|
||||
!module.nodeType && module;
|
||||
var freeGlobal = typeof global == 'object' && global;
|
||||
if (
|
||||
freeGlobal.global === freeGlobal ||
|
||||
freeGlobal.window === freeGlobal ||
|
||||
freeGlobal.self === freeGlobal
|
||||
) {
|
||||
root = freeGlobal;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `punycode` object.
|
||||
* @name punycode
|
||||
* @type Object
|
||||
*/
|
||||
var punycode,
|
||||
|
||||
/** Highest positive signed 32-bit float value */
|
||||
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
||||
|
||||
/** Bootstring parameters */
|
||||
base = 36,
|
||||
tMin = 1,
|
||||
tMax = 26,
|
||||
skew = 38,
|
||||
damp = 700,
|
||||
initialBias = 72,
|
||||
initialN = 128, // 0x80
|
||||
delimiter = '-', // '\x2D'
|
||||
|
||||
/** Regular expressions */
|
||||
regexPunycode = /^xn--/,
|
||||
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
||||
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
||||
|
||||
/** Error messages */
|
||||
errors = {
|
||||
'overflow': 'Overflow: input needs wider integers to process',
|
||||
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
||||
'invalid-input': 'Invalid input'
|
||||
},
|
||||
|
||||
/** Convenience shortcuts */
|
||||
baseMinusTMin = base - tMin,
|
||||
floor = Math.floor,
|
||||
stringFromCharCode = String.fromCharCode,
|
||||
|
||||
/** Temporary variable */
|
||||
key;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* A generic error utility function.
|
||||
* @private
|
||||
* @param {String} type The error type.
|
||||
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
||||
*/
|
||||
function error(type) {
|
||||
throw new RangeError(errors[type]);
|
||||
}
|
||||
|
||||
/**
|
||||
* A generic `Array#map` utility function.
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} callback The function that gets called for every array
|
||||
* item.
|
||||
* @returns {Array} A new array of values returned by the callback function.
|
||||
*/
|
||||
function map(array, fn) {
|
||||
var length = array.length;
|
||||
var result = [];
|
||||
while (length--) {
|
||||
result[length] = fn(array[length]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
||||
* addresses.
|
||||
* @private
|
||||
* @param {String} domain The domain name or email address.
|
||||
* @param {Function} callback The function that gets called for every
|
||||
* character.
|
||||
* @returns {Array} A new string of characters returned by the callback
|
||||
* function.
|
||||
*/
|
||||
function mapDomain(string, fn) {
|
||||
var parts = string.split('@');
|
||||
var result = '';
|
||||
if (parts.length > 1) {
|
||||
// In email addresses, only the domain name should be punycoded. Leave
|
||||
// the local part (i.e. everything up to `@`) intact.
|
||||
result = parts[0] + '@';
|
||||
string = parts[1];
|
||||
}
|
||||
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
||||
string = string.replace(regexSeparators, '\x2E');
|
||||
var labels = string.split('.');
|
||||
var encoded = map(labels, fn).join('.');
|
||||
return result + encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array containing the numeric code points of each Unicode
|
||||
* character in the string. While JavaScript uses UCS-2 internally,
|
||||
* this function will convert a pair of surrogate halves (each of which
|
||||
* UCS-2 exposes as separate characters) into a single code point,
|
||||
* matching UTF-16.
|
||||
* @see `punycode.ucs2.encode`
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode.ucs2
|
||||
* @name decode
|
||||
* @param {String} string The Unicode input string (UCS-2).
|
||||
* @returns {Array} The new array of code points.
|
||||
*/
|
||||
function ucs2decode(string) {
|
||||
var output = [],
|
||||
counter = 0,
|
||||
length = string.length,
|
||||
value,
|
||||
extra;
|
||||
while (counter < length) {
|
||||
value = string.charCodeAt(counter++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
||||
// high surrogate, and there is a next character
|
||||
extra = string.charCodeAt(counter++);
|
||||
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
||||
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
||||
} else {
|
||||
// unmatched surrogate; only append this code unit, in case the next
|
||||
// code unit is the high surrogate of a surrogate pair
|
||||
output.push(value);
|
||||
counter--;
|
||||
}
|
||||
} else {
|
||||
output.push(value);
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string based on an array of numeric code points.
|
||||
* @see `punycode.ucs2.decode`
|
||||
* @memberOf punycode.ucs2
|
||||
* @name encode
|
||||
* @param {Array} codePoints The array of numeric code points.
|
||||
* @returns {String} The new Unicode string (UCS-2).
|
||||
*/
|
||||
function ucs2encode(array) {
|
||||
return map(array, function(value) {
|
||||
var output = '';
|
||||
if (value > 0xFFFF) {
|
||||
value -= 0x10000;
|
||||
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
||||
value = 0xDC00 | value & 0x3FF;
|
||||
}
|
||||
output += stringFromCharCode(value);
|
||||
return output;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a basic code point into a digit/integer.
|
||||
* @see `digitToBasic()`
|
||||
* @private
|
||||
* @param {Number} codePoint The basic numeric code point value.
|
||||
* @returns {Number} The numeric value of a basic code point (for use in
|
||||
* representing integers) in the range `0` to `base - 1`, or `base` if
|
||||
* the code point does not represent a value.
|
||||
*/
|
||||
function basicToDigit(codePoint) {
|
||||
if (codePoint - 48 < 10) {
|
||||
return codePoint - 22;
|
||||
}
|
||||
if (codePoint - 65 < 26) {
|
||||
return codePoint - 65;
|
||||
}
|
||||
if (codePoint - 97 < 26) {
|
||||
return codePoint - 97;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a digit/integer into a basic code point.
|
||||
* @see `basicToDigit()`
|
||||
* @private
|
||||
* @param {Number} digit The numeric value of a basic code point.
|
||||
* @returns {Number} The basic code point whose value (when used for
|
||||
* representing integers) is `digit`, which needs to be in the range
|
||||
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
||||
* used; else, the lowercase form is used. The behavior is undefined
|
||||
* if `flag` is non-zero and `digit` has no uppercase form.
|
||||
*/
|
||||
function digitToBasic(digit, flag) {
|
||||
// 0..25 map to ASCII a..z or A..Z
|
||||
// 26..35 map to ASCII 0..9
|
||||
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bias adaptation function as per section 3.4 of RFC 3492.
|
||||
* https://tools.ietf.org/html/rfc3492#section-3.4
|
||||
* @private
|
||||
*/
|
||||
function adapt(delta, numPoints, firstTime) {
|
||||
var k = 0;
|
||||
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
||||
delta += floor(delta / numPoints);
|
||||
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
||||
delta = floor(delta / baseMinusTMin);
|
||||
}
|
||||
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
||||
* symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycode string of ASCII-only symbols.
|
||||
* @returns {String} The resulting string of Unicode symbols.
|
||||
*/
|
||||
function decode(input) {
|
||||
// Don't use UCS-2
|
||||
var output = [],
|
||||
inputLength = input.length,
|
||||
out,
|
||||
i = 0,
|
||||
n = initialN,
|
||||
bias = initialBias,
|
||||
basic,
|
||||
j,
|
||||
index,
|
||||
oldi,
|
||||
w,
|
||||
k,
|
||||
digit,
|
||||
t,
|
||||
/** Cached calculation results */
|
||||
baseMinusT;
|
||||
|
||||
// Handle the basic code points: let `basic` be the number of input code
|
||||
// points before the last delimiter, or `0` if there is none, then copy
|
||||
// the first basic code points to the output.
|
||||
|
||||
basic = input.lastIndexOf(delimiter);
|
||||
if (basic < 0) {
|
||||
basic = 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < basic; ++j) {
|
||||
// if it's not a basic code point
|
||||
if (input.charCodeAt(j) >= 0x80) {
|
||||
error('not-basic');
|
||||
}
|
||||
output.push(input.charCodeAt(j));
|
||||
}
|
||||
|
||||
// Main decoding loop: start just after the last delimiter if any basic code
|
||||
// points were copied; start at the beginning otherwise.
|
||||
|
||||
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
||||
|
||||
// `index` is the index of the next character to be consumed.
|
||||
// Decode a generalized variable-length integer into `delta`,
|
||||
// which gets added to `i`. The overflow checking is easier
|
||||
// if we increase `i` as we go, then subtract off its starting
|
||||
// value at the end to obtain `delta`.
|
||||
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
||||
|
||||
if (index >= inputLength) {
|
||||
error('invalid-input');
|
||||
}
|
||||
|
||||
digit = basicToDigit(input.charCodeAt(index++));
|
||||
|
||||
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
i += digit * w;
|
||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
|
||||
if (digit < t) {
|
||||
break;
|
||||
}
|
||||
|
||||
baseMinusT = base - t;
|
||||
if (w > floor(maxInt / baseMinusT)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
w *= baseMinusT;
|
||||
|
||||
}
|
||||
|
||||
out = output.length + 1;
|
||||
bias = adapt(i - oldi, out, oldi == 0);
|
||||
|
||||
// `i` was supposed to wrap around from `out` to `0`,
|
||||
// incrementing `n` each time, so we'll fix that now:
|
||||
if (floor(i / out) > maxInt - n) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
n += floor(i / out);
|
||||
i %= out;
|
||||
|
||||
// Insert `n` at position `i` of the output
|
||||
output.splice(i++, 0, n);
|
||||
|
||||
}
|
||||
|
||||
return ucs2encode(output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
||||
* Punycode string of ASCII-only symbols.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The string of Unicode symbols.
|
||||
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
||||
*/
|
||||
function encode(input) {
|
||||
var n,
|
||||
delta,
|
||||
handledCPCount,
|
||||
basicLength,
|
||||
bias,
|
||||
j,
|
||||
m,
|
||||
q,
|
||||
k,
|
||||
t,
|
||||
currentValue,
|
||||
output = [],
|
||||
/** `inputLength` will hold the number of code points in `input`. */
|
||||
inputLength,
|
||||
/** Cached calculation results */
|
||||
handledCPCountPlusOne,
|
||||
baseMinusT,
|
||||
qMinusT;
|
||||
|
||||
// Convert the input in UCS-2 to Unicode
|
||||
input = ucs2decode(input);
|
||||
|
||||
// Cache the length
|
||||
inputLength = input.length;
|
||||
|
||||
// Initialize the state
|
||||
n = initialN;
|
||||
delta = 0;
|
||||
bias = initialBias;
|
||||
|
||||
// Handle the basic code points
|
||||
for (j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
if (currentValue < 0x80) {
|
||||
output.push(stringFromCharCode(currentValue));
|
||||
}
|
||||
}
|
||||
|
||||
handledCPCount = basicLength = output.length;
|
||||
|
||||
// `handledCPCount` is the number of code points that have been handled;
|
||||
// `basicLength` is the number of basic code points.
|
||||
|
||||
// Finish the basic string - if it is not empty - with a delimiter
|
||||
if (basicLength) {
|
||||
output.push(delimiter);
|
||||
}
|
||||
|
||||
// Main encoding loop:
|
||||
while (handledCPCount < inputLength) {
|
||||
|
||||
// All non-basic code points < n have been handled already. Find the next
|
||||
// larger one:
|
||||
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
if (currentValue >= n && currentValue < m) {
|
||||
m = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
||||
// but guard against overflow
|
||||
handledCPCountPlusOne = handledCPCount + 1;
|
||||
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
delta += (m - n) * handledCPCountPlusOne;
|
||||
n = m;
|
||||
|
||||
for (j = 0; j < inputLength; ++j) {
|
||||
currentValue = input[j];
|
||||
|
||||
if (currentValue < n && ++delta > maxInt) {
|
||||
error('overflow');
|
||||
}
|
||||
|
||||
if (currentValue == n) {
|
||||
// Represent delta as a generalized variable-length integer
|
||||
for (q = delta, k = base; /* no condition */; k += base) {
|
||||
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
||||
if (q < t) {
|
||||
break;
|
||||
}
|
||||
qMinusT = q - t;
|
||||
baseMinusT = base - t;
|
||||
output.push(
|
||||
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
||||
);
|
||||
q = floor(qMinusT / baseMinusT);
|
||||
}
|
||||
|
||||
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
||||
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
||||
delta = 0;
|
||||
++handledCPCount;
|
||||
}
|
||||
}
|
||||
|
||||
++delta;
|
||||
++n;
|
||||
|
||||
}
|
||||
return output.join('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Punycode string representing a domain name or an email address
|
||||
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
||||
* it doesn't matter if you call it on a string that has already been
|
||||
* converted to Unicode.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The Punycoded domain name or email address to
|
||||
* convert to Unicode.
|
||||
* @returns {String} The Unicode representation of the given Punycode
|
||||
* string.
|
||||
*/
|
||||
function toUnicode(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexPunycode.test(string)
|
||||
? decode(string.slice(4).toLowerCase())
|
||||
: string;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Unicode string representing a domain name or an email address to
|
||||
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
||||
* i.e. it doesn't matter if you call it with a domain that's already in
|
||||
* ASCII.
|
||||
* @memberOf punycode
|
||||
* @param {String} input The domain name or email address to convert, as a
|
||||
* Unicode string.
|
||||
* @returns {String} The Punycode representation of the given domain name or
|
||||
* email address.
|
||||
*/
|
||||
function toASCII(input) {
|
||||
return mapDomain(input, function(string) {
|
||||
return regexNonASCII.test(string)
|
||||
? 'xn--' + encode(string)
|
||||
: string;
|
||||
});
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/** Define the public API */
|
||||
punycode = {
|
||||
/**
|
||||
* A string representing the current Punycode.js version number.
|
||||
* @memberOf punycode
|
||||
* @type String
|
||||
*/
|
||||
'version': '1.4.1',
|
||||
/**
|
||||
* An object of methods to convert from JavaScript's internal character
|
||||
* representation (UCS-2) to Unicode code points, and back.
|
||||
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
||||
* @memberOf punycode
|
||||
* @type Object
|
||||
*/
|
||||
'ucs2': {
|
||||
'decode': ucs2decode,
|
||||
'encode': ucs2encode
|
||||
},
|
||||
'decode': decode,
|
||||
'encode': encode,
|
||||
'toASCII': toASCII,
|
||||
'toUnicode': toUnicode
|
||||
};
|
||||
|
||||
/** Expose `punycode` */
|
||||
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
||||
// like the following:
|
||||
if (
|
||||
true
|
||||
) {
|
||||
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
|
||||
return punycode;
|
||||
}.call(exports, __webpack_require__, exports, module),
|
||||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||||
} else if (freeExports && freeModule) {
|
||||
if (module.exports == freeExports) {
|
||||
// in Node.js, io.js, or RingoJS v0.8.0+
|
||||
freeModule.exports = punycode;
|
||||
} else {
|
||||
// in Narwhal or RingoJS v0.7.0-
|
||||
for (key in punycode) {
|
||||
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// in Rhino or a web browser
|
||||
root.punycode = punycode;
|
||||
}
|
||||
|
||||
}(this));
|
||||
|
||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("./node_modules/webpack/buildin/module.js")(module), __webpack_require__("./node_modules/webpack/buildin/global.js")))
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/querystring-es3/decode.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
// If obj.hasOwnProperty has been overridden, then calling
|
||||
// obj.hasOwnProperty(prop) will break.
|
||||
// See: https://github.com/joyent/node/issues/1707
|
||||
function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
||||
|
||||
module.exports = function(qs, sep, eq, options) {
|
||||
sep = sep || '&';
|
||||
eq = eq || '=';
|
||||
var obj = {};
|
||||
|
||||
if (typeof qs !== 'string' || qs.length === 0) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var regexp = /\+/g;
|
||||
qs = qs.split(sep);
|
||||
|
||||
var maxKeys = 1000;
|
||||
if (options && typeof options.maxKeys === 'number') {
|
||||
maxKeys = options.maxKeys;
|
||||
}
|
||||
|
||||
var len = qs.length;
|
||||
// maxKeys <= 0 means that we should not limit keys count
|
||||
if (maxKeys > 0 && len > maxKeys) {
|
||||
len = maxKeys;
|
||||
}
|
||||
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var x = qs[i].replace(regexp, '%20'),
|
||||
idx = x.indexOf(eq),
|
||||
kstr, vstr, k, v;
|
||||
|
||||
if (idx >= 0) {
|
||||
kstr = x.substr(0, idx);
|
||||
vstr = x.substr(idx + 1);
|
||||
} else {
|
||||
kstr = x;
|
||||
vstr = '';
|
||||
}
|
||||
|
||||
k = decodeURIComponent(kstr);
|
||||
v = decodeURIComponent(vstr);
|
||||
|
||||
if (!hasOwnProperty(obj, k)) {
|
||||
obj[k] = v;
|
||||
} else if (isArray(obj[k])) {
|
||||
obj[k].push(v);
|
||||
} else {
|
||||
obj[k] = [obj[k], v];
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
var isArray = Array.isArray || function (xs) {
|
||||
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/querystring-es3/encode.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
var stringifyPrimitive = function(v) {
|
||||
switch (typeof v) {
|
||||
case 'string':
|
||||
return v;
|
||||
|
||||
case 'boolean':
|
||||
return v ? 'true' : 'false';
|
||||
|
||||
case 'number':
|
||||
return isFinite(v) ? v : '';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function(obj, sep, eq, name) {
|
||||
sep = sep || '&';
|
||||
eq = eq || '=';
|
||||
if (obj === null) {
|
||||
obj = undefined;
|
||||
}
|
||||
|
||||
if (typeof obj === 'object') {
|
||||
return map(objectKeys(obj), function(k) {
|
||||
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
|
||||
if (isArray(obj[k])) {
|
||||
return map(obj[k], function(v) {
|
||||
return ks + encodeURIComponent(stringifyPrimitive(v));
|
||||
}).join(sep);
|
||||
} else {
|
||||
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
|
||||
}
|
||||
}).join(sep);
|
||||
|
||||
}
|
||||
|
||||
if (!name) return '';
|
||||
return encodeURIComponent(stringifyPrimitive(name)) + eq +
|
||||
encodeURIComponent(stringifyPrimitive(obj));
|
||||
};
|
||||
|
||||
var isArray = Array.isArray || function (xs) {
|
||||
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||
};
|
||||
|
||||
function map (xs, f) {
|
||||
if (xs.map) return xs.map(f);
|
||||
var res = [];
|
||||
for (var i = 0; i < xs.length; i++) {
|
||||
res.push(f(xs[i], i));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var res = [];
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/querystring-es3/index.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
exports.decode = exports.parse = __webpack_require__("./node_modules/querystring-es3/decode.js");
|
||||
exports.encode = exports.stringify = __webpack_require__("./node_modules/querystring-es3/encode.js");
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/url/url.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
|
||||
var punycode = __webpack_require__("./node_modules/punycode/punycode.js");
|
||||
var util = __webpack_require__("./node_modules/url/util.js");
|
||||
|
||||
exports.parse = urlParse;
|
||||
exports.resolve = urlResolve;
|
||||
exports.resolveObject = urlResolveObject;
|
||||
exports.format = urlFormat;
|
||||
|
||||
exports.Url = Url;
|
||||
|
||||
function Url() {
|
||||
this.protocol = null;
|
||||
this.slashes = null;
|
||||
this.auth = null;
|
||||
this.host = null;
|
||||
this.port = null;
|
||||
this.hostname = null;
|
||||
this.hash = null;
|
||||
this.search = null;
|
||||
this.query = null;
|
||||
this.pathname = null;
|
||||
this.path = null;
|
||||
this.href = null;
|
||||
}
|
||||
|
||||
// Reference: RFC 3986, RFC 1808, RFC 2396
|
||||
|
||||
// define these here so at least they only have to be
|
||||
// compiled once on the first module load.
|
||||
var protocolPattern = /^([a-z0-9.+-]+:)/i,
|
||||
portPattern = /:[0-9]*$/,
|
||||
|
||||
// Special case for a simple path URL
|
||||
simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
||||
|
||||
// RFC 2396: characters reserved for delimiting URLs.
|
||||
// We actually just auto-escape these.
|
||||
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
|
||||
|
||||
// RFC 2396: characters not allowed for various reasons.
|
||||
unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
|
||||
|
||||
// Allowed by RFCs, but cause of XSS attacks. Always escape these.
|
||||
autoEscape = ['\''].concat(unwise),
|
||||
// Characters that are never ever allowed in a hostname.
|
||||
// Note that any invalid chars are also handled, but these
|
||||
// are the ones that are *expected* to be seen, so we fast-path
|
||||
// them.
|
||||
nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
|
||||
hostEndingChars = ['/', '?', '#'],
|
||||
hostnameMaxLen = 255,
|
||||
hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
|
||||
hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
||||
// protocols that can allow "unsafe" and "unwise" chars.
|
||||
unsafeProtocol = {
|
||||
'javascript': true,
|
||||
'javascript:': true
|
||||
},
|
||||
// protocols that never have a hostname.
|
||||
hostlessProtocol = {
|
||||
'javascript': true,
|
||||
'javascript:': true
|
||||
},
|
||||
// protocols that always contain a // bit.
|
||||
slashedProtocol = {
|
||||
'http': true,
|
||||
'https': true,
|
||||
'ftp': true,
|
||||
'gopher': true,
|
||||
'file': true,
|
||||
'http:': true,
|
||||
'https:': true,
|
||||
'ftp:': true,
|
||||
'gopher:': true,
|
||||
'file:': true
|
||||
},
|
||||
querystring = __webpack_require__("./node_modules/querystring-es3/index.js");
|
||||
|
||||
function urlParse(url, parseQueryString, slashesDenoteHost) {
|
||||
if (url && util.isObject(url) && url instanceof Url) return url;
|
||||
|
||||
var u = new Url;
|
||||
u.parse(url, parseQueryString, slashesDenoteHost);
|
||||
return u;
|
||||
}
|
||||
|
||||
Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
||||
if (!util.isString(url)) {
|
||||
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
|
||||
}
|
||||
|
||||
// Copy chrome, IE, opera backslash-handling behavior.
|
||||
// Back slashes before the query string get converted to forward slashes
|
||||
// See: https://code.google.com/p/chromium/issues/detail?id=25916
|
||||
var queryIndex = url.indexOf('?'),
|
||||
splitter =
|
||||
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
|
||||
uSplit = url.split(splitter),
|
||||
slashRegex = /\\/g;
|
||||
uSplit[0] = uSplit[0].replace(slashRegex, '/');
|
||||
url = uSplit.join(splitter);
|
||||
|
||||
var rest = url;
|
||||
|
||||
// trim before proceeding.
|
||||
// This is to support parse stuff like " http://foo.com \n"
|
||||
rest = rest.trim();
|
||||
|
||||
if (!slashesDenoteHost && url.split('#').length === 1) {
|
||||
// Try fast path regexp
|
||||
var simplePath = simplePathPattern.exec(rest);
|
||||
if (simplePath) {
|
||||
this.path = rest;
|
||||
this.href = rest;
|
||||
this.pathname = simplePath[1];
|
||||
if (simplePath[2]) {
|
||||
this.search = simplePath[2];
|
||||
if (parseQueryString) {
|
||||
this.query = querystring.parse(this.search.substr(1));
|
||||
} else {
|
||||
this.query = this.search.substr(1);
|
||||
}
|
||||
} else if (parseQueryString) {
|
||||
this.search = '';
|
||||
this.query = {};
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
var proto = protocolPattern.exec(rest);
|
||||
if (proto) {
|
||||
proto = proto[0];
|
||||
var lowerProto = proto.toLowerCase();
|
||||
this.protocol = lowerProto;
|
||||
rest = rest.substr(proto.length);
|
||||
}
|
||||
|
||||
// figure out if it's got a host
|
||||
// user@server is *always* interpreted as a hostname, and url
|
||||
// resolution will treat //foo/bar as host=foo,path=bar because that's
|
||||
// how the browser resolves relative URLs.
|
||||
if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
||||
var slashes = rest.substr(0, 2) === '//';
|
||||
if (slashes && !(proto && hostlessProtocol[proto])) {
|
||||
rest = rest.substr(2);
|
||||
this.slashes = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hostlessProtocol[proto] &&
|
||||
(slashes || (proto && !slashedProtocol[proto]))) {
|
||||
|
||||
// there's a hostname.
|
||||
// the first instance of /, ?, ;, or # ends the host.
|
||||
//
|
||||
// If there is an @ in the hostname, then non-host chars *are* allowed
|
||||
// to the left of the last @ sign, unless some host-ending character
|
||||
// comes *before* the @-sign.
|
||||
// URLs are obnoxious.
|
||||
//
|
||||
// ex:
|
||||
// http://a@b@c/ => user:a@b host:c
|
||||
// http://a@b?@c => user:a host:c path:/?@c
|
||||
|
||||
// v0.12 TODO(isaacs): This is not quite how Chrome does things.
|
||||
// Review our test case against browsers more comprehensively.
|
||||
|
||||
// find the first instance of any hostEndingChars
|
||||
var hostEnd = -1;
|
||||
for (var i = 0; i < hostEndingChars.length; i++) {
|
||||
var hec = rest.indexOf(hostEndingChars[i]);
|
||||
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
||||
hostEnd = hec;
|
||||
}
|
||||
|
||||
// at this point, either we have an explicit point where the
|
||||
// auth portion cannot go past, or the last @ char is the decider.
|
||||
var auth, atSign;
|
||||
if (hostEnd === -1) {
|
||||
// atSign can be anywhere.
|
||||
atSign = rest.lastIndexOf('@');
|
||||
} else {
|
||||
// atSign must be in auth portion.
|
||||
// http://a@b/c@d => host:b auth:a path:/c@d
|
||||
atSign = rest.lastIndexOf('@', hostEnd);
|
||||
}
|
||||
|
||||
// Now we have a portion which is definitely the auth.
|
||||
// Pull that off.
|
||||
if (atSign !== -1) {
|
||||
auth = rest.slice(0, atSign);
|
||||
rest = rest.slice(atSign + 1);
|
||||
this.auth = decodeURIComponent(auth);
|
||||
}
|
||||
|
||||
// the host is the remaining to the left of the first non-host char
|
||||
hostEnd = -1;
|
||||
for (var i = 0; i < nonHostChars.length; i++) {
|
||||
var hec = rest.indexOf(nonHostChars[i]);
|
||||
if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
|
||||
hostEnd = hec;
|
||||
}
|
||||
// if we still have not hit it, then the entire thing is a host.
|
||||
if (hostEnd === -1)
|
||||
hostEnd = rest.length;
|
||||
|
||||
this.host = rest.slice(0, hostEnd);
|
||||
rest = rest.slice(hostEnd);
|
||||
|
||||
// pull out port.
|
||||
this.parseHost();
|
||||
|
||||
// we've indicated that there is a hostname,
|
||||
// so even if it's empty, it has to be present.
|
||||
this.hostname = this.hostname || '';
|
||||
|
||||
// if hostname begins with [ and ends with ]
|
||||
// assume that it's an IPv6 address.
|
||||
var ipv6Hostname = this.hostname[0] === '[' &&
|
||||
this.hostname[this.hostname.length - 1] === ']';
|
||||
|
||||
// validate a little.
|
||||
if (!ipv6Hostname) {
|
||||
var hostparts = this.hostname.split(/\./);
|
||||
for (var i = 0, l = hostparts.length; i < l; i++) {
|
||||
var part = hostparts[i];
|
||||
if (!part) continue;
|
||||
if (!part.match(hostnamePartPattern)) {
|
||||
var newpart = '';
|
||||
for (var j = 0, k = part.length; j < k; j++) {
|
||||
if (part.charCodeAt(j) > 127) {
|
||||
// we replace non-ASCII char with a temporary placeholder
|
||||
// we need this to make sure size of hostname is not
|
||||
// broken by replacing non-ASCII by nothing
|
||||
newpart += 'x';
|
||||
} else {
|
||||
newpart += part[j];
|
||||
}
|
||||
}
|
||||
// we test again with ASCII char only
|
||||
if (!newpart.match(hostnamePartPattern)) {
|
||||
var validParts = hostparts.slice(0, i);
|
||||
var notHost = hostparts.slice(i + 1);
|
||||
var bit = part.match(hostnamePartStart);
|
||||
if (bit) {
|
||||
validParts.push(bit[1]);
|
||||
notHost.unshift(bit[2]);
|
||||
}
|
||||
if (notHost.length) {
|
||||
rest = '/' + notHost.join('.') + rest;
|
||||
}
|
||||
this.hostname = validParts.join('.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hostname.length > hostnameMaxLen) {
|
||||
this.hostname = '';
|
||||
} else {
|
||||
// hostnames are always lower case.
|
||||
this.hostname = this.hostname.toLowerCase();
|
||||
}
|
||||
|
||||
if (!ipv6Hostname) {
|
||||
// IDNA Support: Returns a punycoded representation of "domain".
|
||||
// It only converts parts of the domain name that
|
||||
// have non-ASCII characters, i.e. it doesn't matter if
|
||||
// you call it with a domain that already is ASCII-only.
|
||||
this.hostname = punycode.toASCII(this.hostname);
|
||||
}
|
||||
|
||||
var p = this.port ? ':' + this.port : '';
|
||||
var h = this.hostname || '';
|
||||
this.host = h + p;
|
||||
this.href += this.host;
|
||||
|
||||
// strip [ and ] from the hostname
|
||||
// the host field still retains them, though
|
||||
if (ipv6Hostname) {
|
||||
this.hostname = this.hostname.substr(1, this.hostname.length - 2);
|
||||
if (rest[0] !== '/') {
|
||||
rest = '/' + rest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now rest is set to the post-host stuff.
|
||||
// chop off any delim chars.
|
||||
if (!unsafeProtocol[lowerProto]) {
|
||||
|
||||
// First, make 100% sure that any "autoEscape" chars get
|
||||
// escaped, even if encodeURIComponent doesn't think they
|
||||
// need to be.
|
||||
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
||||
var ae = autoEscape[i];
|
||||
if (rest.indexOf(ae) === -1)
|
||||
continue;
|
||||
var esc = encodeURIComponent(ae);
|
||||
if (esc === ae) {
|
||||
esc = escape(ae);
|
||||
}
|
||||
rest = rest.split(ae).join(esc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// chop off from the tail first.
|
||||
var hash = rest.indexOf('#');
|
||||
if (hash !== -1) {
|
||||
// got a fragment string.
|
||||
this.hash = rest.substr(hash);
|
||||
rest = rest.slice(0, hash);
|
||||
}
|
||||
var qm = rest.indexOf('?');
|
||||
if (qm !== -1) {
|
||||
this.search = rest.substr(qm);
|
||||
this.query = rest.substr(qm + 1);
|
||||
if (parseQueryString) {
|
||||
this.query = querystring.parse(this.query);
|
||||
}
|
||||
rest = rest.slice(0, qm);
|
||||
} else if (parseQueryString) {
|
||||
// no query string, but parseQueryString still requested
|
||||
this.search = '';
|
||||
this.query = {};
|
||||
}
|
||||
if (rest) this.pathname = rest;
|
||||
if (slashedProtocol[lowerProto] &&
|
||||
this.hostname && !this.pathname) {
|
||||
this.pathname = '/';
|
||||
}
|
||||
|
||||
//to support http.request
|
||||
if (this.pathname || this.search) {
|
||||
var p = this.pathname || '';
|
||||
var s = this.search || '';
|
||||
this.path = p + s;
|
||||
}
|
||||
|
||||
// finally, reconstruct the href based on what has been validated.
|
||||
this.href = this.format();
|
||||
return this;
|
||||
};
|
||||
|
||||
// format a parsed object into a url string
|
||||
function urlFormat(obj) {
|
||||
// ensure it's an object, and not a string url.
|
||||
// If it's an obj, this is a no-op.
|
||||
// this way, you can call url_format() on strings
|
||||
// to clean up potentially wonky urls.
|
||||
if (util.isString(obj)) obj = urlParse(obj);
|
||||
if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
|
||||
return obj.format();
|
||||
}
|
||||
|
||||
Url.prototype.format = function() {
|
||||
var auth = this.auth || '';
|
||||
if (auth) {
|
||||
auth = encodeURIComponent(auth);
|
||||
auth = auth.replace(/%3A/i, ':');
|
||||
auth += '@';
|
||||
}
|
||||
|
||||
var protocol = this.protocol || '',
|
||||
pathname = this.pathname || '',
|
||||
hash = this.hash || '',
|
||||
host = false,
|
||||
query = '';
|
||||
|
||||
if (this.host) {
|
||||
host = auth + this.host;
|
||||
} else if (this.hostname) {
|
||||
host = auth + (this.hostname.indexOf(':') === -1 ?
|
||||
this.hostname :
|
||||
'[' + this.hostname + ']');
|
||||
if (this.port) {
|
||||
host += ':' + this.port;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.query &&
|
||||
util.isObject(this.query) &&
|
||||
Object.keys(this.query).length) {
|
||||
query = querystring.stringify(this.query);
|
||||
}
|
||||
|
||||
var search = this.search || (query && ('?' + query)) || '';
|
||||
|
||||
if (protocol && protocol.substr(-1) !== ':') protocol += ':';
|
||||
|
||||
// only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
|
||||
// unless they had them to begin with.
|
||||
if (this.slashes ||
|
||||
(!protocol || slashedProtocol[protocol]) && host !== false) {
|
||||
host = '//' + (host || '');
|
||||
if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
|
||||
} else if (!host) {
|
||||
host = '';
|
||||
}
|
||||
|
||||
if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
|
||||
if (search && search.charAt(0) !== '?') search = '?' + search;
|
||||
|
||||
pathname = pathname.replace(/[?#]/g, function(match) {
|
||||
return encodeURIComponent(match);
|
||||
});
|
||||
search = search.replace('#', '%23');
|
||||
|
||||
return protocol + host + pathname + search + hash;
|
||||
};
|
||||
|
||||
function urlResolve(source, relative) {
|
||||
return urlParse(source, false, true).resolve(relative);
|
||||
}
|
||||
|
||||
Url.prototype.resolve = function(relative) {
|
||||
return this.resolveObject(urlParse(relative, false, true)).format();
|
||||
};
|
||||
|
||||
function urlResolveObject(source, relative) {
|
||||
if (!source) return relative;
|
||||
return urlParse(source, false, true).resolveObject(relative);
|
||||
}
|
||||
|
||||
Url.prototype.resolveObject = function(relative) {
|
||||
if (util.isString(relative)) {
|
||||
var rel = new Url();
|
||||
rel.parse(relative, false, true);
|
||||
relative = rel;
|
||||
}
|
||||
|
||||
var result = new Url();
|
||||
var tkeys = Object.keys(this);
|
||||
for (var tk = 0; tk < tkeys.length; tk++) {
|
||||
var tkey = tkeys[tk];
|
||||
result[tkey] = this[tkey];
|
||||
}
|
||||
|
||||
// hash is always overridden, no matter what.
|
||||
// even href="" will remove it.
|
||||
result.hash = relative.hash;
|
||||
|
||||
// if the relative url is empty, then there's nothing left to do here.
|
||||
if (relative.href === '') {
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
// hrefs like //foo/bar always cut to the protocol.
|
||||
if (relative.slashes && !relative.protocol) {
|
||||
// take everything except the protocol from relative
|
||||
var rkeys = Object.keys(relative);
|
||||
for (var rk = 0; rk < rkeys.length; rk++) {
|
||||
var rkey = rkeys[rk];
|
||||
if (rkey !== 'protocol')
|
||||
result[rkey] = relative[rkey];
|
||||
}
|
||||
|
||||
//urlParse appends trailing / to urls like http://www.example.com
|
||||
if (slashedProtocol[result.protocol] &&
|
||||
result.hostname && !result.pathname) {
|
||||
result.path = result.pathname = '/';
|
||||
}
|
||||
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
if (relative.protocol && relative.protocol !== result.protocol) {
|
||||
// if it's a known url protocol, then changing
|
||||
// the protocol does weird things
|
||||
// first, if it's not file:, then we MUST have a host,
|
||||
// and if there was a path
|
||||
// to begin with, then we MUST have a path.
|
||||
// if it is file:, then the host is dropped,
|
||||
// because that's known to be hostless.
|
||||
// anything else is assumed to be absolute.
|
||||
if (!slashedProtocol[relative.protocol]) {
|
||||
var keys = Object.keys(relative);
|
||||
for (var v = 0; v < keys.length; v++) {
|
||||
var k = keys[v];
|
||||
result[k] = relative[k];
|
||||
}
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
result.protocol = relative.protocol;
|
||||
if (!relative.host && !hostlessProtocol[relative.protocol]) {
|
||||
var relPath = (relative.pathname || '').split('/');
|
||||
while (relPath.length && !(relative.host = relPath.shift()));
|
||||
if (!relative.host) relative.host = '';
|
||||
if (!relative.hostname) relative.hostname = '';
|
||||
if (relPath[0] !== '') relPath.unshift('');
|
||||
if (relPath.length < 2) relPath.unshift('');
|
||||
result.pathname = relPath.join('/');
|
||||
} else {
|
||||
result.pathname = relative.pathname;
|
||||
}
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
result.host = relative.host || '';
|
||||
result.auth = relative.auth;
|
||||
result.hostname = relative.hostname || relative.host;
|
||||
result.port = relative.port;
|
||||
// to support http.request
|
||||
if (result.pathname || result.search) {
|
||||
var p = result.pathname || '';
|
||||
var s = result.search || '';
|
||||
result.path = p + s;
|
||||
}
|
||||
result.slashes = result.slashes || relative.slashes;
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
|
||||
isRelAbs = (
|
||||
relative.host ||
|
||||
relative.pathname && relative.pathname.charAt(0) === '/'
|
||||
),
|
||||
mustEndAbs = (isRelAbs || isSourceAbs ||
|
||||
(result.host && relative.pathname)),
|
||||
removeAllDots = mustEndAbs,
|
||||
srcPath = result.pathname && result.pathname.split('/') || [],
|
||||
relPath = relative.pathname && relative.pathname.split('/') || [],
|
||||
psychotic = result.protocol && !slashedProtocol[result.protocol];
|
||||
|
||||
// if the url is a non-slashed url, then relative
|
||||
// links like ../.. should be able
|
||||
// to crawl up to the hostname, as well. This is strange.
|
||||
// result.protocol has already been set by now.
|
||||
// Later on, put the first path part into the host field.
|
||||
if (psychotic) {
|
||||
result.hostname = '';
|
||||
result.port = null;
|
||||
if (result.host) {
|
||||
if (srcPath[0] === '') srcPath[0] = result.host;
|
||||
else srcPath.unshift(result.host);
|
||||
}
|
||||
result.host = '';
|
||||
if (relative.protocol) {
|
||||
relative.hostname = null;
|
||||
relative.port = null;
|
||||
if (relative.host) {
|
||||
if (relPath[0] === '') relPath[0] = relative.host;
|
||||
else relPath.unshift(relative.host);
|
||||
}
|
||||
relative.host = null;
|
||||
}
|
||||
mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
|
||||
}
|
||||
|
||||
if (isRelAbs) {
|
||||
// it's absolute.
|
||||
result.host = (relative.host || relative.host === '') ?
|
||||
relative.host : result.host;
|
||||
result.hostname = (relative.hostname || relative.hostname === '') ?
|
||||
relative.hostname : result.hostname;
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
srcPath = relPath;
|
||||
// fall through to the dot-handling below.
|
||||
} else if (relPath.length) {
|
||||
// it's relative
|
||||
// throw away the existing file, and take the new path instead.
|
||||
if (!srcPath) srcPath = [];
|
||||
srcPath.pop();
|
||||
srcPath = srcPath.concat(relPath);
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
} else if (!util.isNullOrUndefined(relative.search)) {
|
||||
// just pull out the search.
|
||||
// like href='?foo'.
|
||||
// Put this after the other two cases because it simplifies the booleans
|
||||
if (psychotic) {
|
||||
result.hostname = result.host = srcPath.shift();
|
||||
//occationaly the auth can get stuck only in host
|
||||
//this especially happens in cases like
|
||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||||
result.host.split('@') : false;
|
||||
if (authInHost) {
|
||||
result.auth = authInHost.shift();
|
||||
result.host = result.hostname = authInHost.shift();
|
||||
}
|
||||
}
|
||||
result.search = relative.search;
|
||||
result.query = relative.query;
|
||||
//to support http.request
|
||||
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
||||
result.path = (result.pathname ? result.pathname : '') +
|
||||
(result.search ? result.search : '');
|
||||
}
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!srcPath.length) {
|
||||
// no path at all. easy.
|
||||
// we've already handled the other stuff above.
|
||||
result.pathname = null;
|
||||
//to support http.request
|
||||
if (result.search) {
|
||||
result.path = '/' + result.search;
|
||||
} else {
|
||||
result.path = null;
|
||||
}
|
||||
result.href = result.format();
|
||||
return result;
|
||||
}
|
||||
|
||||
// if a url ENDs in . or .., then it must get a trailing slash.
|
||||
// however, if it ends in anything else non-slashy,
|
||||
// then it must NOT get a trailing slash.
|
||||
var last = srcPath.slice(-1)[0];
|
||||
var hasTrailingSlash = (
|
||||
(result.host || relative.host || srcPath.length > 1) &&
|
||||
(last === '.' || last === '..') || last === '');
|
||||
|
||||
// strip single dots, resolve double dots to parent dir
|
||||
// if the path tries to go above the root, `up` ends up > 0
|
||||
var up = 0;
|
||||
for (var i = srcPath.length; i >= 0; i--) {
|
||||
last = srcPath[i];
|
||||
if (last === '.') {
|
||||
srcPath.splice(i, 1);
|
||||
} else if (last === '..') {
|
||||
srcPath.splice(i, 1);
|
||||
up++;
|
||||
} else if (up) {
|
||||
srcPath.splice(i, 1);
|
||||
up--;
|
||||
}
|
||||
}
|
||||
|
||||
// if the path is allowed to go above the root, restore leading ..s
|
||||
if (!mustEndAbs && !removeAllDots) {
|
||||
for (; up--; up) {
|
||||
srcPath.unshift('..');
|
||||
}
|
||||
}
|
||||
|
||||
if (mustEndAbs && srcPath[0] !== '' &&
|
||||
(!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
|
||||
srcPath.unshift('');
|
||||
}
|
||||
|
||||
if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
|
||||
srcPath.push('');
|
||||
}
|
||||
|
||||
var isAbsolute = srcPath[0] === '' ||
|
||||
(srcPath[0] && srcPath[0].charAt(0) === '/');
|
||||
|
||||
// put the host back
|
||||
if (psychotic) {
|
||||
result.hostname = result.host = isAbsolute ? '' :
|
||||
srcPath.length ? srcPath.shift() : '';
|
||||
//occationaly the auth can get stuck only in host
|
||||
//this especially happens in cases like
|
||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||
var authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||||
result.host.split('@') : false;
|
||||
if (authInHost) {
|
||||
result.auth = authInHost.shift();
|
||||
result.host = result.hostname = authInHost.shift();
|
||||
}
|
||||
}
|
||||
|
||||
mustEndAbs = mustEndAbs || (result.host && srcPath.length);
|
||||
|
||||
if (mustEndAbs && !isAbsolute) {
|
||||
srcPath.unshift('');
|
||||
}
|
||||
|
||||
if (!srcPath.length) {
|
||||
result.pathname = null;
|
||||
result.path = null;
|
||||
} else {
|
||||
result.pathname = srcPath.join('/');
|
||||
}
|
||||
|
||||
//to support request.http
|
||||
if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
|
||||
result.path = (result.pathname ? result.pathname : '') +
|
||||
(result.search ? result.search : '');
|
||||
}
|
||||
result.auth = relative.auth || result.auth;
|
||||
result.slashes = result.slashes || relative.slashes;
|
||||
result.href = result.format();
|
||||
return result;
|
||||
};
|
||||
|
||||
Url.prototype.parseHost = function() {
|
||||
var host = this.host;
|
||||
var port = portPattern.exec(host);
|
||||
if (port) {
|
||||
port = port[0];
|
||||
if (port !== ':') {
|
||||
this.port = port.substr(1);
|
||||
}
|
||||
host = host.substr(0, host.length - port.length);
|
||||
}
|
||||
if (host) this.hostname = host;
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/url/util.js":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
module.exports = {
|
||||
isString: function(arg) {
|
||||
return typeof(arg) === 'string';
|
||||
},
|
||||
isObject: function(arg) {
|
||||
return typeof(arg) === 'object' && arg !== null;
|
||||
},
|
||||
isNull: function(arg) {
|
||||
return arg === null;
|
||||
},
|
||||
isNullOrUndefined: function(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/webpack/buildin/global.js":
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var g;
|
||||
|
||||
// This works in non-strict mode
|
||||
g = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
try {
|
||||
// This works if eval is allowed (see CSP)
|
||||
g = g || Function("return this")() || (1,eval)("this");
|
||||
} catch(e) {
|
||||
// This works if the window reference is available
|
||||
if(typeof window === "object")
|
||||
g = window;
|
||||
}
|
||||
|
||||
// g can still be undefined, but nothing to do about it...
|
||||
// We return undefined, instead of nothing here, so it's
|
||||
// easier to handle this case. if(!global) { ...}
|
||||
|
||||
module.exports = g;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./node_modules/webpack/buildin/module.js":
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(module) {
|
||||
if(!module.webpackPolyfill) {
|
||||
module.deprecate = function() {};
|
||||
module.paths = [];
|
||||
// module.parent = undefined by default
|
||||
if(!module.children) module.children = [];
|
||||
Object.defineProperty(module, "loaded", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return module.l;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(module, "id", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return module.i;
|
||||
}
|
||||
});
|
||||
module.webpackPolyfill = 1;
|
||||
}
|
||||
return module;
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 0:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = Injector;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = React;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = IsomorphicFetch;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = ReactDom;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4:
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = ReactSelect;
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
//# sourceMappingURL=bundle.js.map
|
3
client/dist/styles/bundle.css
vendored
3
client/dist/styles/bundle.css
vendored
@ -1 +1,2 @@
|
||||
.Select{position:relative}.Select input::-webkit-contacts-auto-fill-button,.Select input::-webkit-credentials-auto-fill-button{display:none!important}.Select input::-ms-clear,.Select input::-ms-reveal{display:none!important}.Select,.Select div,.Select input,.Select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.Select.is-disabled .Select-arrow-zone{cursor:default;pointer-events:none;opacity:.35}.Select.is-disabled>.Select-control{background-color:#f9f9f9}.Select.is-disabled>.Select-control:hover{box-shadow:none}.Select.is-open>.Select-control{border-bottom-right-radius:0;border-bottom-left-radius:0;background:#fff;border-color:#b3b3b3 #ccc #d9d9d9}.Select.is-open>.Select-control .Select-arrow{top:-2px;border-color:transparent transparent #999;border-width:0 5px 5px}.Select.is-searchable.is-focused:not(.is-open)>.Select-control,.Select.is-searchable.is-open>.Select-control{cursor:text}.Select.is-focused>.Select-control{background:#fff}.Select.is-focused:not(.is-open)>.Select-control{border-color:#007eff;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 0 3px rgba(0,126,255,.1);background:#fff}.Select.has-value.is-clearable.Select--single>.Select-control .Select-value{padding-right:42px}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value .Select-value-label,.Select.has-value.Select--single>.Select-control .Select-value .Select-value-label{color:#333}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label{cursor:pointer;text-decoration:none}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label:focus,.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label:hover,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label:focus,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label:hover{color:#007eff;outline:none;text-decoration:underline}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label:focus,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label:focus{background:#fff}.Select.has-value.is-pseudo-focused .Select-input{opacity:0}.Select.is-open .Select-arrow,.Select .Select-arrow-zone:hover>.Select-arrow{border-top-color:#666}.Select.Select--rtl{direction:rtl;text-align:right}.Select-control{background-color:#fff;border-color:#d9d9d9 #ccc #b3b3b3;border-radius:4px;border:1px solid #ccc;color:#333;cursor:default;display:table;border-spacing:0;border-collapse:separate;height:36px;outline:none;overflow:hidden;position:relative;width:100%}.Select-control:hover{box-shadow:0 1px 0 rgba(0,0,0,.06)}.Select-control .Select-input:focus{outline:none;background:#fff}.Select--single>.Select-control .Select-value,.Select-placeholder{bottom:0;color:#aaa;left:0;line-height:34px;padding-left:10px;padding-right:10px;position:absolute;right:0;top:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Select-input{height:34px;padding-left:10px;padding-right:10px;vertical-align:middle}.Select-input>input{width:100%;background:none transparent;border:0 none;box-shadow:none;cursor:default;display:inline-block;font-family:inherit;font-size:inherit;margin:0;outline:none;line-height:17px;padding:8px 0 12px;-webkit-appearance:none}.is-focused .Select-input>input{cursor:text}.has-value.is-pseudo-focused .Select-input{opacity:0}.Select-control:not(.is-searchable)>.Select-input{outline:none}.Select-loading-zone{cursor:pointer;display:table-cell;text-align:center}.Select-loading,.Select-loading-zone{position:relative;vertical-align:middle;width:16px}.Select-loading{-webkit-animation:Select-animation-spin .4s infinite linear;-o-animation:Select-animation-spin .4s infinite linear;animation:Select-animation-spin .4s infinite linear;height:16px;box-sizing:border-box;border-radius:50%;border:2px solid #ccc;border-right-color:#333;display:inline-block}.Select-clear-zone{-webkit-animation:Select-animation-fadeIn .2s;-o-animation:Select-animation-fadeIn .2s;animation:Select-animation-fadeIn .2s;color:#999;cursor:pointer;display:table-cell;position:relative;text-align:center;vertical-align:middle;width:17px}.Select-clear-zone:hover{color:#d0021b}.Select-clear{display:inline-block;font-size:18px;line-height:1}.Select--multi .Select-clear-zone{width:17px}.Select-arrow-zone{cursor:pointer;display:table-cell;position:relative;text-align:center;vertical-align:middle;width:25px;padding-right:5px}.Select--rtl .Select-arrow-zone{padding-right:0;padding-left:5px}.Select-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 2.5px;display:inline-block;height:0;width:0;position:relative}.Select-control>:last-child{padding-right:5px}.Select--multi .Select-multi-value-wrapper{display:inline-block}.Select .Select-aria-only{position:absolute;display:inline-block;height:1px;width:1px;margin:-1px;clip:rect(0,0,0,0);overflow:hidden;float:left}@-webkit-keyframes Select-animation-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes Select-animation-fadeIn{0%{opacity:0}to{opacity:1}}.Select-menu-outer{border-bottom-right-radius:4px;border-bottom-left-radius:4px;background-color:#fff;border:1px solid #ccc;border-top-color:#e6e6e6;box-shadow:0 1px 0 rgba(0,0,0,.06);box-sizing:border-box;margin-top:-1px;max-height:200px;position:absolute;left:0;top:100%;width:100%;z-index:1;-webkit-overflow-scrolling:touch}.Select-menu{max-height:198px;overflow-y:auto}.Select-option{box-sizing:border-box;background-color:#fff;color:#666;cursor:pointer;display:block;padding:8px 10px}.Select-option:last-child{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.Select-option.is-selected{background-color:#f5faff;background-color:rgba(0,126,255,.04);color:#333}.Select-option.is-focused{background-color:#ebf5ff;background-color:rgba(0,126,255,.08);color:#333}.Select-option.is-disabled{color:#ccc;cursor:default}.Select-noresults{box-sizing:border-box;color:#999;cursor:default;display:block;padding:8px 10px}.Select--multi .Select-input{vertical-align:middle;margin-left:10px;padding:0}.Select--multi.Select--rtl .Select-input{margin-left:0;margin-right:10px}.Select--multi.has-value .Select-input{margin-left:5px}.Select--multi .Select-value{background-color:#ebf5ff;background-color:rgba(0,126,255,.08);border-radius:2px;border:1px solid #c2e0ff;border:1px solid rgba(0,126,255,.24);color:#007eff;display:inline-block;font-size:.9em;line-height:1.4;margin-left:5px;margin-top:5px;vertical-align:top}.Select--multi .Select-value-icon,.Select--multi .Select-value-label{display:inline-block;vertical-align:middle}.Select--multi .Select-value-label{border-bottom-right-radius:2px;border-top-right-radius:2px;cursor:default;padding:2px 5px}.Select--multi a.Select-value-label{color:#007eff;cursor:pointer;text-decoration:none}.Select--multi a.Select-value-label:hover{text-decoration:underline}.Select--multi .Select-value-icon{cursor:pointer;border-bottom-left-radius:2px;border-top-left-radius:2px;border-right:1px solid #c2e0ff;border-right:1px solid rgba(0,126,255,.24);padding:1px 5px 3px}.Select--multi .Select-value-icon:focus,.Select--multi .Select-value-icon:hover{background-color:#d8eafd;background-color:rgba(0,113,230,.08);color:#0071e6}.Select--multi .Select-value-icon:active{background-color:#c2e0ff;background-color:rgba(0,126,255,.24)}.Select--multi.Select--rtl .Select-value{margin-left:0;margin-right:5px}.Select--multi.Select--rtl .Select-value-icon{border-right:none;border-left:1px solid #c2e0ff;border-left:1px solid rgba(0,126,255,.24)}.Select--multi.is-disabled .Select-value{background-color:#fcfcfc;border:1px solid #e3e3e3;color:#333}.Select--multi.is-disabled .Select-value-icon{cursor:not-allowed;border-right:1px solid #e3e3e3}.Select--multi.is-disabled .Select-value-icon:active,.Select--multi.is-disabled .Select-value-icon:focus,.Select--multi.is-disabled .Select-value-icon:hover{background-color:#fcfcfc}@keyframes Select-animation-spin{to{transform:rotate(1turn)}}@-webkit-keyframes Select-animation-spin{to{-webkit-transform:rotate(1turn)}}.ss-tag-field .Select--multi .Select-value{margin-top:3px}
|
||||
.Select{position:relative}.Select input::-webkit-contacts-auto-fill-button,.Select input::-webkit-credentials-auto-fill-button{display:none!important}.Select input::-ms-clear,.Select input::-ms-reveal{display:none!important}.Select,.Select div,.Select input,.Select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.Select.is-disabled .Select-arrow-zone{cursor:default;pointer-events:none;opacity:.35}.Select.is-disabled>.Select-control{background-color:#f9f9f9}.Select.is-disabled>.Select-control:hover{box-shadow:none}.Select.is-open>.Select-control{border-bottom-right-radius:0;border-bottom-left-radius:0;background:#fff;border-color:#b3b3b3 #ccc #d9d9d9}.Select.is-open>.Select-control .Select-arrow{top:-2px;border-color:transparent transparent #999;border-width:0 5px 5px}.Select.is-searchable.is-focused:not(.is-open)>.Select-control,.Select.is-searchable.is-open>.Select-control{cursor:text}.Select.is-focused>.Select-control{background:#fff}.Select.is-focused:not(.is-open)>.Select-control{border-color:#007eff;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 0 3px rgba(0,126,255,.1);background:#fff}.Select.has-value.is-clearable.Select--single>.Select-control .Select-value{padding-right:42px}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value .Select-value-label,.Select.has-value.Select--single>.Select-control .Select-value .Select-value-label{color:#333}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label{cursor:pointer;text-decoration:none}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label:focus,.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label:hover,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label:focus,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label:hover{color:#007eff;outline:none;text-decoration:underline}.Select.has-value.is-pseudo-focused.Select--single>.Select-control .Select-value a.Select-value-label:focus,.Select.has-value.Select--single>.Select-control .Select-value a.Select-value-label:focus{background:#fff}.Select.has-value.is-pseudo-focused .Select-input{opacity:0}.Select.is-open .Select-arrow,.Select .Select-arrow-zone:hover>.Select-arrow{border-top-color:#666}.Select.Select--rtl{direction:rtl;text-align:right}.Select-control{background-color:#fff;border-color:#d9d9d9 #ccc #b3b3b3;border-radius:4px;border:1px solid #ccc;color:#333;cursor:default;display:table;border-spacing:0;border-collapse:separate;height:36px;outline:none;overflow:hidden;position:relative;width:100%}.Select-control:hover{box-shadow:0 1px 0 rgba(0,0,0,.06)}.Select-control .Select-input:focus{outline:none;background:#fff}.Select--single>.Select-control .Select-value,.Select-placeholder{bottom:0;color:#aaa;left:0;line-height:34px;padding-left:10px;padding-right:10px;position:absolute;right:0;top:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.Select-input{height:34px;padding-left:10px;padding-right:10px;vertical-align:middle}.Select-input>input{width:100%;background:none transparent;border:0 none;box-shadow:none;cursor:default;display:inline-block;font-family:inherit;font-size:inherit;margin:0;outline:none;line-height:17px;padding:8px 0 12px;-webkit-appearance:none}.is-focused .Select-input>input{cursor:text}.has-value.is-pseudo-focused .Select-input{opacity:0}.Select-control:not(.is-searchable)>.Select-input{outline:none}.Select-loading-zone{cursor:pointer;display:table-cell;text-align:center}.Select-loading,.Select-loading-zone{position:relative;vertical-align:middle;width:16px}.Select-loading{-webkit-animation:Select-animation-spin .4s infinite linear;-o-animation:Select-animation-spin .4s infinite linear;animation:Select-animation-spin .4s infinite linear;height:16px;box-sizing:border-box;border-radius:50%;border:2px solid #ccc;border-right-color:#333;display:inline-block}.Select-clear-zone{-webkit-animation:Select-animation-fadeIn .2s;-o-animation:Select-animation-fadeIn .2s;animation:Select-animation-fadeIn .2s;color:#999;cursor:pointer;display:table-cell;position:relative;text-align:center;vertical-align:middle;width:17px}.Select-clear-zone:hover{color:#d0021b}.Select-clear{display:inline-block;font-size:18px;line-height:1}.Select--multi .Select-clear-zone{width:17px}.Select-arrow-zone{cursor:pointer;display:table-cell;position:relative;text-align:center;vertical-align:middle;width:25px;padding-right:5px}.Select--rtl .Select-arrow-zone{padding-right:0;padding-left:5px}.Select-arrow{border-color:#999 transparent transparent;border-style:solid;border-width:5px 5px 2.5px;display:inline-block;height:0;width:0;position:relative}.Select-control>:last-child{padding-right:5px}.Select--multi .Select-multi-value-wrapper{display:inline-block}.Select .Select-aria-only{position:absolute;display:inline-block;height:1px;width:1px;margin:-1px;clip:rect(0,0,0,0);overflow:hidden;float:left}@-webkit-keyframes Select-animation-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes Select-animation-fadeIn{0%{opacity:0}to{opacity:1}}.Select-menu-outer{border-bottom-right-radius:4px;border-bottom-left-radius:4px;background-color:#fff;border:1px solid #ccc;border-top-color:#e6e6e6;box-shadow:0 1px 0 rgba(0,0,0,.06);box-sizing:border-box;margin-top:-1px;max-height:200px;position:absolute;left:0;top:100%;width:100%;z-index:1;-webkit-overflow-scrolling:touch}.Select-menu{max-height:198px;overflow-y:auto}.Select-option{box-sizing:border-box;background-color:#fff;color:#666;cursor:pointer;display:block;padding:8px 10px}.Select-option:last-child{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.Select-option.is-selected{background-color:#f5faff;background-color:rgba(0,126,255,.04);color:#333}.Select-option.is-focused{background-color:#ebf5ff;background-color:rgba(0,126,255,.08);color:#333}.Select-option.is-disabled{color:#ccc;cursor:default}.Select-noresults{box-sizing:border-box;color:#999;cursor:default;display:block;padding:8px 10px}.Select--multi .Select-input{vertical-align:middle;margin-left:10px;padding:0}.Select--multi.Select--rtl .Select-input{margin-left:0;margin-right:10px}.Select--multi.has-value .Select-input{margin-left:5px}.Select--multi .Select-value{background-color:#ebf5ff;background-color:rgba(0,126,255,.08);border-radius:2px;border:1px solid #c2e0ff;border:1px solid rgba(0,126,255,.24);color:#007eff;display:inline-block;font-size:.9em;line-height:1.4;margin-left:5px;margin-top:5px;vertical-align:top}.Select--multi .Select-value-icon,.Select--multi .Select-value-label{display:inline-block;vertical-align:middle}.Select--multi .Select-value-label{border-bottom-right-radius:2px;border-top-right-radius:2px;cursor:default;padding:2px 5px}.Select--multi a.Select-value-label{color:#007eff;cursor:pointer;text-decoration:none}.Select--multi a.Select-value-label:hover{text-decoration:underline}.Select--multi .Select-value-icon{cursor:pointer;border-bottom-left-radius:2px;border-top-left-radius:2px;border-right:1px solid #c2e0ff;border-right:1px solid rgba(0,126,255,.24);padding:1px 5px 3px}.Select--multi .Select-value-icon:focus,.Select--multi .Select-value-icon:hover{background-color:#d8eafd;background-color:rgba(0,113,230,.08);color:#0071e6}.Select--multi .Select-value-icon:active{background-color:#c2e0ff;background-color:rgba(0,126,255,.24)}.Select--multi.Select--rtl .Select-value{margin-left:0;margin-right:5px}.Select--multi.Select--rtl .Select-value-icon{border-right:none;border-left:1px solid #c2e0ff;border-left:1px solid rgba(0,126,255,.24)}.Select--multi.is-disabled .Select-value{background-color:#fcfcfc;border:1px solid #e3e3e3;color:#333}.Select--multi.is-disabled .Select-value-icon{cursor:not-allowed;border-right:1px solid #e3e3e3}.Select--multi.is-disabled .Select-value-icon:active,.Select--multi.is-disabled .Select-value-icon:focus,.Select--multi.is-disabled .Select-value-icon:hover{background-color:#fcfcfc}@keyframes Select-animation-spin{to{transform:rotate(1turn)}}@-webkit-keyframes Select-animation-spin{to{-webkit-transform:rotate(1turn)}}.ss-tag-field .Select--multi .Select-value{margin-top:3px}
|
||||
/*# sourceMappingURL=bundle.css.map*/
|
6
client/src/boot/index.js
Normal file
6
client/src/boot/index.js
Normal file
@ -0,0 +1,6 @@
|
||||
/* global window */
|
||||
import registerComponents from 'boot/registerComponents';
|
||||
|
||||
window.document.addEventListener('DOMContentLoaded', () => {
|
||||
registerComponents();
|
||||
});
|
8
client/src/boot/registerComponents.js
Normal file
8
client/src/boot/registerComponents.js
Normal file
@ -0,0 +1,8 @@
|
||||
import Injector from 'lib/Injector';
|
||||
import TagField from 'components/TagField';
|
||||
|
||||
export default () => {
|
||||
Injector.component.registerMany({
|
||||
TagField,
|
||||
});
|
||||
};
|
@ -1 +1,2 @@
|
||||
require('legacy/entwine/TagField.js');
|
||||
require('boot');
|
||||
|
@ -1,11 +1,16 @@
|
||||
/* global window */
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import TagField from 'components/TagField';
|
||||
import { loadComponent } from 'lib/Injector';
|
||||
|
||||
window.jQuery.entwine('ss', ($) => {
|
||||
$('.js-injector-boot .ss-tag-field').entwine({
|
||||
onmatch() {
|
||||
const cmsContent = this.closest('.cms-content').attr('id');
|
||||
const context = (cmsContent)
|
||||
? { context: cmsContent }
|
||||
: {};
|
||||
const TagField = loadComponent('TagField', context);
|
||||
const dataSchema = {
|
||||
...this.data('schema'),
|
||||
onBlur: () => {
|
||||
|
@ -2,6 +2,7 @@
|
||||
"name": "silverstripe-tagfield",
|
||||
"version": "2.2.0",
|
||||
"description": "Tag field for SilverStripe",
|
||||
"main": "./client/src/boot/index.js",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -58,9 +59,6 @@
|
||||
"devDependencies": {
|
||||
"@silverstripe/eslint-config": "^0.0.4",
|
||||
"@silverstripe/webpack-config": "^0.8.0",
|
||||
"@storybook/addon-actions": "^3.2.19",
|
||||
"@storybook/addon-options": "^3.2.19",
|
||||
"@storybook/react": "^3.2.19",
|
||||
"babel-jest": "^20.0.3",
|
||||
"copy-webpack-plugin": "^4.2.0",
|
||||
"enzyme": "^3.3.0",
|
||||
|
Loading…
Reference in New Issue
Block a user