!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],e):"object"==typeof exports?exports["openstack-uicore-foundation"]=e():t["openstack-uicore-foundation"]=e()}(this,(()=>(()=>{"use strict";var t={8575:(t,e,i)=>{i.d(e,{default:()=>r});var n=i(8362),s=i.n(n);const r=class{constructor(t,e=null){this._event=t,this._summit=e}set summit(t){this._summit=t}get summit(){return this._summit}getId(){return this._event.id}isPublished(){return this._event.hasOwnProperty("is_published")&&this._event.is_published}getMinutesDuration(t){if(this._event.hasOwnProperty("start_date")&&this._event.hasOwnProperty("end_date")&&null!=this._event.start_date&&null!=this._event.end_date){let t=s()(1e3*this._event.start_date).tz(this._summit.time_zone.name);return s()(1e3*this._event.end_date).tz(this._summit.time_zone.name).diff(t,"minutes")}return this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):t}canMove(t,e,i,n){let r=this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):n;this.isPublished()&&(r=this.getMinutesDuration());let m=s().tz(e+" "+i.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name),a=s().tz(e+" "+i.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name);a=a.add(r,"minutes");for(let e of t.filter((t=>t.id!==this.getId()))){let t=s()(1e3*e.start_date).tz(this._summit.time_zone.name),i=s()(1e3*e.end_date).tz(this._summit.time_zone.name);if(t.isBefore(a)&&i.isAfter(m))return!1}return!0}calculateNewDates(t,e,i){return i=this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):i,[s().tz(t+" "+e.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name),s().tz(t+" "+e.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name).add(i,"minutes")]}isValidEndDate(t){if(null==t)return!0;let e=s().tz(1e3*this._event.start_date,this._summit.time_zone.name);t=s().tz(1e3*t,this._summit.time_zone.name);let i=s().tz(1e3*this._summit.end_date,this._summit.time_zone.name);return t.isAfter(e)&&(t.isBefore(i)||t.isSame(i))}isValidStartDate(t){if(null==t)return!0;t=s().tz(1e3*t,this._summit.time_zone.name);let e=s().tz(1e3*this._event.end_date,this._summit.time_zone.name),i=s().tz(1e3*this._summit.start_date,this._summit.time_zone.name);return s().isMoment(t)&&t.isAfter(i)&&t.isBefore(e)}isValidTitle(t){return""!==t.trim()}isValid(){return this.isValidTitle(this._event.title)&&this.isValidStartDate(this._event.start_date)&&this.isValidEndDate(this._event.end_date)}}},8362:t=>{t.exports=require("moment-timezone")}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}(()=>{i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e}})(),(()=>{i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}})(),(()=>{i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})();var n={};return(()=>{i.r(n),i.d(n,{SummitEvent:()=>t.default});require("react");var t=i(8575)})(),n})()));
//# sourceMappingURL=index.js.map