!function(s,n,r){"use strict";Promise.settle=function(e){e=e.map(function(e){return e.then(function(e){return{result:e,status:"resolved"}},function(e){return{result:e,status:"rejected"}})});return Promise.all(e)};var a=function(){var i=this;this.promise=new Promise(function(e,t){i.resolve=e,i.reject=t}),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)},l=(((e.prototype={addError:function(e,t,i){this.state=!1;e={header:e,message:t};return i&&(e.context=i.context,e.code=i.code,e.serverCode=i.serverCode),this.errors.push(e),this},firstError:function(){return 0
',this.panel.content.appendChild(i),n.createElement("iframe"));return o.setAttribute("src",e),o.setAttribute("sandbox","allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-scripts allow-top-navigation allow-top-navigation-by-user-activation"),o.onload=function(){i.setAttribute("class","frame-overlay loaded"),setTimeout(function(){t.panel.content.removeChild(i)},200)},this.panel.content.appendChild(o),this}};var F=M;function M(e){this.tmpID=N.util.Obj.guid(),this.name=e&&e.name||"",this.width=e&&e.width||325,this.height=e&&e.height||627,this.container=e&&e.container||n.body,this.url=e&&e.url||null,this.panel=null,this.onclosed=e?e.onclosed:null}G.prototype={fromJSON:function(e){return this.id=e.id,this.name=e.Name,this.creatorID=e.CreatorID,this.isActive=e.IsActive,this},setLimitDetails:function(e){this.limit.apiLimit=+e.rateLimit.usageLimit,this.limit.throttle=e.rateLimit.throttle,this.limit.limitResetDate=new Date(1e3*+e.rateLimit.resetUsageAt),this.limit.apiUsage={},this.limit.apiUsageTotal=0;var t=this;return e.rateLimit.CatalogueUsages.forEach(function(e){t.limit.apiUsageTotal+=+e.usage,t.limit.apiUsage[e.catalogueID]=+e.usage}),this},setCTXPlugins:function(e){return this.ctxPlugins=e,this}};var U=G;function G(e){this.id=null,this.name=null,this.creatorID=null,this.isActive=!1,this.limit={},e&&this.fromJSON(e)}o.BOOLEAN=(o.prototype={fromJSON:function(i){this.id=i.uid,this.name=i.name,this.iconURL=i.iconUrl,this.description=i.description,this.isReserved=i.isReserved,this.isEnabled=i.tenantConfig.isEnabled;var e=Object.keys(i.values);return this.attributes=e.map(function(e){var t=i.values[e],e={id:e,name:t.name,type:t.valueType,parameters:t.parameters?t.parameters.map(function(e){return{index:e.index,name:e.key,description:e.description,type:e.valueType,_input:null}}):[],_input:null};return e.type===o.BOOLEAN&&(e._input=!1),e}),this},getValues:function(){var e=new u;return e.gatherValues(this),e},setValues:function(e){return e.applyValues(this),this},clearValues:function(){this.attributes.forEach(function(e){e.type===o.BOOLEAN?e._input=!1:e._input=null,e.parameters.forEach(function(e){e._input=null})})}}).BOOLEAN="bool",o.INTEGER=o.prototype.INTEGER="int",o.FLOAT=o.prototype.FLOAT="float",o.STRING=o.prototype.STRING="string";var J=o;function o(e){this.id=null,this.name=null,this.iconURL=null,this.description=null,this.isReserved=!1,this.isEnabled=!1,this.attributes=[],e&&this.fromJSON(e)}t.FULLSCREEN=(t.prototype={fromJSON:function(e){return e.id&&(this.id=e.id),this.mode=e.mode,this.splashURL=e.splashURL,this.appscreenURL=e.appscreenURL,this.widgetIconURL=e.widgetIconURL,this.primaryColor=e.primaryColor,this.secondaryColor=e.secondaryColor,this.tertiaryColor=e.tertiaryColor,this.fgColor=e.fgColor,this.fineGrainColor.feedBG=e.fineGrainColor?e.fineGrainColor.feedBG:null,this.fineGrainColor.pillsBG=e.fineGrainColor?e.fineGrainColor.pillsBG:null,this.fineGrainColor.tabbarBG=e.fineGrainColor?e.fineGrainColor.tabbarBG:null,this.fineGrainColor.tabbarActiveBG=e.fineGrainColor?e.fineGrainColor.tabbarActiveBG:null,this.fineGrainColor.widgetBG=e.fineGrainColor?e.fineGrainColor.widgetBG:null,this.fineGrainColor.buttonBG=e.fineGrainColor?e.fineGrainColor.buttonBG:null,this.pillsEnabled=!e.hasOwnProperty("pillsEnabled")||e.pillsEnabled,e.pills&&(this.pills=e.pills),this.tileStyle.borderColor=e.tileStyle?e.tileStyle.borderColor:"#e5e5e5",this.tileStyle.borderRadius=e.tileStyle?e.tileStyle.borderRadius:4,this.tileStyle.enableShadow=!e.tileStyle||e.tileStyle.enableShadow,this.tileStyle.sideMargin=e.tileStyle?e.tileStyle.sideMargin:10,this.enableHeaderIcon=e.enableHeaderIcon,this},toJSON:function(){return{groupName:this.groupName,keyProperty:"id",payload:{id:this.id,mode:this.mode,splashURL:this.splashURL,appscreenURL:this.appscreenURL,widgetIconURL:this.widgetIconURL,primaryColor:this.primaryColor,secondaryColor:this.secondaryColor,tertiaryColor:this.tertiaryColor,fgColor:this.fgColor,fineGrainColor:this.fineGrainColor,pillsEnabled:this.pillsEnabled,pills:this.pills,tileStyle:this.tileStyle,enableHeaderIcon:this.enableHeaderIcon}}}}).FULLSCREEN="fullscreen",t.EMBEDDED=t.prototype.EMBEDDED="embedded",t.WIDGET=t.prototype.WIDGET="widget";var c=t;function t(e,t){this.id=N.util.Obj.guid(),this.groupName=t,this.mode=N.cfg.themeDefaults.mode,this.splashURL=r,this.appscreenURL=r,this.widgetIconURL=N.cfg.themeDefaults.widgetIconURL,this.primaryColor=N.cfg.themeDefaults.primaryColor,this.secondaryColor=N.cfg.themeDefaults.secondaryColor,this.tertiaryColor=N.cfg.themeDefaults.tertiaryColor,this.fgColor=N.cfg.themeDefaults.fgColor,this.fineGrainColor={feedBG:null,pillsBG:null,tabbarBG:null,tabbarActiveBG:null,widgetBG:null,buttonBG:null},this.pillsEnabled=N.cfg.themeDefaults.pillsEnabled,this.pills=JSON.parse(JSON.stringify(N.cfg.themeDefaults.pills)),this.tileStyle=JSON.parse(JSON.stringify(N.cfg.themeDefaults.tileStyle))||{borderColor:"#e5e5e5",borderRadius:4,enableShadow:!0,sideMargin:10},this.enableHeaderIcon=N.cfg.themeDefaults.enableHeaderIcon,e&&this.fromJSON(e)}z.auth=(z.prototype={saveState:function(){this.tmpState=this.toJSON()},restoreState:function(){this.tmpState&&this.fromJSON(this.tmpState)},fromJSON:function(t){this.id=t.id,this.name=t.name,this.description=t.desc,this.iconURL=t.iconURL,this.color=t.color,this.ctxs=t.ctxs.map(function(e){return new u(e)}).filter(function(e){return!(!e.ctx||!e.ctx.id)||(console.error("Missing context plugin detected and removed from profile.","error"),console.error("Please resave your profile: "+t.name),!1)}),t.authType&&(this.authType=t.authType),t.auth&&(this.auth=t.auth),t.hasOwnProperty("isDisabled")&&(this.isDisabled=t.isDisabled)},toJSON:function(){return{id:this.id,name:this.name,desc:this.description,iconURL:this.iconURL,color:this.color,ctxs:this.ctxs.map(function(e){return e.toJSON()}),authType:this.authType,auth:this.auth,isDisabled:this.isDisabled}}}).auth={OIDC:"oidc",OKTA:"okta",JWT:"jwt",ANONYMOUS:"anonymous",FLYBITS:"flybits"};var i=z;function z(e){this.id=N.util.Obj.guid(),this.name="",this.description="",this.color="",this.iconURL="",this.tmpState=null,this.ctxs=[],this.authType="anonymous",this.highlight=!1,this.isDisabled=!1,this.auth={token:"",ref:""},e&&this.fromJSON(e)}B.prototype={fromJSON:function(e){return this.id=e.id,this.list=e.profiles.map(function(e){return new i(e)}),this},toJSON:function(){return{groupName:this.groupName,keyProperty:"id",payload:{id:this.id,profiles:this.list.map(function(e){return e.toJSON()})}}}};var V=B;function B(e,t){this.id=N.util.Obj.guid(),this.groupName=t,this.list=[],e&&this.fromJSON(e)}H.prototype={fromJSON:function(t){var e;return this.values=t.values,N.store&&N.store.project&&(e=N.store.project.ctxPlugins.filter(function(e){return e.id===t.ctxID})[0],(this.ctx=e)||(N.toast("Cannot find plugin: "+t.ctxID,"error"),console.log("> missing plugin",t.ctxID))),this},toJSON:function(){return{ctxID:this.ctx.id,ctxName:this.ctx.name,ctxIconURL:this.ctx.iconURL,values:JSON.parse(JSON.stringify(this.values))}},gatherValues:function(e){this.ctx=e;var n=this.values;return e.attributes.forEach(function(e){var t,i,o;e.hasOwnProperty("_input")&&null!==e._input&&(i=e.type,o=e._input,i=i===J.INTEGER||i===J.FLOAT?+o:o,!function(e){for(var t=0;t
Just for you
`,styleStr:` .td-header { background-color: #1A5336; } .td-header .logo { width: 100%; display: block; } .header-bar{ position: relative; padding: 0 16px 0; background-color: #F3F3F3; } .header-bar::before { content: ''; position: absolute; top: 37px; left: 16px; right: 0; height: 1px; background-color: #CCCCCC; z-index: 1; } .header-bar::after { content: ''; display: block; height: 0; clear: both } .header-bar .title{ position: relative; float: left; cursor: pointer; font-size: 20px; padding: 20px 0 8px 0; padding-right: 10px; font-weight: bold; color: #1C1C1C; background-color: #F3F3F3; z-index: 2; } `,content:[]},footer:{id:N.util.Obj.guid(1),cacheKey:N.util.Obj.guid(1),layoutStr:` `,styleStr:` .footer-bar{ overflow: hidden; background-color: #F3F3F3; } .footer-bar .view-more{ float: right; font-size: 16px; font-weight: bold; line-height: 16px; padding: 8px 16px 30px 0; cursor: pointer; color: #308523; padding-left: 20px; } .td-footer img { width: 100%; display: block; } `,content:[]}},i.containers.unshift(e.header),i.containers.push(e.footer)):"landerpage"!==t&&"lander"!==t||(e=K(N.cfg.HOMEZONEREF||"homepage"),i.containers.unshift(e))),console.log("> refresh",i),i},toDetailsPayload:function(e,t){var i=this.contentMap[e];if(i)return h.createDetailsPayload(i,t);console.log("> no content details found",e)},toOverlayPayload:function(e){var t=this.contentMap[e];if(t)return h.createOverlayPayload(t);console.log("> no content details found",e)}}).createDetailsPayload=function(e,t){e={id:N.util.Obj.guid(2),refID:"details",name:"Content Details",containers:[{id:N.util.Obj.guid(),cacheKey:N.util.Obj.guid(1),layout:"vertical",content:[X(e,"details")]}]};return N.cfg.themeDefaults.disableTDHome||(t=K("back",t),e.containers.unshift(t)),console.log("> tmpZone",e),e},h.createOverlayPayload=h.prototype.createOverlayPayload=function(e){e={id:N.util.Obj.guid(2),refID:"overlay",name:"Overlay",containers:[{id:N.util.Obj.guid(),cacheKey:N.util.Obj.guid(1),layout:"overlay",content:[X(e,"details")]}]};return console.log("> tmpZone",e),e};var _=h;function X(e,t){var i=e.data.result&&Array.isArray(e.data.result)?e.data.result[0].toJSON():e.data,i=(N.util.Content.flattenLocales(i),{id:e.id,data:i,uiTemplate:"",style:"",styleStr:"",contentInfo:{id:e.id}}),t=t&&"details"===t?e.detailsUI:e.defaultUI||{};return i.uiTemplate=t.layoutHTML||"\x3c!-- --\x3e",i.style=t.styleCSSURL,i.styleStr=t.styleCSS,i}function K(e,t){return t=t||"TD for Me",e="back"===e?"back://":"concierge://?container=configured&zoneReferenceId="+e,{id:N.util.Obj.guid(1),cacheKey:N.util.Obj.guid(1),layoutStr:`
${t}
`,styleStr:` .td-header-small{ position: relative; background-color: #018701; padding-top: 40px; padding-bottom: 10px; color: white; } .td-header-small .back-btn{ position: absolute; left: 0; top: 40px; line-height: 40px; width: 40px; text-align: center; font-size: 35px; font-weight: bold; cursor: pointer; } .td-header-small .back-btn:active,.td-header-small .back-btn:focus{ background-color: #135131; } .td-header-small .page-title{ text-align: center; font-size: 18px; line-height: 40px; font-weight: bold; } .details-page.info .inner-scroll{ top: 90px !important; } `,content:[]}}function h(e){this.fromJSON(e)}d.prototype={startPoll:function(){this.isPolling=!0,this.poll()},stopPoll:function(){this.isPolling=!1,clearTimeout(this.timer)},togglePolling:function(){this.isPolling?this.stopPoll():this.startPoll()},poll:function(){var e=this;this.reload().catch(function(e){console.log("> failed to retrieve")}).then(function(){e.timer=setTimeout(function(){e.isPolling&&e.poll()},e.delay)})},reload:function(){var t=new Flybits.Deferred;return 0 failed to refresh",e),t.reject(e)}):t.reject(),t.promise},load:function(e){var t,i=new Flybits.Deferred,o=e.opts||{},n=this,{zoneRef:r,contentID:s,skipCache:a,pageTitle:l}=o;return e?e.type===d.DETAILS?a?o.overlay?N.store.getOverlay(s).then(function(e){n.frameController.injectOverlay(e),i.resolve()}).catch(function(e){console.log("> oh no",e),i.reject(e)}):N.store.getDetails(s,{pageTitle:l}).then(function(e){n.frameController.inject(e),i.resolve()}).catch(function(e){console.log("> oh no",e),i.reject(e)}):o.overlay?(t=N.store.getCachedOverlay(s))?(n.frameController.injectOverlay(t),i.resolve()):(console.log("> no valid content found",s),i.reject()):(t=N.store.getCachedDetails(s,l))?(n.frameController.inject(t),i.resolve()):(console.log("> no valid content found",s),i.reject()):e.type===d.CONCIERGE&&(a?N.store.getZonesContent({zoneRef:r}).then(function(e){n.frameController.inject(e),i.resolve()}):(t=N.store.getCachedZone(r))?(this.frameController.inject(t),i.resolve()):(console.log("> no valid zone found",r),i.reject())):i.reject(),i.promise},clear:function(){this.stack=[]},back:function(e){if(e=e||{},!(this.stack.length<=1)){if(this.stack[this.stack.length-1]?.opts.overlay&&this.frameController.isOverlayOpen)return this.stack.pop(),this.frameController.closeOverlay(),Promise.resolve();this.stack.pop();var t=this.stack[this.stack.length-1],t=(e.noLoader||N.evt.emit(N.actions.FRAMELOADING,!0),this.load(t));return t.catch(function(){}).then(function(){e.noLoader||N.evt.emit(N.actions.FRAMELOADING,!1)}),t}},push:function(e,t){this.stack[this.stack.length-1]?.opts.overlay&&this.frameController.isOverlayOpen&&(this.stack.pop(),this.frameController.closeOverlay());var i={type:e,opts:t},o=this,n=(o.stopPoll(),this.stack.push(i),!t.skipCache||t.noLoader||t.overlay||N.evt.emit(N.actions.FRAMELOADING,!0),new Flybits.Deferred);return t.delay?setTimeout(function(){o.load(i).then(function(){n.resolve()}).catch(function(e){n.reject(e)})},1e3):o.load(i).then(function(){n.resolve()}).catch(function(e){n.reject(e)}),n.promise.catch(function(){}).then(function(){!t.skipCache||t.noLoader||t.overlay||N.evt.emit(N.actions.FRAMELOADING,!1)}),n.promise},replace:function(e,t){return this.clear(),this.push(e,t)}},d.DETAILS="details",d.CONCIERGE="concierge";var p=d;function d(e){this.stack=[],this.frameController=e,this.isPolling=!1,this.timer=null,this.delay=3e3}var f,m,g,y,W,v,Z,b,Y,O=Vue.extend({template:"#view-loading"}),O=(Vue.component("loading-view",O),Vue.extend({template:"#loader-bar"})),O=(Vue.component("loader-bar",O),Vue.extend({template:"#login-modal",data:function(){return{isLoading:!1,display:!1,email:"",password:"",deferred:null,error:""}},computed:{hasValue:function(){return this.email&&this.password}},watch:{email:function(e,t){this.error=""},password:function(e,t){this.error=""}},methods:{showControl:function(e){var t=this;this.display=e.isOpen,e.isOpen?(Flybits.Session.disconnect(),setTimeout(function(){t.$el.querySelector(".entry-field.email").focus()},1)):t.reset(),e.deferred&&(this.deferred=e.deferred)},login:function(){if(!this.isLoading&&this.hasValue){if(this.isLoading=!0,!this.email)return this.error="Email is required",void(this.isLoading=!1);if(!this.password)return this.error="Password is required",void(this.isLoading=!1);var t=this;Flybits.Session.connect(new Flybits.idp.FlybitsIDP({email:this.email,password:this.password,projectID:N.cfg.PROJECTID})).then(function(){t.deferred&&t.deferred.resolve(),t.showControl({isOpen:!1})}).catch(function(e){t.error=e.firstError().message,t.deferred&&t.deferred.reject()}).then(function(){t.isLoading=!1})}},reset:function(){this.email="",this.password="",this.error="",this.deferred=null}},mounted:function(){var e=this;N?N.ready.then(function(){N.evt.on(N.actions.PROMPTLOGIN,e.showControl)}):console.log("> warning: login-modal not registered to event bus")},beforeDestroy:function(){N.evt.off(N.actions.PROMPTLOGIN,this.showControl)}})),O=(Vue.component("login-modal",O),Vue.extend({template:"#api-usage",props:{usage:Object,max:Number},computed:{total:function(){var t=this;return this.usage?Object.keys(this.usage).map(function(e){return+t.usage[e]}).reduce(function(e,t){return e+t},0):0},segments:function(){var o=this;return this.usage?Object.keys(this.usage).map(function(e){var t=+o.usage[e],i=+(t/o.max*100).toFixed(2);return{key:e,value:t,styleWidth:(i=0",e,t),e&&e!==m&&this.resetLazyLoad()},"picker.isOpen":function(e,t){e&&this.picker.mode!==m&&this.resetLazyLoad()},rawSearchKey:function(e,t){this.updateSearch()},searchKey:function(e,t){this.updateLazyLoad()}},methods:{updateSearch:O(function(){this.searchKey=this.rawSearchKey},250),removeBGImg:function(){var e=this.$refs.themeslist;e&&(e=e.querySelectorAll(".asset-img")).length&&[].forEach.call(e,function(e){e.removeAttribute("data-was-processed")})},updateLazyLoad:function(){var e=this;setTimeout(function(){e.picker.lazyload&&e.$refs.themeslist&&(e.removeBGImg(),e.picker.lazyload.update())},100)},resetLazyLoad:function(){var e=this;setTimeout(function(){e.$refs.themeslist&&(e.picker.lazyload&&e.picker.lazyload.destroy(),e.picker.lazyload=new LazyLoad({container:e.$refs.themeslist,elements_selector:".asset-img"}))},100)},setMode:function(e){this.theme.mode=e},syncSelected:function(){var t=this.theme.mode,e=this;Vue.nextTick(function(){e.$el.querySelectorAll(".mode").forEach(function(e){e.classList.contains(t)?e.classList.add("selected"):e.classList.remove("selected")})})},apply:function(){var t=this,i=Date.now();t.isLoading=!0,R.upsertTheme(this.theme).catch(function(){console.log("> uh oh")}).then(function(){var e=Date.now()-i;e<800?setTimeout(function(){t.isLoading=!1},800-e):t.isLoading=!1})},setThemePickMode:function(e){(this.picker.mode=e)===f?this.picker.isOpen=!0:e===m?(this.picker.isOpen=!0,this.picker.isSaveOpen=!0):e===g&&(this.picker.isOpen=!0,this.picker.isSaveOpen=!1)},openThemePicker:function(){var e=this;this.setThemePickMode(f),setTimeout(function(){e.$refs.searchField.focus()},10)},openSave:function(){this.setThemePickMode(m)},savePick:function(){this.setThemePickMode(g)},clearSearch:function(){this.rawSearchKey=""},cancel:function(){this.picker.isOpen=!1,this.picker.isSaveOpen=!1,this.picker.tmpThemeDesc="",this.picker.tmpThemeName="",this.picker.lazyload&&this.picker.lazyload.destroy(),this.clearSearch()},saveNewTheme:function(){var e=this.theme.toJSON().payload,e=(e.id=N.util.Obj.guid(),{theme:new c(e,this.theme.groupName),name:this.picker.tmpThemeName,desc:this.picker.tmpThemeDesc}),t=(this.themes.list.push(e),this.isLoading=!0,this);R.upsertThemes(this.themes).then(function(){t.cancel()}).catch(function(e){}).then(function(){t.isLoading=!1})},selectTheme:function(e){var t,i;this.picker.mode===f?(delete(t=e.theme.toJSON().payload).id,this.theme.fromJSON(t),this.cancel()):this.picker.mode===g&&(e.theme.fromJSON((i=this).theme.toJSON().payload),e.name=this.picker.tmpThemeName,e.desc=this.picker.tmpThemeDesc,this.isLoading=!0,R.upsertThemes(this.themes).then(function(){i.cancel()}).catch(function(e){}).then(function(){i.isLoading=!1}))},deleteTheme:function(e){N.util.Obj.removeObject(this.themes.list,e),this.isLoading=!0;var t=this;R.upsertThemes(this.themes).catch(function(e){}).then(function(){t.isLoading=!1})},removeCategory:function(e){N.util.Obj.removeObject(this.theme.pills,e)},addCategory:function(){this.theme.pills.push({displayName:"",label:""})}}})),O=(Vue.component("theme-editor",O),Vue.extend({template:"#profiles-editor",props:{profiles:Object},data:function(){return{modWindowOpen:!1,tmpProfile:null,isLoading:!1}},computed:{isTmpNew:function(){var t=this;return!(this.profiles?this.profiles.list.filter(function(e){return t.tmpProfile&&e.id===t.tmpProfile.id})[0]:r)}},methods:{closeModify:function(){this.tmpProfile=null,this.modWindowOpen=!1},modifyProfile:function(e){this.tmpProfile=e,this.tmpProfile.saveState(),this.modWindowOpen=!0},modifyCTX:function(e){var o=this,t=new Flybits.Deferred;N.evt.emit(N.actions.OPENCTXPICKER,{value:e,deferredPromise:t}),t.promise.then(function(e){i=o.tmpProfile.ctxs,t=e;var t,i=i.filter(function(e){return t&&e.ctx.id===t.ctx.id})[0];e instanceof u&&!i?o.tmpProfile.ctxs.push(e):i&&(i.values=e.values)})},deleteCTX:function(t){t instanceof u&&N.util.Obj.removeObject(this.tmpProfile.ctxs,t,function(e){return e.ctx.id===t.ctx.id})},deleteProfile:function(t){var e=this;N.util.Obj.removeObject(this.profiles.list,t,function(e){return e.id===t.id}),this.isLoading=!0,N.store.upsertProfiles(this.profiles).then(function(){console.log("> yay",t),e.closeModify()}).catch(function(e){console.log("> uh oh")}).then(function(){e.isLoading=!1})},updateProfile:function(e){var t=this;this.isLoading=!0,N.store.upsertProfiles(this.profiles).then(function(){console.log("> yay",e),N.toast("Profiles updated.")}).catch(function(e){console.log("> uh oh"),N.toast("Profiles failed to update.","error")}).then(function(){t.isLoading=!1})},moveUp:function(e){var t=this,i=this.profiles.list.indexOf(e),o=i-1;0<=o&&(e.highlight=!0,setTimeout(function(){N.util.Obj.moveItem(t.profiles.list,i,o),N.store.upsertProfiles(t.profiles).catch(function(e){N.util.Obj.moveItem(t.profiles.list,o,i),console.log("> move up failed",e),N.toast("Move failed to save","error")}),setTimeout(function(){e.highlight=!1},1)},150))},moveDown:function(e){var t=this,i=this.profiles.list.indexOf(e),o=i+1;o move down failed",e),N.toast("Move failed to save","error")}),setTimeout(function(){e.highlight=!1},1)},150))},addProfileTrigger:function(){this.modifyProfile(new i)},cancelModify:function(){this.tmpProfile&&this.tmpProfile.restoreState(),this.closeModify()},saveModify:function(){var t,i=this,o=(this.isTmpNew&&this.profiles.list.push(this.tmpProfile),Date.now());this.isLoading=!0,N.store.upsertProfiles(this.profiles).then(function(){console.log("> yay",i.profiles);var e=(t=Date.now())-o;e<800?setTimeout(function(){i.closeModify()},800-e):i.closeModify()}).catch(function(e){t=Date.now(),console.log("> uh oh")}).then(function(){var e=t-o;e<800?setTimeout(function(){i.isLoading=!1},800-e):i.isLoading=!1})}}})),O=(Vue.component("profiles-editor",O),Vue.extend({template:"#color-picker",props:{value:String,reset:Boolean},data:function(){return{picker:null,previewColor:null}},watch:{value:function(e,t){this.picker.setColor(e),this.previewColor=e}},methods:{setColor:function(e){this.$emit("input",e),this.previewColor=e},clear:function(){this.setColor(null)}},mounted:function(){var t=this;this.picker=new Picker({parent:this.$el.querySelector(".preview"),alpha:!1,onDone:function(e){t.setColor(e.hex.substr(0,7))}}),this.value&&(this.picker.setColor(this.value),this.previewColor=this.value)}})),O=(Vue.component("color-picker",O),T.prototype.fromJSON=function(e){return this.grayscale=!!e.hasOwnProperty("grayscale")&&e.grayscale,this.blur=e.hasOwnProperty("blur")?e.blur:0,this.rotate=e.hasOwnProperty("rotate")?e.rotate:0,this.crop=e.crop?JSON.parse(JSON.stringify(e.crop)):null,this},T.prototype.toJSON=function(){var e={grayscale:this.grayscale,blur:+this.blur,rotate:+this.rotate};return this.crop&&(e.crop=JSON.parse(JSON.stringify(this.crop))),e},T.prototype.equals=function(e){return this.grayscale===e.grayscale&&this.blur===e.blur&&this.rotate===e.rotate&&this.crop==e.crop},T.copy=T.prototype.copy=function(e){return new T(e)},W=T,w.prototype.setStyle=function(e){this.style.fromJSON(e.toJSON())},w.prototype.toJSON=function(){var e={id:this.id,url:this.url,friendlyName:this.name,extension:this.extension};return this.uploadedAt&&(e.uploadedAt=Math.round(this.uploadedAt.getTime()/1e3)),this.size&&(e.size=this.size),e},w.prototype.fromJSON=function(e){this.id=e.id,this.url=e.url,e.uploadedAt&&(this.uploadedAt=new Date(1e3*e.uploadedAt),this.uploadedAtStr=this.uploadedAt.getShortMonthName()+" "+this.uploadedAt.getDate()+", "+this.uploadedAt.getFullYear()),this.name=e.friendlyName,this.extension=e.extension,e.size&&(this.size=e.size,this.sizeStr=w.generateSizeStr(this.size)),this.resolutionStr="",this.dimensions={width:0,height:0};var t=n.createElement("img"),i=(t.style.position="fixed",t.style.left="-1999px",t.style.opacity=0,t.src=this.url,n.body.appendChild(t),this);t.onload=function(){i.dimensions.width=t.naturalWidth,i.dimensions.height=t.naturalHeight,n.body.removeChild(t)}},w.generateSizeStr=function(e){return e<1e3?e+" B":e<1e6?(e/1e3).toFixed(1)+" KB":e<1e9?(e/1e6).toFixed(1)+" MB":e<1e12?(e/1e9).toFixed(1)+" GB":""},w.StyleState=W,v=w,S.prototype.getMore=function(){if(!this.hasMore())return Promise.reject();-1===this.offset?this.offset=0:this.offset=this.offset+this.limit;var i=this,o=new Flybits.Deferred,e=y+"?limit="+this.limit+"&offset="+this.offset;return this.isLoading=!0,Flybits.util.Api.flbFetch(e).then(function(e){i.offset=e.body.pagination.offset,i.total=e.body.pagination.totalRecords;var t=i.images.map(function(e){return e.id}),e=e.body.data.map(function(e){return new v(e)}).filter(function(e){return t.indexOf(e.id)<0});i.images.push.apply(i.images,e),o.resolve(i.images)}).catch(function(e){o.reject(e)}).then(function(){i.isLoading=!1}),o.promise},S.prototype.hasMore=function(){return-1===this.offset||this.offset+this.limit uh oh",e)})},deleteFile:function(){var e=this;this.currentImg&&(this.isLoading=!0,this.store.deleteImage(this.currentImg).then(function(){e.selectImg(null)}).catch(function(e){console.log("> uh oh",e)}).then(function(){e.isLoading=!1}))},uploadFile:function(){var t=this;b.uploadFile({onfilechange:function(){t.isLoading=!0}}).then(function(e){console.log("> fileuplaoded",e);e=new v(e[0]);t.store.insertImage(e),t.selectImg(e)}).catch(function(e){console.log("> uh oh",e)}).then(function(){t.isLoading=!1})},uploadURL:function(){var t=this;this.urlToUpload&&(this.isLoading=!0,b.uploadURL({url:this.urlToUpload}).then(function(e){console.log("> urluplaoded",e),t.selectImg(new v(e[0])),t.urlToUpload=null}).catch(function(e){console.log("> uh oh",e)}).then(function(){t.isLoading=!1}))},openManager:function(e){this.isOpen=!0,this.deferredChild=e.deferredChild,e.existingURL&&this.selectImg(new v({url:e.existingURL})),e.constraints&&(this.constraints=e.constraints)},closeManager:function(e){var t=this;this.isOpen=!1,this.deferredChild&&(e?this.deferredChild.reject():this.deferredChild.resolve(this.currentImg),this.deferredChild=null),setTimeout(function(){t.pixelPusher&&(t.pixelPusher.stopCrop(),t.pixelPusher=null),t.currentImg=null,t.urlToUpload=null,t.isEdit=!1,t.isDetail=!1,t.detailMode=null},200)},revertEditMode:function(){this.pixelPusher&&(this.pixelPusher.stopCrop(),this.pixelPusher=null),this.isDetail=!1,this.detailMode=null,this.isEdit=!1},cancelMode:function(){this.isEdit?this.revertEditMode():this.closeManager(!0)},completeManage:function(){this.closeManager()},selectImg:function(e){this.currentImg=e},listLoad:function(){var e=this,t=this.$refs.imagelist,i=this.$refs.imageswrap;s.requestAnimationFrame(function(){t.scrollTop+t.offsetHeight>=i.offsetHeight-25&&!e.store.isLoading&&e.store.hasMore()&&(console.log("> load moar"),e.store.getMore())})}},mounted:function(){var t=this;setTimeout(function(){N.ready.then(function(){y=N.cfg.HOST+"/kernel/file-manager/files",Flybits.Session.ready.then(function(){t.store.getMore()}),N.evt.on(N.actions.OPENMANAGEIMAGE,function(e){t.openManager(e)})})},1)}}));function T(e){e&&this.fromJSON(e)}function w(e){this.style=new W,e&&this.fromJSON(e)}function S(e){e=e||{},this.offset=-1,this.total=0,this.limit=e.limit||20,this.images=[],this.isLoading=!1}function C(e){this.image=(e=e||{}).image,this.$el=e.$el,this.state=v.StyleState.copy(e.image.style),this.backHistory=[],this.forwardHistory=[],this.cropper,this.constraints=e.constraints,this.commit()}Vue.component("image-manager",O);var O=Vue.extend({template:"#image-field",props:{value:String,aspectRatio:String,editable:{type:Boolean,default:!0}},data:function(){return{currentURL:null}},watch:{value:function(e,t){this.currentURL=e}},methods:{openManager:function(){var t,e,i,o,n;this.editable&&(t=this,i={deferredChild:e=new Flybits.Deferred},this.currentURL&&(i.existingURL=this.currentURL),this.aspectRatio&&(o=+this.aspectRatio.split("/")[0],n=+this.aspectRatio.split("/")[1],i.constraints={aspectRatio:+(o/n).toFixed(4)}),e.promise.then(function(e){t.setImg(e),console.log("> manager closed")}).catch(function(){console.log("> manager error closed")}),N.evt.emit(N.actions.OPENMANAGEIMAGE,i))},setImg:function(e){e&&(this.currentURL=e.url,this.$emit("input",e.url))}},mounted:function(){this.currentURL=this.value}}),O=(Vue.component("image-field",O),Vue.extend({template:"#toggle-view",props:["value","label","inverted"],methods:{toggle:function(){this.$emit("input",!this.value)}}})),O=(Vue.component("toggle-view",O),Vue.extend({template:"#conditional-modal"})),O=(Vue.component("conditional-modal",O),Vue.extend({template:"#context-picker",props:{plugins:Array},data:function(){return{isOpen:!1,tmpCTX:"none",deferredPromise:null,isTmpNew:!0}},computed:{selectedIcon:function(){return"none"!==this.tmpCTX?this.tmpCTX.iconURL:""}},methods:{closePicker:function(e){this.isOpen=!1,this.tmpCTX="none",this.plugins.forEach(function(e){e.clearValues()}),this.deferredPromise&&this.deferredPromise.resolve()},openPicker:function(e){this.isOpen=!0,e&&(this.tmpCTX=e)},saveChanges:function(){var e=this.tmpCTX.getValues();console.log("> oh",e),this.deferredPromise&&(this.deferredPromise.resolve(e),this.deferredPromise=null),this.closePicker()}},mounted:function(){var t=this;N.ready.then(function(){N.evt.on(N.actions.OPENCTXPICKER,function(e){t.deferredPromise=(e=e||{}).deferredPromise,e.value&&e.value instanceof u?(e.value.ctx.setValues(e.value),t.tmpCTX=e.value.ctx,t.isTmpNew=!1):t.isTmpNew=!0,t.openPicker(e.ctx)})})}})),O=(Vue.component("context-picker",O),Vue.extend({template:"#field-type-editor",props:{value:Object},data:function(){return{tmp:{}}},computed:{type:function(){return this.value?this.value.type:null}},watch:{tmp:{deep:!0,handler:function(e,t){var i=Object.keys(this.tmp),o=this.tmp,i=i.map(function(e){return o[e]}).filter(function(e){return e!==r&&null!==e});this.value._input=i.join(",")}}}})),O=(Vue.component("field-type-editor",O),Vue.extend({template:"#ctxvalue-list",props:{ctxs:Array,editable:{default:!0,type:Boolean}},methods:{getValues:function(t){return Object.keys(t.values).map(function(e){return{key:e,value:t.values[e]}})},emitEdit:function(e){this.$emit("edit",e)},emitDelete:function(e){this.$emit("delete",e)}}})),O=(Vue.component("ctxvalue-list",O),Vue.extend({template:"#profile-list",props:{list:{default:function(){return[]},type:Array}},data:function(){return{profileDelete:null}},methods:{confirmDelete:function(e){this.profileDelete=e},cancelDelete:function(){this.profileDelete=null},emitEdit:function(e){this.$emit("edit",e)},emitDelete:function(){this.profileDelete&&this.$emit("delete",this.profileDelete),this.cancelDelete()},emitMoveUp:function(e){this.$emit("moveup",e)},emitMoveDown:function(e){this.$emit("movedown",e)},updateVisibility:function(e){this.$emit("update",e)}}})),O=(Vue.component("profile-list",O),Vue.extend({template:"#qr-field",props:["text"],watch:{text:function(e,t){this.generate()}},methods:{generate:function(){this.text?(this.$refs.qr.innerHTML="",new QRCode(this.$refs.qr,{text:this.text,colorLight:"#1162A4",colorDark:"#ffffff"})):this.$refs.qr.innerHTML=""}},mounted:function(){this.generate()}})),L=(Vue.component("qr-field",O),Q.prototype={beforeRouteEnter:function(e,t,i){var o=e.matched[0]?e.matched[0].components.default:null;setTimeout(function(){N.ready.then(function(){o&&o.extBeforeRouteEnter?o.extBeforeRouteEnter(e,t,i):i()})},1)}},Q);function Q(e){(e=e||{}).beforeRouteEnter&&(this.extBeforeRouteEnter=e.beforeRouteEnter,delete e.beforeRouteEnter),Flybits.util.Obj.extend(this,e,{mutate:!0})}((ee.prototype=Object.create(L.prototype)).constructor=ee).prototype.beforeRouteEnter=function(e,t,i){var o=e.matched[0]?e.matched[0].components.default:null;setTimeout(function(){N.ready.then(function(){Flybits.Session.resolveSession().then(function(){o&&o.extBeforeRouteEnter?o.extBeforeRouteEnter(e,t,i):i()}).catch(function(e){Flybits.Session.clearSession(),N.authClient.request()})})},1)};O=ee;function ee(e){L.call(this,e)}var x,k,te,P,E,ie,oe,ne,re,D={template:"#splash-page",beforeRouteEnter:function(e,t,i){i(function(e){N.ready.then(function(){N.router.replace("journey")})})}},se=(Vue.component("splash-page",D),new L({template:"#landscape",beforeRouteEnter:function(e,t,i){i(function(e){if(N.cfg.defaultWindowCount)for(var t=0;t uh oh",e)}),N.store.getThemes().then(function(e){i.themes=e}).catch(function(e){console.log("> uh oh",e)})},initModeToggles:function(){var e=this.themeToggle.getBoundingClientRect();this.themeToggle.style.top=e.y+"px",this.themeToggle.style.left=e.x+"px",e=this.profileToggle.getBoundingClientRect(),this.profileToggle.style.top=e.y+"px",this.profileToggle.style.right=e.x-105+"px",this.themeToggle.style.position="fixed",this.profileToggle.style.position="fixed",this.themeToggle.setAttribute("data-style",this.themeToggle.getAttribute("style")),this.profileToggle.setAttribute("data-style",this.profileToggle.getAttribute("style"))},switchMode:function(e){e===this.curMode?this.curMode=3:this.curMode=e},engageToggle:function(e){e.classList.add("last"),e.setAttribute("data-style",e.getAttribute("style")),e.removeAttribute("style"),e.classList.remove("inactive")},disengageToggle:function(e,t){e.setAttribute("style",e.getAttribute("data-style")),e.classList.remove("last"),t?e.classList.add("inactive"):e.classList.remove("inactive")},logout:function(){Flybits.Session.clearSession(),N.router.replace("landscape"),N.toast("Successfully logged out")}},mounted:function(){this.themeToggle=this.$el.querySelector(".mode-icon.theme"),this.profileToggle=this.$el.querySelector(".mode-icon.profile")}})),ae=(Vue.component("configure",O),{template:"#link-show",beforeRouteEnter:function(e,t,i){i(function(e){e.init()})},data:function(){return{url:"",host:""}},methods:{init:function(){this.host=s.location.host,this.url="https://"+this.host,new QRCode(this.$refs.qr,{text:this.url,colorLight:"#1162A4",colorDark:"#ffffff"})},goback:function(){N.router.back()}}}),le=(Vue.component("link-show",ae),new L({template:"#auth-callback",beforeRouteEnter:function(e,t,i){i(function(e){N.evt.emit(N.actions.LOADING,!0),N.authClient.requestSPAuthz().then(function(e){e&&e.accessToken?(Flybits.Session.setUserToken(e.accessToken),N.router.replace("configure")):(N.router.replace("landscape"),console.log("> uh oh: no valid accessToken"),N.toast("Authorization denied","error"))}).catch(function(e){console.log("> blah",e),N.router.replace("landscape"),N.toast("Authorization denied","error")}).then(function(){N.evt.emit(N.actions.LOADING,!1)})})}})),ce=(Vue.component("auth-callback",le),function(){const e="https://api.demo.flybits.com/context/ctxdata";function o(e){var t=new Flybits.idp.AnonymousIDP({projectID:N.cfg.PROJECTID});return Flybits.Session.connect(t)}var t="laying",n="front";return new L({template:"#journey",beforeRouteEnter:function(e,t,i){i(function(e){e.init()})},beforeRouteLeave:function(e,t,i){i()},data:function(){return{mode:t,isQRVisible:!1,isIframeLoading:!1,isLoadingData:!1,isOverlayOpen:!1,startLoadTime:0,endLoadTime:0,appURL:"",linkURL:"",modeBannerURL:"",travelMode:!1,modeLabel:"",currentStep:"start",profile:null,iframeLoadPromise:null,nav:null,journey:[{key:"start",label:"Start",icon:"images/off.png",showLabel:!1,action:function(){this.travelMode=!1,this.mode=t,this.appURL="",this.modeBannerURL="",this.modeLabel="",this.iframeLoadPromise=null,this.closeOverlay(),this.nav.stopPoll(),Flybits.util.Api.flbFetch(e,{method:"POST",respType:"none",body:JSON.stringify([{dataTypeID:"ctx.mybank.CheckingAccountTransactions",value:{"Deposit-Amount":0}}])})}},{key:"boot",label:"Launch App",icon:"images/on.png",showLabel:!0,action:function(){function e(){console.log("> iframe loaded"),i.resolve()}var t=this,i=new Flybits.Deferred;this.iframeLoadPromise=i.promise,this.mode=n;this.$refs.frame.addEventListener("load",e),this.iframeLoadPromise.then(function(){t.$refs.frame.removeEventListener("load",e)}),this.startLoad(),Vue.nextTick(function(){t.appURL=N.cfg.APPHOST}),o(N.cfg.PROJECTID).then(function(){return t.nav.push(p.CONCIERGE,{zoneRef:N.cfg.HOMEZONEREF||"homepage",skipCache:!0,noLoader:!0})}).catch(function(e){}).then(function(){setTimeout(function(){t.endLoad()},300)})}},{key:"reload",label:"Reload",icon:"images/refresh.png",showLabel:!0,stateUnselectable:!0,action:function(){this.nav.reload().then(function(){N.toast("Updated")})}}]}},computed:{isPolling:function(){return this.nav&&this.nav.isPolling},isMobile:function(){let e=!1;var t;return t=navigator.userAgent||navigator.vendor||s.opera,e=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))?!0:e},loadingLogo:function(){return N.cfg.themeDefaults.loadingIconURL||"images/tdlogo.png"}},methods:{init:function(){var t=this;N.evt.on(N.actions.FRAMELOADING,function(e){e?t.startLoad():t.endLoad()}),this.nav=N.nav=new p(this)},initProfile:function(){var e,t=Promise.resolve();return this.profile=N.store.profiles?N.store.profiles.list.filter(function(e){return"comms;roaming"===e.description})[0]:null,this.profile||N.toast("Missing profile: comms;roaming","error"),this.profile.authType===i.auth.OIDC?t=function(e){e=new OidcIDP({projectID:N.cfg.PROJECTID,idToken:e.token});return Flybits.Session.connect(e)}(this.profile.auth):this.profile.authType===i.auth.OKTA?t=function(e){e=new Flybits.idp.OAuthIDP({providerName:"okta",projectID:N.cfg.PROJECTID,accessToken:e.token});return Flybits.Session.connect(e)}(this.profile.auth):this.profile.authType===i.auth.JWT?(e=this.profile.auth,Flybits.Session.setUserToken(e.token),t=Flybits.api.User.getSignedInUser()):this.profile.authType===i.auth.FLYBITS?t=function(e){e=new Flybits.idp.FlybitsIDP({email:e.ref,password:e.token,projectID:N.cfg.PROJECTID});return Flybits.Session.connect(e)}(this.profile.auth):this.profile.authType===i.auth.ANONYMOUS&&(t=o(this.profile.auth)),t},switchLayout:function(e){this.mode=e},isCurrent:function(e){return e.key===this.currentStep},selectStep:function(e){e.stateUnselectable||(this.currentStep=e.key),e.action&&e.action.call(this)},togglePolling:function(){this.nav.togglePolling()},toggleQR:function(){this.isQRVisible=!this.isQRVisible},reportTrue:function(){},reportFalse:function(){},gotoConfigure:function(){N.router.push("configure")},gotoDashboard:function(){N.router.push("landscape")},startLoad:function(){this.startLoadTime=Date.now(),this.isLoadingData=!0},endLoad:function(){var e,t;this.isLoadingData&&(this.endLoadTime=Date.now(),e=this.endLoadTime-this.startLoadTime,t=this,setTimeout(function(){t.isLoadingData=!1},e<200?200-e:0))},inject:function(e){var t=this.$refs.frame;this.iframeLoadPromise?this.iframeLoadPromise.then(function(){t.contentWindow.postMessage(e,"*")}):t.contentWindow.postMessage(e,"*")},injectOverlay:function(e){function t(){console.log("> iframe loaded"),i.contentWindow.postMessage(e,"*"),i.removeEventListener("load",t)}var i=this.$refs.overlay;this.isOverlayOpen=!0;i.addEventListener("load",t),i.setAttribute("src",N.cfg.APPHOST)},closeOverlay:function(){this.isOverlayOpen=!1,this.$refs.overlay.removeAttribute("src")},openInternalBrowser:function(e){this.linkURL=e},handleAction:function(e){var t,i,o,n,r=e.actionlink;r&&(r.startsWith("concierge://")?(t=N.util.Browser.getURLParam("zoneReferenceId",r),this.nav.push(p.CONCIERGE,{zoneRef:t,skipCache:!0})):r.startsWith("details://")?(t=e.contentInfo,e=N.util.Browser.getURLParam("contentId",r),i=N.util.Browser.getURLParam("title",r),o=Boolean(N.util.Browser.getURLParam("overlay",r)),e?this.nav.push(p.DETAILS,{contentID:e,pageTitle:i,skipCache:!0,overlay:o}):t&&t.id?this.nav.push(p.DETAILS,{contentID:t.id,pageTitle:i,overlay:o}):console.log("> no valid content info")):r.startsWith("browser://")?(n=N.util.Browser.getURLParam("url",r))&&s.open(n,"_blank"):r.startsWith("https://")?s.open(r,"_blank"):r.startsWith("web://")?(n=N.util.Browser.getURLParam("url",r))&&this.openInternalBrowser(n):r.startsWith("back://")?this.nav.back():console.log("> no supported action"))},handleCtxReport:function(e){e&&Array.isArray(e)&&(e=e.map(function(e){return{dataTypeID:e.pluginId||e.dataTypeID,value:e.values||e.value}})),e=e,Flybits.util.Api.flbFetch("https://api.demo.flybits.com/context/ctxdata",{method:"POST",body:JSON.stringify(e),respType:"none"}).catch(function(e){console.log("> failed to report ctx",e)})},navBack:function(){this.nav.back()},navHome:function(){this.nav.push(p.CONCIERGE,{zoneRef:N.cfg.HOMEZONEREF||"homepage",skipCache:!0,noLoader:!1})}},mounted:function(){var i=this;s.addEventListener("message",function(e){try{var t;e.data&&e.data.flb&&(t=e?.data?.value?JSON.parse(e.data.value):{},"context"===e.data.type?(console.log("> ctx report",t),i.handleCtxReport(t)):"action"===e.data.type?i.handleAction(t):"analytics"===e.data.type?console.log("> analytics",t):"error"===e.data.type?console.log("> error",t):"dismiss"===e.data.type?i.isOverlayOpen&&i.nav.back():console.log("> tada"))}catch(e){console.log("> cannot parse value",e)}}),this.isMobile&&this.selectStep(this.journey[1])}})}()),R=(Vue.component("journey",ce),k={theme:null,themes:null,profiles:null,project:null,zoneContainers:null,init:function(){var t,e,i=new Flybits.Deferred;return x?i.resolve():(t=new Flybits.Deferred,e=N.cfg.SETTINGSHOST+"/session?key="+N.cfg.SETTINGSKEY,Flybits.util.Api.fetch(e,{respType:"json"}).then(function(e){t.resolve(e.body)}).catch(function(e){t.reject(e)}),t.promise.then(function(e){return x=e.key,k.getProfiles()}).then(function(){i.resolve()}).catch(function(e){i.reject(e)})),i.promise},resolveGroupName:function(e){var t=N.cfg.PROJECTID;return N.cfg.hasOwnProperty("variant")&&(t+="-"+N.cfg.variant),t=e?e+t:t},getProject:function(){var e=ue.getProject();return e.then(function(e){k.project=e}),e},upsertTheme:function(t){var i=new Flybits.Deferred,e=N.cfg.SETTINGSHOST+"/model";return Flybits.util.Api.fetch(e,{method:"POST",headers:{key:x,"Content-Type":"application/json"},respType:"none",body:JSON.stringify(t.toJSON())}).then(function(e){k.theme=t,i.resolve(t)}).catch(function(e){console.error(e),i.reject()}),i.promise},upsertProfiles:function(t){var i=new Flybits.Deferred,e=N.cfg.SETTINGSHOST+"/model";return Flybits.util.Api.fetch(e,{method:"POST",headers:{key:x,"Content-Type":"application/json"},respType:"none",body:JSON.stringify(t.toJSON())}).then(function(e){k.profiles=t,i.resolve(t)}).catch(function(e){console.error(e),i.reject()}),i.promise},upsertThemes:function(t){var i=new Flybits.Deferred,e=N.cfg.SETTINGSHOST+"/model";return Flybits.util.Api.fetch(e,{method:"POST",headers:{key:x,"Content-Type":"application/json"},respType:"none",body:JSON.stringify(t.toJSON())}).then(function(e){k.themes=t,i.resolve(t)}).catch(function(e){console.error(e),i.reject()}),i.promise},getTheme:function(){var t=new Flybits.Deferred,i=this.resolveGroupName("theme-"),e=N.cfg.SETTINGSHOST+"/models?groupName="+i;return Flybits.util.Api.fetch(e,{headers:{key:x},respType:"json"}).then(function(e){return new c(e.body.data[0],i)}).catch(function(e){if(404===e.firstError().serverCode)return e=new c(r,i),k.upsertTheme(e)}).then(function(e){e?(k.theme=e,t.resolve(e)):t.reject((new Flybits.Validation).addError("cannot retrieve theme","",{code:Flybits.Validation.type.RETRIEVALERROR}))}),t.promise},getThemes:function(){var t=new Flybits.Deferred,i=N.cfg.store.themeset,e=N.cfg.SETTINGSHOST+"/models?groupName="+i;return Flybits.util.Api.fetch(e,{headers:{key:x},respType:"json"}).then(function(e){return new $(e.body.data[0],i)}).catch(function(e){if(404===e.firstError().serverCode)return e=new $(r,i),k.upsertThemes(e)}).then(function(e){e?(k.themes=e,t.resolve(e)):t.reject((new Flybits.Validation).addError("cannot retrieve available themes","",{code:Flybits.Validation.type.RETRIEVALERROR}))}),t.promise},getProfiles:function(e){var t=new Flybits.Deferred,i=this.resolveGroupName("profiles-"),o=N.cfg.SETTINGSHOST+"/models?groupName="+i;return Flybits.util.Api.fetch(o,{headers:{key:x},respType:"json"}).then(function(e){return new V(e.body.data[0],i)}).catch(function(e){if(404===e.firstError().serverCode)return e=new V(r,i),k.upsertProfiles(e)}).then(function(e){e?(k.profiles=e,t.resolve(e)):t.reject((new Flybits.Validation).addError("cannot retrieve profiles","",{code:Flybits.Validation.type.RETRIEVALERROR}))}),t.promise},getZonesContent:function(e){var{jwt:e,zoneRef:t}=e=e||{},i=new Flybits.Deferred,o=N.cfg.HOST+"/kernel/experiences/zoneconfigurations/contents",e=e||Flybits.Session.userToken;return Flybits.util.Api.fetch(o,{headers:{"x-authorization":e,"content-type":"application/json"},respType:"json"}).then(function(e){k.zoneContainers=new _(e.body),i.resolve(k.zoneContainers.toInjectPayload(t))}).catch(function(e){i.reject(e)}),i.promise},getCachedZone:function(e){return k.zoneContainers?k.zoneContainers.toInjectPayload(e):null},getCachedDetails:function(e,t){return k.zoneContainers?k.zoneContainers.toDetailsPayload(e,t):null},getDetails:function(e,t){var i=(t=t||{})["jwt"],o=new Flybits.Deferred,e=N.cfg.HOST+"/kernel/content/instances/"+e+"?data=true",i=i||Flybits.Session.userToken;return Flybits.util.Api.fetch(e,{headers:{"x-authorization":i,"content-type":"application/json"},respType:"json"}).then(function(e){e=new Flybits.Content(e.body);o.resolve(_.createDetailsPayload(e,t.pageTitle))}).catch(function(e){o.reject(e)}),o.promise},getOverlay:function(e,t){var i=(t=t||{})["jwt"],o=new Flybits.Deferred,e=N.cfg.HOST+"/kernel/content/instances/"+e+"?data=true",i=i||Flybits.Session.userToken;return Flybits.util.Api.fetch(e,{headers:{"x-authorization":i,"content-type":"application/json"},respType:"json"}).then(function(e){e=new Flybits.Content(e.body);o.resolve(_.createOverlayPayload(e,t.pageTitle))}).catch(function(e){o.reject(e)}),o.promise},getCachedOverlay:function(e){return k.zoneContainers?k.zoneContainers.toOverlayPayload(e):null}}),N=(te=new a,P={ready:te.promise,vm:null,evt:null,version:"",ext:{CONFIG:"res/config.json",VERSION:"version.txt"},actions:{LOADING:"loading",CONFIG_UPDATE:"configupdated",PROMPTLOGIN:"prompt_login",OPENMANAGEIMAGE:"open_manage_image",OPENCTXPICKER:"open_context_picker",FRAMELOADING:"frameloading"},cfg:{},util:{},initConfig:function(){var t=this,i=new a;return fetch(this.ext.CONFIG).then(function(e){if(200!==e.status)throw(new l).addError("Configuration file not found","Reverting to default configuration. No configuration found at:"+t.ext.CONFIG,{code:Flybits.Validation.type.MISSINGARG});return e.json()}).then(function(e){t.cfg=P.util.Obj.extend(t.cfg,e.defaults),t.vm.isDebug=t.cfg.debug,t.cfg.defaultWindowCount=P.util.Browser.getURLParam("count")?+P.util.Browser.getURLParam("count"):null,i.resolve(t.cfg)}).catch(function(e){e instanceof l?i.reject(e):i.reject((new l).addError("Failed to read configuration file.","Reverting to default configuration. Configuration format incorrect at:"+t.ext.CONFIG,{code:l.type.MALFORMED}))}),i.promise},checkVersion:function(){fetch(this.ext.VERSION).then(function(e){return e.text()}).then(function(e){console.debug(e),P.version=e})},toast:function(e,t,i){e={text:e,gravity:"bottom",duration:3e3};"error"===t&&(e.backgroundColor="#b20000",e.duration=7e3),i&&(e.duration=i),Toastify(e).showToast()},startup:function(){P.authClient=new IAMFlybits.oauth2PKCE.Client({spHost:P.cfg.HOST,projectID:P.cfg.PROJECTID,clientID:P.cfg.CLIENTID,appCallbackURL:P.cfg.APPHOST+"/dashboard"+P.cfg.res.AUTHCALLBACK}),Flybits.init({HOST:P.cfg.HOST}).then(function(){te.resolve()})}},D=P.router=new VueRouter({routes:[{path:"/",name:"splash",component:D,alias:"/splash"},{path:"/landscape",name:"landscape",component:se},{path:"/configure",name:"configure",component:O},{path:"/onboard",name:"onboard",component:ae},{path:"/auth-callback",name:"auth-callback",component:le},{path:"/journey",name:"journey",component:ce}]}),P.vm=new Vue({router:D,el:".container",data:function(){return{isLoaded:!1,isLoading:!1,isCFGLoaded:!1,errorText:"",sessionUser:null}},computed:{},watch:{},methods:{refreshApp:function(){s.location.reload()}},mounted:function(){this.isLoaded=!0,s.App=P}}),P.vm.on=P.vm.$on,P.vm.off=P.vm.$off,P.vm.emit=P.vm.$emit,P.evt=P.vm,E=[],ie=0,P.evt.on(P.actions.LOADING,function(e,t){e?(P.vm.isLoading=!0,E.length<=0&&(ie=(new Date).getTime()),E.push(!0)):!e&&1 "+e.displayName:e.displayName,a.push({key:i="data."+i,name:t,type:e.type,uiType:e.uiType}))})}var a=[];return s(e.schema),a.sort(function(e,t){e=e.name.toUpperCase(),t=t.name.toUpperCase();return e