mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
4 lines
54 KiB
JavaScript
4 lines
54 KiB
JavaScript
!function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=r[a]={exports:{}};t[a][0].call(l.exports,function(e){var r=t[a][1][e];return o(r?r:e)},l,l.exports,e,t,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(){h["default"].add("config",b["default"]),h["default"].add("schemas",E["default"]),h["default"].add("records",w["default"]),h["default"].add("campaign",C["default"]);var e={},t=(0,c.combineReducers)(h["default"].getAll()),r=(0,c.applyMiddleware)(l["default"],(0,p["default"])())(c.createStore);window.store=r(t,e),window.store.dispatch(m.setConfig(window.ss.config))}var a=e("jQuery"),s=o(a),c=e("redux"),u=e("redux-thunk"),l=o(u),f=e("redux-logger"),p=o(f),d=e("reducer-register"),h=o(d),y=e("state/config/actions"),m=n(y),v=e("state/config/reducer"),b=o(v),g=e("state/schema/reducer"),E=o(g),_=e("state/records/reducer"),w=o(_),O=e("state/campaign/reducer"),C=o(O),T=e("sections/campaign-admin/index");o(T);(0,s["default"])("body").entwine({onadd:function(){return i()}})},{jQuery:"jQuery","reducer-register":"reducer-register",redux:"redux","redux-logger":31,"redux-thunk":"redux-thunk","sections/campaign-admin/index":6,"state/campaign/reducer":13,"state/config/actions":15,"state/config/reducer":16,"state/records/reducer":19,"state/schema/reducer":21}],2:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):o(e,t))}Object.defineProperty(r,"__esModule",{value:!0});var c=e("react"),u=n(c),l=e("silverstripe-component"),f=n(l);e("bootstrap-collapse");var p=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.render=function(){var e=this.props.groupid+"_Header",t=this.props.groupid+"_Items",r="#"+t,n={id:t,"aria-expanded":!0,className:"list-group list-group-flush collapse in",role:"tabpanel","aria-labelledby":e};return u["default"].createElement("div",{className:"accordion-group"},u["default"].createElement("h6",{className:"accordion-group__title",role:"tab",id:e},u["default"].createElement("a",{"data-toggle":"collapse",href:r,"aria-expanded":"true","aria-controls":t},this.props.title)),u["default"].createElement("div",n,this.props.children))},t}(f["default"]);r["default"]=p},{"bootstrap-collapse":"bootstrap-collapse",react:"react","silverstripe-component":"silverstripe-component"}],3:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):o(e,t))}Object.defineProperty(r,"__esModule",{value:!0});var c=e("react"),u=n(c),l=e("silverstripe-component"),f=n(l),p=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.render=function(){return u["default"].createElement("div",{role:"tablist","aria-multiselectable":"true"},this.props.children)},t}(f["default"]);r["default"]=p},{react:"react","silverstripe-component":"silverstripe-component"}],4:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):o(e,t))}Object.defineProperty(r,"__esModule",{value:!0});var c=e("react"),u=n(c),l=e("silverstripe-component"),f=n(l),p=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.render=function(){var e="list-group-item "+this.props.className;return u["default"].createElement("a",{className:e},this.props.children)},t}(f["default"]);r["default"]=p},{react:"react","silverstripe-component":"silverstripe-component"}],5:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}function u(e,t){return{config:e.config,sectionConfig:e.config.sections[t.sectionConfigKey],campaignId:e.campaign.campaignId,view:e.campaign.view}}function l(e){return{actions:(0,h.bindActionCreators)(g,e)}}Object.defineProperty(r,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p=e("react"),d=o(p),h=e("redux"),y=e("react-redux"),m=e("silverstripe-backend"),v=o(m),b=e("state/campaign/actions"),g=n(b),E=e("silverstripe-component"),_=o(E),w=e("components/form-action/index"),O=o(w),C=e("i18n"),T=o(C),j=e("components/north-header/index"),S=o(j),R=e("components/form-builder/index"),P=o(R),A=e("./list"),x=o(A),D=function(e){function t(r){a(this,t);var n=s(this,e.call(this,r));return n.addCampaign=n.addCampaign.bind(n),n.createFn=n.createFn.bind(n),n.publishApi=v["default"].createEndpointFetcher({url:n.props.sectionConfig.publishEndpoint.url,method:n.props.sectionConfig.publishEndpoint.method,defaultData:{SecurityID:n.props.config.SecurityID},payloadSchema:{id:{urlReplacement:":id",remove:!0}}}),n}return c(t,e),t.prototype.componentDidMount=function(){var e=this;window.ss.router("/"+this.props.sectionConfig.campaignViewRoute,function(t){e.props.actions.showCampaignView(t.params.id,t.params.view)})},t.prototype.render=function(){var e=null;switch(this.props.view){case"show":e=this.renderItemListView();break;case"edit":e=this.renderDetailEditView();break;default:e=this.renderIndexView()}return e},t.prototype.renderIndexView=function(){var e=this.props.sectionConfig.forms.editForm.schemaUrl;return d["default"].createElement("div",{className:"cms-middle no-preview"},d["default"].createElement("div",{className:"cms-campaigns collapse in","aria-expanded":"true"},d["default"].createElement(S["default"],null),d["default"].createElement(O["default"],{label:T["default"]._t("Campaigns.ADDCAMPAIGN"),icon:"plus-circled",handleClick:this.addCampaign}),d["default"].createElement(P["default"],{schemaUrl:e,createFn:this.createFn})))},t.prototype.renderItemListView=function(){var e={campaignId:this.props.campaignId,itemListViewEndpoint:this.props.sectionConfig.itemListViewEndpoint,publishApi:this.publishApi};return d["default"].createElement(x["default"],e)},t.prototype.renderDetailEditView=function(){return d["default"].createElement("p",null,"Edit")},t.prototype.createFn=function(e,t){var r=this.props.sectionConfig.campaignViewRoute;if("GridField"===t.component){var n=f({},t,{data:f({},t.data,{handleDrillDown:function(e,t){var n=r.replace(/:type\?/,"set").replace(/:id\?/,t.ID).replace(/:view\?/,"show");window.ss.router.show(n)}})});return d["default"].createElement(e,f({key:n.name},n))}return d["default"].createElement(e,f({key:t.name},t))},t.prototype.previewURLForItem=function(e){return e?document.getElementsByTagName("base")[0].href:""},t.prototype.addCampaign=function(){},t}(_["default"]);D.propTypes={sectionConfig:d["default"].PropTypes.shape({forms:d["default"].PropTypes.shape({editForm:d["default"].PropTypes.shape({schemaUrl:d["default"].PropTypes.string})})}),config:d["default"].PropTypes.shape({SecurityID:d["default"].PropTypes.string}),sectionConfigKey:d["default"].PropTypes.string.isRequired},r["default"]=(0,y.connect)(u,l)(D)},{"./list":8,"components/form-action/index":"components/form-action/index","components/form-builder/index":"components/form-builder/index","components/north-header/index":"components/north-header/index",i18n:"i18n",react:"react","react-redux":"react-redux",redux:"redux","silverstripe-backend":"silverstripe-backend","silverstripe-component":"silverstripe-component","state/campaign/actions":12}],6:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var o=e("jQuery"),i=n(o),a=e("react"),s=n(a),c=e("react-dom"),u=n(c),l=e("react-redux"),f=e("./controller"),p=n(f);i["default"].entwine("ss",function(e){e(".cms-content.CampaignAdmin").entwine({onadd:function(){u["default"].render(s["default"].createElement(l.Provider,{store:window.store},s["default"].createElement(p["default"],{sectionConfigKey:"CampaignAdmin"})),this[0])},onremove:function(){u["default"].unmountComponentAtNode(this[0])}})})},{"./controller":5,jQuery:"jQuery",react:"react","react-dom":"react-dom","react-redux":"react-redux"}],7:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):o(e,t))}Object.defineProperty(r,"__esModule",{value:!0});var c=e("react"),u=n(c),l=e("silverstripe-component"),f=n(l),p=e("i18n"),d=n(p),h=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.render=function(){var e=null,t={},r=this.props.item,n=this.props.campaign;if("open"===n.State)switch(r.ChangeType){case"created":t.className="label label-warning",t.Title=d["default"]._t("CampaignItem.DRAFT","Draft");break;case"modified":t.className="label label-warning",t.Title=d["default"]._t("CampaignItem.MODIFIED","Modified");break;case"deleted":t.className="label label-error",t.Title=d["default"]._t("CampaignItem.REMOVED","Removed");break;case"none":default:t.className="label label-success item_visible-hovered",t.Title=d["default"]._t("CampaignItem.NO_CHANGES","No changes")}var o=u["default"].createElement("span",{className:"list-group-item__linked item_visible-hovered"},"[lk] 3 links");return r.Thumbnail&&(e=u["default"].createElement("span",{className:"item__thumbnail"},u["default"].createElement("img",{src:r.Thumbnail}))),u["default"].createElement("div",null,e,u["default"].createElement("h4",{className:"list-group-item-heading"},r.Title),o,t.className&&t.Title&&u["default"].createElement("span",{className:t.className},t.Title))},t}(f["default"]);h.propTypes={campaign:u["default"].PropTypes.object.isRequired,item:u["default"].PropTypes.object.isRequired},r["default"]=h},{i18n:"i18n",react:"react","silverstripe-component":"silverstripe-component"}],8:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):i(e,t))}function u(e,t){var r=null;return e.records&&e.records.ChangeSet&&t.campaignId&&(r=e.records.ChangeSet[parseInt(t.campaignId,10)]),{record:r||{},campaign:e.campaign}}function l(e){return{recordActions:(0,h.bindActionCreators)(v,e),campaignActions:(0,h.bindActionCreators)(g,e)}}Object.defineProperty(r,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},p=e("react"),d=o(p),h=e("redux"),y=e("react-redux"),m=e("state/records/actions"),v=n(m),b=e("state/campaign/actions"),g=n(b),E=e("silverstripe-component"),_=o(E),w=e("components/accordion/index"),O=o(w),C=e("components/accordion/group"),T=o(C),j=e("components/accordion/item"),S=o(j),R=e("components/north-header/index"),P=o(R),A=e("components/form-action/index"),x=o(A),D=e("./item"),I=o(D),F=e("./preview"),N=o(F),U=e("i18n"),L=o(U),M=function(e){function t(r){a(this,t);var n=s(this,e.call(this,r));return n.handlePublish=n.handlePublish.bind(n),n}return c(t,e),t.prototype.componentDidMount=function(){var t=this.props.itemListViewEndpoint.replace(/:id/,this.props.campaignId);e.prototype.componentDidMount.call(this),this.props.recordActions.fetchRecord("ChangeSet","get",t)},t.prototype.render=function(){var e=this,t=1,r=this.props.campaignId,n=this.props.record,o=this.previewURLForItem(t),i=this.groupItemsForSet(),a=o?"cms-middle with-preview":"cms-middle no-preview",s=[];return Object.keys(i).forEach(function(t){var o=i[t],a=o.items.length,c=[],u=a+" "+(1===a?o.singular:o.plural),l="Set_"+r+"_Group_"+t;o.items.forEach(function(t){var r="";"none"!==t.ChangeType&&"published"!==n.State||(r="list-group-item--published"),c.push(d["default"].createElement(S["default"],{key:t.ID,className:r},d["default"].createElement(I["default"],{item:t,campaign:e.props.record})))}),s.push(d["default"].createElement(T["default"],{key:l,groupid:l,title:u},c))}),d["default"].createElement("div",{className:a},d["default"].createElement("div",{className:"cms-campaigns collapse in","aria-expanded":"true"},d["default"].createElement(P["default"],null),d["default"].createElement("div",{className:"col-md-12 campaign-items"},d["default"].createElement(O["default"],null,s)),d["default"].createElement("div",{className:"cms-south-actions"},this.renderButtonToolbar())),o&&d["default"].createElement(N["default"],{previewUrl:o}))},t.prototype.renderButtonToolbar=function(){var e=this.getItems();if(!e)return d["default"].createElement("div",{className:"btn-toolbar"});var t={};return"open"===this.props.record.State?t=f(t,{label:L["default"]._t("Campaigns.PUBLISHCAMPAIGN"),bootstrapButtonStyle:"success",loading:this.props.campaign.isPublishing,handleClick:this.handlePublish,icon:"rocket"}):"published"===this.props.record.State&&(t=f(t,{label:L["default"]._t("Campaigns.REVERTCAMPAIGN"),bootstrapButtonStyle:"default",icon:"back-in-time",disabled:!0})),d["default"].createElement("div",{className:"btn-toolbar"},d["default"].createElement(x["default"],t))},t.prototype.previewURLForItem=function(e){return e?document.getElementsByTagName("base")[0].href:""},t.prototype.getItems=function(){return this.props.record&&this.props.record._embedded?this.props.record._embedded.ChangeSetItems:null},t.prototype.groupItemsForSet=function(){var e={},t=this.getItems();return t?(t.forEach(function(t){var r=t.BaseClass;e[r]||(e[r]={singular:t.Singular,plural:t.Plural,items:[]}),e[r].items.push(t)}),e):e},t.prototype.handlePublish=function(e){e.preventDefault(),this.props.campaignActions.publishCampaign(this.props.publishApi,this.props.campaignId)},t}(_["default"]);M.propTypes={campaign:d["default"].PropTypes.shape({isPublishing:d["default"].PropTypes.bool.isRequired}),campaignActions:d["default"].PropTypes.object.isRequired,publishApi:d["default"].PropTypes.func.isRequired,record:d["default"].PropTypes.object.isRequired,recordActions:d["default"].PropTypes.object.isRequired},r["default"]=(0,y.connect)(u,l)(M)},{"./item":7,"./preview":9,"components/accordion/group":2,"components/accordion/index":3,"components/accordion/item":4,"components/form-action/index":"components/form-action/index","components/north-header/index":"components/north-header/index",i18n:"i18n",react:"react","react-redux":"react-redux",redux:"redux","silverstripe-component":"silverstripe-component","state/campaign/actions":12,"state/records/actions":18}],9:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],i=Object.getOwnPropertyDescriptor(t,o);i&&i.configurable&&void 0===e[o]&&Object.defineProperty(e,o,i)}return e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):o(e,t))}Object.defineProperty(r,"__esModule",{value:!0});var c=e("react"),u=n(c),l=e("silverstripe-component"),f=n(l),p=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.render=function(){return u["default"].createElement("div",{className:"pages-preview"},u["default"].createElement("iframe",{src:this.props.previewUrl}))},t}(f["default"]);r["default"]=p},{react:"react","silverstripe-component":"silverstripe-component"}],10:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){var t=void 0,r=void 0;if(!(e.status>=200&&e.status<300))throw r=new Error(e.statusText),r.response=e,r;return t=e}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=e("isomorphic-fetch"),u=n(c),l=e("es6-promise"),f=n(l),p=e("qs"),d=n(p),h=e("merge"),y=n(h);f["default"].polyfill();var m=function(){function e(){i(this,e),this.fetch=u["default"]}return e.prototype.createEndpointFetcher=function(e){function t(e,t){switch(e){case"application/x-www-form-urlencoded":return d["default"].stringify(t);case"application/json":case"application/x-json":case"application/x-javascript":case"text/javascript":case"text/x-javascript":case"text/x-json":return JSON.stringify(t);default:throw new Error("Can't encode format: "+e)}}function r(e,t){switch(e){case"application/x-www-form-urlencoded":return d["default"].parse(t);case"application/json":case"application/x-json":case"application/x-javascript":case"text/javascript":case"text/x-javascript":case"text/x-json":return JSON.parse(t);default:throw new Error("Can't decode format: "+e)}}function n(e,t){return""===t?e:e.match(/\?/)?e+"&"+t:e+"?"+t}function i(e){return e.text().then(function(t){return r(e.headers.get("Content-Type"),t)})}function a(e,t){return Object.keys(t).reduce(function(r,n){var i=e[n];return!i||i.remove!==!0&&i.querystring!==!0?s(r,o({},n,t[n])):r},{})}function c(e,r,i){var a=arguments.length<=3||void 0===arguments[3]?{setFromData:!1}:arguments[3],c=r,u=Object.keys(i).reduce(function(t,r){var n=e[r],c=a.setFromData===!0&&!(n&&n.remove===!0),u=n&&n.querystring===!0&&n.remove!==!0;return c||u?s(t,o({},r,i[r])):t},{});return c=n(c,t("application/x-www-form-urlencoded",u)),c=Object.keys(e).reduce(function(t,r){var n=e[r].urlReplacement;return n?t.replace(n,i[r]):t},c)}var u=this,l=s({method:"get",payloadFormat:"application/x-www-form-urlencoded",responseFormat:"application/json",payloadSchema:{},defaultData:{}},e),f={json:"application/json",urlencoded:"application/x-www-form-urlencoded"};return["payloadFormat","responseFormat"].forEach(function(e){f[l[e]]&&(l[e]=f[l[e]])}),function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r={Accept:l.responseFormat,"Content-Type":l.payloadFormat},n=y["default"].recursive({},l.defaultData,e),o=c(l.payloadSchema,l.url,n,{setFromData:"get"===l.method.toLowerCase()}),s=t(l.payloadFormat,a(l.payloadSchema,n)),f="get"===l.method.toLowerCase()?[o,r]:[o,s,r];return u[l.method].apply(u,f).then(i)}},e.prototype.get=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return this.fetch(e,{method:"get",credentials:"same-origin",headers:t}).then(a)},e.prototype.post=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n={"Content-Type":"application/x-www-form-urlencoded"};return this.fetch(e,{method:"post",headers:s({},n,r),credentials:"same-origin",body:t}).then(a)},e.prototype.put=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return this.fetch(e,{method:"put",credentials:"same-origin",body:t,headers:r}).then(a)},e.prototype["delete"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return this.fetch(e,{method:"delete",credentials:"same-origin",body:t,headers:r}).then(a)},e}(),v=new m;r["default"]=v},{"es6-promise":23,"isomorphic-fetch":24,merge:26,qs:27}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={SET_CAMPAIGN_ACTIVE_CHANGESET:"SET_CAMPAIGN_ACTIVE_CHANGESET",PUBLISH_CAMPAIGN_REQUEST:"PUBLISH_CAMPAIGN_REQUEST",PUBLISH_CAMPAIGN_SUCCESS:"PUBLISH_CAMPAIGN_SUCCESS",PUBLISH_CAMPAIGN_FAILURE:"PUBLISH_CAMPAIGN_FAILURE"}},{}],12:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return{type:s["default"].SET_CAMPAIGN_ACTIVE_CHANGESET,payload:{campaignId:e,view:t}}}function i(e,t){return function(r){r({type:s["default"].PUBLISH_CAMPAIGN_REQUEST,payload:{campaignId:t}}),e({id:t}).then(function(e){r({type:s["default"].PUBLISH_CAMPAIGN_SUCCESS,payload:{campaignId:t}}),r({type:u["default"].FETCH_RECORD_SUCCESS,payload:{recordType:"ChangeSet",data:e}})})["catch"](function(e){r({type:s["default"].PUBLISH_CAMPAIGN_FAILURE,payload:{error:e}})})}}Object.defineProperty(r,"__esModule",{value:!0}),r.showCampaignView=o,r.publishCampaign=i;var a=e("./action-types"),s=n(a),c=e("state/records/action-types"),u=n(c)},{"./action-types":11,"state/records/action-types":17}],13:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=arguments.length<=0||void 0===arguments[0]?l:arguments[0],t=arguments[1];switch(t.type){case u["default"].SET_CAMPAIGN_ACTIVE_CHANGESET:return(0,s["default"])(i({},e,{campaignId:t.payload.campaignId,view:t.payload.view}));case u["default"].PUBLISH_CAMPAIGN_REQUEST:return(0,s["default"])(i({},e,{isPublishing:!0}));case u["default"].PUBLISH_CAMPAIGN_SUCCESS:case u["default"].PUBLISH_CAMPAIGN_FAILURE:return(0,s["default"])(i({},e,{isPublishing:!1}));default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=e("deep-freeze"),s=n(a),c=e("./action-types"),u=n(c),l={campaignId:null,isPublishing:!1,view:null};r["default"]=o},{"./action-types":11,"deep-freeze":"deep-freeze"}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={SET_CONFIG:"SET_CONFIG"}},{}],15:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return{type:a["default"].SET_CONFIG,payload:{config:e}}}Object.defineProperty(r,"__esModule",{value:!0}),r.setConfig=o;var i=e("./action-types"),a=n(i)},{"./action-types":14}],16:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];switch(t.type){case u["default"].SET_CONFIG:return(0,s["default"])(i({},e,t.payload.config));default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=e("deep-freeze"),s=n(a),c=e("./action-types"),u=n(c);r["default"]=o},{"./action-types":14,"deep-freeze":"deep-freeze"}],17:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={CREATE_RECORD:"CREATE_RECORD",UPDATE_RECORD:"UPDATE_RECORD",DELETE_RECORD:"DELETE_RECORD",FETCH_RECORDS_REQUEST:"FETCH_RECORDS_REQUEST",FETCH_RECORDS_FAILURE:"FETCH_RECORDS_FAILURE",FETCH_RECORDS_SUCCESS:"FETCH_RECORDS_SUCCESS",FETCH_RECORD_REQUEST:"FETCH_RECORD_REQUEST",FETCH_RECORD_FAILURE:"FETCH_RECORD_FAILURE",FETCH_RECORD_SUCCESS:"FETCH_RECORD_SUCCESS",DELETE_RECORD_REQUEST:"DELETE_RECORD_REQUEST",DELETE_RECORD_FAILURE:"DELETE_RECORD_FAILURE",DELETE_RECORD_SUCCESS:"DELETE_RECORD_SUCCESS"}},{}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var r=["id"];return r.reduce(function(e,r){return e.replace(":"+r,t[r])},e)}function i(e,t,r){var n={recordType:e},i={Accept:"text/json"},a=t.toLowerCase();return function(t){t({type:u["default"].FETCH_RECORDS_REQUEST,payload:n});var s="get"===a?[o(r,n),i]:[o(r,n),{},i];return f["default"][a].apply(f["default"],s).then(function(e){return e.json()}).then(function(r){t({type:u["default"].FETCH_RECORDS_SUCCESS,payload:{recordType:e,data:r}})})["catch"](function(r){t({type:u["default"].FETCH_RECORDS_FAILURE,payload:{error:r,recordType:e}})})}}function a(e,t,r){var n={recordType:e},i={Accept:"text/json"},a=t.toLowerCase();return function(t){t({type:u["default"].FETCH_RECORD_REQUEST,payload:n});var s="get"===a?[o(r,n),i]:[o(r,n),{},i];return f["default"][a].apply(f["default"],s).then(function(e){return e.json()}).then(function(r){t({type:u["default"].FETCH_RECORD_SUCCESS,payload:{recordType:e,data:r}})})["catch"](function(r){t({type:u["default"].FETCH_RECORD_FAILURE,payload:{error:r,recordType:e}})})}}function s(e,t,r,n){var i={recordType:e,id:t};return function(a){return a({type:u["default"].DELETE_RECORD_REQUEST,payload:i}),f["default"][r.toLowerCase()](o(n,i)).then(function(){a({type:u["default"].DELETE_RECORD_SUCCESS,payload:{recordType:e,id:t}})})["catch"](function(r){a({type:u["default"].DELETE_RECORD_FAILURE,payload:{error:r,recordType:e,id:t}})})}}Object.defineProperty(r,"__esModule",{value:!0}),r.fetchRecords=i,r.fetchRecord=a,r.deleteRecord=s;var c=e("./action-types"),u=n(c),l=e("silverstripe-backend.js"),f=n(l)},{"./action-types":17,"silverstripe-backend.js":10}],19:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(){var e=arguments.length<=0||void 0===arguments[0]?f:arguments[0],t=arguments[1],r=void 0,n=void 0,i=void 0;switch(t.type){case l["default"].CREATE_RECORD:return(0,c["default"])(a({},e,{}));case l["default"].UPDATE_RECORD:return(0,c["default"])(a({},e,{}));case l["default"].DELETE_RECORD:return(0,c["default"])(a({},e,{}));case l["default"].FETCH_RECORDS_REQUEST:return e;case l["default"].FETCH_RECORDS_FAILURE:return e;case l["default"].FETCH_RECORDS_SUCCESS:return n=t.payload.recordType,r=t.payload.data._embedded[n+"s"]||{},r=r.reduce(function(e,t){return a({},e,o({},t.id,t))},{}),(0,c["default"])(a({},e,o({},n,r)));case l["default"].FETCH_RECORD_REQUEST:return e;case l["default"].FETCH_RECORD_FAILURE:return e;case l["default"].FETCH_RECORD_SUCCESS:return n=t.payload.recordType,i=t.payload.data,(0,c["default"])(a({},e,o({},n,a({},e[n],o({},i.ID,i)))));case l["default"].DELETE_RECORD_REQUEST:return e;case l["default"].DELETE_RECORD_FAILURE:return e;case l["default"].DELETE_RECORD_SUCCESS:return n=t.payload.recordType,r=e[n],r=Object.keys(r).reduce(function(e,n){return parseInt(n,10)!==parseInt(t.payload.id,10)?a({},e,o({},n,r[n])):e},{}),(0,c["default"])(a({},e,o({},n,r)));default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=e("deep-freeze"),c=n(s),u=e("./action-types"),l=n(u),f={};r["default"]=i},{"./action-types":17,"deep-freeze":"deep-freeze"}],20:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={SET_SCHEMA:"SET_SCHEMA"};r["default"]=n},{}],21:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,
|
|
writable:!0}):e[t]=r,e}function i(){var e=arguments.length<=0||void 0===arguments[0]?f:arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];switch(t.type){case l["default"].SET_SCHEMA:var r=t.payload.schema.schema_url;return(0,c["default"])(a({},e,o({},r,t.payload)));default:return e}}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};r["default"]=i;var s=e("deep-freeze"),c=n(s),u=e("./action-types"),l=n(u),f=(0,c["default"])({})},{"./action-types":20,"deep-freeze":"deep-freeze"}],22:[function(e,t,r){function n(){l=!1,s.length?u=s.concat(u):f=-1,u.length&&o()}function o(){if(!l){var e=setTimeout(n);l=!0;for(var t=u.length;t;){for(s=u,u=[];++f<t;)s&&s[f].run();f=-1,t=u.length}s=null,l=!1,clearTimeout(e)}}function i(e,t){this.fun=e,this.array=t}function a(){}var s,c=t.exports={},u=[],l=!1,f=-1;c.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new i(e,t)),1!==u.length||l||setTimeout(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=a,c.addListener=a,c.once=a,c.off=a,c.removeListener=a,c.removeAllListeners=a,c.emit=a,c.binding=function(e){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(e){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],23:[function(e,t,r){(function(r,n){(function(){"use strict";function o(e){return"function"==typeof e||"object"==typeof e&&null!==e}function i(e){return"function"==typeof e}function a(e){V=e}function s(e){X=e}function c(){return function(){r.nextTick(d)}}function u(){return function(){Q(d)}}function l(){var e=0,t=new W(d),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function f(){var e=new MessageChannel;return e.port1.onmessage=d,function(){e.port2.postMessage(0)}}function p(){return function(){setTimeout(d,1)}}function d(){for(var e=0;J>e;e+=2){var t=te[e],r=te[e+1];t(r),te[e]=void 0,te[e+1]=void 0}J=0}function h(){try{var t=e,r=t("vertx");return Q=r.runOnLoop||r.runOnContext,u()}catch(n){return p()}}function y(e,t){var r=this,n=r._state;if(n===ie&&!e||n===ae&&!t)return this;var o=new this.constructor(v),i=r._result;if(n){var a=arguments[n-1];X(function(){I(n,o,a,i)})}else P(r,o,e,t);return o}function m(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(v);return T(r,e),r}function v(){}function b(){return new TypeError("You cannot resolve a promise with itself")}function g(){return new TypeError("A promises callback cannot return that same promise.")}function E(e){try{return e.then}catch(t){return se.error=t,se}}function _(e,t,r,n){try{e.call(t,r,n)}catch(o){return o}}function w(e,t,r){X(function(e){var n=!1,o=_(r,t,function(r){n||(n=!0,t!==r?T(e,r):S(e,r))},function(t){n||(n=!0,R(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,R(e,o))},e)}function O(e,t){t._state===ie?S(e,t._result):t._state===ae?R(e,t._result):P(t,void 0,function(t){T(e,t)},function(t){R(e,t)})}function C(e,t,r){t.constructor===e.constructor&&r===re&&constructor.resolve===ne?O(e,t):r===se?R(e,se.error):void 0===r?S(e,t):i(r)?w(e,t,r):S(e,t)}function T(e,t){e===t?R(e,b()):o(t)?C(e,t,E(t)):S(e,t)}function j(e){e._onerror&&e._onerror(e._result),A(e)}function S(e,t){e._state===oe&&(e._result=t,e._state=ie,0!==e._subscribers.length&&X(A,e))}function R(e,t){e._state===oe&&(e._state=ae,e._result=t,X(j,e))}function P(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ie]=r,o[i+ae]=n,0===i&&e._state&&X(A,e)}function A(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,o,i=e._result,a=0;a<t.length;a+=3)n=t[a],o=t[a+r],n?I(r,n,o,i):o(i);e._subscribers.length=0}}function x(){this.error=null}function D(e,t){try{return e(t)}catch(r){return ce.error=r,ce}}function I(e,t,r,n){var o,a,s,c,u=i(r);if(u){if(o=D(r,n),o===ce?(c=!0,a=o.error,o=null):s=!0,t===o)return void R(t,g())}else o=n,s=!0;t._state!==oe||(u&&s?T(t,o):c?R(t,a):e===ie?S(t,o):e===ae&&R(t,o))}function F(e,t){try{t(function(t){T(e,t)},function(t){R(e,t)})}catch(r){R(e,r)}}function N(e){return new he(this,e).promise}function U(e){function t(e){T(o,e)}function r(e){R(o,e)}var n=this,o=new n(v);if(!K(e))return R(o,new TypeError("You must pass an array to race.")),o;for(var i=e.length,a=0;o._state===oe&&i>a;a++)P(n.resolve(e[a]),void 0,t,r);return o}function L(e){var t=this,r=new t(v);return R(r,e),r}function M(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function H(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function k(e){this._id=pe++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==e&&("function"!=typeof e&&M(),this instanceof k?F(this,e):H())}function B(e,t){this._instanceConstructor=e,this.promise=new e(v),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):R(this.promise,this._validationError())}function G(){var e;if("undefined"!=typeof n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(e.Promise=de)}var q;q=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var Q,V,z,K=q,J=0,X=function(e,t){te[J]=e,te[J+1]=t,J+=2,2===J&&(V?V(d):z())},Y="undefined"!=typeof window?window:void 0,$=Y||{},W=$.MutationObserver||$.WebKitMutationObserver,Z="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);z=Z?c():W?l():ee?f():void 0===Y&&"function"==typeof e?h():p();var re=y,ne=m,oe=void 0,ie=1,ae=2,se=new x,ce=new x,ue=N,le=U,fe=L,pe=0,de=k;k.all=ue,k.race=le,k.resolve=ne,k.reject=fe,k._setScheduler=a,k._setAsap=s,k._asap=X,k.prototype={constructor:k,then:re,"catch":function(e){return this.then(null,e)}};var he=B;B.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},B.prototype._enumerate=function(){for(var e=this.length,t=this._input,r=0;this._state===oe&&e>r;r++)this._eachEntry(t[r],r)},B.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===ne){var o=E(e);if(o===re&&e._state!==oe)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===de){var i=new r(v);C(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){t(e)}),t)}else this._willSettleAt(n(e),t)},B.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===oe&&(this._remaining--,e===ae?R(n,r):this._result[t]=r),0===this._remaining&&S(n,this._result)},B.prototype._willSettleAt=function(e,t){var r=this;P(e,void 0,function(e){r._settledAt(ie,t,e)},function(e){r._settledAt(ae,t,e)})};var ye=G,me={Promise:de,polyfill:ye};"function"==typeof define&&define.amd?define(function(){return me}):"undefined"!=typeof t&&t.exports?t.exports=me:"undefined"!=typeof this&&(this.ES6Promise=me),ye()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:22}],24:[function(e,t,r){e("whatwg-fetch"),t.exports=self.fetch.bind(self)},{"whatwg-fetch":25}],25:[function(e,t,r){!function(e){"use strict";function t(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function r(e){return"string"!=typeof e&&(e=String(e)),e}function n(e){this.map={},e instanceof n?e.forEach(function(e,t){this.append(t,e)},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function o(e){return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function i(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function a(e){var t=new FileReader;return t.readAsArrayBuffer(e),i(t)}function s(e){var t=new FileReader;return t.readAsText(e),i(t)}function c(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,"string"==typeof e)this._bodyText=e;else if(h.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(h.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(e){if(!h.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e))throw new Error("unsupported BodyInit type")}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type&&this.headers.set("content-type",this._bodyBlob.type))},h.blob?(this.blob=function(){var e=o(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(a)},this.text=function(){var e=o(this);if(e)return e;if(this._bodyBlob)return s(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var e=o(this);return e?e:Promise.resolve(this._bodyText)},h.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then(JSON.parse)},this}function u(e){var t=e.toUpperCase();return y.indexOf(t)>-1?t:e}function l(e,t){t=t||{};var r=t.body;if(l.prototype.isPrototypeOf(e)){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new n(e.headers)),this.method=e.method,this.mode=e.mode,r||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e;if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new n(t.headers)),this.method=u(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function f(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function p(e){var t=new n,r=e.getAllResponseHeaders().trim().split("\n");return r.forEach(function(e){var r=e.trim().split(":"),n=r.shift().trim(),o=r.join(":").trim();t.append(n,o)}),t}function d(e,t){t||(t={}),this.type="default",this.status=t.status,this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText,this.headers=t.headers instanceof n?t.headers:new n(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){n.prototype.append=function(e,n){e=t(e),n=r(n);var o=this.map[e];o||(o=[],this.map[e]=o),o.push(n)},n.prototype["delete"]=function(e){delete this.map[t(e)]},n.prototype.get=function(e){var r=this.map[t(e)];return r?r[0]:null},n.prototype.getAll=function(e){return this.map[t(e)]||[]},n.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},n.prototype.set=function(e,n){this.map[t(e)]=[r(n)]},n.prototype.forEach=function(e,t){Object.getOwnPropertyNames(this.map).forEach(function(r){this.map[r].forEach(function(n){e.call(t,n,r,this)},this)},this)};var h={blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e},y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this)},c.call(l.prototype),c.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new n(this.headers),url:this.url})},d.error=function(){var e=new d(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];d.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new d(null,{status:t,headers:{location:e}})},e.Headers=n,e.Request=l,e.Response=d,e.fetch=function(e,t){return new Promise(function(r,n){function o(){return"responseURL"in a?a.responseURL:/^X-Request-URL:/m.test(a.getAllResponseHeaders())?a.getResponseHeader("X-Request-URL"):void 0}var i;i=l.prototype.isPrototypeOf(e)&&!t?e:new l(e,t);var a=new XMLHttpRequest;a.onload=function(){var e=1223===a.status?204:a.status;if(100>e||e>599)return void n(new TypeError("Network request failed"));var t={status:e,statusText:a.statusText,headers:p(a),url:o()},i="response"in a?a.response:a.responseText;r(new d(i,t))},a.onerror=function(){n(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials&&(a.withCredentials=!0),"responseType"in a&&h.blob&&(a.responseType="blob"),i.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),a.send("undefined"==typeof i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],26:[function(e,t,r){!function(e){function r(e,t){if("object"!==o(e))return t;for(var n in t)"object"===o(e[n])&&"object"===o(t[n])?e[n]=r(e[n],t[n]):e[n]=t[n];return e}function n(e,t,n){var a=n[0],s=n.length;(e||"object"!==o(a))&&(a={});for(var c=0;s>c;++c){var u=n[c],l=o(u);if("object"===l)for(var f in u){var p=e?i.clone(u[f]):u[f];t?a[f]=r(a[f],p):a[f]=p}}return a}function o(e){return{}.toString.call(e).slice(8,-1).toLowerCase()}var i=function(e){return n(e===!0,!1,arguments)},a="merge";i.recursive=function(e){return n(e===!0,!0,arguments)},i.clone=function(e){var t,r,n=e,a=o(e);if("array"===a)for(n=[],r=e.length,t=0;r>t;++t)n[t]=i.clone(e[t]);else if("object"===a){n={};for(t in e)n[t]=i.clone(e[t])}return n},e?t.exports=i:window[a]=i}("object"==typeof t&&t&&"object"==typeof t.exports&&t.exports)},{}],27:[function(e,t,r){"use strict";var n=e("./stringify"),o=e("./parse");t.exports={stringify:n,parse:o}},{"./parse":28,"./stringify":29}],28:[function(e,t,r){"use strict";var n=e("./utils"),o={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1};o.parseValues=function(e,t){for(var r={},o=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),i=0;i<o.length;++i){var a=o[i],s=-1===a.indexOf("]=")?a.indexOf("="):a.indexOf("]=")+1;if(-1===s)r[n.decode(a)]="",t.strictNullHandling&&(r[n.decode(a)]=null);else{var c=n.decode(a.slice(0,s)),u=n.decode(a.slice(s+1));Object.prototype.hasOwnProperty.call(r,c)?r[c]=[].concat(r[c]).concat(u):r[c]=u}}return r},o.parseObject=function(e,t,r){if(!e.length)return t;var n,i=e.shift();if("[]"===i)n=[],n=n.concat(o.parseObject(e,t,r));else{n=r.plainObjects?Object.create(null):{};var a="["===i[0]&&"]"===i[i.length-1]?i.slice(1,i.length-1):i,s=parseInt(a,10);!isNaN(s)&&i!==a&&String(s)===a&&s>=0&&r.parseArrays&&s<=r.arrayLimit?(n=[],n[s]=o.parseObject(e,t,r)):n[a]=o.parseObject(e,t,r)}return n},o.parseKeys=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^\.\[]+)/g,"[$1]"):e,i=/^([^\[\]]*)/,a=/(\[[^\[\]]*\])/g,s=i.exec(n),c=[];if(s[1]){if(!r.plainObjects&&Object.prototype.hasOwnProperty(s[1])&&!r.allowPrototypes)return;c.push(s[1])}for(var u=0;null!==(s=a.exec(n))&&u<r.depth;)u+=1,(r.plainObjects||!Object.prototype.hasOwnProperty(s[1].replace(/\[|\]/g,""))||r.allowPrototypes)&&c.push(s[1]);return s&&c.push("["+n.slice(s.index)+"]"),o.parseObject(c,t,r)}},t.exports=function(e,t){var r=t||{};if(r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:o.delimiter,r.depth="number"==typeof r.depth?r.depth:o.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:o.arrayLimit,r.parseArrays=r.parseArrays!==!1,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:o.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:o.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:o.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:o.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:o.strictNullHandling,""===e||null===e||"undefined"==typeof e)return r.plainObjects?Object.create(null):{};for(var i="string"==typeof e?o.parseValues(e,r):e,a=r.plainObjects?Object.create(null):{},s=Object.keys(i),c=0;c<s.length;++c){var u=s[c],l=o.parseKeys(u,i[u],r);a=n.merge(a,l,r)}return n.compact(a)}},{"./utils":30}],29:[function(e,t,r){"use strict";var n=e("./utils"),o={delimiter:"&",arrayPrefixGenerators:{brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},strictNullHandling:!1,skipNulls:!1,encode:!0};o.stringify=function(e,t,r,i,a,s,c,u,l){var f=e;if("function"==typeof c)f=c(t,f);else if(n.isBuffer(f))f=String(f);else if(f instanceof Date)f=f.toISOString();else if(null===f){if(i)return s?n.encode(t):t;f=""}if("string"==typeof f||"number"==typeof f||"boolean"==typeof f)return s?[n.encode(t)+"="+n.encode(f)]:[t+"="+f];var p=[];if("undefined"==typeof f)return p;var d;if(Array.isArray(c))d=c;else{var h=Object.keys(f);d=u?h.sort(u):h}for(var y=0;y<d.length;++y){var m=d[y];a&&null===f[m]||(p=Array.isArray(f)?p.concat(o.stringify(f[m],r(t,m),r,i,a,s,c,u,l)):p.concat(o.stringify(f[m],t+(l?"."+m:"["+m+"]"),r,i,a,s,c,u,l)))}return p},t.exports=function(e,t){var r,n,i=e,a=t||{},s="undefined"==typeof a.delimiter?o.delimiter:a.delimiter,c="boolean"==typeof a.strictNullHandling?a.strictNullHandling:o.strictNullHandling,u="boolean"==typeof a.skipNulls?a.skipNulls:o.skipNulls,l="boolean"==typeof a.encode?a.encode:o.encode,f="function"==typeof a.sort?a.sort:null,p="undefined"==typeof a.allowDots?!1:a.allowDots;"function"==typeof a.filter?(n=a.filter,i=n("",i)):Array.isArray(a.filter)&&(r=n=a.filter);var d=[];if("object"!=typeof i||null===i)return"";var h;h=a.arrayFormat in o.arrayPrefixGenerators?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var y=o.arrayPrefixGenerators[h];r||(r=Object.keys(i)),f&&r.sort(f);for(var m=0;m<r.length;++m){var v=r[m];u&&null===i[v]||(d=d.concat(o.stringify(i[v],v,y,c,u,l,n,f,p)))}return d.join(s)}},{"./utils":30}],30:[function(e,t,r){"use strict";var n=function(){for(var e=new Array(256),t=0;256>t;++t)e[t]="%"+((16>t?"0":"")+t.toString(16)).toUpperCase();return e}();r.arrayToObject=function(e,t){for(var r=t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)"undefined"!=typeof e[n]&&(r[n]=e[n]);return r},r.merge=function(e,t,n){if(!t)return e;if("object"!=typeof t){if(Array.isArray(e))e.push(t);else{if("object"!=typeof e)return[e,t];e[t]=!0}return e}if("object"!=typeof e)return[e].concat(t);var o=e;return Array.isArray(e)&&!Array.isArray(t)&&(o=r.arrayToObject(e,n)),Object.keys(t).reduce(function(e,o){var i=t[o];return Object.prototype.hasOwnProperty.call(e,o)?e[o]=r.merge(e[o],i,n):e[o]=i,e},o)},r.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},r.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",o=0;o<t.length;++o){var i=t.charCodeAt(o);45===i||46===i||95===i||126===i||i>=48&&57>=i||i>=65&&90>=i||i>=97&&122>=i?r+=t.charAt(o):128>i?r+=n[i]:2048>i?r+=n[192|i>>6]+n[128|63&i]:55296>i||i>=57344?r+=n[224|i>>12]+n[128|i>>6&63]+n[128|63&i]:(o+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(o)),r+=n[240|i>>18]+n[128|i>>12&63]+n[128|i>>6&63]+n[128|63&i])}return r},r.compact=function(e,t){if("object"!=typeof e||null===e)return e;var n=t||[],o=n.indexOf(e);if(-1!==o)return n[o];if(n.push(e),Array.isArray(e)){for(var i=[],a=0;a<e.length;++a)"undefined"!=typeof e[a]&&i.push(e[a]);return i}for(var s=Object.keys(e),c=0;c<s.length;++c){var u=s[c];e[u]=r.compact(e[u],n)}return e},r.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},r.isBuffer=function(e){return null===e||"undefined"==typeof e?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},{}],31:[function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function i(e,t,r,i){switch("undefined"==typeof e?"undefined":o(e)){case"object":return"function"==typeof e[i]?e[i].apply(e,n(r)):e[i];case"function":return e(t);default:return e}}function a(){function e(){j.forEach(function(e,t){var r=e.started,o=e.startedTime,s=e.action,c=e.prevState,l=e.error,p=e.took,d=e.nextState,y=j[t+1];y&&(d=y.prevState,p=y.started-r);var v=_(s),b="function"==typeof f?f(function(){return d},s):f,g=u(o),E=T.title?"color: "+T.title(v)+";":null,w="action "+(m?g:"")+" "+v.type+" "+(h?"(in "+p.toFixed(2)+" ms)":"");try{b?T.title?a.groupCollapsed("%c "+w,E):a.groupCollapsed(w):T.title?a.group("%c "+w,E):a.group(w)}catch(O){a.log(w)}var C=i(n,v,[c],"prevState"),S=i(n,v,[v],"action"),R=i(n,v,[l,c],"error"),P=i(n,v,[d],"nextState");C&&(T.prevState?a[C]("%c prev state","color: "+T.prevState(c)+"; font-weight: bold",c):a[C]("prev state",c)),S&&(T.action?a[S]("%c action","color: "+T.action(v)+"; font-weight: bold",v):a[S]("action",v)),l&&R&&(T.error?a[R]("%c error","color: "+T.error(l,c)+"; font-weight: bold",l):a[R]("error",l)),P&&(T.nextState?a[P]("%c next state","color: "+T.nextState(d)+"; font-weight: bold",d):a[P]("next state",d));try{a.groupEnd()}catch(O){a.log("—— log end ——")}}),j.length=0}var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=t.level,n=void 0===r?"log":r,o=t.logger,a=void 0===o?console:o,s=t.logErrors,c=void 0===s?!0:s,f=t.collapsed,p=t.predicate,d=t.duration,h=void 0===d?!1:d,y=t.timestamp,m=void 0===y?!0:y,v=t.transformer,b=t.stateTransformer,g=void 0===b?function(e){return e}:b,E=t.actionTransformer,_=void 0===E?function(e){return e}:E,w=t.errorTransformer,O=void 0===w?function(e){return e}:w,C=t.colors,T=void 0===C?{title:function(){return"#000000"},prevState:function(){return"#9E9E9E"},action:function(){return"#03A9F4"},nextState:function(){return"#4CAF50"},error:function(){return"#F20404"}}:C;if("undefined"==typeof a)return function(){return function(e){return function(t){return e(t)}}};v&&console.error("Option 'transformer' is deprecated, use stateTransformer instead");var j=[];return function(t){var r=t.getState;return function(t){return function(n){if("function"==typeof p&&!p(r,n))return t(n);var o={};j.push(o),o.started=l.now(),o.startedTime=new Date,o.prevState=g(r()),o.action=n;var i=void 0;if(c)try{i=t(n)}catch(a){o.error=O(a)}else i=t(n);if(o.took=l.now()-o.started,o.nextState=g(r()),e(),o.error)throw o.error;return i}}}}var s=function(e,t){return new Array(t+1).join(e)},c=function(e,t){return s("0",t-e.toString().length)+e},u=function(e){return"@ "+c(e.getHours(),2)+":"+c(e.getMinutes(),2)+":"+c(e.getSeconds(),2)+"."+c(e.getMilliseconds(),3)},l="undefined"!=typeof performance&&"function"==typeof performance.now?performance:Date;t.exports=a},{}]},{},[1]);
|
|
//# sourceMappingURL=bundle-framework.js.map
|