Socket
Socket
Sign inDemoInstall

@candulabs/core

Package Overview
Dependencies
Maintainers
5
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@candulabs/core - npm Package Compare versions

Comparing version 0.7.1-alpha.22 to 0.7.1-alpha.23

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## 0.7.1-alpha.23 (2021-05-13)
**Note:** Version bump only for package @candulabs/core
## 0.7.1-alpha.22 (2021-05-13)

@@ -8,0 +16,0 @@

2

dist/index.cjs.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@candulabs/eventing"),e=require("invariant");require("setimmediate");var r=require("dataloader");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=n(e),i=n(r),a=Array.isArray;var u="https://cdn.candu.ai",s="/api/checklistItems",c="/api/cards",l="/api/segmentMemberships",d="/api/segmentsDefinition",p="/api/tutorialMetadata",f="/api/tutorialDocumentsSdk",v=function(t){if(!document.querySelectorAll('[href="'+t+'"]').length){var e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.appendChild(e)}};var h=function(){function t(t){this.adjacencyList={},this.rootDocument=t,this.adjacencyList[t]=[]}return t.prototype.get=function(t){return this.adjacencyList[t]},t.prototype.add=function(t,e){var r=this;if(this.adjacencyList[t]||(this.adjacencyList[t]=[]),!this.adjacencyList[e])return this.adjacencyList[t].push(e),this.adjacencyList[e]=[],!0;if(this.adjacencyList[t].includes(e))return!0;var n=function(e){if(e===t)return!0;for(var o=0,i=r.adjacencyList[e];o<i.length;o++){var a=i[o];if(n(a))return!0}return!1};return!n(e)&&(this.adjacencyList[t].push(e),!0)},t}(),E=function(t,e){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function _(t,e){function r(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var y=function(){return(y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function g(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function T(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(a,u)}s((n=n.apply(t,e||[])).next())}))}function b(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function O(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)n[o]=i[a];return n}var S="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(t){var e={exports:{}};return t(e,e.exports),e.exports}var I="object"==typeof S&&S&&S.Object===Object&&S,m="object"==typeof self&&self&&self.Object===Object&&self,R=I||m||Function("return this")(),C=R.Symbol,N=Object.prototype,x=N.hasOwnProperty,L=N.toString,D=C?C.toStringTag:void 0;var P=function(t){var e=x.call(t,D),r=t[D];try{t[D]=void 0;var n=!0}catch(t){}var o=L.call(t);return n&&(e?t[D]=r:delete t[D]),o},j=Object.prototype.toString;var w=function(t){return j.call(t)},M=C?C.toStringTag:void 0;var k=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":M&&M in Object(t)?P(t):w(t)};var U=function(t){return null!=t&&"object"==typeof t};var G=function(t){return"string"==typeof t||!a(t)&&U(t)&&"[object String]"==k(t)};var F,V,B=function(t){return"number"==typeof t||U(t)&&"[object Number]"==k(t)},H=/^([a-zA-Z0-9]|_|-)+$/,W=function(t){return G(t)&&t.length>=3&&t.length<100&&H.test(t)},Y=function(t){return B(t)&&t>=0},z=function(t){return G(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10},K=function(t){return Y(t)||G(t)&&t.trim().length>0};exports.ACTORS=void 0,(F=exports.ACTORS||(exports.ACTORS={})).SDK="SDK",F.PREVIEW="PREVIEW",exports.MESSAGES=void 0,(V=exports.MESSAGES||(exports.MESSAGES={})).BOOTSTRAP="Bootstrap",V.CHANGE_POSITION="ChangePosition",V.CLOSE_PREVIEW="ClosePreview",V.PREVIEW_LOADED="PreviewLoaded",V.SET_AVALIABLE_PORTALS="SetAvaliablePortals",V.SET_CONTENT="SetContent",V.SET_SELECTED_ELEMENT="SetSelectedElement",V.SET_VIEW_MODE="SetViewMode",V.ADD_ELEMENT="AddElement",V.REMOVE_ELEMENT="RemoveElement",V.UPDATE_ELEMENT="UpdateElement",V.SET_ELEMENT="SetElement";var $=function(t,e){return void 0===e&&(e={}),y({type:t},e)},J={bootstrap:function(t,e,r,n){return $(exports.MESSAGES.BOOTSTRAP,{clientToken:t,userId:e,version:r,preview:n})},changePosition:function(t,e){return $(exports.MESSAGES.CHANGE_POSITION,{mouseEvent:t,top:e})},closePreview:function(){return $(exports.MESSAGES.CLOSE_PREVIEW)},previewLoaded:function(){return $(exports.MESSAGES.PREVIEW_LOADED)},setAvaliablePortals:function(t){return $(exports.MESSAGES.SET_AVALIABLE_PORTALS,{avaliablePortals:t})},addElement:function(t){return $(exports.MESSAGES.ADD_ELEMENT,{element:t})},removeElement:function(t){return $(exports.MESSAGES.REMOVE_ELEMENT,{id:t})},updateElement:function(t){return $(exports.MESSAGES.UPDATE_ELEMENT,{element:t})},setContent:function(t){return $(exports.MESSAGES.SET_CONTENT,{content:t})},setViewMode:function(t){return $(exports.MESSAGES.SET_VIEW_MODE,{viewMode:t})},setSelectedElement:function(t){return $(exports.MESSAGES.SET_SELECTED_ELEMENT,{element:t})}},q=function(t){var e=t.source,r=t.destination;return{read:function(t){var e=t.actor,n=t.message;return e===r?n:null},write:function(t){return{actor:e,message:t}}}};var Z,X,Q,tt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};exports.TRIGGERS=void 0,(exports.TRIGGERS||(exports.TRIGGERS={})).ON_CLICK="OnClick",exports.CATEGORIES=void 0,(Z=exports.CATEGORIES||(exports.CATEGORIES={})).NATIVE="Native",Z.PENDO="Pendo",exports.HANDLER_TYPES=void 0,(X=exports.HANDLER_TYPES||(exports.HANDLER_TYPES={})).NAVIGATE="Navigate",X.CHANGE_TUTORIAL="ChangeTutorial",X.OPEN_GUIDE="OpenGuide",X.DISMISSED_CARD="DismissedCard",exports.COLORS=void 0,(Q=exports.COLORS||(exports.COLORS={})).PRIMARY="primary",Q.SECONDARY="primary",Q.WARNING="warning",Q.DANGER="danger",Q.NEUTRAL="neutral",Q.ACTIVE="active",Q.INFO="info";var et,rt=exports.COLORS.PRIMARY;exports.Mark=void 0,(et=exports.Mark||(exports.Mark={})).U="U",et.B="B",et.Em="Em",et.InlineCode="InlineCode";var nt,ot,it=function(t){return G(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/)},at=function(t){return Y(t)},ut=function(t){return W(t)};exports.CheckListItemStatus=void 0,(nt=exports.CheckListItemStatus||(exports.CheckListItemStatus={})).NotStared="NotStarted",nt.InProgress="InProgress",nt.Done="Done",exports.CheckListScope=void 0,(ot=exports.CheckListScope||(exports.CheckListScope={})).User="User",ot.Account="Account";var st,ct;exports.FRAME_SIZES=void 0,(st=exports.FRAME_SIZES||(exports.FRAME_SIZES={})).COLLAPSED="Collapsed",st.EXPANDED="Expanded",st.MINIMIZED="Minimized",exports.PREVIEW_MODES=void 0,(ct=exports.PREVIEW_MODES||(exports.PREVIEW_MODES={})).TUTORIAL="Tutorial",ct.PORTAL="Portal";var lt,dt;exports.StateScope=void 0,(lt=exports.StateScope||(exports.StateScope={})).Global="Global",lt.Carried="Carried",exports.StateResolverType=void 0,(dt=exports.StateResolverType||(exports.StateResolverType={})).CanduCdn="CanduCdn",dt.CheckListApi="CheckListApi",dt.CardApi="CardApi";var pt,ft;exports.StyleguideScope=void 0,(pt=exports.StyleguideScope||(exports.StyleguideScope={})).Global="Global",pt.Organization="Organization",exports.CSSNodeTypes=void 0,(ft=exports.CSSNodeTypes||(exports.CSSNodeTypes={})).Root="root",ft.Rule="rule",ft.Atrule="atrule",ft.Decl="decl",ft.Any="any";var vt,ht={button:{childClassNames:{icon:"button-icon"},variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},badge:{variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},typography:{variants:{typography:function(t){return"typography-"+t}}}},Et=function(t){return"candu.sdk."+t},_t=function(t){return Et("error."+t)},yt={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",PROVIDER_ERROR:"provider_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},gt={HEARTBEAT:Et("heartbeat"),PREVIEW_OPEN:Et("preview.open"),PORTAL:Et("portal"),TUTORIAL:Et("tutorial"),TUTORIAL_INTERACTION:Et("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:_t("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:_t("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:_t("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:_t("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:_t("commit_api"),TUTORIAL_LOADING_ERROR:_t("tutorial"),UNKOWN_NODE_TYPE:_t(yt.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:_t(yt.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:_t(yt.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:_t(yt.TUTORIAL_ERROR),PORTAL_ERROR:_t(yt.PORTAL_ERROR),PROVIDER_ERROR:_t(yt.PROVIDER_ERROR),STYLEGUIDE_MAP_ERROR:_t(yt.TUTORIAL_ERROR),RENDER_NODE_ERROR:_t(yt.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:_t("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:_t("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:_t("state_fetch_failed"),STATE_UPDATE_FAILED:_t("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:_t("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:Et("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:Et("tutorial.checklist_group_complete"),CARD_DISMISSED:Et("tutorial.card_dismissed")},Tt=function(t){return Et("metric."+t)},bt={SEGMENT_MEMBERSHIP_LOAD_TIME:Tt("segment_membership_load_time"),PORTAL_LOAD_TIME:Tt("portal_load_time"),CONTENT_LOAD_TIME:Tt("content_load_time"),TUTORIAL_LOAD_TIME:Tt("tutorial_load_time"),TUTORIAL_DOCUMENT_MOUNT_TIME:Tt("tutorial_document_mount_time")},Ot=function(t){return"An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: "+t+"."},St=((vt={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n"})[gt.PORTAL_ASSET_NOT_FOUND]="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",vt[gt.PORTAL_NO_SEGMENT_IDS]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",vt[gt.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",vt[gt.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",vt[gt.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",vt[gt.UNKOWN_INLINE_NODE_TYPE]=Ot(yt.UNKOWN_INLINE_NODE_TYPE),vt[gt.UNKOWN_NODE_TYPE]=Ot(yt.UNKOWN_NODE_TYPE),vt[gt.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",vt[gt.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",vt[gt.PORTAL_ERROR]="An error has occured within Portal",vt[gt.PROVIDER_ERROR]="An error has occured within Provider",vt[gt.TUTORIAL_ERROR]="An error has occured within Tutorial",vt[gt.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",vt[gt.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",vt[gt.STATE_FETCH_FAILED]="An error has occured while fetching state:",vt[gt.STATE_UPDATE_FAILED]="An error has occured while updating state:",vt[gt.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",vt),At={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},It={error:console.error,warning:console.warn},mt=function(t){return o.default(!t||tt(t),"(Candu) styleguide must be undefined or an object")},Rt=function(t,e){return T(void 0,void 0,void 0,(function(){return b(this,(function(r){switch(r.label){case 0:return[4,fetch(t,e&&{headers:e})];case 1:return[2,r.sent().json()]}}))}))},Ct=function(t){return Rt("https://api.candu.ai"+t,{SDKVersion:"0.7.1-alpha.22"})},Nt=function(t){return Rt(""+u+t,{SDKVersion:"0.7.1-alpha.22"})},xt=function(t){return{byId:function(e){return Ct(f+"?token="+t+"&finder=latestPublished&tutorialId="+e)},bySlug:function(e){return Nt("/tutorials/"+t+"/"+e+".json")},byContentHash:function(e){return Nt("/tutorials/"+t+"/"+e+".json")}}},Lt={tutorialDocumentLatestSaved:function(t,e){return T(void 0,void 0,void 0,(function(){return b(this,(function(r){return[2,Ct(f+"/"+e+"?token="+t)]}))}))},portalAsset:function(t,e,r){return T(void 0,void 0,void 0,(function(){var n,o;return b(this,(function(i){return(null===(o=r)||void 0===o?void 0:o.length)?(n="?segmentIds="+r.join(","),[2,Nt("/portalMemberships/"+t+"/"+e+"/head.json"+n)]):[2,Nt("/portals/"+t+"/"+e+"/head.json")]}))}))},contentDocument:function(t,e,r){return T(void 0,void 0,void 0,(function(){var n,o,i;return b(this,(function(a){switch(a.label){case 0:return n=(null===(i=r)||void 0===i?void 0:i.length)?"?segmentIds="+r.join(","):"",[4,fetch(u+"/contentDocument/"+t+"/"+e+".json"+n)];case 1:return[2,(o=a.sent()).ok?o.json():null]}}))}))},segmentMembership:function(t,e){return T(void 0,void 0,void 0,(function(){return b(this,(function(r){return[2,Ct(l+"/"+e+"?token="+t)]}))}))},segmentDefinition:function(t){return T(void 0,void 0,void 0,(function(){return b(this,(function(e){return[2,Ct(d+"?token="+t)]}))}))},tutorialMetadata:function(t){return T(void 0,void 0,void 0,(function(){return b(this,(function(e){return[2,Ct(p+"?token="+t)]}))}))},tutorialDocument:function(t,e,r){var n=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.slug,u=xt(e);return ut(a)?u.bySlug(a):at(o)?u.byId(o):it(n)?u.byContentHash(n):tt(i)?Promise.resolve(i):(It.error(St[gt.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(gt.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},Dt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.error.apply(console,t)},Pt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.warn.apply(console,t)},jt={error:Dt,warning:Pt},wt=function(){function t(){this.subscribers=[]}return t.prototype.subscribe=function(t){var e=this;return this.subscribers.push(t),function(){e.subscribers[e.subscribers.indexOf(t)]=function(){}}},t.prototype.notify=function(t){this.subscribers.forEach((function(e){return e(t)}))},t.prototype.clear=function(){this.subscribers=[]},t}(),Mt=function(){function t(t,e){var r=this;this.state="waiting",this.currentElement=null,this.selector=t,this.renderToElement=e,this.findAndRender(),this.observer=new MutationObserver((function(t){switch(r.state){case"waiting":t.some((function(t){return!!t.addedNodes.length}))&&r.findAndRender();break;case"mounted":t.forEach((function(t){t.removedNodes.length&&t.removedNodes.forEach((function(t){t===r.currentElement&&(r.currentElement=null,r.state="waiting")}))}));break;default:throw new Error("Unhandled state: "+r.state)}})),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1})}return t.prototype.findAndRender=function(){var t=document.querySelector(this.selector);t&&(this.renderToElement(t),this.currentElement=t,this.state="mounted")},t.prototype.stopObserving=function(){this.observer.disconnect()},t}(),kt=function(){function t(){this.onClientUpdateObserver=new wt}return t.prototype.attachClient=function(t){this.client=t,this.onClientUpdateObserver.notify({client:t})},t.prototype.detachClient=function(){this.client&&(this.client=null,this.onClientUpdateObserver.notify({client:null}))},t.prototype.onClientUpdate=function(t){var e=this.onClientUpdateObserver.subscribe(t);return this.client&&t({client:this.client}),e},t}();var Ut="@candulabs/core",Gt="0.7.1-alpha.22",Ft=function(){function t(t){this.init(t)}return t.prototype.getInfo=function(){return{core:{version:Gt,name:Ut},sdk:{version:this.version,name:this.name}}},t.prototype.attachClient=function(t){return this.provider.preview.attachClient(t)},t.prototype.detachClient=function(){return this.provider.preview.detachClient()},Object.defineProperty(t.prototype,"provider",{get:function(){return this.getProvider()},enumerable:!0,configurable:!0}),t}(),Vt=function(t){switch(t.trigger){case exports.TRIGGERS.ON_CLICK:default:return"onClick"}},Bt=function(t,e){var r,n,o,i,a,u;if("Link"===t.type&&(null===(r=t.props)||void 0===r?void 0:r.href)){var s=t.props.href+" Link Clicked",c=null===(o=null===(n=t)||void 0===n?void 0:n.nodes)||void 0===o?void 0:o[0];if(c){var l=e.document.nodes[c];"Text"===(null===(i=l)||void 0===i?void 0:i.type)&&(null===(u=null===(a=l)||void 0===a?void 0:a.props)||void 0===u?void 0:u.children)&&(s=l.props.children+" Link Clicked")}return{onClick:function(){var r;return e.provider.eventing.track(gt.TUTORIAL_INTERACTION,{trigger:exports.TRIGGERS.ON_CLICK,category:t.type,eventName:s,handler:{href:null===(r=t.props)||void 0===r?void 0:r.href,type:exports.HANDLER_TYPES.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var d=function(t,r){e.provider.eventing.track(gt.TUTORIAL_INTERACTION,y(y({},t),r||{}))};return t.data.actions.map((function(t){return function(t,e,r){var n,o,i;switch(t.handler.type){case exports.HANDLER_TYPES.NAVIGATE:return(n={})[Vt(t)]=function(n){n.stopPropagation();var o=t.handler,i=o.href,a=o.target,u=r||{},s=u.parentTrackers,c=g(u,["parentTrackers"]);s&&s.forEach((function(r){return e(t,r)})),e(t,c),"Blank"===a?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},n;case exports.HANDLER_TYPES.CHANGE_TUTORIAL:return(o={})[Vt(t)]=function(){var e=t.handler.tutorialId;Dt("TODO -> change tutorial",e)},o;case exports.HANDLER_TYPES.OPEN_GUIDE:return(i={})[Vt(t)]=function(){var e=t.handler.guideId;Dt("TODO -> open guide",e)},i;default:return{}}}(t,d,e.trackingIdentifiers)})).reduce((function(t,e){return y(y({},t),e)}),{})},Ht=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},Wt=function(t,e){var r=t.states;return r&&e.stateProviderInstances.filter((function(t){return!!r[t.providerId]}))},Yt=function(t,e){var r=t.nodes;return r&&r.map((function(t){return e.document.nodes[t]})).filter((function(t){return!!t})).map((function(t){return Wt(t,e)||[]})).reduce((function(t,e){return t.concat(e)}),[])},zt=function(t,e){try{var r=e.provider,n=e.document,o=e.trackingIdentifiers,i=n.nodes[t];if(!i)return jt.error("Document is corrupted. Refusing to move further."),null;var a=function(t){return zt(t,e)},u=i.type,s=i.props,c=i.css,l=y(y(y({},s||{}),{style:c||{},children:Ht(i,a)}),Bt(i,{trackingIdentifiers:o,provider:r,document:n})),d={nodeId:t,node:i,document:n,render:{node:a,styleguide:function(t,r){return void 0===r&&(r={}),e.renderNode(t,{api:d,attributes:r})},tutorial:function(t){return e.renderTutorial(t)},portal:function(t){return e.renderPortal(t)}},trackingIdentifiers:o,stateInstances:Wt(i,e),childrenStateInstances:Yt(i,e)},p=d.render.styleguide(u,l);return p||(jt.error(St[gt.UNKOWN_NODE_TYPE],{type:u}),r.eventing.error(new Error(St[gt.UNKOWN_NODE_TYPE]),{type:u}),null)}catch(t){return jt.error(St[gt.STYLEGUIDE_MAP_ERROR],t),e.provider.eventing.error(t),null}};var Kt,$t=function(t){if(!tt(t))return!1;var e=k(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Jt=R["__core-js_shared__"],qt=(Kt=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Kt:"";var Zt=function(t){return!!qt&&qt in t},Xt=Function.prototype.toString;var Qt=function(t){if(null!=t){try{return Xt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},te=/^\[object .+?Constructor\]$/,ee=Function.prototype,re=Object.prototype,ne=ee.toString,oe=re.hasOwnProperty,ie=RegExp("^"+ne.call(oe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ae=function(t){return!(!tt(t)||Zt(t))&&($t(t)?ie:te).test(Qt(t))};var ue=function(t,e){return null==t?void 0:t[e]};var se=function(t,e){var r=ue(t,e);return ae(r)?r:void 0},ce=se(Object,"create");var le=function(){this.__data__=ce?ce(null):{},this.size=0};var de=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pe=Object.prototype.hasOwnProperty;var fe=function(t){var e=this.__data__;if(ce){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return pe.call(e,t)?e[t]:void 0},ve=Object.prototype.hasOwnProperty;var he=function(t){var e=this.__data__;return ce?void 0!==e[t]:ve.call(e,t)};var Ee=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ce&&void 0===e?"__lodash_hash_undefined__":e,this};function _e(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_e.prototype.clear=le,_e.prototype.delete=de,_e.prototype.get=fe,_e.prototype.has=he,_e.prototype.set=Ee;var ye=_e;var ge=function(){this.__data__=[],this.size=0};var Te=function(t,e){return t===e||t!=t&&e!=e};var be=function(t,e){for(var r=t.length;r--;)if(Te(t[r][0],e))return r;return-1},Oe=Array.prototype.splice;var Se=function(t){var e=this.__data__,r=be(e,t);return!(r<0)&&(r==e.length-1?e.pop():Oe.call(e,r,1),--this.size,!0)};var Ae=function(t){var e=this.__data__,r=be(e,t);return r<0?void 0:e[r][1]};var Ie=function(t){return be(this.__data__,t)>-1};var me=function(t,e){var r=this.__data__,n=be(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Re(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Re.prototype.clear=ge,Re.prototype.delete=Se,Re.prototype.get=Ae,Re.prototype.has=Ie,Re.prototype.set=me;var Ce=Re,Ne=se(R,"Map");var xe=function(){this.size=0,this.__data__={hash:new ye,map:new(Ne||Ce),string:new ye}};var Le=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var De=function(t,e){var r=t.__data__;return Le(e)?r["string"==typeof e?"string":"hash"]:r.map};var Pe=function(t){var e=De(this,t).delete(t);return this.size-=e?1:0,e};var je=function(t){return De(this,t).get(t)};var we=function(t){return De(this,t).has(t)};var Me=function(t,e){var r=De(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ke(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ke.prototype.clear=xe,ke.prototype.delete=Pe,ke.prototype.get=je,ke.prototype.has=we,ke.prototype.set=Me;var Ue=ke;function Ge(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(Ge.Cache||Ue),r}Ge.Cache=Ue;var Fe=Ge,Ve=Fe((function(t,e){var r,n,o=t.provider,i=t.portal,a=t.tutorial,u=o.styleguide;return a&&(n=a.styleguide),i&&(r=i.styleguide),y(y(y(y({},u||{}),r||{}),n||{}),e||{})})),Be=function(t){return"candu-styleguide-"+t},He=function(t,e){var r,n,o,i,a="string"==typeof e&&e.split(" ");return a?1===a.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===a.length?((n={})[t+"Top"]=a[0],n[t+"Right"]=a[1],n[t+"Bottom"]=a[0],n[t+"Left"]=a[1],n):3===a.length?((o={})[t+"Top"]=a[0],o[t+"Right"]=a[1],o[t+"Bottom"]=a[2],o[t+"Left"]=a[1],o):((i={})[t+"Top"]=a[0],i[t+"Right"]=a[1],i[t+"Bottom"]=a[2],i[t+"Left"]=a[3],i):{}};var We=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o};var Ye=function(){this.__data__=new Ce,this.size=0};var ze=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ke=function(t){return this.__data__.get(t)};var $e=function(t){return this.__data__.has(t)};var Je=function(t,e){var r=this.__data__;if(r instanceof Ce){var n=r.__data__;if(!Ne||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ue(n)}return r.set(t,e),this.size=r.size,this};function qe(t){var e=this.__data__=new Ce(t);this.size=e.size}qe.prototype.clear=Ye,qe.prototype.delete=ze,qe.prototype.get=Ke,qe.prototype.has=$e,qe.prototype.set=Je;var Ze=qe;var Xe=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Qe=function(t){return this.__data__.has(t)};function tr(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Ue;++e<r;)this.add(t[e])}tr.prototype.add=tr.prototype.push=Xe,tr.prototype.has=Qe;var er=tr;var rr=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var nr=function(t,e){return t.has(e)};var or=function(t,e,r,n,o,i){var a=1&r,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var l=-1,d=!0,p=2&r?new er:void 0;for(i.set(t,e),i.set(e,t);++l<u;){var f=t[l],v=e[l];if(n)var h=a?n(v,f,l,e,t,i):n(f,v,l,t,e,i);if(void 0!==h){if(h)continue;d=!1;break}if(p){if(!rr(e,(function(t,e){if(!nr(p,e)&&(f===t||o(f,t,r,n,i)))return p.push(e)}))){d=!1;break}}else if(f!==v&&!o(f,v,r,n,i)){d=!1;break}}return i.delete(t),i.delete(e),d},ir=R.Uint8Array;var ar=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var ur=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},sr=C?C.prototype:void 0,cr=sr?sr.valueOf:void 0;var lr=function(t,e,r,n,o,i,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new ir(t),new ir(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Te(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=ar;case"[object Set]":var s=1&n;if(u||(u=ur),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var l=or(u(t),u(e),n,o,i,a);return a.delete(t),l;case"[object Symbol]":if(cr)return cr.call(t)==cr.call(e)}return!1};var dr=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var pr=function(t,e,r){var n=e(t);return a(t)?n:dr(n,r(t))};var fr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var vr=function(){return[]},hr=Object.prototype.propertyIsEnumerable,Er=Object.getOwnPropertySymbols,_r=Er?function(t){return null==t?[]:(t=Object(t),fr(Er(t),(function(e){return hr.call(t,e)})))}:vr;var yr=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var gr=function(t){return U(t)&&"[object Arguments]"==k(t)},Tr=Object.prototype,br=Tr.hasOwnProperty,Or=Tr.propertyIsEnumerable,Sr=gr(function(){return arguments}())?gr:function(t){return U(t)&&br.call(t,"callee")&&!Or.call(t,"callee")};var Ar=function(){return!1},Ir=A((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?R.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ar;t.exports=i})),mr=/^(?:0|[1-9]\d*)$/;var Rr=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&mr.test(t))&&t>-1&&t%1==0&&t<e};var Cr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Nr={};Nr["[object Float32Array]"]=Nr["[object Float64Array]"]=Nr["[object Int8Array]"]=Nr["[object Int16Array]"]=Nr["[object Int32Array]"]=Nr["[object Uint8Array]"]=Nr["[object Uint8ClampedArray]"]=Nr["[object Uint16Array]"]=Nr["[object Uint32Array]"]=!0,Nr["[object Arguments]"]=Nr["[object Array]"]=Nr["[object ArrayBuffer]"]=Nr["[object Boolean]"]=Nr["[object DataView]"]=Nr["[object Date]"]=Nr["[object Error]"]=Nr["[object Function]"]=Nr["[object Map]"]=Nr["[object Number]"]=Nr["[object Object]"]=Nr["[object RegExp]"]=Nr["[object Set]"]=Nr["[object String]"]=Nr["[object WeakMap]"]=!1;var xr=function(t){return U(t)&&Cr(t.length)&&!!Nr[k(t)]};var Lr=function(t){return function(e){return t(e)}},Dr=A((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&I.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),Pr=Dr&&Dr.isTypedArray,jr=Pr?Lr(Pr):xr,wr=Object.prototype.hasOwnProperty;var Mr=function(t,e){var r=a(t),n=!r&&Sr(t),o=!r&&!n&&Ir(t),i=!r&&!n&&!o&&jr(t),u=r||n||o||i,s=u?yr(t.length,String):[],c=s.length;for(var l in t)!e&&!wr.call(t,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Rr(l,c))||s.push(l);return s},kr=Object.prototype;var Ur=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||kr)};var Gr=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Fr=Object.prototype.hasOwnProperty;var Vr=function(t){if(!Ur(t))return Gr(t);var e=[];for(var r in Object(t))Fr.call(t,r)&&"constructor"!=r&&e.push(r);return e};var Br=function(t){return null!=t&&Cr(t.length)&&!$t(t)};var Hr=function(t){return Br(t)?Mr(t):Vr(t)};var Wr=function(t){return pr(t,Hr,_r)},Yr=Object.prototype.hasOwnProperty;var zr=function(t,e,r,n,o,i){var a=1&r,u=Wr(t),s=u.length;if(s!=Wr(e).length&&!a)return!1;for(var c=s;c--;){var l=u[c];if(!(a?l in e:Yr.call(e,l)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var p=!0;i.set(t,e),i.set(e,t);for(var f=a;++c<s;){var v=t[l=u[c]],h=e[l];if(n)var E=a?n(h,v,l,e,t,i):n(v,h,l,t,e,i);if(!(void 0===E?v===h||o(v,h,r,n,i):E)){p=!1;break}f||(f="constructor"==l)}if(p&&!f){var _=t.constructor,y=e.constructor;_==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(p=!1)}return i.delete(t),i.delete(e),p},Kr=se(R,"DataView"),$r=se(R,"Promise"),Jr=se(R,"Set"),qr=se(R,"WeakMap"),Zr=Qt(Kr),Xr=Qt(Ne),Qr=Qt($r),tn=Qt(Jr),en=Qt(qr),rn=k;(Kr&&"[object DataView]"!=rn(new Kr(new ArrayBuffer(1)))||Ne&&"[object Map]"!=rn(new Ne)||$r&&"[object Promise]"!=rn($r.resolve())||Jr&&"[object Set]"!=rn(new Jr)||qr&&"[object WeakMap]"!=rn(new qr))&&(rn=function(t){var e=k(t),r="[object Object]"==e?t.constructor:void 0,n=r?Qt(r):"";if(n)switch(n){case Zr:return"[object DataView]";case Xr:return"[object Map]";case Qr:return"[object Promise]";case tn:return"[object Set]";case en:return"[object WeakMap]"}return e});var nn=rn,on="[object Object]",an=Object.prototype.hasOwnProperty;var un=function(t,e,r,n,o,i){var u=a(t),s=a(e),c=u?"[object Array]":nn(t),l=s?"[object Array]":nn(e),d=(c="[object Arguments]"==c?on:c)==on,p=(l="[object Arguments]"==l?on:l)==on,f=c==l;if(f&&Ir(t)){if(!Ir(e))return!1;u=!0,d=!1}if(f&&!d)return i||(i=new Ze),u||jr(t)?or(t,e,r,n,o,i):lr(t,e,c,r,n,o,i);if(!(1&r)){var v=d&&an.call(t,"__wrapped__"),h=p&&an.call(e,"__wrapped__");if(v||h){var E=v?t.value():t,_=h?e.value():e;return i||(i=new Ze),o(E,_,r,n,i)}}return!!f&&(i||(i=new Ze),zr(t,e,r,n,o,i))};var sn=function t(e,r,n,o,i){return e===r||(null==e||null==r||!U(e)&&!U(r)?e!=e&&r!=r:un(e,r,n,o,t,i))};var cn=function(t,e,r,n){var o=r.length,i=o,a=!n;if(null==t)return!i;for(t=Object(t);o--;){var u=r[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var s=(u=r[o])[0],c=t[s],l=u[1];if(a&&u[2]){if(void 0===c&&!(s in t))return!1}else{var d=new Ze;if(n)var p=n(c,l,s,t,e,d);if(!(void 0===p?sn(l,c,3,n,d):p))return!1}}return!0};var ln=function(t){return t==t&&!tt(t)};var dn=function(t){for(var e=Hr(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,ln(o)]}return e};var pn=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var fn=function(t){var e=dn(t);return 1==e.length&&e[0][2]?pn(e[0][0],e[0][1]):function(r){return r===t||cn(r,t,e)}};var vn=function(t){return"symbol"==typeof t||U(t)&&"[object Symbol]"==k(t)},hn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,En=/^\w*$/;var _n=function(t,e){if(a(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!vn(t))||(En.test(t)||!hn.test(t)||null!=e&&t in Object(e))};var yn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gn=/\\(\\)?/g,Tn=function(t){var e=Fe(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(yn,(function(t,r,n,o){e.push(n?o.replace(gn,"$1"):r||t)})),e})),bn=C?C.prototype:void 0,On=bn?bn.toString:void 0;var Sn=function t(e){if("string"==typeof e)return e;if(a(e))return We(e,t)+"";if(vn(e))return On?On.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var An=function(t){return null==t?"":Sn(t)};var In=function(t,e){return a(t)?t:_n(t,e)?[t]:Tn(An(t))};var mn=function(t){if("string"==typeof t||vn(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Rn=function(t,e){for(var r=0,n=(e=In(e,t)).length;null!=t&&r<n;)t=t[mn(e[r++])];return r&&r==n?t:void 0};var Cn=function(t,e,r){var n=null==t?void 0:Rn(t,e);return void 0===n?r:n};var Nn=function(t,e){return null!=t&&e in Object(t)};var xn=function(t,e,r){for(var n=-1,o=(e=In(e,t)).length,i=!1;++n<o;){var u=mn(e[n]);if(!(i=null!=t&&r(t,u)))break;t=t[u]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Cr(o)&&Rr(u,o)&&(a(t)||Sr(t))};var Ln=function(t,e){return null!=t&&xn(t,e,Nn)};var Dn=function(t,e){return _n(t)&&ln(e)?pn(mn(t),e):function(r){var n=Cn(r,t);return void 0===n&&n===e?Ln(r,t):sn(e,n,3)}};var Pn=function(t){return t};var jn=function(t){return function(e){return null==e?void 0:e[t]}};var wn=function(t){return function(e){return Rn(e,t)}};var Mn=function(t){return _n(t)?jn(mn(t)):wn(t)};var kn=function(t){return"function"==typeof t?t:null==t?Pn:"object"==typeof t?a(t)?Dn(t[0],t[1]):fn(t):Mn(t)};var Un=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),u=a.length;u--;){var s=a[t?u:++o];if(!1===r(i[s],s,i))break}return e}}();var Gn=function(t,e){return function(r,n){if(null==r)return r;if(!Br(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++i<o)&&!1!==n(a[i],i,a););return r}}((function(t,e){return t&&Un(t,e,Hr)}));var Fn=function(t,e){var r=-1,n=Br(t)?Array(t.length):[];return Gn(t,(function(t,o,i){n[++r]=e(t,o,i)})),n};var Vn=function(t,e){return(a(t)?We:Fn)(t,kn(e))},Bn=function(){function t(t,e,r){var n=this;this.observer=new wt,this.context=t,this.providerId=e,this.resolver=r,this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return n.updateState(t)})).catch((function(t){jt.error(St[gt.STATE_FETCH_FAILED],t.message),n.context.eventing.track(St[gt.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,r=this.state;this.updateState(y(y({},r),t)),this.resolver.update(this.context,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){jt.error(St[gt.STATE_UPDATE_FAILED],t.message),e.context.eventing.track(St[gt.STATE_UPDATE_FAILED],{errorMessage:t.message}),r&&e.updateState(r)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),Hn=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),Wn=Object.create(null),Yn=function(){function t(t){this.cache=new Hn,this.options=y({},t||{})}return t.register=function(t,e){Wn[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=g(t,["type"]),n=Wn[e];return n?new n(r):null},t.prototype.toJSON=function(){return y({type:this.type},this.options)},t}();var zn=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var Kn=function(t){return t!=t};var $n=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var Jn=function(t,e,r){return e==e?$n(t,e,r):zn(t,Kn,r)};var qn=function(t,e){return!!(null==t?0:t.length)&&Jn(t,e,0)>-1};var Zn=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var Xn=function(){},Qn=Jr&&1/ur(new Jr([,-0]))[1]==1/0?function(t){return new Jr(t)}:Xn;var to=function(t,e,r){var n=-1,o=qn,i=t.length,a=!0,u=[],s=u;if(r)a=!1,o=Zn;else if(i>=200){var c=e?null:Qn(t);if(c)return ur(c);a=!1,o=nr,s=new er}else s=e?[]:u;t:for(;++n<i;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,a&&d==d){for(var p=s.length;p--;)if(s[p]===d)continue t;e&&s.push(d),u.push(l)}else o(s,d,r)||(s!==u&&s.push(d),u.push(l))}return u};var eo=function(t){return t&&t.length?to(t):[]},ro=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new i.default(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),no="https://api.candu.ai"+c,oo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _(e,t),e.prototype.retrieve=function(t,e){return T(this,void 0,void 0,(function(){var r,n,o=this;return b(this,(function(i){switch(i.label){case 0:return[4,ro.get("cardStateApi",(function(e){return T(o,void 0,void 0,(function(){var r;return b(this,(function(n){switch(n.label){case 0:return[4,fetch(no+"?token="+t.clientToken+"&finder=byIds&ids="+eo(e).join(",")+"&userId="+t.userId).then((function(t){return t.json()}))];case 1:return r=n.sent(),[2,e.map((function(t){return r.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return r=i.sent(),n={id:e,state:{dismissed:!1}},[2,r||n]}}))}))},e.prototype.update=function(t,e,r){return fetch(no+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:t.userId.toString()})}).then((function(t){return t.json()}))},e}(Yn);Yn.register(exports.StateResolverType.CardApi,oo);var io="https://api.candu.ai"+s;function ao(t){return{state:t.state,id:t.id}}function uo(t){switch(t){case exports.CheckListScope.Account:return"AccountId";case exports.CheckListScope.User:default:return"UserId"}}var so=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _(e,t),e.prototype.getScopeAndFieldFromContext=function(t){var e=this.options.scopeTrait,r=this.options.scope||exports.CheckListScope.User,n=t.userId.toString();return r===exports.CheckListScope.Account&&(e&&t.traits[e]?n=t.traits[e]:(Pt("trait '"+e+"' is not defined, falling back to user scope"),r=exports.CheckListScope.User)),{scope:r,scopeField:n}},e.prototype.retrieve=function(t,e){return T(this,void 0,void 0,(function(){var r,n,o,i=this;return b(this,(function(a){switch(a.label){case 0:return r=this.getScopeAndFieldFromContext(t),n=r.scope,o=r.scopeField,[4,ro.get("checklistState",(function(e){return T(i,void 0,void 0,(function(){var r;return b(this,(function(i){switch(i.label){case 0:return[4,fetch(io+"?token="+t.clientToken+"&byTrait="+uo(n)+"&field="+o+"&finder=byIds&ids="+eo(e).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(ao)}))];case 1:return r=i.sent(),[2,e.map((function(t){return r.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,a.sent()||{id:e,state:exports.CheckListItemStatus.NotStared}]}}))}))},e.prototype.update=function(t,e,r){var n=this.getScopeAndFieldFromContext(t),o=n.scope,i=n.scopeField;return fetch(io+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y(y({},r),{byTrait:uo(o),field:i}))}).then((function(t){return t.json()})).then(ao)},e}(Yn);Yn.register(exports.StateResolverType.CheckListApi,so);exports.CANDU_PORTAL_CLASS="candu_portal",exports.CardResolverInstance=oo,exports.CheckListResolverInstance=so,exports.DEFAULT_ALERT_COLOR="#EDEDED",exports.DEFAULT_ALT="",exports.DEFAULT_COLOR=rt,exports.DEFAULT_SEGMENT_ID="Everyone",exports.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",exports.DEFAULT_TAB_COLOR="#FEFEFE",exports.DEFAULT_TAB_HEADER_COLOR="#333745",exports.DEFAULT_TAB_ITEM_COLOR="#838792",exports.ERROR_MESSAGES=St,exports.ERROR_SLUGS=yt,exports.EVENT_NAMES=gt,exports.IsNumericId=Y,exports.LOGGER=It,exports.METRICS=bt,exports.NodeManager=Mt,exports.Observer=wt,exports.PREVIEW_COOKIE_NAME="candu.preview",exports.PREVIEW_FRAME_ID="canduPreview",exports.PREVIEW_SCRIPT_URL="https://app.candu.ai/preview.html",exports.PREVIEW_URL_PARAM="candu_preview",exports.PreviewContainer=kt,exports.RESOURCES=Lt,exports.STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},exports.SingletonAPI=Ft,exports.StateProviderInstance=Bn,exports.StateResolverInstance=Yn,exports.TutorialDependencies=h,exports.attachStylesheet=function(t,e){void 0===e&&(e="main");var r=Be(t);if(!document.getElementById(r)){var n=document.createElement("link");n.setAttribute("id",r),n.setAttribute("rel","stylesheet"),n.setAttribute("href",u+"/styleguides/applications/"+t+"/default/"+e+".css"),document.head.appendChild(n)}},exports.calculateGroupCompletion=function(t,e){var r=Object.values(t).filter((function(t){return t.status===exports.CheckListItemStatus.Done})).length;return{completedItems:r,percComplete:e?Math.round(100*r/e):0}},exports.canduPortalId=function(t){return"candu_portal_"+t},exports.checkCyclicAndAdd=function(t,e){return t.dependencies.add(t.id,e)},exports.createSingleton=function(t){var e,r,n=function(t){return function(){for(var e,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(r.api)return(e=r.api)[t].apply(e,n);console.warn("Please initialize the SDK by calling Candu.init() before attempting to call "+t)}};return(e=function(){function e(){}return e.init=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return this.api||(e.api=new(t.bind.apply(t,O([void 0],r)))),e.subscriberCallbacks.forEach((function(t){return t()})),e.subscriberCallbacks=[],window.postMessage({source:"CANDU_SINGLETON",payload:{type:"INIT"}},window&&window.origin?window.origin:"*"),e},e.onProviderReady=function(t){if(e.api)return t();e.subscriberCallbacks.push(t)},e}()).subscriberCallbacks=[],e.renderTutorial=n("renderTutorial"),e.renderPortal=n("renderPortal"),e.renderContent=n("renderContent"),e.attachClient=n("attachClient"),e.detachClient=n("detachClient"),e.getProvider=n("getProvider"),e.getInfo=n("getInfo"),r=e,window.Candu=r,r},exports.createTutorialDocumentContext=function(t,e){return{id:t,dependencies:e?e.dependencies:new h(t)}},exports.cssInputObjToString=function(t){return Object.keys(t).reduce((function(e,r){return""+e+r+": "+t[r]+";"}),"")},exports.cssInputStringToObj=function(t){return t.split(";").reduce((function(t,e){var r,n=e.split(":"),o=n[0],i=n[1];return o&&i?y(y({},t),((r={})[o.trim()]=i.trim(),r)):t}),{})},exports.defaultStyleguide=At,exports.detachStylesheet=function(t){var e=document.getElementById(Be(t));e&&e.remove()},exports.fetchFromApi=Ct,exports.fetchFromCdn=Nt,exports.fetchHead=function(t,e){t&&a(t)&&(!function(t,e){var r="candu-stylesheet-"+t;if(!document.getElementById(r)){var n=document.createElement("style");n.setAttribute("id",r),n.setAttribute("type","text/css"),n.appendChild(document.createTextNode(e)),document.head.append(n)}}("document",".candu-document * {\n box-sizing: border-box;\n }\n "),t.map((function(t){var r=t.nodeType,n=t.url;return v("EmbedTutorial"===r?u+"/tutorials/"+e+"/"+n+".json":"EmbedPortal"===r?u+"/portals/"+e+"/"+n+"/head.json":n)})))},exports.fetchURL=Rt,exports.findMatchingSegment=function(t,e){var r=e.reduce((function(t,e){var r;return y(y({},t),((r={})[e]=e,r))}),{});if(a(t.content))return t.content.find((function(t){var e=t.segmentId;return!!r[e]||"Everyone"===e}))},exports.getCheckListStateProviders=function(t){return t.filter((function(t){return t.resolver instanceof so}))},exports.getContentState=function(t){return t.lastModifiedAt===t.lastPublishedAt?"Published":t.lastPublishedAt?"Unsynced":"Draft"},exports.getFirstNotStartedItem=function(t,e){for(var r=Object.values(t),n=function(t){var e=r.find((function(e){return e.position===t}));if(!e||e.status===exports.CheckListItemStatus.NotStared)return{value:t}},o=0;o<e;o+=1){var i=n(o);if("object"==typeof i)return i.value}},exports.getInitialItems=function(t){var e={};return t.forEach((function(t,r){var n=t.getResolvedState();n&&(e[n.id]={status:n.state,position:r})})),e},exports.getTutorialDocument=xt,exports.includeHTMLWhitespaces=function(t){return t.replace(/\s/g,"&nbsp;")},exports.initStateProviders=function(t,e){return Vn(t,(function(t,r){var n=Yn.fromJSON(t.resolver);return n?new Bn(e,r,n):null})).filter((function(t){return!!t}))},exports.internalEventing=function(t){var e=t.identify,r=t.track;return{provider:function(t){var n=t.userId,o=t.traits,i=t.styleguide;e(n,o),r(gt.HEARTBEAT,function(t){var e={};return Object.keys(t).forEach((function(r){At[r]&&(e["styleguide."+r]=t[r].displayName||!0)})),e}(i))},tutorialDocumentLoadingError:function(t){var e=t.tutorialId,n=t.slug,o=t.contentHashId;It.error(St[gt.TUTORIAL_LOADING_ERROR]),r(gt.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:n,contentHashId:o})}}},exports.isApiError=function(t){return tt(t)&&G(t.errorCode)},exports.isClientToken=z,exports.isContentHashId=it,exports.isIdentifier=W,exports.isPortalId=function(t){return Y(t)},exports.isPortalSlug=function(t){return W(t)},exports.isStatePath=function(t){return G(t)&&!!t.match(/^@(\w|\d|_|-|\.){3,20}\$/)},exports.isTutorialId=at,exports.isTutorialSlug=ut,exports.isUserId=K,exports.logError=Dt,exports.logWarning=Pt,exports.logger=jt,exports.mapNodeToStyleguide=zt,exports.mergeStyleguidesFromContext=Ve,exports.messageFactory=q,exports.messages=J,exports.portalValidation=function(t){var e=t.slug,r=t.styleguide;return mt(r),{slug:e,styleguide:r||{}}},exports.providerValidation=function(e){var r=e.clientToken,n=e.userId,i=e.traits,a=e.options,u=e.styleguide,s=g(e,["clientToken","userId","traits","options","styleguide"]);return o.default(z(r),"(Candu) you must provide a valid clientToken"),o.default(!n||K(n),"(Candu) you must provide a valid userId"),mt(u),o.default(!i||tt(i),"(Candu) traits must be undefined or an object"),o.default(!a||tt(a),"(Candu) options must be undefined or an object"),y(y({},s),{clientToken:r,traits:i||{},options:a||{},styleguide:u||{},userId:n||t.getAnonymousId()})},exports.stripHTML=function(t){return DOMParser?(new DOMParser).parseFromString(t,"text/html").body.textContent||"":t},exports.stylguideClassNameMap=ht,exports.toCssSelector=function(t,e){var r=y({className:"root",variant:void 0,selector:"",output:"css"},e||{}),n=r.className,o=r.variant,i=r.selector,a=r.output,u="candu-"+t;if("global"===n)return"html"===a?"":":root";var s=null,c=[],l=ht[t]||{};if(o&&l.variants){var d=l.variants;c=Object.keys(o).reduce((function(t,e){var r=o[e],n=d[e];return t.push(n?n(r):e+"-"+r),t}),[])}return"root"!==n&&l.childClassNames&&l.childClassNames[n]&&(s="candu-"+t+"--"+l.childClassNames[n]),"css"===a?[u,s,i].reduce((function(t,e,r){return e&&""!==e?0===r?"."+u+c.map((function(t){return"."+t})).join(""):1===r?t+" ."+e:""+t+e:t}),"")||"":"root"===n?O([u],c).filter((function(t){return!!t})).join(" ")||"":s||""},exports.toStyleguideDecl=function(t){return Object.keys(t).reduce((function(e,r){return O(e,[{type:exports.CSSNodeTypes.Decl,prop:r,value:t[r]}])}),[])},exports.tutorialValidation=function(t){var e=t.slug,r=t.styleguide,n=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.renderedByClient,u=g(t,["slug","styleguide","contentHashId","tutorialId","tutorialDocument","renderedByClient"]);return mt(r),y(y({},u),{slug:e,styleguide:r||{},contentHashId:n,tutorialId:o,tutorialDocument:i,renderedByClient:a})},exports.unpackShorthandStyles=function(t){var e=t.padding,r=t.margin,n=g(t,["padding","margin"]),o={};return e&&(o=y(y({},o),He("padding",e))),r&&(o=y(y({},o),He("margin",r))),y(y({},o),n)},exports.windowStream=function(t){var e=t.source,r=t.destination,n=t.targetOrigin,o=t.targetWindow,i=t.originWindow,a=t.onRecieveMessage,u=q({source:e,destination:r}),s=u.read,c=u.write,l=function(t){var e=s(t.data);e&&a(e)};return i.addEventListener("message",l,!1),{close:function(){i.removeEventListener("message",l)},send:function(t){o.postMessage(c(t),n)}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@candulabs/eventing"),e=require("invariant");require("setimmediate");var r=require("dataloader");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=n(e),i=n(r),a=Array.isArray;var u="https://cdn.candu.ai",s="/api/checklistItems",c="/api/cards",l="/api/segmentMemberships",d="/api/segmentsDefinition",p="/api/tutorialMetadata",f="/api/tutorialDocumentsSdk",v=function(t){if(!document.querySelectorAll('[href="'+t+'"]').length){var e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.appendChild(e)}};var h=function(){function t(t){this.adjacencyList={},this.rootDocument=t,this.adjacencyList[t]=[]}return t.prototype.get=function(t){return this.adjacencyList[t]},t.prototype.add=function(t,e){var r=this;if(this.adjacencyList[t]||(this.adjacencyList[t]=[]),!this.adjacencyList[e])return this.adjacencyList[t].push(e),this.adjacencyList[e]=[],!0;if(this.adjacencyList[t].includes(e))return!0;var n=function(e){if(e===t)return!0;for(var o=0,i=r.adjacencyList[e];o<i.length;o++){var a=i[o];if(n(a))return!0}return!1};return!n(e)&&(this.adjacencyList[t].push(e),!0)},t}(),E=function(t,e){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function _(t,e){function r(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var y=function(){return(y=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function g(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function T(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function u(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){t.done?o(t.value):new r((function(e){e(t.value)})).then(a,u)}s((n=n.apply(t,e||[])).next())}))}function b(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function O(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)n[o]=i[a];return n}var S="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(t){var e={exports:{}};return t(e,e.exports),e.exports}var I="object"==typeof S&&S&&S.Object===Object&&S,m="object"==typeof self&&self&&self.Object===Object&&self,R=I||m||Function("return this")(),C=R.Symbol,N=Object.prototype,x=N.hasOwnProperty,L=N.toString,D=C?C.toStringTag:void 0;var P=function(t){var e=x.call(t,D),r=t[D];try{t[D]=void 0;var n=!0}catch(t){}var o=L.call(t);return n&&(e?t[D]=r:delete t[D]),o},j=Object.prototype.toString;var w=function(t){return j.call(t)},M=C?C.toStringTag:void 0;var k=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":M&&M in Object(t)?P(t):w(t)};var U=function(t){return null!=t&&"object"==typeof t};var G=function(t){return"string"==typeof t||!a(t)&&U(t)&&"[object String]"==k(t)};var F,V,B=function(t){return"number"==typeof t||U(t)&&"[object Number]"==k(t)},H=/^([a-zA-Z0-9]|_|-)+$/,W=function(t){return G(t)&&t.length>=3&&t.length<100&&H.test(t)},Y=function(t){return B(t)&&t>=0},z=function(t){return G(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10},K=function(t){return Y(t)||G(t)&&t.trim().length>0};exports.ACTORS=void 0,(F=exports.ACTORS||(exports.ACTORS={})).SDK="SDK",F.PREVIEW="PREVIEW",exports.MESSAGES=void 0,(V=exports.MESSAGES||(exports.MESSAGES={})).BOOTSTRAP="Bootstrap",V.CHANGE_POSITION="ChangePosition",V.CLOSE_PREVIEW="ClosePreview",V.PREVIEW_LOADED="PreviewLoaded",V.SET_AVALIABLE_PORTALS="SetAvaliablePortals",V.SET_CONTENT="SetContent",V.SET_SELECTED_ELEMENT="SetSelectedElement",V.SET_VIEW_MODE="SetViewMode",V.ADD_ELEMENT="AddElement",V.REMOVE_ELEMENT="RemoveElement",V.UPDATE_ELEMENT="UpdateElement",V.SET_ELEMENT="SetElement";var $=function(t,e){return void 0===e&&(e={}),y({type:t},e)},J={bootstrap:function(t,e,r,n){return $(exports.MESSAGES.BOOTSTRAP,{clientToken:t,userId:e,version:r,preview:n})},changePosition:function(t,e){return $(exports.MESSAGES.CHANGE_POSITION,{mouseEvent:t,top:e})},closePreview:function(){return $(exports.MESSAGES.CLOSE_PREVIEW)},previewLoaded:function(){return $(exports.MESSAGES.PREVIEW_LOADED)},setAvaliablePortals:function(t){return $(exports.MESSAGES.SET_AVALIABLE_PORTALS,{avaliablePortals:t})},addElement:function(t){return $(exports.MESSAGES.ADD_ELEMENT,{element:t})},removeElement:function(t){return $(exports.MESSAGES.REMOVE_ELEMENT,{id:t})},updateElement:function(t){return $(exports.MESSAGES.UPDATE_ELEMENT,{element:t})},setContent:function(t){return $(exports.MESSAGES.SET_CONTENT,{content:t})},setViewMode:function(t){return $(exports.MESSAGES.SET_VIEW_MODE,{viewMode:t})},setSelectedElement:function(t){return $(exports.MESSAGES.SET_SELECTED_ELEMENT,{element:t})}},q=function(t){var e=t.source,r=t.destination;return{read:function(t){var e=t.actor,n=t.message;return e===r?n:null},write:function(t){return{actor:e,message:t}}}};var Z,X,Q,tt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};exports.TRIGGERS=void 0,(exports.TRIGGERS||(exports.TRIGGERS={})).ON_CLICK="OnClick",exports.CATEGORIES=void 0,(Z=exports.CATEGORIES||(exports.CATEGORIES={})).NATIVE="Native",Z.PENDO="Pendo",exports.HANDLER_TYPES=void 0,(X=exports.HANDLER_TYPES||(exports.HANDLER_TYPES={})).NAVIGATE="Navigate",X.CHANGE_TUTORIAL="ChangeTutorial",X.OPEN_GUIDE="OpenGuide",X.DISMISSED_CARD="DismissedCard",exports.COLORS=void 0,(Q=exports.COLORS||(exports.COLORS={})).PRIMARY="primary",Q.SECONDARY="primary",Q.WARNING="warning",Q.DANGER="danger",Q.NEUTRAL="neutral",Q.ACTIVE="active",Q.INFO="info";var et,rt=exports.COLORS.PRIMARY;exports.Mark=void 0,(et=exports.Mark||(exports.Mark={})).U="U",et.B="B",et.Em="Em",et.InlineCode="InlineCode";var nt,ot,it=function(t){return G(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/)},at=function(t){return Y(t)},ut=function(t){return W(t)};exports.CheckListItemStatus=void 0,(nt=exports.CheckListItemStatus||(exports.CheckListItemStatus={})).NotStared="NotStarted",nt.InProgress="InProgress",nt.Done="Done",exports.CheckListScope=void 0,(ot=exports.CheckListScope||(exports.CheckListScope={})).User="User",ot.Account="Account";var st,ct;exports.FRAME_SIZES=void 0,(st=exports.FRAME_SIZES||(exports.FRAME_SIZES={})).COLLAPSED="Collapsed",st.EXPANDED="Expanded",st.MINIMIZED="Minimized",exports.PREVIEW_MODES=void 0,(ct=exports.PREVIEW_MODES||(exports.PREVIEW_MODES={})).TUTORIAL="Tutorial",ct.PORTAL="Portal";var lt,dt;exports.StateScope=void 0,(lt=exports.StateScope||(exports.StateScope={})).Global="Global",lt.Carried="Carried",exports.StateResolverType=void 0,(dt=exports.StateResolverType||(exports.StateResolverType={})).CanduCdn="CanduCdn",dt.CheckListApi="CheckListApi",dt.CardApi="CardApi";var pt,ft;exports.StyleguideScope=void 0,(pt=exports.StyleguideScope||(exports.StyleguideScope={})).Global="Global",pt.Organization="Organization",exports.CSSNodeTypes=void 0,(ft=exports.CSSNodeTypes||(exports.CSSNodeTypes={})).Root="root",ft.Rule="rule",ft.Atrule="atrule",ft.Decl="decl",ft.Any="any";var vt,ht={button:{childClassNames:{icon:"button-icon"},variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},badge:{variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},typography:{variants:{typography:function(t){return"typography-"+t}}}},Et=function(t){return"candu.sdk."+t},_t=function(t){return Et("error."+t)},yt={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",PROVIDER_ERROR:"provider_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},gt={HEARTBEAT:Et("heartbeat"),PREVIEW_OPEN:Et("preview.open"),PORTAL:Et("portal"),TUTORIAL:Et("tutorial"),TUTORIAL_INTERACTION:Et("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:_t("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:_t("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:_t("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:_t("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:_t("commit_api"),TUTORIAL_LOADING_ERROR:_t("tutorial"),UNKOWN_NODE_TYPE:_t(yt.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:_t(yt.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:_t(yt.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:_t(yt.TUTORIAL_ERROR),PORTAL_ERROR:_t(yt.PORTAL_ERROR),PROVIDER_ERROR:_t(yt.PROVIDER_ERROR),STYLEGUIDE_MAP_ERROR:_t(yt.TUTORIAL_ERROR),RENDER_NODE_ERROR:_t(yt.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:_t("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:_t("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:_t("state_fetch_failed"),STATE_UPDATE_FAILED:_t("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:_t("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:Et("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:Et("tutorial.checklist_group_complete"),CARD_DISMISSED:Et("tutorial.card_dismissed")},Tt=function(t){return Et("metric."+t)},bt={SEGMENT_MEMBERSHIP_LOAD_TIME:Tt("segment_membership_load_time"),PORTAL_LOAD_TIME:Tt("portal_load_time"),CONTENT_LOAD_TIME:Tt("content_load_time"),TUTORIAL_LOAD_TIME:Tt("tutorial_load_time"),TUTORIAL_DOCUMENT_MOUNT_TIME:Tt("tutorial_document_mount_time")},Ot=function(t){return"An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: "+t+"."},St=((vt={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n"})[gt.PORTAL_ASSET_NOT_FOUND]="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",vt[gt.PORTAL_NO_SEGMENT_IDS]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",vt[gt.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",vt[gt.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",vt[gt.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",vt[gt.UNKOWN_INLINE_NODE_TYPE]=Ot(yt.UNKOWN_INLINE_NODE_TYPE),vt[gt.UNKOWN_NODE_TYPE]=Ot(yt.UNKOWN_NODE_TYPE),vt[gt.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",vt[gt.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",vt[gt.PORTAL_ERROR]="An error has occured within Portal",vt[gt.PROVIDER_ERROR]="An error has occured within Provider",vt[gt.TUTORIAL_ERROR]="An error has occured within Tutorial",vt[gt.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",vt[gt.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",vt[gt.STATE_FETCH_FAILED]="An error has occured while fetching state:",vt[gt.STATE_UPDATE_FAILED]="An error has occured while updating state:",vt[gt.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",vt),At={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},It={error:console.error,warning:console.warn},mt=function(t){return o.default(!t||tt(t),"(Candu) styleguide must be undefined or an object")},Rt=function(t,e){return T(void 0,void 0,void 0,(function(){return b(this,(function(r){switch(r.label){case 0:return[4,fetch(t,e&&{headers:e})];case 1:return[2,r.sent().json()]}}))}))},Ct=function(t){return Rt("https://api.candu.ai"+t,{SDKVersion:"0.7.1-alpha.23"})},Nt=function(t){return Rt(""+u+t,{SDKVersion:"0.7.1-alpha.23"})},xt=function(t){return{byId:function(e){return Ct(f+"?token="+t+"&finder=latestPublished&tutorialId="+e)},bySlug:function(e){return Nt("/tutorials/"+t+"/"+e+".json")},byContentHash:function(e){return Nt("/tutorials/"+t+"/"+e+".json")}}},Lt={tutorialDocumentLatestSaved:function(t,e){return T(void 0,void 0,void 0,(function(){return b(this,(function(r){return[2,Ct(f+"/"+e+"?token="+t)]}))}))},portalAsset:function(t,e,r){return T(void 0,void 0,void 0,(function(){var n,o;return b(this,(function(i){return(null===(o=r)||void 0===o?void 0:o.length)?(n="?segmentIds="+r.join(","),[2,Nt("/portalMemberships/"+t+"/"+e+"/head.json"+n)]):[2,Nt("/portals/"+t+"/"+e+"/head.json")]}))}))},contentDocument:function(t,e,r){return T(void 0,void 0,void 0,(function(){var n,o,i;return b(this,(function(a){switch(a.label){case 0:return n=(null===(i=r)||void 0===i?void 0:i.length)?"?segmentIds="+r.join(","):"",[4,fetch(u+"/contentDocument/"+t+"/"+e+".json"+n)];case 1:return[2,(o=a.sent()).ok?o.json():null]}}))}))},segmentMembership:function(t,e){return T(void 0,void 0,void 0,(function(){return b(this,(function(r){return[2,Ct(l+"/"+e+"?token="+t)]}))}))},segmentDefinition:function(t){return T(void 0,void 0,void 0,(function(){return b(this,(function(e){return[2,Ct(d+"?token="+t)]}))}))},tutorialMetadata:function(t){return T(void 0,void 0,void 0,(function(){return b(this,(function(e){return[2,Ct(p+"?token="+t)]}))}))},tutorialDocument:function(t,e,r){var n=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.slug,u=xt(e);return ut(a)?u.bySlug(a):at(o)?u.byId(o):it(n)?u.byContentHash(n):tt(i)?Promise.resolve(i):(It.error(St[gt.NO_VALID_TUTORIAL_IDENTIFIER]),r.track(gt.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},Dt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.error.apply(console,t)},Pt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.warn.apply(console,t)},jt={error:Dt,warning:Pt},wt=function(){function t(){this.subscribers=[]}return t.prototype.subscribe=function(t){var e=this;return this.subscribers.push(t),function(){e.subscribers[e.subscribers.indexOf(t)]=function(){}}},t.prototype.notify=function(t){this.subscribers.forEach((function(e){return e(t)}))},t.prototype.clear=function(){this.subscribers=[]},t}(),Mt=function(){function t(t,e){var r=this;this.state="waiting",this.currentElement=null,this.selector=t,this.renderToElement=e,this.findAndRender(),this.observer=new MutationObserver((function(t){switch(r.state){case"waiting":t.some((function(t){return!!t.addedNodes.length}))&&r.findAndRender();break;case"mounted":t.forEach((function(t){t.removedNodes.length&&t.removedNodes.forEach((function(t){t===r.currentElement&&(r.currentElement=null,r.state="waiting")}))}));break;default:throw new Error("Unhandled state: "+r.state)}})),this.observer.observe(document,{childList:!0,subtree:!0,attributes:!1,characterData:!1})}return t.prototype.findAndRender=function(){var t=document.querySelector(this.selector);t&&(this.renderToElement(t),this.currentElement=t,this.state="mounted")},t.prototype.stopObserving=function(){this.observer.disconnect()},t}(),kt=function(){function t(){this.onClientUpdateObserver=new wt}return t.prototype.attachClient=function(t){this.client=t,this.onClientUpdateObserver.notify({client:t})},t.prototype.detachClient=function(){this.client&&(this.client=null,this.onClientUpdateObserver.notify({client:null}))},t.prototype.onClientUpdate=function(t){var e=this.onClientUpdateObserver.subscribe(t);return this.client&&t({client:this.client}),e},t}();var Ut="@candulabs/core",Gt="0.7.1-alpha.23",Ft=function(){function t(t){this.init(t)}return t.prototype.getInfo=function(){return{core:{version:Gt,name:Ut},sdk:{version:this.version,name:this.name}}},t.prototype.attachClient=function(t){return this.provider.preview.attachClient(t)},t.prototype.detachClient=function(){return this.provider.preview.detachClient()},Object.defineProperty(t.prototype,"provider",{get:function(){return this.getProvider()},enumerable:!0,configurable:!0}),t}(),Vt=function(t){switch(t.trigger){case exports.TRIGGERS.ON_CLICK:default:return"onClick"}},Bt=function(t,e){var r,n,o,i,a,u;if("Link"===t.type&&(null===(r=t.props)||void 0===r?void 0:r.href)){var s=t.props.href+" Link Clicked",c=null===(o=null===(n=t)||void 0===n?void 0:n.nodes)||void 0===o?void 0:o[0];if(c){var l=e.document.nodes[c];"Text"===(null===(i=l)||void 0===i?void 0:i.type)&&(null===(u=null===(a=l)||void 0===a?void 0:a.props)||void 0===u?void 0:u.children)&&(s=l.props.children+" Link Clicked")}return{onClick:function(){var r;return e.provider.eventing.track(gt.TUTORIAL_INTERACTION,{trigger:exports.TRIGGERS.ON_CLICK,category:t.type,eventName:s,handler:{href:null===(r=t.props)||void 0===r?void 0:r.href,type:exports.HANDLER_TYPES.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var d=function(t,r){e.provider.eventing.track(gt.TUTORIAL_INTERACTION,y(y({},t),r||{}))};return t.data.actions.map((function(t){return function(t,e,r){var n,o,i;switch(t.handler.type){case exports.HANDLER_TYPES.NAVIGATE:return(n={})[Vt(t)]=function(n){n.stopPropagation();var o=t.handler,i=o.href,a=o.target,u=r||{},s=u.parentTrackers,c=g(u,["parentTrackers"]);s&&s.forEach((function(r){return e(t,r)})),e(t,c),"Blank"===a?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},n;case exports.HANDLER_TYPES.CHANGE_TUTORIAL:return(o={})[Vt(t)]=function(){var e=t.handler.tutorialId;Dt("TODO -> change tutorial",e)},o;case exports.HANDLER_TYPES.OPEN_GUIDE:return(i={})[Vt(t)]=function(){var e=t.handler.guideId;Dt("TODO -> open guide",e)},i;default:return{}}}(t,d,e.trackingIdentifiers)})).reduce((function(t,e){return y(y({},t),e)}),{})},Ht=function(t,e){var r=t.props||{},n=t.nodes,o=r.children;return o||(n?n.map(e):null)},Wt=function(t,e){var r=t.states;return r&&e.stateProviderInstances.filter((function(t){return!!r[t.providerId]}))},Yt=function(t,e){var r=t.nodes;return r&&r.map((function(t){return e.document.nodes[t]})).filter((function(t){return!!t})).map((function(t){return Wt(t,e)||[]})).reduce((function(t,e){return t.concat(e)}),[])},zt=function(t,e){try{var r=e.provider,n=e.document,o=e.trackingIdentifiers,i=n.nodes[t];if(!i)return jt.error("Document is corrupted. Refusing to move further."),null;var a=function(t){return zt(t,e)},u=i.type,s=i.props,c=i.css,l=y(y(y({},s||{}),{style:c||{},children:Ht(i,a)}),Bt(i,{trackingIdentifiers:o,provider:r,document:n})),d={nodeId:t,node:i,document:n,render:{node:a,styleguide:function(t,r){return void 0===r&&(r={}),e.renderNode(t,{api:d,attributes:r})},tutorial:function(t){return e.renderTutorial(t)},portal:function(t){return e.renderPortal(t)}},trackingIdentifiers:o,stateInstances:Wt(i,e),childrenStateInstances:Yt(i,e)},p=d.render.styleguide(u,l);return p||(jt.error(St[gt.UNKOWN_NODE_TYPE],{type:u}),r.eventing.error(new Error(St[gt.UNKOWN_NODE_TYPE]),{type:u}),null)}catch(t){return jt.error(St[gt.STYLEGUIDE_MAP_ERROR],t),e.provider.eventing.error(t),null}};var Kt,$t=function(t){if(!tt(t))return!1;var e=k(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Jt=R["__core-js_shared__"],qt=(Kt=/[^.]+$/.exec(Jt&&Jt.keys&&Jt.keys.IE_PROTO||""))?"Symbol(src)_1."+Kt:"";var Zt=function(t){return!!qt&&qt in t},Xt=Function.prototype.toString;var Qt=function(t){if(null!=t){try{return Xt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},te=/^\[object .+?Constructor\]$/,ee=Function.prototype,re=Object.prototype,ne=ee.toString,oe=re.hasOwnProperty,ie=RegExp("^"+ne.call(oe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var ae=function(t){return!(!tt(t)||Zt(t))&&($t(t)?ie:te).test(Qt(t))};var ue=function(t,e){return null==t?void 0:t[e]};var se=function(t,e){var r=ue(t,e);return ae(r)?r:void 0},ce=se(Object,"create");var le=function(){this.__data__=ce?ce(null):{},this.size=0};var de=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pe=Object.prototype.hasOwnProperty;var fe=function(t){var e=this.__data__;if(ce){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return pe.call(e,t)?e[t]:void 0},ve=Object.prototype.hasOwnProperty;var he=function(t){var e=this.__data__;return ce?void 0!==e[t]:ve.call(e,t)};var Ee=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ce&&void 0===e?"__lodash_hash_undefined__":e,this};function _e(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}_e.prototype.clear=le,_e.prototype.delete=de,_e.prototype.get=fe,_e.prototype.has=he,_e.prototype.set=Ee;var ye=_e;var ge=function(){this.__data__=[],this.size=0};var Te=function(t,e){return t===e||t!=t&&e!=e};var be=function(t,e){for(var r=t.length;r--;)if(Te(t[r][0],e))return r;return-1},Oe=Array.prototype.splice;var Se=function(t){var e=this.__data__,r=be(e,t);return!(r<0)&&(r==e.length-1?e.pop():Oe.call(e,r,1),--this.size,!0)};var Ae=function(t){var e=this.__data__,r=be(e,t);return r<0?void 0:e[r][1]};var Ie=function(t){return be(this.__data__,t)>-1};var me=function(t,e){var r=this.__data__,n=be(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Re(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Re.prototype.clear=ge,Re.prototype.delete=Se,Re.prototype.get=Ae,Re.prototype.has=Ie,Re.prototype.set=me;var Ce=Re,Ne=se(R,"Map");var xe=function(){this.size=0,this.__data__={hash:new ye,map:new(Ne||Ce),string:new ye}};var Le=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var De=function(t,e){var r=t.__data__;return Le(e)?r["string"==typeof e?"string":"hash"]:r.map};var Pe=function(t){var e=De(this,t).delete(t);return this.size-=e?1:0,e};var je=function(t){return De(this,t).get(t)};var we=function(t){return De(this,t).has(t)};var Me=function(t,e){var r=De(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function ke(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}ke.prototype.clear=xe,ke.prototype.delete=Pe,ke.prototype.get=je,ke.prototype.has=we,ke.prototype.set=Me;var Ue=ke;function Ge(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(Ge.Cache||Ue),r}Ge.Cache=Ue;var Fe=Ge,Ve=Fe((function(t,e){var r,n,o=t.provider,i=t.portal,a=t.tutorial,u=o.styleguide;return a&&(n=a.styleguide),i&&(r=i.styleguide),y(y(y(y({},u||{}),r||{}),n||{}),e||{})})),Be=function(t){return"candu-styleguide-"+t},He=function(t,e){var r,n,o,i,a="string"==typeof e&&e.split(" ");return a?1===a.length?((r={})[t+"Right"]=e,r[t+"Left"]=e,r[t+"Bottom"]=e,r[t+"Top"]=e,r):2===a.length?((n={})[t+"Top"]=a[0],n[t+"Right"]=a[1],n[t+"Bottom"]=a[0],n[t+"Left"]=a[1],n):3===a.length?((o={})[t+"Top"]=a[0],o[t+"Right"]=a[1],o[t+"Bottom"]=a[2],o[t+"Left"]=a[1],o):((i={})[t+"Top"]=a[0],i[t+"Right"]=a[1],i[t+"Bottom"]=a[2],i[t+"Left"]=a[3],i):{}};var We=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o};var Ye=function(){this.__data__=new Ce,this.size=0};var ze=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var Ke=function(t){return this.__data__.get(t)};var $e=function(t){return this.__data__.has(t)};var Je=function(t,e){var r=this.__data__;if(r instanceof Ce){var n=r.__data__;if(!Ne||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ue(n)}return r.set(t,e),this.size=r.size,this};function qe(t){var e=this.__data__=new Ce(t);this.size=e.size}qe.prototype.clear=Ye,qe.prototype.delete=ze,qe.prototype.get=Ke,qe.prototype.has=$e,qe.prototype.set=Je;var Ze=qe;var Xe=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var Qe=function(t){return this.__data__.has(t)};function tr(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Ue;++e<r;)this.add(t[e])}tr.prototype.add=tr.prototype.push=Xe,tr.prototype.has=Qe;var er=tr;var rr=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var nr=function(t,e){return t.has(e)};var or=function(t,e,r,n,o,i){var a=1&r,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var c=i.get(t);if(c&&i.get(e))return c==e;var l=-1,d=!0,p=2&r?new er:void 0;for(i.set(t,e),i.set(e,t);++l<u;){var f=t[l],v=e[l];if(n)var h=a?n(v,f,l,e,t,i):n(f,v,l,t,e,i);if(void 0!==h){if(h)continue;d=!1;break}if(p){if(!rr(e,(function(t,e){if(!nr(p,e)&&(f===t||o(f,t,r,n,i)))return p.push(e)}))){d=!1;break}}else if(f!==v&&!o(f,v,r,n,i)){d=!1;break}}return i.delete(t),i.delete(e),d},ir=R.Uint8Array;var ar=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var ur=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},sr=C?C.prototype:void 0,cr=sr?sr.valueOf:void 0;var lr=function(t,e,r,n,o,i,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new ir(t),new ir(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Te(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=ar;case"[object Set]":var s=1&n;if(u||(u=ur),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var l=or(u(t),u(e),n,o,i,a);return a.delete(t),l;case"[object Symbol]":if(cr)return cr.call(t)==cr.call(e)}return!1};var dr=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var pr=function(t,e,r){var n=e(t);return a(t)?n:dr(n,r(t))};var fr=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var vr=function(){return[]},hr=Object.prototype.propertyIsEnumerable,Er=Object.getOwnPropertySymbols,_r=Er?function(t){return null==t?[]:(t=Object(t),fr(Er(t),(function(e){return hr.call(t,e)})))}:vr;var yr=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var gr=function(t){return U(t)&&"[object Arguments]"==k(t)},Tr=Object.prototype,br=Tr.hasOwnProperty,Or=Tr.propertyIsEnumerable,Sr=gr(function(){return arguments}())?gr:function(t){return U(t)&&br.call(t,"callee")&&!Or.call(t,"callee")};var Ar=function(){return!1},Ir=A((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?R.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ar;t.exports=i})),mr=/^(?:0|[1-9]\d*)$/;var Rr=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&mr.test(t))&&t>-1&&t%1==0&&t<e};var Cr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Nr={};Nr["[object Float32Array]"]=Nr["[object Float64Array]"]=Nr["[object Int8Array]"]=Nr["[object Int16Array]"]=Nr["[object Int32Array]"]=Nr["[object Uint8Array]"]=Nr["[object Uint8ClampedArray]"]=Nr["[object Uint16Array]"]=Nr["[object Uint32Array]"]=!0,Nr["[object Arguments]"]=Nr["[object Array]"]=Nr["[object ArrayBuffer]"]=Nr["[object Boolean]"]=Nr["[object DataView]"]=Nr["[object Date]"]=Nr["[object Error]"]=Nr["[object Function]"]=Nr["[object Map]"]=Nr["[object Number]"]=Nr["[object Object]"]=Nr["[object RegExp]"]=Nr["[object Set]"]=Nr["[object String]"]=Nr["[object WeakMap]"]=!1;var xr=function(t){return U(t)&&Cr(t.length)&&!!Nr[k(t)]};var Lr=function(t){return function(e){return t(e)}},Dr=A((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&I.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),Pr=Dr&&Dr.isTypedArray,jr=Pr?Lr(Pr):xr,wr=Object.prototype.hasOwnProperty;var Mr=function(t,e){var r=a(t),n=!r&&Sr(t),o=!r&&!n&&Ir(t),i=!r&&!n&&!o&&jr(t),u=r||n||o||i,s=u?yr(t.length,String):[],c=s.length;for(var l in t)!e&&!wr.call(t,l)||u&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Rr(l,c))||s.push(l);return s},kr=Object.prototype;var Ur=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||kr)};var Gr=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),Fr=Object.prototype.hasOwnProperty;var Vr=function(t){if(!Ur(t))return Gr(t);var e=[];for(var r in Object(t))Fr.call(t,r)&&"constructor"!=r&&e.push(r);return e};var Br=function(t){return null!=t&&Cr(t.length)&&!$t(t)};var Hr=function(t){return Br(t)?Mr(t):Vr(t)};var Wr=function(t){return pr(t,Hr,_r)},Yr=Object.prototype.hasOwnProperty;var zr=function(t,e,r,n,o,i){var a=1&r,u=Wr(t),s=u.length;if(s!=Wr(e).length&&!a)return!1;for(var c=s;c--;){var l=u[c];if(!(a?l in e:Yr.call(e,l)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var p=!0;i.set(t,e),i.set(e,t);for(var f=a;++c<s;){var v=t[l=u[c]],h=e[l];if(n)var E=a?n(h,v,l,e,t,i):n(v,h,l,t,e,i);if(!(void 0===E?v===h||o(v,h,r,n,i):E)){p=!1;break}f||(f="constructor"==l)}if(p&&!f){var _=t.constructor,y=e.constructor;_==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(p=!1)}return i.delete(t),i.delete(e),p},Kr=se(R,"DataView"),$r=se(R,"Promise"),Jr=se(R,"Set"),qr=se(R,"WeakMap"),Zr=Qt(Kr),Xr=Qt(Ne),Qr=Qt($r),tn=Qt(Jr),en=Qt(qr),rn=k;(Kr&&"[object DataView]"!=rn(new Kr(new ArrayBuffer(1)))||Ne&&"[object Map]"!=rn(new Ne)||$r&&"[object Promise]"!=rn($r.resolve())||Jr&&"[object Set]"!=rn(new Jr)||qr&&"[object WeakMap]"!=rn(new qr))&&(rn=function(t){var e=k(t),r="[object Object]"==e?t.constructor:void 0,n=r?Qt(r):"";if(n)switch(n){case Zr:return"[object DataView]";case Xr:return"[object Map]";case Qr:return"[object Promise]";case tn:return"[object Set]";case en:return"[object WeakMap]"}return e});var nn=rn,on="[object Object]",an=Object.prototype.hasOwnProperty;var un=function(t,e,r,n,o,i){var u=a(t),s=a(e),c=u?"[object Array]":nn(t),l=s?"[object Array]":nn(e),d=(c="[object Arguments]"==c?on:c)==on,p=(l="[object Arguments]"==l?on:l)==on,f=c==l;if(f&&Ir(t)){if(!Ir(e))return!1;u=!0,d=!1}if(f&&!d)return i||(i=new Ze),u||jr(t)?or(t,e,r,n,o,i):lr(t,e,c,r,n,o,i);if(!(1&r)){var v=d&&an.call(t,"__wrapped__"),h=p&&an.call(e,"__wrapped__");if(v||h){var E=v?t.value():t,_=h?e.value():e;return i||(i=new Ze),o(E,_,r,n,i)}}return!!f&&(i||(i=new Ze),zr(t,e,r,n,o,i))};var sn=function t(e,r,n,o,i){return e===r||(null==e||null==r||!U(e)&&!U(r)?e!=e&&r!=r:un(e,r,n,o,t,i))};var cn=function(t,e,r,n){var o=r.length,i=o,a=!n;if(null==t)return!i;for(t=Object(t);o--;){var u=r[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var s=(u=r[o])[0],c=t[s],l=u[1];if(a&&u[2]){if(void 0===c&&!(s in t))return!1}else{var d=new Ze;if(n)var p=n(c,l,s,t,e,d);if(!(void 0===p?sn(l,c,3,n,d):p))return!1}}return!0};var ln=function(t){return t==t&&!tt(t)};var dn=function(t){for(var e=Hr(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,ln(o)]}return e};var pn=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var fn=function(t){var e=dn(t);return 1==e.length&&e[0][2]?pn(e[0][0],e[0][1]):function(r){return r===t||cn(r,t,e)}};var vn=function(t){return"symbol"==typeof t||U(t)&&"[object Symbol]"==k(t)},hn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,En=/^\w*$/;var _n=function(t,e){if(a(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!vn(t))||(En.test(t)||!hn.test(t)||null!=e&&t in Object(e))};var yn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gn=/\\(\\)?/g,Tn=function(t){var e=Fe(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(yn,(function(t,r,n,o){e.push(n?o.replace(gn,"$1"):r||t)})),e})),bn=C?C.prototype:void 0,On=bn?bn.toString:void 0;var Sn=function t(e){if("string"==typeof e)return e;if(a(e))return We(e,t)+"";if(vn(e))return On?On.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var An=function(t){return null==t?"":Sn(t)};var In=function(t,e){return a(t)?t:_n(t,e)?[t]:Tn(An(t))};var mn=function(t){if("string"==typeof t||vn(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Rn=function(t,e){for(var r=0,n=(e=In(e,t)).length;null!=t&&r<n;)t=t[mn(e[r++])];return r&&r==n?t:void 0};var Cn=function(t,e,r){var n=null==t?void 0:Rn(t,e);return void 0===n?r:n};var Nn=function(t,e){return null!=t&&e in Object(t)};var xn=function(t,e,r){for(var n=-1,o=(e=In(e,t)).length,i=!1;++n<o;){var u=mn(e[n]);if(!(i=null!=t&&r(t,u)))break;t=t[u]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&Cr(o)&&Rr(u,o)&&(a(t)||Sr(t))};var Ln=function(t,e){return null!=t&&xn(t,e,Nn)};var Dn=function(t,e){return _n(t)&&ln(e)?pn(mn(t),e):function(r){var n=Cn(r,t);return void 0===n&&n===e?Ln(r,t):sn(e,n,3)}};var Pn=function(t){return t};var jn=function(t){return function(e){return null==e?void 0:e[t]}};var wn=function(t){return function(e){return Rn(e,t)}};var Mn=function(t){return _n(t)?jn(mn(t)):wn(t)};var kn=function(t){return"function"==typeof t?t:null==t?Pn:"object"==typeof t?a(t)?Dn(t[0],t[1]):fn(t):Mn(t)};var Un=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),u=a.length;u--;){var s=a[t?u:++o];if(!1===r(i[s],s,i))break}return e}}();var Gn=function(t,e){return function(r,n){if(null==r)return r;if(!Br(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++i<o)&&!1!==n(a[i],i,a););return r}}((function(t,e){return t&&Un(t,e,Hr)}));var Fn=function(t,e){var r=-1,n=Br(t)?Array(t.length):[];return Gn(t,(function(t,o,i){n[++r]=e(t,o,i)})),n};var Vn=function(t,e){return(a(t)?We:Fn)(t,kn(e))},Bn=function(){function t(t,e,r){var n=this;this.observer=new wt,this.context=t,this.providerId=e,this.resolver=r,this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return n.updateState(t)})).catch((function(t){jt.error(St[gt.STATE_FETCH_FAILED],t.message),n.context.eventing.track(St[gt.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,r=this.state;this.updateState(y(y({},r),t)),this.resolver.update(this.context,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){jt.error(St[gt.STATE_UPDATE_FAILED],t.message),e.context.eventing.track(St[gt.STATE_UPDATE_FAILED],{errorMessage:t.message}),r&&e.updateState(r)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),Hn=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),Wn=Object.create(null),Yn=function(){function t(t){this.cache=new Hn,this.options=y({},t||{})}return t.register=function(t,e){Wn[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,r=g(t,["type"]),n=Wn[e];return n?new n(r):null},t.prototype.toJSON=function(){return y({type:this.type},this.options)},t}();var zn=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var Kn=function(t){return t!=t};var $n=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1};var Jn=function(t,e,r){return e==e?$n(t,e,r):zn(t,Kn,r)};var qn=function(t,e){return!!(null==t?0:t.length)&&Jn(t,e,0)>-1};var Zn=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1};var Xn=function(){},Qn=Jr&&1/ur(new Jr([,-0]))[1]==1/0?function(t){return new Jr(t)}:Xn;var to=function(t,e,r){var n=-1,o=qn,i=t.length,a=!0,u=[],s=u;if(r)a=!1,o=Zn;else if(i>=200){var c=e?null:Qn(t);if(c)return ur(c);a=!1,o=nr,s=new er}else s=e?[]:u;t:for(;++n<i;){var l=t[n],d=e?e(l):l;if(l=r||0!==l?l:0,a&&d==d){for(var p=s.length;p--;)if(s[p]===d)continue t;e&&s.push(d),u.push(l)}else o(s,d,r)||(s!==u&&s.push(d),u.push(l))}return u};var eo=function(t){return t&&t.length?to(t):[]},ro=function(){function t(){}return t.get=function(e,r){var n=t.loaders.get(e);if(n)return n;var o=new i.default(r,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),no="https://api.candu.ai"+c,oo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _(e,t),e.prototype.retrieve=function(t,e){return T(this,void 0,void 0,(function(){var r,n,o=this;return b(this,(function(i){switch(i.label){case 0:return[4,ro.get("cardStateApi",(function(e){return T(o,void 0,void 0,(function(){var r;return b(this,(function(n){switch(n.label){case 0:return[4,fetch(no+"?token="+t.clientToken+"&finder=byIds&ids="+eo(e).join(",")+"&userId="+t.userId).then((function(t){return t.json()}))];case 1:return r=n.sent(),[2,e.map((function(t){return r.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return r=i.sent(),n={id:e,state:{dismissed:!1}},[2,r||n]}}))}))},e.prototype.update=function(t,e,r){return fetch(no+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:r.state,userId:t.userId.toString()})}).then((function(t){return t.json()}))},e}(Yn);Yn.register(exports.StateResolverType.CardApi,oo);var io="https://api.candu.ai"+s;function ao(t){return{state:t.state,id:t.id}}function uo(t){switch(t){case exports.CheckListScope.Account:return"AccountId";case exports.CheckListScope.User:default:return"UserId"}}var so=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _(e,t),e.prototype.getScopeAndFieldFromContext=function(t){var e=this.options.scopeTrait,r=this.options.scope||exports.CheckListScope.User,n=t.userId.toString();return r===exports.CheckListScope.Account&&(e&&t.traits[e]?n=t.traits[e]:(Pt("trait '"+e+"' is not defined, falling back to user scope"),r=exports.CheckListScope.User)),{scope:r,scopeField:n}},e.prototype.retrieve=function(t,e){return T(this,void 0,void 0,(function(){var r,n,o,i=this;return b(this,(function(a){switch(a.label){case 0:return r=this.getScopeAndFieldFromContext(t),n=r.scope,o=r.scopeField,[4,ro.get("checklistState",(function(e){return T(i,void 0,void 0,(function(){var r;return b(this,(function(i){switch(i.label){case 0:return[4,fetch(io+"?token="+t.clientToken+"&byTrait="+uo(n)+"&field="+o+"&finder=byIds&ids="+eo(e).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(ao)}))];case 1:return r=i.sent(),[2,e.map((function(t){return r.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,a.sent()||{id:e,state:exports.CheckListItemStatus.NotStared}]}}))}))},e.prototype.update=function(t,e,r){var n=this.getScopeAndFieldFromContext(t),o=n.scope,i=n.scopeField;return fetch(io+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y(y({},r),{byTrait:uo(o),field:i}))}).then((function(t){return t.json()})).then(ao)},e}(Yn);Yn.register(exports.StateResolverType.CheckListApi,so);exports.CANDU_PORTAL_CLASS="candu_portal",exports.CardResolverInstance=oo,exports.CheckListResolverInstance=so,exports.DEFAULT_ALERT_COLOR="#EDEDED",exports.DEFAULT_ALT="",exports.DEFAULT_COLOR=rt,exports.DEFAULT_SEGMENT_ID="Everyone",exports.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",exports.DEFAULT_TAB_COLOR="#FEFEFE",exports.DEFAULT_TAB_HEADER_COLOR="#333745",exports.DEFAULT_TAB_ITEM_COLOR="#838792",exports.ERROR_MESSAGES=St,exports.ERROR_SLUGS=yt,exports.EVENT_NAMES=gt,exports.IsNumericId=Y,exports.LOGGER=It,exports.METRICS=bt,exports.NodeManager=Mt,exports.Observer=wt,exports.PREVIEW_COOKIE_NAME="candu.preview",exports.PREVIEW_FRAME_ID="canduPreview",exports.PREVIEW_SCRIPT_URL="https://app.candu.ai/preview.html",exports.PREVIEW_URL_PARAM="candu_preview",exports.PreviewContainer=kt,exports.RESOURCES=Lt,exports.STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},exports.SingletonAPI=Ft,exports.StateProviderInstance=Bn,exports.StateResolverInstance=Yn,exports.TutorialDependencies=h,exports.attachStylesheet=function(t,e){void 0===e&&(e="main");var r=Be(t);if(!document.getElementById(r)){var n=document.createElement("link");n.setAttribute("id",r),n.setAttribute("rel","stylesheet"),n.setAttribute("href",u+"/styleguides/applications/"+t+"/default/"+e+".css"),document.head.appendChild(n)}},exports.calculateGroupCompletion=function(t,e){var r=Object.values(t).filter((function(t){return t.status===exports.CheckListItemStatus.Done})).length;return{completedItems:r,percComplete:e?Math.round(100*r/e):0}},exports.canduPortalId=function(t){return"candu_portal_"+t},exports.checkCyclicAndAdd=function(t,e){return t.dependencies.add(t.id,e)},exports.createSingleton=function(t){var e,r,n=function(t){return function(){for(var e,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(r.api)return(e=r.api)[t].apply(e,n);console.warn("Please initialize the SDK by calling Candu.init() before attempting to call "+t)}};return(e=function(){function e(){}return e.init=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return this.api||(e.api=new(t.bind.apply(t,O([void 0],r)))),e.subscriberCallbacks.forEach((function(t){return t()})),e.subscriberCallbacks=[],window.postMessage({source:"CANDU_SINGLETON",payload:{type:"INIT"}},window&&window.origin?window.origin:"*"),e},e.onProviderReady=function(t){if(e.api)return t();e.subscriberCallbacks.push(t)},e}()).subscriberCallbacks=[],e.renderTutorial=n("renderTutorial"),e.renderPortal=n("renderPortal"),e.renderContent=n("renderContent"),e.attachClient=n("attachClient"),e.detachClient=n("detachClient"),e.getProvider=n("getProvider"),e.getInfo=n("getInfo"),r=e,window.Candu=r,r},exports.createTutorialDocumentContext=function(t,e){return{id:t,dependencies:e?e.dependencies:new h(t)}},exports.cssInputObjToString=function(t){return Object.keys(t).reduce((function(e,r){return""+e+r+": "+t[r]+";"}),"")},exports.cssInputStringToObj=function(t){return t.split(";").reduce((function(t,e){var r,n=e.split(":"),o=n[0],i=n[1];return o&&i?y(y({},t),((r={})[o.trim()]=i.trim(),r)):t}),{})},exports.defaultStyleguide=At,exports.detachStylesheet=function(t){var e=document.getElementById(Be(t));e&&e.remove()},exports.fetchFromApi=Ct,exports.fetchFromCdn=Nt,exports.fetchHead=function(t,e){t&&a(t)&&(!function(t,e){var r="candu-stylesheet-"+t;if(!document.getElementById(r)){var n=document.createElement("style");n.setAttribute("id",r),n.setAttribute("type","text/css"),n.appendChild(document.createTextNode(e)),document.head.append(n)}}("document",".candu-document * {\n box-sizing: border-box;\n }\n "),t.map((function(t){var r=t.nodeType,n=t.url;return v("EmbedTutorial"===r?u+"/tutorials/"+e+"/"+n+".json":"EmbedPortal"===r?u+"/portals/"+e+"/"+n+"/head.json":n)})))},exports.fetchURL=Rt,exports.findMatchingSegment=function(t,e){var r=e.reduce((function(t,e){var r;return y(y({},t),((r={})[e]=e,r))}),{});if(a(t.content))return t.content.find((function(t){var e=t.segmentId;return!!r[e]||"Everyone"===e}))},exports.getCheckListStateProviders=function(t){return t.filter((function(t){return t.resolver instanceof so}))},exports.getContentState=function(t){return t.lastModifiedAt===t.lastPublishedAt?"Published":t.lastPublishedAt?"Unsynced":"Draft"},exports.getFirstNotStartedItem=function(t,e){for(var r=Object.values(t),n=function(t){var e=r.find((function(e){return e.position===t}));if(!e||e.status===exports.CheckListItemStatus.NotStared)return{value:t}},o=0;o<e;o+=1){var i=n(o);if("object"==typeof i)return i.value}},exports.getInitialItems=function(t){var e={};return t.forEach((function(t,r){var n=t.getResolvedState();n&&(e[n.id]={status:n.state,position:r})})),e},exports.getTutorialDocument=xt,exports.includeHTMLWhitespaces=function(t){return t.replace(/\s/g,"&nbsp;")},exports.initStateProviders=function(t,e){return Vn(t,(function(t,r){var n=Yn.fromJSON(t.resolver);return n?new Bn(e,r,n):null})).filter((function(t){return!!t}))},exports.internalEventing=function(t){var e=t.identify,r=t.track;return{provider:function(t){var n=t.userId,o=t.traits,i=t.styleguide;e(n,o),r(gt.HEARTBEAT,function(t){var e={};return Object.keys(t).forEach((function(r){At[r]&&(e["styleguide."+r]=t[r].displayName||!0)})),e}(i))},tutorialDocumentLoadingError:function(t){var e=t.tutorialId,n=t.slug,o=t.contentHashId;It.error(St[gt.TUTORIAL_LOADING_ERROR]),r(gt.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:n,contentHashId:o})}}},exports.isApiError=function(t){return tt(t)&&G(t.errorCode)},exports.isClientToken=z,exports.isContentHashId=it,exports.isIdentifier=W,exports.isPortalId=function(t){return Y(t)},exports.isPortalSlug=function(t){return W(t)},exports.isStatePath=function(t){return G(t)&&!!t.match(/^@(\w|\d|_|-|\.){3,20}\$/)},exports.isTutorialId=at,exports.isTutorialSlug=ut,exports.isUserId=K,exports.logError=Dt,exports.logWarning=Pt,exports.logger=jt,exports.mapNodeToStyleguide=zt,exports.mergeStyleguidesFromContext=Ve,exports.messageFactory=q,exports.messages=J,exports.portalValidation=function(t){var e=t.slug,r=t.styleguide;return mt(r),{slug:e,styleguide:r||{}}},exports.providerValidation=function(e){var r=e.clientToken,n=e.userId,i=e.traits,a=e.options,u=e.styleguide,s=g(e,["clientToken","userId","traits","options","styleguide"]);return o.default(z(r),"(Candu) you must provide a valid clientToken"),o.default(!n||K(n),"(Candu) you must provide a valid userId"),mt(u),o.default(!i||tt(i),"(Candu) traits must be undefined or an object"),o.default(!a||tt(a),"(Candu) options must be undefined or an object"),y(y({},s),{clientToken:r,traits:i||{},options:a||{},styleguide:u||{},userId:n||t.getAnonymousId()})},exports.stripHTML=function(t){return DOMParser?(new DOMParser).parseFromString(t,"text/html").body.textContent||"":t},exports.stylguideClassNameMap=ht,exports.toCssSelector=function(t,e){var r=y({className:"root",variant:void 0,selector:"",output:"css"},e||{}),n=r.className,o=r.variant,i=r.selector,a=r.output,u="candu-"+t;if("global"===n)return"html"===a?"":":root";var s=null,c=[],l=ht[t]||{};if(o&&l.variants){var d=l.variants;c=Object.keys(o).reduce((function(t,e){var r=o[e],n=d[e];return t.push(n?n(r):e+"-"+r),t}),[])}return"root"!==n&&l.childClassNames&&l.childClassNames[n]&&(s="candu-"+t+"--"+l.childClassNames[n]),"css"===a?[u,s,i].reduce((function(t,e,r){return e&&""!==e?0===r?"."+u+c.map((function(t){return"."+t})).join(""):1===r?t+" ."+e:""+t+e:t}),"")||"":"root"===n?O([u],c).filter((function(t){return!!t})).join(" ")||"":s||""},exports.toStyleguideDecl=function(t){return Object.keys(t).reduce((function(e,r){return O(e,[{type:exports.CSSNodeTypes.Decl,prop:r,value:t[r]}])}),[])},exports.tutorialValidation=function(t){var e=t.slug,r=t.styleguide,n=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.renderedByClient,u=g(t,["slug","styleguide","contentHashId","tutorialId","tutorialDocument","renderedByClient"]);return mt(r),y(y({},u),{slug:e,styleguide:r||{},contentHashId:n,tutorialId:o,tutorialDocument:i,renderedByClient:a})},exports.unpackShorthandStyles=function(t){var e=t.padding,r=t.margin,n=g(t,["padding","margin"]),o={};return e&&(o=y(y({},o),He("padding",e))),r&&(o=y(y({},o),He("margin",r))),y(y({},o),n)},exports.windowStream=function(t){var e=t.source,r=t.destination,n=t.targetOrigin,o=t.targetWindow,i=t.originWindow,a=t.onRecieveMessage,u=q({source:e,destination:r}),s=u.read,c=u.write,l=function(t){var e=s(t.data);e&&a(e)};return i.addEventListener("message",l,!1),{close:function(){i.removeEventListener("message",l)},send:function(t){o.postMessage(c(t),n)}}};
//# sourceMappingURL=index.cjs.js.map

@@ -1,2 +0,2 @@

import{getAnonymousId as t}from"@candulabs/eventing";import e from"invariant";import"setimmediate";import n from"dataloader";var r=Array.isArray;var o="https://cdn.candu.ai",i="/api/checklistItems",u="/api/cards",a="/api/segmentMemberships",c="/api/segmentsDefinition",s="/api/tutorialMetadata",l="/api/tutorialDocumentsSdk",f=function(t){if(!document.querySelectorAll('[href="'+t+'"]').length){var e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.appendChild(e)}};var d=function(t,e){t&&r(t)&&(!function(t,e){var n="candu-stylesheet-"+t;if(!document.getElementById(n)){var r=document.createElement("style");r.setAttribute("id",n),r.setAttribute("type","text/css"),r.appendChild(document.createTextNode(e)),document.head.append(r)}}("document",".candu-document * {\n box-sizing: border-box;\n }\n "),t.map((function(t){var n=t.nodeType,r=t.url;return f("EmbedTutorial"===n?o+"/tutorials/"+e+"/"+r+".json":"EmbedPortal"===n?o+"/portals/"+e+"/"+r+"/head.json":r)})))},p=function(){function t(t){this.adjacencyList={},this.rootDocument=t,this.adjacencyList[t]=[]}return t.prototype.get=function(t){return this.adjacencyList[t]},t.prototype.add=function(t,e){var n=this;if(this.adjacencyList[t]||(this.adjacencyList[t]=[]),!this.adjacencyList[e])return this.adjacencyList[t].push(e),this.adjacencyList[e]=[],!0;if(this.adjacencyList[t].includes(e))return!0;var r=function(e){if(e===t)return!0;for(var o=0,i=n.adjacencyList[e];o<i.length;o++){var u=i[o];if(r(u))return!0}return!1};return!r(e)&&(this.adjacencyList[t].push(e),!0)},t}(),v=function(t,e){return{id:t,dependencies:e?e.dependencies:new p(t)}},h=function(t,e){return t.dependencies.add(t.id,e)},_=function(t,e){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function E(t,e){function n(){this.constructor=t}_(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var y=function(){return(y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function b(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function g(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(u,a)}c((r=r.apply(t,e||[])).next())}))}function O(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function T(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,a=i.length;u<a;u++,o++)r[o]=i[u];return r}var m="Everyone",I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(t){var e={exports:{}};return t(e,e.exports),e.exports}var R="object"==typeof I&&I&&I.Object===Object&&I,N="object"==typeof self&&self&&self.Object===Object&&self,D=R||N||Function("return this")(),w=D.Symbol,j=Object.prototype,C=j.hasOwnProperty,P=j.toString,L=w?w.toStringTag:void 0;var S=function(t){var e=C.call(t,L),n=t[L];try{t[L]=void 0;var r=!0}catch(t){}var o=P.call(t);return r&&(e?t[L]=n:delete t[L]),o},U=Object.prototype.toString;var k=function(t){return U.call(t)},M=w?w.toStringTag:void 0;var x=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":M&&M in Object(t)?S(t):k(t)};var F=function(t){return null!=t&&"object"==typeof t};var B=function(t){return"string"==typeof t||!r(t)&&F(t)&&"[object String]"==x(t)};var G,V,z=function(t){return"number"==typeof t||F(t)&&"[object Number]"==x(t)},H=/^([a-zA-Z0-9]|_|-)+$/,W=function(t){return B(t)&&t.length>=3&&t.length<100&&H.test(t)},Y=function(t){return z(t)&&t>=0},K=function(t){return B(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10},$=function(t){return Y(t)||B(t)&&t.trim().length>0};!function(t){t.SDK="SDK",t.PREVIEW="PREVIEW"}(G||(G={})),function(t){t.BOOTSTRAP="Bootstrap",t.CHANGE_POSITION="ChangePosition",t.CLOSE_PREVIEW="ClosePreview",t.PREVIEW_LOADED="PreviewLoaded",t.SET_AVALIABLE_PORTALS="SetAvaliablePortals",t.SET_CONTENT="SetContent",t.SET_SELECTED_ELEMENT="SetSelectedElement",t.SET_VIEW_MODE="SetViewMode",t.ADD_ELEMENT="AddElement",t.REMOVE_ELEMENT="RemoveElement",t.UPDATE_ELEMENT="UpdateElement",t.SET_ELEMENT="SetElement"}(V||(V={}));var J=function(t,e){return void 0===e&&(e={}),y({type:t},e)},q={bootstrap:function(t,e,n,r){return J(V.BOOTSTRAP,{clientToken:t,userId:e,version:n,preview:r})},changePosition:function(t,e){return J(V.CHANGE_POSITION,{mouseEvent:t,top:e})},closePreview:function(){return J(V.CLOSE_PREVIEW)},previewLoaded:function(){return J(V.PREVIEW_LOADED)},setAvaliablePortals:function(t){return J(V.SET_AVALIABLE_PORTALS,{avaliablePortals:t})},addElement:function(t){return J(V.ADD_ELEMENT,{element:t})},removeElement:function(t){return J(V.REMOVE_ELEMENT,{id:t})},updateElement:function(t){return J(V.UPDATE_ELEMENT,{element:t})},setContent:function(t){return J(V.SET_CONTENT,{content:t})},setViewMode:function(t){return J(V.SET_VIEW_MODE,{viewMode:t})},setSelectedElement:function(t){return J(V.SET_SELECTED_ELEMENT,{element:t})}},Z=function(t){var e=t.source,n=t.destination;return{read:function(t){var e=t.actor,r=t.message;return e===n?r:null},write:function(t){return{actor:e,message:t}}}},X=function(t){var e=t.source,n=t.destination,r=t.targetOrigin,o=t.targetWindow,i=t.originWindow,u=t.onRecieveMessage,a=Z({source:e,destination:n}),c=a.read,s=a.write,l=function(t){var e=c(t.data);e&&u(e)};return i.addEventListener("message",l,!1),{close:function(){i.removeEventListener("message",l)},send:function(t){o.postMessage(s(t),r)}}};var Q,tt,et,nt,rt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};function ot(t){return rt(t)&&B(t.errorCode)}!function(t){t.ON_CLICK="OnClick"}(Q||(Q={})),function(t){t.NATIVE="Native",t.PENDO="Pendo"}(tt||(tt={})),function(t){t.NAVIGATE="Navigate",t.CHANGE_TUTORIAL="ChangeTutorial",t.OPEN_GUIDE="OpenGuide",t.DISMISSED_CARD="DismissedCard"}(et||(et={})),function(t){t.PRIMARY="primary",t.SECONDARY="primary",t.WARNING="warning",t.DANGER="danger",t.NEUTRAL="neutral",t.ACTIVE="active",t.INFO="info"}(nt||(nt={}));var it,ut=nt.PRIMARY;!function(t){t.U="U",t.B="B",t.Em="Em",t.InlineCode="InlineCode"}(it||(it={}));var at,ct,st=function(t){return B(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/)},lt=function(t){return Y(t)},ft=function(t){return W(t)},dt=function(t){return Y(t)},pt=function(t){return W(t)};!function(t){t.NotStared="NotStarted",t.InProgress="InProgress",t.Done="Done"}(at||(at={})),function(t){t.User="User",t.Account="Account"}(ct||(ct={}));var vt="candu_portal",ht=function(t){return"candu_portal_"+t};var _t,Et,yt="candu.preview",bt="candu_preview",gt="canduPreview";!function(t){t.COLLAPSED="Collapsed",t.EXPANDED="Expanded",t.MINIMIZED="Minimized"}(_t||(_t={})),function(t){t.TUTORIAL="Tutorial",t.PORTAL="Portal"}(Et||(Et={}));var Ot,Tt,mt="https://app.candu.ai/preview.html";!function(t){t.Global="Global",t.Carried="Carried"}(Ot||(Ot={})),function(t){t.CanduCdn="CanduCdn",t.CheckListApi="CheckListApi",t.CardApi="CardApi"}(Tt||(Tt={}));var It,At,Rt=function(t){return B(t)&&!!t.match(/^@(\w|\d|_|-|\.){3,20}\$/)};!function(t){t.Global="Global",t.Organization="Organization"}(It||(It={})),function(t){t.Root="root",t.Rule="rule",t.Atrule="atrule",t.Decl="decl",t.Any="any"}(At||(At={}));var Nt,Dt={button:{childClassNames:{icon:"button-icon"},variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},badge:{variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},typography:{variants:{typography:function(t){return"typography-"+t}}}},wt=function(t,e){var n=y({className:"root",variant:void 0,selector:"",output:"css"},e||{}),r=n.className,o=n.variant,i=n.selector,u=n.output,a="candu-"+t;if("global"===r)return"html"===u?"":":root";var c=null,s=[],l=Dt[t]||{};if(o&&l.variants){var f=l.variants;s=Object.keys(o).reduce((function(t,e){var n=o[e],r=f[e];return t.push(r?r(n):e+"-"+n),t}),[])}return"root"!==r&&l.childClassNames&&l.childClassNames[r]&&(c="candu-"+t+"--"+l.childClassNames[r]),"css"===u?[a,c,i].reduce((function(t,e,n){return e&&""!==e?0===n?"."+a+s.map((function(t){return"."+t})).join(""):1===n?t+" ."+e:""+t+e:t}),"")||"":"root"===r?T([a],s).filter((function(t){return!!t})).join(" ")||"":c||""},jt=function(t){return Object.keys(t).reduce((function(e,n){return""+e+n+": "+t[n]+";"}),"")},Ct=function(t){return t.split(";").reduce((function(t,e){var n,r=e.split(":"),o=r[0],i=r[1];return o&&i?y(y({},t),((n={})[o.trim()]=i.trim(),n)):t}),{})},Pt=function(t){return Object.keys(t).reduce((function(e,n){return T(e,[{type:At.Decl,prop:n,value:t[n]}])}),[])},Lt=function(t,e){var n=e.reduce((function(t,e){var n;return y(y({},t),((n={})[e]=e,n))}),{});if(r(t.content))return t.content.find((function(t){var e=t.segmentId;return!!n[e]||"Everyone"===e}))},St=function(t){return"candu.sdk."+t},Ut=function(t){return St("error."+t)},kt={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",PROVIDER_ERROR:"provider_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},Mt={HEARTBEAT:St("heartbeat"),PREVIEW_OPEN:St("preview.open"),PORTAL:St("portal"),TUTORIAL:St("tutorial"),TUTORIAL_INTERACTION:St("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Ut("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Ut("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Ut("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Ut("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Ut("commit_api"),TUTORIAL_LOADING_ERROR:Ut("tutorial"),UNKOWN_NODE_TYPE:Ut(kt.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:Ut(kt.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:Ut(kt.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:Ut(kt.TUTORIAL_ERROR),PORTAL_ERROR:Ut(kt.PORTAL_ERROR),PROVIDER_ERROR:Ut(kt.PROVIDER_ERROR),STYLEGUIDE_MAP_ERROR:Ut(kt.TUTORIAL_ERROR),RENDER_NODE_ERROR:Ut(kt.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Ut("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Ut("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Ut("state_fetch_failed"),STATE_UPDATE_FAILED:Ut("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Ut("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:St("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:St("tutorial.checklist_group_complete"),CARD_DISMISSED:St("tutorial.card_dismissed")},xt=function(t){return St("metric."+t)},Ft={SEGMENT_MEMBERSHIP_LOAD_TIME:xt("segment_membership_load_time"),PORTAL_LOAD_TIME:xt("portal_load_time"),CONTENT_LOAD_TIME:xt("content_load_time"),TUTORIAL_LOAD_TIME:xt("tutorial_load_time"),TUTORIAL_DOCUMENT_MOUNT_TIME:xt("tutorial_document_mount_time")},Bt=function(t){return"An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: "+t+"."},Gt=((Nt={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n"})[Mt.PORTAL_ASSET_NOT_FOUND]="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",Nt[Mt.PORTAL_NO_SEGMENT_IDS]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",Nt[Mt.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",Nt[Mt.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",Nt[Mt.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",Nt[Mt.UNKOWN_INLINE_NODE_TYPE]=Bt(kt.UNKOWN_INLINE_NODE_TYPE),Nt[Mt.UNKOWN_NODE_TYPE]=Bt(kt.UNKOWN_NODE_TYPE),Nt[Mt.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Nt[Mt.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Nt[Mt.PORTAL_ERROR]="An error has occured within Portal",Nt[Mt.PROVIDER_ERROR]="An error has occured within Provider",Nt[Mt.TUTORIAL_ERROR]="An error has occured within Tutorial",Nt[Mt.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",Nt[Mt.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",Nt[Mt.STATE_FETCH_FAILED]="An error has occured while fetching state:",Nt[Mt.STATE_UPDATE_FAILED]="An error has occured while updating state:",Nt[Mt.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",Nt),Vt={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},zt={error:console.error,warning:console.warn},Ht=function(t){var e=t.identify,n=t.track;return{provider:function(t){var r=t.userId,o=t.traits,i=t.styleguide;e(r,o),n(Mt.HEARTBEAT,function(t){var e={};return Object.keys(t).forEach((function(n){Vt[n]&&(e["styleguide."+n]=t[n].displayName||!0)})),e}(i))},tutorialDocumentLoadingError:function(t){var e=t.tutorialId,r=t.slug,o=t.contentHashId;zt.error(Gt[Mt.TUTORIAL_LOADING_ERROR]),n(Mt.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:r,contentHashId:o})}}},Wt=function(t){return e(!t||rt(t),"(Candu) styleguide must be undefined or an object")},Yt=function(n){var r=n.clientToken,o=n.userId,i=n.traits,u=n.options,a=n.styleguide,c=b(n,["clientToken","userId","traits","options","styleguide"]);return e(K(r),"(Candu) you must provide a valid clientToken"),e(!o||$(o),"(Candu) you must provide a valid userId"),Wt(a),e(!i||rt(i),"(Candu) traits must be undefined or an object"),e(!u||rt(u),"(Candu) options must be undefined or an object"),y(y({},c),{clientToken:r,traits:i||{},options:u||{},styleguide:a||{},userId:o||t()})},Kt=function(t){var e=t.slug,n=t.styleguide,r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,u=t.renderedByClient,a=b(t,["slug","styleguide","contentHashId","tutorialId","tutorialDocument","renderedByClient"]);return Wt(n),y(y({},a),{slug:e,styleguide:n||{},contentHashId:r,tutorialId:o,tutorialDocument:i,renderedByClient:u})},$t=function(t){var e=t.slug,n=t.styleguide;return Wt(n),{slug:e,styleguide:n||{}}},Jt=function(t,e){return g(void 0,void 0,void 0,(function(){return O(this,(function(n){switch(n.label){case 0:return[4,fetch(t,e&&{headers:e})];case 1:return[2,n.sent().json()]}}))}))},qt=function(t){return Jt("https://api.candu.ai"+t,{SDKVersion:"0.7.1-alpha.22"})},Zt=function(t){return Jt(""+o+t,{SDKVersion:"0.7.1-alpha.22"})},Xt=function(t){return{byId:function(e){return qt(l+"?token="+t+"&finder=latestPublished&tutorialId="+e)},bySlug:function(e){return Zt("/tutorials/"+t+"/"+e+".json")},byContentHash:function(e){return Zt("/tutorials/"+t+"/"+e+".json")}}},Qt={tutorialDocumentLatestSaved:function(t,e){return g(void 0,void 0,void 0,(function(){return O(this,(function(n){return[2,qt(l+"/"+e+"?token="+t)]}))}))},portalAsset:function(t,e,n){return g(void 0,void 0,void 0,(function(){var r,o;return O(this,(function(i){return(null===(o=n)||void 0===o?void 0:o.length)?(r="?segmentIds="+n.join(","),[2,Zt("/portalMemberships/"+t+"/"+e+"/head.json"+r)]):[2,Zt("/portals/"+t+"/"+e+"/head.json")]}))}))},contentDocument:function(t,e,n){return g(void 0,void 0,void 0,(function(){var r,i,u;return O(this,(function(a){switch(a.label){case 0:return r=(null===(u=n)||void 0===u?void 0:u.length)?"?segmentIds="+n.join(","):"",[4,fetch(o+"/contentDocument/"+t+"/"+e+".json"+r)];case 1:return[2,(i=a.sent()).ok?i.json():null]}}))}))},segmentMembership:function(t,e){return g(void 0,void 0,void 0,(function(){return O(this,(function(n){return[2,qt(a+"/"+e+"?token="+t)]}))}))},segmentDefinition:function(t){return g(void 0,void 0,void 0,(function(){return O(this,(function(e){return[2,qt(c+"?token="+t)]}))}))},tutorialMetadata:function(t){return g(void 0,void 0,void 0,(function(){return O(this,(function(e){return[2,qt(s+"?token="+t)]}))}))},tutorialDocument:function(t,e,n){var r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,u=t.slug,a=Xt(e);return pt(u)?a.bySlug(u):dt(o)?a.byId(o):st(r)?a.byContentHash(r):rt(i)?Promise.resolve(i):(zt.error(Gt[Mt.NO_VALID_TUTORIAL_IDENTIFIER]),n.track(Mt.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},te=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.error.apply(console,t)},ee=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.warn.apply(console,t)},ne={error:te,warning:ee},re=function(t){return t.replace(/\s/g,"&nbsp;")},oe=function(t){return DOMParser?(new DOMParser).parseFromString(t,"text/html").body.textContent||"":t},ie=function(){function t(){this.subscribers=[]}return t.prototype.subscribe=function(t){var e=this;return this.subscribers.push(t),function(){e.subscribers[e.subscribers.indexOf(t)]=function(){}}},t.prototype.notify=function(t){this.subscribers.forEach((function(e){return e(t)}))},t.prototype.clear=function(){this.subscribers=[]},t}(),ue=function(){function t(t,e){var n=this;this.state="waiting",this.currentElement=null,this.selector=t,this.renderToElement=e,this.findAndRender(),this.observer=new MutationObserver((function(t){switch(n.state){case"waiting":t.some((function(t){return!!t.addedNodes.length}))&&n.findAndRender();break;case"mounted":t.forEach((function(t){t.removedNodes.length&&t.removedNodes.forEach((function(t){t===n.currentElement&&(n.currentElement=null,n.state="waiting")}))}));break;default:throw new Error("Unhandled state: "+n.state)}})),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1})}return t.prototype.findAndRender=function(){var t=document.querySelector(this.selector);t&&(this.renderToElement(t),this.currentElement=t,this.state="mounted")},t.prototype.stopObserving=function(){this.observer.disconnect()},t}(),ae=function(){function t(){this.onClientUpdateObserver=new ie}return t.prototype.attachClient=function(t){this.client=t,this.onClientUpdateObserver.notify({client:t})},t.prototype.detachClient=function(){this.client&&(this.client=null,this.onClientUpdateObserver.notify({client:null}))},t.prototype.onClientUpdate=function(t){var e=this.onClientUpdateObserver.subscribe(t);return this.client&&t({client:this.client}),e},t}(),ce=function(t){return t.lastModifiedAt===t.lastPublishedAt?"Published":t.lastPublishedAt?"Unsynced":"Draft"};function se(t){var e,n,r=function(t){return function(){for(var e,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(n.api)return(e=n.api)[t].apply(e,r);console.warn("Please initialize the SDK by calling Candu.init() before attempting to call "+t)}};return(e=function(){function e(){}return e.init=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this.api||(e.api=new(t.bind.apply(t,T([void 0],n)))),e.subscriberCallbacks.forEach((function(t){return t()})),e.subscriberCallbacks=[],window.postMessage({source:"CANDU_SINGLETON",payload:{type:"INIT"}},window&&window.origin?window.origin:"*"),e},e.onProviderReady=function(t){if(e.api)return t();e.subscriberCallbacks.push(t)},e}()).subscriberCallbacks=[],e.renderTutorial=r("renderTutorial"),e.renderPortal=r("renderPortal"),e.renderContent=r("renderContent"),e.attachClient=r("attachClient"),e.detachClient=r("detachClient"),e.getProvider=r("getProvider"),e.getInfo=r("getInfo"),n=e,window.Candu=n,n}var le="@candulabs/core",fe="0.7.1-alpha.22",de=function(){function t(t){this.init(t)}return t.prototype.getInfo=function(){return{core:{version:fe,name:le},sdk:{version:this.version,name:this.name}}},t.prototype.attachClient=function(t){return this.provider.preview.attachClient(t)},t.prototype.detachClient=function(){return this.provider.preview.detachClient()},Object.defineProperty(t.prototype,"provider",{get:function(){return this.getProvider()},enumerable:!0,configurable:!0}),t}(),pe=function(t){switch(t.trigger){case Q.ON_CLICK:default:return"onClick"}},ve=function(t,e){var n,r,o,i,u,a;if("Link"===t.type&&(null===(n=t.props)||void 0===n?void 0:n.href)){var c=t.props.href+" Link Clicked",s=null===(o=null===(r=t)||void 0===r?void 0:r.nodes)||void 0===o?void 0:o[0];if(s){var l=e.document.nodes[s];"Text"===(null===(i=l)||void 0===i?void 0:i.type)&&(null===(a=null===(u=l)||void 0===u?void 0:u.props)||void 0===a?void 0:a.children)&&(c=l.props.children+" Link Clicked")}return{onClick:function(){var n;return e.provider.eventing.track(Mt.TUTORIAL_INTERACTION,{trigger:Q.ON_CLICK,category:t.type,eventName:c,handler:{href:null===(n=t.props)||void 0===n?void 0:n.href,type:et.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var f=function(t,n){e.provider.eventing.track(Mt.TUTORIAL_INTERACTION,y(y({},t),n||{}))};return t.data.actions.map((function(t){return function(t,e,n){var r,o,i;switch(t.handler.type){case et.NAVIGATE:return(r={})[pe(t)]=function(r){r.stopPropagation();var o=t.handler,i=o.href,u=o.target,a=n||{},c=a.parentTrackers,s=b(a,["parentTrackers"]);c&&c.forEach((function(n){return e(t,n)})),e(t,s),"Blank"===u?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},r;case et.CHANGE_TUTORIAL:return(o={})[pe(t)]=function(){var e=t.handler.tutorialId;te("TODO -> change tutorial",e)},o;case et.OPEN_GUIDE:return(i={})[pe(t)]=function(){var e=t.handler.guideId;te("TODO -> open guide",e)},i;default:return{}}}(t,f,e.trackingIdentifiers)})).reduce((function(t,e){return y(y({},t),e)}),{})},he=function(t,e){var n=t.props||{},r=t.nodes,o=n.children;return o||(r?r.map(e):null)},_e=function(t,e){var n=t.states;return n&&e.stateProviderInstances.filter((function(t){return!!n[t.providerId]}))},Ee=function(t,e){var n=t.nodes;return n&&n.map((function(t){return e.document.nodes[t]})).filter((function(t){return!!t})).map((function(t){return _e(t,e)||[]})).reduce((function(t,e){return t.concat(e)}),[])},ye=function(t,e){try{var n=e.provider,r=e.document,o=e.trackingIdentifiers,i=r.nodes[t];if(!i)return ne.error("Document is corrupted. Refusing to move further."),null;var u=function(t){return ye(t,e)},a=i.type,c=i.props,s=i.css,l=y(y(y({},c||{}),{style:s||{},children:he(i,u)}),ve(i,{trackingIdentifiers:o,provider:n,document:r})),f={nodeId:t,node:i,document:r,render:{node:u,styleguide:function(t,n){return void 0===n&&(n={}),e.renderNode(t,{api:f,attributes:n})},tutorial:function(t){return e.renderTutorial(t)},portal:function(t){return e.renderPortal(t)}},trackingIdentifiers:o,stateInstances:_e(i,e),childrenStateInstances:Ee(i,e)},d=f.render.styleguide(a,l);return d||(ne.error(Gt[Mt.UNKOWN_NODE_TYPE],{type:a}),n.eventing.error(new Error(Gt[Mt.UNKOWN_NODE_TYPE]),{type:a}),null)}catch(t){return ne.error(Gt[Mt.STYLEGUIDE_MAP_ERROR],t),e.provider.eventing.error(t),null}};var be,ge=function(t){if(!rt(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Oe=D["__core-js_shared__"],Te=(be=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+be:"";var me=function(t){return!!Te&&Te in t},Ie=Function.prototype.toString;var Ae=function(t){if(null!=t){try{return Ie.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Re=/^\[object .+?Constructor\]$/,Ne=Function.prototype,De=Object.prototype,we=Ne.toString,je=De.hasOwnProperty,Ce=RegExp("^"+we.call(je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Pe=function(t){return!(!rt(t)||me(t))&&(ge(t)?Ce:Re).test(Ae(t))};var Le=function(t,e){return null==t?void 0:t[e]};var Se=function(t,e){var n=Le(t,e);return Pe(n)?n:void 0},Ue=Se(Object,"create");var ke=function(){this.__data__=Ue?Ue(null):{},this.size=0};var Me=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},xe=Object.prototype.hasOwnProperty;var Fe=function(t){var e=this.__data__;if(Ue){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xe.call(e,t)?e[t]:void 0},Be=Object.prototype.hasOwnProperty;var Ge=function(t){var e=this.__data__;return Ue?void 0!==e[t]:Be.call(e,t)};var Ve=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ue&&void 0===e?"__lodash_hash_undefined__":e,this};function ze(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ze.prototype.clear=ke,ze.prototype.delete=Me,ze.prototype.get=Fe,ze.prototype.has=Ge,ze.prototype.set=Ve;var He=ze;var We=function(){this.__data__=[],this.size=0};var Ye=function(t,e){return t===e||t!=t&&e!=e};var Ke=function(t,e){for(var n=t.length;n--;)if(Ye(t[n][0],e))return n;return-1},$e=Array.prototype.splice;var Je=function(t){var e=this.__data__,n=Ke(e,t);return!(n<0)&&(n==e.length-1?e.pop():$e.call(e,n,1),--this.size,!0)};var qe=function(t){var e=this.__data__,n=Ke(e,t);return n<0?void 0:e[n][1]};var Ze=function(t){return Ke(this.__data__,t)>-1};var Xe=function(t,e){var n=this.__data__,r=Ke(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function Qe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Qe.prototype.clear=We,Qe.prototype.delete=Je,Qe.prototype.get=qe,Qe.prototype.has=Ze,Qe.prototype.set=Xe;var tn=Qe,en=Se(D,"Map");var nn=function(){this.size=0,this.__data__={hash:new He,map:new(en||tn),string:new He}};var rn=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var on=function(t,e){var n=t.__data__;return rn(e)?n["string"==typeof e?"string":"hash"]:n.map};var un=function(t){var e=on(this,t).delete(t);return this.size-=e?1:0,e};var an=function(t){return on(this,t).get(t)};var cn=function(t){return on(this,t).has(t)};var sn=function(t,e){var n=on(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function ln(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ln.prototype.clear=nn,ln.prototype.delete=un,ln.prototype.get=an,ln.prototype.has=cn,ln.prototype.set=sn;var fn=ln;function dn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var u=t.apply(this,r);return n.cache=i.set(o,u)||i,u};return n.cache=new(dn.Cache||fn),n}dn.Cache=fn;var pn=dn,vn=pn((function(t,e){var n,r,o=t.provider,i=t.portal,u=t.tutorial,a=o.styleguide;return u&&(r=u.styleguide),i&&(n=i.styleguide),y(y(y(y({},a||{}),n||{}),r||{}),e||{})})),hn="",_n="#EDEDED",En="#333745",yn="#838792",bn="#FEFEFE",gn="#FEFEFE",On={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},Tn=function(t){return"candu-styleguide-"+t},mn=function(t,e){void 0===e&&(e="main");var n=Tn(t);if(!document.getElementById(n)){var r=document.createElement("link");r.setAttribute("id",n),r.setAttribute("rel","stylesheet"),r.setAttribute("href",o+"/styleguides/applications/"+t+"/default/"+e+".css"),document.head.appendChild(r)}},In=function(t){var e=document.getElementById(Tn(t));e&&e.remove()},An=function(t,e){var n,r,o,i,u="string"==typeof e&&e.split(" ");return u?1===u.length?((n={})[t+"Right"]=e,n[t+"Left"]=e,n[t+"Bottom"]=e,n[t+"Top"]=e,n):2===u.length?((r={})[t+"Top"]=u[0],r[t+"Right"]=u[1],r[t+"Bottom"]=u[0],r[t+"Left"]=u[1],r):3===u.length?((o={})[t+"Top"]=u[0],o[t+"Right"]=u[1],o[t+"Bottom"]=u[2],o[t+"Left"]=u[1],o):((i={})[t+"Top"]=u[0],i[t+"Right"]=u[1],i[t+"Bottom"]=u[2],i[t+"Left"]=u[3],i):{}},Rn=function(t){var e=t.padding,n=t.margin,r=b(t,["padding","margin"]),o={};return e&&(o=y(y({},o),An("padding",e))),n&&(o=y(y({},o),An("margin",n))),y(y({},o),r)};var Nn=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o};var Dn=function(){this.__data__=new tn,this.size=0};var wn=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var jn=function(t){return this.__data__.get(t)};var Cn=function(t){return this.__data__.has(t)};var Pn=function(t,e){var n=this.__data__;if(n instanceof tn){var r=n.__data__;if(!en||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new fn(r)}return n.set(t,e),this.size=n.size,this};function Ln(t){var e=this.__data__=new tn(t);this.size=e.size}Ln.prototype.clear=Dn,Ln.prototype.delete=wn,Ln.prototype.get=jn,Ln.prototype.has=Cn,Ln.prototype.set=Pn;var Sn=Ln;var Un=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var kn=function(t){return this.__data__.has(t)};function Mn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new fn;++e<n;)this.add(t[e])}Mn.prototype.add=Mn.prototype.push=Un,Mn.prototype.has=kn;var xn=Mn;var Fn=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var Bn=function(t,e){return t.has(e)};var Gn=function(t,e,n,r,o,i){var u=1&n,a=t.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var s=i.get(t);if(s&&i.get(e))return s==e;var l=-1,f=!0,d=2&n?new xn:void 0;for(i.set(t,e),i.set(e,t);++l<a;){var p=t[l],v=e[l];if(r)var h=u?r(v,p,l,e,t,i):r(p,v,l,t,e,i);if(void 0!==h){if(h)continue;f=!1;break}if(d){if(!Fn(e,(function(t,e){if(!Bn(d,e)&&(p===t||o(p,t,n,r,i)))return d.push(e)}))){f=!1;break}}else if(p!==v&&!o(p,v,n,r,i)){f=!1;break}}return i.delete(t),i.delete(e),f},Vn=D.Uint8Array;var zn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n};var Hn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},Wn=w?w.prototype:void 0,Yn=Wn?Wn.valueOf:void 0;var Kn=function(t,e,n,r,o,i,u){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Vn(t),new Vn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ye(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=zn;case"[object Set]":var c=1&r;if(a||(a=Hn),t.size!=e.size&&!c)return!1;var s=u.get(t);if(s)return s==e;r|=2,u.set(t,e);var l=Gn(a(t),a(e),r,o,i,u);return u.delete(t),l;case"[object Symbol]":if(Yn)return Yn.call(t)==Yn.call(e)}return!1};var $n=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t};var Jn=function(t,e,n){var o=e(t);return r(t)?o:$n(o,n(t))};var qn=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var u=t[n];e(u,n,t)&&(i[o++]=u)}return i};var Zn=function(){return[]},Xn=Object.prototype.propertyIsEnumerable,Qn=Object.getOwnPropertySymbols,tr=Qn?function(t){return null==t?[]:(t=Object(t),qn(Qn(t),(function(e){return Xn.call(t,e)})))}:Zn;var er=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r};var nr=function(t){return F(t)&&"[object Arguments]"==x(t)},rr=Object.prototype,or=rr.hasOwnProperty,ir=rr.propertyIsEnumerable,ur=nr(function(){return arguments}())?nr:function(t){return F(t)&&or.call(t,"callee")&&!ir.call(t,"callee")};var ar=function(){return!1},cr=A((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?D.Buffer:void 0,i=(o?o.isBuffer:void 0)||ar;t.exports=i})),sr=/^(?:0|[1-9]\d*)$/;var lr=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&sr.test(t))&&t>-1&&t%1==0&&t<e};var fr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},dr={};dr["[object Float32Array]"]=dr["[object Float64Array]"]=dr["[object Int8Array]"]=dr["[object Int16Array]"]=dr["[object Int32Array]"]=dr["[object Uint8Array]"]=dr["[object Uint8ClampedArray]"]=dr["[object Uint16Array]"]=dr["[object Uint32Array]"]=!0,dr["[object Arguments]"]=dr["[object Array]"]=dr["[object ArrayBuffer]"]=dr["[object Boolean]"]=dr["[object DataView]"]=dr["[object Date]"]=dr["[object Error]"]=dr["[object Function]"]=dr["[object Map]"]=dr["[object Number]"]=dr["[object Object]"]=dr["[object RegExp]"]=dr["[object Set]"]=dr["[object String]"]=dr["[object WeakMap]"]=!1;var pr=function(t){return F(t)&&fr(t.length)&&!!dr[x(t)]};var vr=function(t){return function(e){return t(e)}},hr=A((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&R.process,i=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),_r=hr&&hr.isTypedArray,Er=_r?vr(_r):pr,yr=Object.prototype.hasOwnProperty;var br=function(t,e){var n=r(t),o=!n&&ur(t),i=!n&&!o&&cr(t),u=!n&&!o&&!i&&Er(t),a=n||o||i||u,c=a?er(t.length,String):[],s=c.length;for(var l in t)!e&&!yr.call(t,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||u&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||lr(l,s))||c.push(l);return c},gr=Object.prototype;var Or=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||gr)};var Tr=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),mr=Object.prototype.hasOwnProperty;var Ir=function(t){if(!Or(t))return Tr(t);var e=[];for(var n in Object(t))mr.call(t,n)&&"constructor"!=n&&e.push(n);return e};var Ar=function(t){return null!=t&&fr(t.length)&&!ge(t)};var Rr=function(t){return Ar(t)?br(t):Ir(t)};var Nr=function(t){return Jn(t,Rr,tr)},Dr=Object.prototype.hasOwnProperty;var wr=function(t,e,n,r,o,i){var u=1&n,a=Nr(t),c=a.length;if(c!=Nr(e).length&&!u)return!1;for(var s=c;s--;){var l=a[s];if(!(u?l in e:Dr.call(e,l)))return!1}var f=i.get(t);if(f&&i.get(e))return f==e;var d=!0;i.set(t,e),i.set(e,t);for(var p=u;++s<c;){var v=t[l=a[s]],h=e[l];if(r)var _=u?r(h,v,l,e,t,i):r(v,h,l,t,e,i);if(!(void 0===_?v===h||o(v,h,n,r,i):_)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var E=t.constructor,y=e.constructor;E==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof E&&E instanceof E&&"function"==typeof y&&y instanceof y||(d=!1)}return i.delete(t),i.delete(e),d},jr=Se(D,"DataView"),Cr=Se(D,"Promise"),Pr=Se(D,"Set"),Lr=Se(D,"WeakMap"),Sr=Ae(jr),Ur=Ae(en),kr=Ae(Cr),Mr=Ae(Pr),xr=Ae(Lr),Fr=x;(jr&&"[object DataView]"!=Fr(new jr(new ArrayBuffer(1)))||en&&"[object Map]"!=Fr(new en)||Cr&&"[object Promise]"!=Fr(Cr.resolve())||Pr&&"[object Set]"!=Fr(new Pr)||Lr&&"[object WeakMap]"!=Fr(new Lr))&&(Fr=function(t){var e=x(t),n="[object Object]"==e?t.constructor:void 0,r=n?Ae(n):"";if(r)switch(r){case Sr:return"[object DataView]";case Ur:return"[object Map]";case kr:return"[object Promise]";case Mr:return"[object Set]";case xr:return"[object WeakMap]"}return e});var Br=Fr,Gr="[object Object]",Vr=Object.prototype.hasOwnProperty;var zr=function(t,e,n,o,i,u){var a=r(t),c=r(e),s=a?"[object Array]":Br(t),l=c?"[object Array]":Br(e),f=(s="[object Arguments]"==s?Gr:s)==Gr,d=(l="[object Arguments]"==l?Gr:l)==Gr,p=s==l;if(p&&cr(t)){if(!cr(e))return!1;a=!0,f=!1}if(p&&!f)return u||(u=new Sn),a||Er(t)?Gn(t,e,n,o,i,u):Kn(t,e,s,n,o,i,u);if(!(1&n)){var v=f&&Vr.call(t,"__wrapped__"),h=d&&Vr.call(e,"__wrapped__");if(v||h){var _=v?t.value():t,E=h?e.value():e;return u||(u=new Sn),i(_,E,n,o,u)}}return!!p&&(u||(u=new Sn),wr(t,e,n,o,i,u))};var Hr=function t(e,n,r,o,i){return e===n||(null==e||null==n||!F(e)&&!F(n)?e!=e&&n!=n:zr(e,n,r,o,t,i))};var Wr=function(t,e,n,r){var o=n.length,i=o,u=!r;if(null==t)return!i;for(t=Object(t);o--;){var a=n[o];if(u&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var c=(a=n[o])[0],s=t[c],l=a[1];if(u&&a[2]){if(void 0===s&&!(c in t))return!1}else{var f=new Sn;if(r)var d=r(s,l,c,t,e,f);if(!(void 0===d?Hr(l,s,3,r,f):d))return!1}}return!0};var Yr=function(t){return t==t&&!rt(t)};var Kr=function(t){for(var e=Rr(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Yr(o)]}return e};var $r=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}};var Jr=function(t){var e=Kr(t);return 1==e.length&&e[0][2]?$r(e[0][0],e[0][1]):function(n){return n===t||Wr(n,t,e)}};var qr=function(t){return"symbol"==typeof t||F(t)&&"[object Symbol]"==x(t)},Zr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xr=/^\w*$/;var Qr=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!qr(t))||(Xr.test(t)||!Zr.test(t)||null!=e&&t in Object(e))};var to=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,eo=/\\(\\)?/g,no=function(t){var e=pn(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(to,(function(t,n,r,o){e.push(r?o.replace(eo,"$1"):n||t)})),e})),ro=w?w.prototype:void 0,oo=ro?ro.toString:void 0;var io=function t(e){if("string"==typeof e)return e;if(r(e))return Nn(e,t)+"";if(qr(e))return oo?oo.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};var uo=function(t){return null==t?"":io(t)};var ao=function(t,e){return r(t)?t:Qr(t,e)?[t]:no(uo(t))};var co=function(t){if("string"==typeof t||qr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var so=function(t,e){for(var n=0,r=(e=ao(e,t)).length;null!=t&&n<r;)t=t[co(e[n++])];return n&&n==r?t:void 0};var lo=function(t,e,n){var r=null==t?void 0:so(t,e);return void 0===r?n:r};var fo=function(t,e){return null!=t&&e in Object(t)};var po=function(t,e,n){for(var o=-1,i=(e=ao(e,t)).length,u=!1;++o<i;){var a=co(e[o]);if(!(u=null!=t&&n(t,a)))break;t=t[a]}return u||++o!=i?u:!!(i=null==t?0:t.length)&&fr(i)&&lr(a,i)&&(r(t)||ur(t))};var vo=function(t,e){return null!=t&&po(t,e,fo)};var ho=function(t,e){return Qr(t)&&Yr(e)?$r(co(t),e):function(n){var r=lo(n,t);return void 0===r&&r===e?vo(n,t):Hr(e,r,3)}};var _o=function(t){return t};var Eo=function(t){return function(e){return null==e?void 0:e[t]}};var yo=function(t){return function(e){return so(e,t)}};var bo=function(t){return Qr(t)?Eo(co(t)):yo(t)};var go=function(t){return"function"==typeof t?t:null==t?_o:"object"==typeof t?r(t)?ho(t[0],t[1]):Jr(t):bo(t)};var Oo=function(t){return function(e,n,r){for(var o=-1,i=Object(e),u=r(e),a=u.length;a--;){var c=u[t?a:++o];if(!1===n(i[c],c,i))break}return e}}();var To=function(t,e){return function(n,r){if(null==n)return n;if(!Ar(n))return t(n,r);for(var o=n.length,i=e?o:-1,u=Object(n);(e?i--:++i<o)&&!1!==r(u[i],i,u););return n}}((function(t,e){return t&&Oo(t,e,Rr)}));var mo=function(t,e){var n=-1,r=Ar(t)?Array(t.length):[];return To(t,(function(t,o,i){r[++n]=e(t,o,i)})),r};var Io=function(t,e){return(r(t)?Nn:mo)(t,go(e))},Ao=function(){function t(t,e,n){var r=this;this.observer=new ie,this.context=t,this.providerId=e,this.resolver=n,this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return r.updateState(t)})).catch((function(t){ne.error(Gt[Mt.STATE_FETCH_FAILED],t.message),r.context.eventing.track(Gt[Mt.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,n=this.state;this.updateState(y(y({},n),t)),this.resolver.update(this.context,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){ne.error(Gt[Mt.STATE_UPDATE_FAILED],t.message),e.context.eventing.track(Gt[Mt.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&e.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),Ro=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),No=Object.create(null),Do=function(){function t(t){this.cache=new Ro,this.options=y({},t||{})}return t.register=function(t,e){No[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,n=b(t,["type"]),r=No[e];return r?new r(n):null},t.prototype.toJSON=function(){return y({type:this.type},this.options)},t}();var wo=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var jo=function(t){return t!=t};var Co=function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1};var Po=function(t,e,n){return e==e?Co(t,e,n):wo(t,jo,n)};var Lo=function(t,e){return!!(null==t?0:t.length)&&Po(t,e,0)>-1};var So=function(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1};var Uo=function(){},ko=Pr&&1/Hn(new Pr([,-0]))[1]==1/0?function(t){return new Pr(t)}:Uo;var Mo=function(t,e,n){var r=-1,o=Lo,i=t.length,u=!0,a=[],c=a;if(n)u=!1,o=So;else if(i>=200){var s=e?null:ko(t);if(s)return Hn(s);u=!1,o=Bn,c=new xn}else c=e?[]:a;t:for(;++r<i;){var l=t[r],f=e?e(l):l;if(l=n||0!==l?l:0,u&&f==f){for(var d=c.length;d--;)if(c[d]===f)continue t;e&&c.push(f),a.push(l)}else o(c,f,n)||(c!==a&&c.push(f),a.push(l))}return a};var xo=function(t){return t&&t.length?Mo(t):[]},Fo=function(){function t(){}return t.get=function(e,r){var o=t.loaders.get(e);if(o)return o;var i=new n(r,{cache:!1});return t.loaders.set(e,i),i},t.loaders=new Map,t}(),Bo="https://api.candu.ai"+u,Go=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.prototype.retrieve=function(t,e){return g(this,void 0,void 0,(function(){var n,r,o=this;return O(this,(function(i){switch(i.label){case 0:return[4,Fo.get("cardStateApi",(function(e){return g(o,void 0,void 0,(function(){var n;return O(this,(function(r){switch(r.label){case 0:return[4,fetch(Bo+"?token="+t.clientToken+"&finder=byIds&ids="+xo(e).join(",")+"&userId="+t.userId).then((function(t){return t.json()}))];case 1:return n=r.sent(),[2,e.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return n=i.sent(),r={id:e,state:{dismissed:!1}},[2,n||r]}}))}))},e.prototype.update=function(t,e,n){return fetch(Bo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:n.state,userId:t.userId.toString()})}).then((function(t){return t.json()}))},e}(Do);Do.register(Tt.CardApi,Go);var Vo="https://api.candu.ai"+i;function zo(t){return{state:t.state,id:t.id}}function Ho(t){switch(t){case ct.Account:return"AccountId";case ct.User:default:return"UserId"}}var Wo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.prototype.getScopeAndFieldFromContext=function(t){var e=this.options.scopeTrait,n=this.options.scope||ct.User,r=t.userId.toString();return n===ct.Account&&(e&&t.traits[e]?r=t.traits[e]:(ee("trait '"+e+"' is not defined, falling back to user scope"),n=ct.User)),{scope:n,scopeField:r}},e.prototype.retrieve=function(t,e){return g(this,void 0,void 0,(function(){var n,r,o,i=this;return O(this,(function(u){switch(u.label){case 0:return n=this.getScopeAndFieldFromContext(t),r=n.scope,o=n.scopeField,[4,Fo.get("checklistState",(function(e){return g(i,void 0,void 0,(function(){var n;return O(this,(function(i){switch(i.label){case 0:return[4,fetch(Vo+"?token="+t.clientToken+"&byTrait="+Ho(r)+"&field="+o+"&finder=byIds&ids="+xo(e).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(zo)}))];case 1:return n=i.sent(),[2,e.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,u.sent()||{id:e,state:at.NotStared}]}}))}))},e.prototype.update=function(t,e,n){var r=this.getScopeAndFieldFromContext(t),o=r.scope,i=r.scopeField;return fetch(Vo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y(y({},n),{byTrait:Ho(o),field:i}))}).then((function(t){return t.json()})).then(zo)},e}(Do);function Yo(t,e){return Io(t,(function(t,n){var r=Do.fromJSON(t.resolver);return r?new Ao(e,n,r):null})).filter((function(t){return!!t}))}Do.register(Tt.CheckListApi,Wo);var Ko=function(t,e){for(var n=Object.values(t),r=function(t){var e=n.find((function(e){return e.position===t}));if(!e||e.status===at.NotStared)return{value:t}},o=0;o<e;o+=1){var i=r(o);if("object"==typeof i)return i.value}},$o=function(t,e){var n=Object.values(t).filter((function(t){return t.status===at.Done})).length;return{completedItems:n,percComplete:e?Math.round(100*n/e):0}},Jo=function(t){return t.filter((function(t){return t.resolver instanceof Wo}))},qo=function(t){var e={};return t.forEach((function(t,n){var r=t.getResolvedState();r&&(e[r.id]={status:r.state,position:n})})),e};export{G as ACTORS,vt as CANDU_PORTAL_CLASS,tt as CATEGORIES,nt as COLORS,At as CSSNodeTypes,Go as CardResolverInstance,at as CheckListItemStatus,Wo as CheckListResolverInstance,ct as CheckListScope,_n as DEFAULT_ALERT_COLOR,hn as DEFAULT_ALT,ut as DEFAULT_COLOR,m as DEFAULT_SEGMENT_ID,bn as DEFAULT_TAB_ACTIVE_COLOR,gn as DEFAULT_TAB_COLOR,En as DEFAULT_TAB_HEADER_COLOR,yn as DEFAULT_TAB_ITEM_COLOR,Gt as ERROR_MESSAGES,kt as ERROR_SLUGS,Mt as EVENT_NAMES,_t as FRAME_SIZES,et as HANDLER_TYPES,Y as IsNumericId,zt as LOGGER,V as MESSAGES,Ft as METRICS,it as Mark,ue as NodeManager,ie as Observer,yt as PREVIEW_COOKIE_NAME,gt as PREVIEW_FRAME_ID,Et as PREVIEW_MODES,mt as PREVIEW_SCRIPT_URL,bt as PREVIEW_URL_PARAM,ae as PreviewContainer,Qt as RESOURCES,On as STYLEGUIDE_COLORS,de as SingletonAPI,Ao as StateProviderInstance,Do as StateResolverInstance,Tt as StateResolverType,Ot as StateScope,It as StyleguideScope,Q as TRIGGERS,p as TutorialDependencies,mn as attachStylesheet,$o as calculateGroupCompletion,ht as canduPortalId,h as checkCyclicAndAdd,se as createSingleton,v as createTutorialDocumentContext,jt as cssInputObjToString,Ct as cssInputStringToObj,Vt as defaultStyleguide,In as detachStylesheet,qt as fetchFromApi,Zt as fetchFromCdn,d as fetchHead,Jt as fetchURL,Lt as findMatchingSegment,Jo as getCheckListStateProviders,ce as getContentState,Ko as getFirstNotStartedItem,qo as getInitialItems,Xt as getTutorialDocument,re as includeHTMLWhitespaces,Yo as initStateProviders,Ht as internalEventing,ot as isApiError,K as isClientToken,st as isContentHashId,W as isIdentifier,lt as isPortalId,ft as isPortalSlug,Rt as isStatePath,dt as isTutorialId,pt as isTutorialSlug,$ as isUserId,te as logError,ee as logWarning,ne as logger,ye as mapNodeToStyleguide,vn as mergeStyleguidesFromContext,Z as messageFactory,q as messages,$t as portalValidation,Yt as providerValidation,oe as stripHTML,Dt as stylguideClassNameMap,wt as toCssSelector,Pt as toStyleguideDecl,Kt as tutorialValidation,Rn as unpackShorthandStyles,X as windowStream};
import{getAnonymousId as t}from"@candulabs/eventing";import e from"invariant";import"setimmediate";import n from"dataloader";var r=Array.isArray;var o="https://cdn.candu.ai",i="/api/checklistItems",u="/api/cards",a="/api/segmentMemberships",c="/api/segmentsDefinition",s="/api/tutorialMetadata",l="/api/tutorialDocumentsSdk",f=function(t){if(!document.querySelectorAll('[href="'+t+'"]').length){var e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.appendChild(e)}};var d=function(t,e){t&&r(t)&&(!function(t,e){var n="candu-stylesheet-"+t;if(!document.getElementById(n)){var r=document.createElement("style");r.setAttribute("id",n),r.setAttribute("type","text/css"),r.appendChild(document.createTextNode(e)),document.head.append(r)}}("document",".candu-document * {\n box-sizing: border-box;\n }\n "),t.map((function(t){var n=t.nodeType,r=t.url;return f("EmbedTutorial"===n?o+"/tutorials/"+e+"/"+r+".json":"EmbedPortal"===n?o+"/portals/"+e+"/"+r+"/head.json":r)})))},p=function(){function t(t){this.adjacencyList={},this.rootDocument=t,this.adjacencyList[t]=[]}return t.prototype.get=function(t){return this.adjacencyList[t]},t.prototype.add=function(t,e){var n=this;if(this.adjacencyList[t]||(this.adjacencyList[t]=[]),!this.adjacencyList[e])return this.adjacencyList[t].push(e),this.adjacencyList[e]=[],!0;if(this.adjacencyList[t].includes(e))return!0;var r=function(e){if(e===t)return!0;for(var o=0,i=n.adjacencyList[e];o<i.length;o++){var u=i[o];if(r(u))return!0}return!1};return!r(e)&&(this.adjacencyList[t].push(e),!0)},t}(),v=function(t,e){return{id:t,dependencies:e?e.dependencies:new p(t)}},h=function(t,e){return t.dependencies.add(t.id,e)},_=function(t,e){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function E(t,e){function n(){this.constructor=t}_(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var y=function(){return(y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function b(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function g(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(u,a)}c((r=r.apply(t,e||[])).next())}))}function O(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function T(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,a=i.length;u<a;u++,o++)r[o]=i[u];return r}var m="Everyone",I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function A(t){var e={exports:{}};return t(e,e.exports),e.exports}var R="object"==typeof I&&I&&I.Object===Object&&I,N="object"==typeof self&&self&&self.Object===Object&&self,D=R||N||Function("return this")(),w=D.Symbol,j=Object.prototype,C=j.hasOwnProperty,P=j.toString,L=w?w.toStringTag:void 0;var S=function(t){var e=C.call(t,L),n=t[L];try{t[L]=void 0;var r=!0}catch(t){}var o=P.call(t);return r&&(e?t[L]=n:delete t[L]),o},U=Object.prototype.toString;var k=function(t){return U.call(t)},M=w?w.toStringTag:void 0;var x=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":M&&M in Object(t)?S(t):k(t)};var F=function(t){return null!=t&&"object"==typeof t};var B=function(t){return"string"==typeof t||!r(t)&&F(t)&&"[object String]"==x(t)};var G,V,z=function(t){return"number"==typeof t||F(t)&&"[object Number]"==x(t)},H=/^([a-zA-Z0-9]|_|-)+$/,W=function(t){return B(t)&&t.length>=3&&t.length<100&&H.test(t)},Y=function(t){return z(t)&&t>=0},K=function(t){return B(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10},$=function(t){return Y(t)||B(t)&&t.trim().length>0};!function(t){t.SDK="SDK",t.PREVIEW="PREVIEW"}(G||(G={})),function(t){t.BOOTSTRAP="Bootstrap",t.CHANGE_POSITION="ChangePosition",t.CLOSE_PREVIEW="ClosePreview",t.PREVIEW_LOADED="PreviewLoaded",t.SET_AVALIABLE_PORTALS="SetAvaliablePortals",t.SET_CONTENT="SetContent",t.SET_SELECTED_ELEMENT="SetSelectedElement",t.SET_VIEW_MODE="SetViewMode",t.ADD_ELEMENT="AddElement",t.REMOVE_ELEMENT="RemoveElement",t.UPDATE_ELEMENT="UpdateElement",t.SET_ELEMENT="SetElement"}(V||(V={}));var J=function(t,e){return void 0===e&&(e={}),y({type:t},e)},q={bootstrap:function(t,e,n,r){return J(V.BOOTSTRAP,{clientToken:t,userId:e,version:n,preview:r})},changePosition:function(t,e){return J(V.CHANGE_POSITION,{mouseEvent:t,top:e})},closePreview:function(){return J(V.CLOSE_PREVIEW)},previewLoaded:function(){return J(V.PREVIEW_LOADED)},setAvaliablePortals:function(t){return J(V.SET_AVALIABLE_PORTALS,{avaliablePortals:t})},addElement:function(t){return J(V.ADD_ELEMENT,{element:t})},removeElement:function(t){return J(V.REMOVE_ELEMENT,{id:t})},updateElement:function(t){return J(V.UPDATE_ELEMENT,{element:t})},setContent:function(t){return J(V.SET_CONTENT,{content:t})},setViewMode:function(t){return J(V.SET_VIEW_MODE,{viewMode:t})},setSelectedElement:function(t){return J(V.SET_SELECTED_ELEMENT,{element:t})}},Z=function(t){var e=t.source,n=t.destination;return{read:function(t){var e=t.actor,r=t.message;return e===n?r:null},write:function(t){return{actor:e,message:t}}}},X=function(t){var e=t.source,n=t.destination,r=t.targetOrigin,o=t.targetWindow,i=t.originWindow,u=t.onRecieveMessage,a=Z({source:e,destination:n}),c=a.read,s=a.write,l=function(t){var e=c(t.data);e&&u(e)};return i.addEventListener("message",l,!1),{close:function(){i.removeEventListener("message",l)},send:function(t){o.postMessage(s(t),r)}}};var Q,tt,et,nt,rt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};function ot(t){return rt(t)&&B(t.errorCode)}!function(t){t.ON_CLICK="OnClick"}(Q||(Q={})),function(t){t.NATIVE="Native",t.PENDO="Pendo"}(tt||(tt={})),function(t){t.NAVIGATE="Navigate",t.CHANGE_TUTORIAL="ChangeTutorial",t.OPEN_GUIDE="OpenGuide",t.DISMISSED_CARD="DismissedCard"}(et||(et={})),function(t){t.PRIMARY="primary",t.SECONDARY="primary",t.WARNING="warning",t.DANGER="danger",t.NEUTRAL="neutral",t.ACTIVE="active",t.INFO="info"}(nt||(nt={}));var it,ut=nt.PRIMARY;!function(t){t.U="U",t.B="B",t.Em="Em",t.InlineCode="InlineCode"}(it||(it={}));var at,ct,st=function(t){return B(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/)},lt=function(t){return Y(t)},ft=function(t){return W(t)},dt=function(t){return Y(t)},pt=function(t){return W(t)};!function(t){t.NotStared="NotStarted",t.InProgress="InProgress",t.Done="Done"}(at||(at={})),function(t){t.User="User",t.Account="Account"}(ct||(ct={}));var vt="candu_portal",ht=function(t){return"candu_portal_"+t};var _t,Et,yt="candu.preview",bt="candu_preview",gt="canduPreview";!function(t){t.COLLAPSED="Collapsed",t.EXPANDED="Expanded",t.MINIMIZED="Minimized"}(_t||(_t={})),function(t){t.TUTORIAL="Tutorial",t.PORTAL="Portal"}(Et||(Et={}));var Ot,Tt,mt="https://app.candu.ai/preview.html";!function(t){t.Global="Global",t.Carried="Carried"}(Ot||(Ot={})),function(t){t.CanduCdn="CanduCdn",t.CheckListApi="CheckListApi",t.CardApi="CardApi"}(Tt||(Tt={}));var It,At,Rt=function(t){return B(t)&&!!t.match(/^@(\w|\d|_|-|\.){3,20}\$/)};!function(t){t.Global="Global",t.Organization="Organization"}(It||(It={})),function(t){t.Root="root",t.Rule="rule",t.Atrule="atrule",t.Decl="decl",t.Any="any"}(At||(At={}));var Nt,Dt={button:{childClassNames:{icon:"button-icon"},variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},badge:{variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},typography:{variants:{typography:function(t){return"typography-"+t}}}},wt=function(t,e){var n=y({className:"root",variant:void 0,selector:"",output:"css"},e||{}),r=n.className,o=n.variant,i=n.selector,u=n.output,a="candu-"+t;if("global"===r)return"html"===u?"":":root";var c=null,s=[],l=Dt[t]||{};if(o&&l.variants){var f=l.variants;s=Object.keys(o).reduce((function(t,e){var n=o[e],r=f[e];return t.push(r?r(n):e+"-"+n),t}),[])}return"root"!==r&&l.childClassNames&&l.childClassNames[r]&&(c="candu-"+t+"--"+l.childClassNames[r]),"css"===u?[a,c,i].reduce((function(t,e,n){return e&&""!==e?0===n?"."+a+s.map((function(t){return"."+t})).join(""):1===n?t+" ."+e:""+t+e:t}),"")||"":"root"===r?T([a],s).filter((function(t){return!!t})).join(" ")||"":c||""},jt=function(t){return Object.keys(t).reduce((function(e,n){return""+e+n+": "+t[n]+";"}),"")},Ct=function(t){return t.split(";").reduce((function(t,e){var n,r=e.split(":"),o=r[0],i=r[1];return o&&i?y(y({},t),((n={})[o.trim()]=i.trim(),n)):t}),{})},Pt=function(t){return Object.keys(t).reduce((function(e,n){return T(e,[{type:At.Decl,prop:n,value:t[n]}])}),[])},Lt=function(t,e){var n=e.reduce((function(t,e){var n;return y(y({},t),((n={})[e]=e,n))}),{});if(r(t.content))return t.content.find((function(t){var e=t.segmentId;return!!n[e]||"Everyone"===e}))},St=function(t){return"candu.sdk."+t},Ut=function(t){return St("error."+t)},kt={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",PROVIDER_ERROR:"provider_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},Mt={HEARTBEAT:St("heartbeat"),PREVIEW_OPEN:St("preview.open"),PORTAL:St("portal"),TUTORIAL:St("tutorial"),TUTORIAL_INTERACTION:St("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Ut("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Ut("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Ut("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Ut("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Ut("commit_api"),TUTORIAL_LOADING_ERROR:Ut("tutorial"),UNKOWN_NODE_TYPE:Ut(kt.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:Ut(kt.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:Ut(kt.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:Ut(kt.TUTORIAL_ERROR),PORTAL_ERROR:Ut(kt.PORTAL_ERROR),PROVIDER_ERROR:Ut(kt.PROVIDER_ERROR),STYLEGUIDE_MAP_ERROR:Ut(kt.TUTORIAL_ERROR),RENDER_NODE_ERROR:Ut(kt.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Ut("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Ut("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Ut("state_fetch_failed"),STATE_UPDATE_FAILED:Ut("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Ut("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:St("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:St("tutorial.checklist_group_complete"),CARD_DISMISSED:St("tutorial.card_dismissed")},xt=function(t){return St("metric."+t)},Ft={SEGMENT_MEMBERSHIP_LOAD_TIME:xt("segment_membership_load_time"),PORTAL_LOAD_TIME:xt("portal_load_time"),CONTENT_LOAD_TIME:xt("content_load_time"),TUTORIAL_LOAD_TIME:xt("tutorial_load_time"),TUTORIAL_DOCUMENT_MOUNT_TIME:xt("tutorial_document_mount_time")},Bt=function(t){return"An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: "+t+"."},Gt=((Nt={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n"})[Mt.PORTAL_ASSET_NOT_FOUND]="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",Nt[Mt.PORTAL_NO_SEGMENT_IDS]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",Nt[Mt.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",Nt[Mt.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",Nt[Mt.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",Nt[Mt.UNKOWN_INLINE_NODE_TYPE]=Bt(kt.UNKOWN_INLINE_NODE_TYPE),Nt[Mt.UNKOWN_NODE_TYPE]=Bt(kt.UNKOWN_NODE_TYPE),Nt[Mt.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",Nt[Mt.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",Nt[Mt.PORTAL_ERROR]="An error has occured within Portal",Nt[Mt.PROVIDER_ERROR]="An error has occured within Provider",Nt[Mt.TUTORIAL_ERROR]="An error has occured within Tutorial",Nt[Mt.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",Nt[Mt.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",Nt[Mt.STATE_FETCH_FAILED]="An error has occured while fetching state:",Nt[Mt.STATE_UPDATE_FAILED]="An error has occured while updating state:",Nt[Mt.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",Nt),Vt={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},zt={error:console.error,warning:console.warn},Ht=function(t){var e=t.identify,n=t.track;return{provider:function(t){var r=t.userId,o=t.traits,i=t.styleguide;e(r,o),n(Mt.HEARTBEAT,function(t){var e={};return Object.keys(t).forEach((function(n){Vt[n]&&(e["styleguide."+n]=t[n].displayName||!0)})),e}(i))},tutorialDocumentLoadingError:function(t){var e=t.tutorialId,r=t.slug,o=t.contentHashId;zt.error(Gt[Mt.TUTORIAL_LOADING_ERROR]),n(Mt.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:r,contentHashId:o})}}},Wt=function(t){return e(!t||rt(t),"(Candu) styleguide must be undefined or an object")},Yt=function(n){var r=n.clientToken,o=n.userId,i=n.traits,u=n.options,a=n.styleguide,c=b(n,["clientToken","userId","traits","options","styleguide"]);return e(K(r),"(Candu) you must provide a valid clientToken"),e(!o||$(o),"(Candu) you must provide a valid userId"),Wt(a),e(!i||rt(i),"(Candu) traits must be undefined or an object"),e(!u||rt(u),"(Candu) options must be undefined or an object"),y(y({},c),{clientToken:r,traits:i||{},options:u||{},styleguide:a||{},userId:o||t()})},Kt=function(t){var e=t.slug,n=t.styleguide,r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,u=t.renderedByClient,a=b(t,["slug","styleguide","contentHashId","tutorialId","tutorialDocument","renderedByClient"]);return Wt(n),y(y({},a),{slug:e,styleguide:n||{},contentHashId:r,tutorialId:o,tutorialDocument:i,renderedByClient:u})},$t=function(t){var e=t.slug,n=t.styleguide;return Wt(n),{slug:e,styleguide:n||{}}},Jt=function(t,e){return g(void 0,void 0,void 0,(function(){return O(this,(function(n){switch(n.label){case 0:return[4,fetch(t,e&&{headers:e})];case 1:return[2,n.sent().json()]}}))}))},qt=function(t){return Jt("https://api.candu.ai"+t,{SDKVersion:"0.7.1-alpha.23"})},Zt=function(t){return Jt(""+o+t,{SDKVersion:"0.7.1-alpha.23"})},Xt=function(t){return{byId:function(e){return qt(l+"?token="+t+"&finder=latestPublished&tutorialId="+e)},bySlug:function(e){return Zt("/tutorials/"+t+"/"+e+".json")},byContentHash:function(e){return Zt("/tutorials/"+t+"/"+e+".json")}}},Qt={tutorialDocumentLatestSaved:function(t,e){return g(void 0,void 0,void 0,(function(){return O(this,(function(n){return[2,qt(l+"/"+e+"?token="+t)]}))}))},portalAsset:function(t,e,n){return g(void 0,void 0,void 0,(function(){var r,o;return O(this,(function(i){return(null===(o=n)||void 0===o?void 0:o.length)?(r="?segmentIds="+n.join(","),[2,Zt("/portalMemberships/"+t+"/"+e+"/head.json"+r)]):[2,Zt("/portals/"+t+"/"+e+"/head.json")]}))}))},contentDocument:function(t,e,n){return g(void 0,void 0,void 0,(function(){var r,i,u;return O(this,(function(a){switch(a.label){case 0:return r=(null===(u=n)||void 0===u?void 0:u.length)?"?segmentIds="+n.join(","):"",[4,fetch(o+"/contentDocument/"+t+"/"+e+".json"+r)];case 1:return[2,(i=a.sent()).ok?i.json():null]}}))}))},segmentMembership:function(t,e){return g(void 0,void 0,void 0,(function(){return O(this,(function(n){return[2,qt(a+"/"+e+"?token="+t)]}))}))},segmentDefinition:function(t){return g(void 0,void 0,void 0,(function(){return O(this,(function(e){return[2,qt(c+"?token="+t)]}))}))},tutorialMetadata:function(t){return g(void 0,void 0,void 0,(function(){return O(this,(function(e){return[2,qt(s+"?token="+t)]}))}))},tutorialDocument:function(t,e,n){var r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,u=t.slug,a=Xt(e);return pt(u)?a.bySlug(u):dt(o)?a.byId(o):st(r)?a.byContentHash(r):rt(i)?Promise.resolve(i):(zt.error(Gt[Mt.NO_VALID_TUTORIAL_IDENTIFIER]),n.track(Mt.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},te=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.error.apply(console,t)},ee=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.warn.apply(console,t)},ne={error:te,warning:ee},re=function(t){return t.replace(/\s/g,"&nbsp;")},oe=function(t){return DOMParser?(new DOMParser).parseFromString(t,"text/html").body.textContent||"":t},ie=function(){function t(){this.subscribers=[]}return t.prototype.subscribe=function(t){var e=this;return this.subscribers.push(t),function(){e.subscribers[e.subscribers.indexOf(t)]=function(){}}},t.prototype.notify=function(t){this.subscribers.forEach((function(e){return e(t)}))},t.prototype.clear=function(){this.subscribers=[]},t}(),ue=function(){function t(t,e){var n=this;this.state="waiting",this.currentElement=null,this.selector=t,this.renderToElement=e,this.findAndRender(),this.observer=new MutationObserver((function(t){switch(n.state){case"waiting":t.some((function(t){return!!t.addedNodes.length}))&&n.findAndRender();break;case"mounted":t.forEach((function(t){t.removedNodes.length&&t.removedNodes.forEach((function(t){t===n.currentElement&&(n.currentElement=null,n.state="waiting")}))}));break;default:throw new Error("Unhandled state: "+n.state)}})),this.observer.observe(document,{childList:!0,subtree:!0,attributes:!1,characterData:!1})}return t.prototype.findAndRender=function(){var t=document.querySelector(this.selector);t&&(this.renderToElement(t),this.currentElement=t,this.state="mounted")},t.prototype.stopObserving=function(){this.observer.disconnect()},t}(),ae=function(){function t(){this.onClientUpdateObserver=new ie}return t.prototype.attachClient=function(t){this.client=t,this.onClientUpdateObserver.notify({client:t})},t.prototype.detachClient=function(){this.client&&(this.client=null,this.onClientUpdateObserver.notify({client:null}))},t.prototype.onClientUpdate=function(t){var e=this.onClientUpdateObserver.subscribe(t);return this.client&&t({client:this.client}),e},t}(),ce=function(t){return t.lastModifiedAt===t.lastPublishedAt?"Published":t.lastPublishedAt?"Unsynced":"Draft"};function se(t){var e,n,r=function(t){return function(){for(var e,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(n.api)return(e=n.api)[t].apply(e,r);console.warn("Please initialize the SDK by calling Candu.init() before attempting to call "+t)}};return(e=function(){function e(){}return e.init=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this.api||(e.api=new(t.bind.apply(t,T([void 0],n)))),e.subscriberCallbacks.forEach((function(t){return t()})),e.subscriberCallbacks=[],window.postMessage({source:"CANDU_SINGLETON",payload:{type:"INIT"}},window&&window.origin?window.origin:"*"),e},e.onProviderReady=function(t){if(e.api)return t();e.subscriberCallbacks.push(t)},e}()).subscriberCallbacks=[],e.renderTutorial=r("renderTutorial"),e.renderPortal=r("renderPortal"),e.renderContent=r("renderContent"),e.attachClient=r("attachClient"),e.detachClient=r("detachClient"),e.getProvider=r("getProvider"),e.getInfo=r("getInfo"),n=e,window.Candu=n,n}var le="@candulabs/core",fe="0.7.1-alpha.23",de=function(){function t(t){this.init(t)}return t.prototype.getInfo=function(){return{core:{version:fe,name:le},sdk:{version:this.version,name:this.name}}},t.prototype.attachClient=function(t){return this.provider.preview.attachClient(t)},t.prototype.detachClient=function(){return this.provider.preview.detachClient()},Object.defineProperty(t.prototype,"provider",{get:function(){return this.getProvider()},enumerable:!0,configurable:!0}),t}(),pe=function(t){switch(t.trigger){case Q.ON_CLICK:default:return"onClick"}},ve=function(t,e){var n,r,o,i,u,a;if("Link"===t.type&&(null===(n=t.props)||void 0===n?void 0:n.href)){var c=t.props.href+" Link Clicked",s=null===(o=null===(r=t)||void 0===r?void 0:r.nodes)||void 0===o?void 0:o[0];if(s){var l=e.document.nodes[s];"Text"===(null===(i=l)||void 0===i?void 0:i.type)&&(null===(a=null===(u=l)||void 0===u?void 0:u.props)||void 0===a?void 0:a.children)&&(c=l.props.children+" Link Clicked")}return{onClick:function(){var n;return e.provider.eventing.track(Mt.TUTORIAL_INTERACTION,{trigger:Q.ON_CLICK,category:t.type,eventName:c,handler:{href:null===(n=t.props)||void 0===n?void 0:n.href,type:et.NAVIGATE}})}}}if(!t.data||!t.data.actions)return{};var f=function(t,n){e.provider.eventing.track(Mt.TUTORIAL_INTERACTION,y(y({},t),n||{}))};return t.data.actions.map((function(t){return function(t,e,n){var r,o,i;switch(t.handler.type){case et.NAVIGATE:return(r={})[pe(t)]=function(r){r.stopPropagation();var o=t.handler,i=o.href,u=o.target,a=n||{},c=a.parentTrackers,s=b(a,["parentTrackers"]);c&&c.forEach((function(n){return e(t,n)})),e(t,s),"Blank"===u?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},r;case et.CHANGE_TUTORIAL:return(o={})[pe(t)]=function(){var e=t.handler.tutorialId;te("TODO -> change tutorial",e)},o;case et.OPEN_GUIDE:return(i={})[pe(t)]=function(){var e=t.handler.guideId;te("TODO -> open guide",e)},i;default:return{}}}(t,f,e.trackingIdentifiers)})).reduce((function(t,e){return y(y({},t),e)}),{})},he=function(t,e){var n=t.props||{},r=t.nodes,o=n.children;return o||(r?r.map(e):null)},_e=function(t,e){var n=t.states;return n&&e.stateProviderInstances.filter((function(t){return!!n[t.providerId]}))},Ee=function(t,e){var n=t.nodes;return n&&n.map((function(t){return e.document.nodes[t]})).filter((function(t){return!!t})).map((function(t){return _e(t,e)||[]})).reduce((function(t,e){return t.concat(e)}),[])},ye=function(t,e){try{var n=e.provider,r=e.document,o=e.trackingIdentifiers,i=r.nodes[t];if(!i)return ne.error("Document is corrupted. Refusing to move further."),null;var u=function(t){return ye(t,e)},a=i.type,c=i.props,s=i.css,l=y(y(y({},c||{}),{style:s||{},children:he(i,u)}),ve(i,{trackingIdentifiers:o,provider:n,document:r})),f={nodeId:t,node:i,document:r,render:{node:u,styleguide:function(t,n){return void 0===n&&(n={}),e.renderNode(t,{api:f,attributes:n})},tutorial:function(t){return e.renderTutorial(t)},portal:function(t){return e.renderPortal(t)}},trackingIdentifiers:o,stateInstances:_e(i,e),childrenStateInstances:Ee(i,e)},d=f.render.styleguide(a,l);return d||(ne.error(Gt[Mt.UNKOWN_NODE_TYPE],{type:a}),n.eventing.error(new Error(Gt[Mt.UNKOWN_NODE_TYPE]),{type:a}),null)}catch(t){return ne.error(Gt[Mt.STYLEGUIDE_MAP_ERROR],t),e.provider.eventing.error(t),null}};var be,ge=function(t){if(!rt(t))return!1;var e=x(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Oe=D["__core-js_shared__"],Te=(be=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+be:"";var me=function(t){return!!Te&&Te in t},Ie=Function.prototype.toString;var Ae=function(t){if(null!=t){try{return Ie.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Re=/^\[object .+?Constructor\]$/,Ne=Function.prototype,De=Object.prototype,we=Ne.toString,je=De.hasOwnProperty,Ce=RegExp("^"+we.call(je).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Pe=function(t){return!(!rt(t)||me(t))&&(ge(t)?Ce:Re).test(Ae(t))};var Le=function(t,e){return null==t?void 0:t[e]};var Se=function(t,e){var n=Le(t,e);return Pe(n)?n:void 0},Ue=Se(Object,"create");var ke=function(){this.__data__=Ue?Ue(null):{},this.size=0};var Me=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},xe=Object.prototype.hasOwnProperty;var Fe=function(t){var e=this.__data__;if(Ue){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return xe.call(e,t)?e[t]:void 0},Be=Object.prototype.hasOwnProperty;var Ge=function(t){var e=this.__data__;return Ue?void 0!==e[t]:Be.call(e,t)};var Ve=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ue&&void 0===e?"__lodash_hash_undefined__":e,this};function ze(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ze.prototype.clear=ke,ze.prototype.delete=Me,ze.prototype.get=Fe,ze.prototype.has=Ge,ze.prototype.set=Ve;var He=ze;var We=function(){this.__data__=[],this.size=0};var Ye=function(t,e){return t===e||t!=t&&e!=e};var Ke=function(t,e){for(var n=t.length;n--;)if(Ye(t[n][0],e))return n;return-1},$e=Array.prototype.splice;var Je=function(t){var e=this.__data__,n=Ke(e,t);return!(n<0)&&(n==e.length-1?e.pop():$e.call(e,n,1),--this.size,!0)};var qe=function(t){var e=this.__data__,n=Ke(e,t);return n<0?void 0:e[n][1]};var Ze=function(t){return Ke(this.__data__,t)>-1};var Xe=function(t,e){var n=this.__data__,r=Ke(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function Qe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Qe.prototype.clear=We,Qe.prototype.delete=Je,Qe.prototype.get=qe,Qe.prototype.has=Ze,Qe.prototype.set=Xe;var tn=Qe,en=Se(D,"Map");var nn=function(){this.size=0,this.__data__={hash:new He,map:new(en||tn),string:new He}};var rn=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var on=function(t,e){var n=t.__data__;return rn(e)?n["string"==typeof e?"string":"hash"]:n.map};var un=function(t){var e=on(this,t).delete(t);return this.size-=e?1:0,e};var an=function(t){return on(this,t).get(t)};var cn=function(t){return on(this,t).has(t)};var sn=function(t,e){var n=on(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function ln(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ln.prototype.clear=nn,ln.prototype.delete=un,ln.prototype.get=an,ln.prototype.has=cn,ln.prototype.set=sn;var fn=ln;function dn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var u=t.apply(this,r);return n.cache=i.set(o,u)||i,u};return n.cache=new(dn.Cache||fn),n}dn.Cache=fn;var pn=dn,vn=pn((function(t,e){var n,r,o=t.provider,i=t.portal,u=t.tutorial,a=o.styleguide;return u&&(r=u.styleguide),i&&(n=i.styleguide),y(y(y(y({},a||{}),n||{}),r||{}),e||{})})),hn="",_n="#EDEDED",En="#333745",yn="#838792",bn="#FEFEFE",gn="#FEFEFE",On={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},Tn=function(t){return"candu-styleguide-"+t},mn=function(t,e){void 0===e&&(e="main");var n=Tn(t);if(!document.getElementById(n)){var r=document.createElement("link");r.setAttribute("id",n),r.setAttribute("rel","stylesheet"),r.setAttribute("href",o+"/styleguides/applications/"+t+"/default/"+e+".css"),document.head.appendChild(r)}},In=function(t){var e=document.getElementById(Tn(t));e&&e.remove()},An=function(t,e){var n,r,o,i,u="string"==typeof e&&e.split(" ");return u?1===u.length?((n={})[t+"Right"]=e,n[t+"Left"]=e,n[t+"Bottom"]=e,n[t+"Top"]=e,n):2===u.length?((r={})[t+"Top"]=u[0],r[t+"Right"]=u[1],r[t+"Bottom"]=u[0],r[t+"Left"]=u[1],r):3===u.length?((o={})[t+"Top"]=u[0],o[t+"Right"]=u[1],o[t+"Bottom"]=u[2],o[t+"Left"]=u[1],o):((i={})[t+"Top"]=u[0],i[t+"Right"]=u[1],i[t+"Bottom"]=u[2],i[t+"Left"]=u[3],i):{}},Rn=function(t){var e=t.padding,n=t.margin,r=b(t,["padding","margin"]),o={};return e&&(o=y(y({},o),An("padding",e))),n&&(o=y(y({},o),An("margin",n))),y(y({},o),r)};var Nn=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o};var Dn=function(){this.__data__=new tn,this.size=0};var wn=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var jn=function(t){return this.__data__.get(t)};var Cn=function(t){return this.__data__.has(t)};var Pn=function(t,e){var n=this.__data__;if(n instanceof tn){var r=n.__data__;if(!en||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new fn(r)}return n.set(t,e),this.size=n.size,this};function Ln(t){var e=this.__data__=new tn(t);this.size=e.size}Ln.prototype.clear=Dn,Ln.prototype.delete=wn,Ln.prototype.get=jn,Ln.prototype.has=Cn,Ln.prototype.set=Pn;var Sn=Ln;var Un=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var kn=function(t){return this.__data__.has(t)};function Mn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new fn;++e<n;)this.add(t[e])}Mn.prototype.add=Mn.prototype.push=Un,Mn.prototype.has=kn;var xn=Mn;var Fn=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var Bn=function(t,e){return t.has(e)};var Gn=function(t,e,n,r,o,i){var u=1&n,a=t.length,c=e.length;if(a!=c&&!(u&&c>a))return!1;var s=i.get(t);if(s&&i.get(e))return s==e;var l=-1,f=!0,d=2&n?new xn:void 0;for(i.set(t,e),i.set(e,t);++l<a;){var p=t[l],v=e[l];if(r)var h=u?r(v,p,l,e,t,i):r(p,v,l,t,e,i);if(void 0!==h){if(h)continue;f=!1;break}if(d){if(!Fn(e,(function(t,e){if(!Bn(d,e)&&(p===t||o(p,t,n,r,i)))return d.push(e)}))){f=!1;break}}else if(p!==v&&!o(p,v,n,r,i)){f=!1;break}}return i.delete(t),i.delete(e),f},Vn=D.Uint8Array;var zn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n};var Hn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},Wn=w?w.prototype:void 0,Yn=Wn?Wn.valueOf:void 0;var Kn=function(t,e,n,r,o,i,u){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Vn(t),new Vn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ye(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=zn;case"[object Set]":var c=1&r;if(a||(a=Hn),t.size!=e.size&&!c)return!1;var s=u.get(t);if(s)return s==e;r|=2,u.set(t,e);var l=Gn(a(t),a(e),r,o,i,u);return u.delete(t),l;case"[object Symbol]":if(Yn)return Yn.call(t)==Yn.call(e)}return!1};var $n=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t};var Jn=function(t,e,n){var o=e(t);return r(t)?o:$n(o,n(t))};var qn=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var u=t[n];e(u,n,t)&&(i[o++]=u)}return i};var Zn=function(){return[]},Xn=Object.prototype.propertyIsEnumerable,Qn=Object.getOwnPropertySymbols,tr=Qn?function(t){return null==t?[]:(t=Object(t),qn(Qn(t),(function(e){return Xn.call(t,e)})))}:Zn;var er=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r};var nr=function(t){return F(t)&&"[object Arguments]"==x(t)},rr=Object.prototype,or=rr.hasOwnProperty,ir=rr.propertyIsEnumerable,ur=nr(function(){return arguments}())?nr:function(t){return F(t)&&or.call(t,"callee")&&!ir.call(t,"callee")};var ar=function(){return!1},cr=A((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?D.Buffer:void 0,i=(o?o.isBuffer:void 0)||ar;t.exports=i})),sr=/^(?:0|[1-9]\d*)$/;var lr=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&sr.test(t))&&t>-1&&t%1==0&&t<e};var fr=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},dr={};dr["[object Float32Array]"]=dr["[object Float64Array]"]=dr["[object Int8Array]"]=dr["[object Int16Array]"]=dr["[object Int32Array]"]=dr["[object Uint8Array]"]=dr["[object Uint8ClampedArray]"]=dr["[object Uint16Array]"]=dr["[object Uint32Array]"]=!0,dr["[object Arguments]"]=dr["[object Array]"]=dr["[object ArrayBuffer]"]=dr["[object Boolean]"]=dr["[object DataView]"]=dr["[object Date]"]=dr["[object Error]"]=dr["[object Function]"]=dr["[object Map]"]=dr["[object Number]"]=dr["[object Object]"]=dr["[object RegExp]"]=dr["[object Set]"]=dr["[object String]"]=dr["[object WeakMap]"]=!1;var pr=function(t){return F(t)&&fr(t.length)&&!!dr[x(t)]};var vr=function(t){return function(e){return t(e)}},hr=A((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&R.process,i=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),_r=hr&&hr.isTypedArray,Er=_r?vr(_r):pr,yr=Object.prototype.hasOwnProperty;var br=function(t,e){var n=r(t),o=!n&&ur(t),i=!n&&!o&&cr(t),u=!n&&!o&&!i&&Er(t),a=n||o||i||u,c=a?er(t.length,String):[],s=c.length;for(var l in t)!e&&!yr.call(t,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||u&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||lr(l,s))||c.push(l);return c},gr=Object.prototype;var Or=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||gr)};var Tr=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),mr=Object.prototype.hasOwnProperty;var Ir=function(t){if(!Or(t))return Tr(t);var e=[];for(var n in Object(t))mr.call(t,n)&&"constructor"!=n&&e.push(n);return e};var Ar=function(t){return null!=t&&fr(t.length)&&!ge(t)};var Rr=function(t){return Ar(t)?br(t):Ir(t)};var Nr=function(t){return Jn(t,Rr,tr)},Dr=Object.prototype.hasOwnProperty;var wr=function(t,e,n,r,o,i){var u=1&n,a=Nr(t),c=a.length;if(c!=Nr(e).length&&!u)return!1;for(var s=c;s--;){var l=a[s];if(!(u?l in e:Dr.call(e,l)))return!1}var f=i.get(t);if(f&&i.get(e))return f==e;var d=!0;i.set(t,e),i.set(e,t);for(var p=u;++s<c;){var v=t[l=a[s]],h=e[l];if(r)var _=u?r(h,v,l,e,t,i):r(v,h,l,t,e,i);if(!(void 0===_?v===h||o(v,h,n,r,i):_)){d=!1;break}p||(p="constructor"==l)}if(d&&!p){var E=t.constructor,y=e.constructor;E==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof E&&E instanceof E&&"function"==typeof y&&y instanceof y||(d=!1)}return i.delete(t),i.delete(e),d},jr=Se(D,"DataView"),Cr=Se(D,"Promise"),Pr=Se(D,"Set"),Lr=Se(D,"WeakMap"),Sr=Ae(jr),Ur=Ae(en),kr=Ae(Cr),Mr=Ae(Pr),xr=Ae(Lr),Fr=x;(jr&&"[object DataView]"!=Fr(new jr(new ArrayBuffer(1)))||en&&"[object Map]"!=Fr(new en)||Cr&&"[object Promise]"!=Fr(Cr.resolve())||Pr&&"[object Set]"!=Fr(new Pr)||Lr&&"[object WeakMap]"!=Fr(new Lr))&&(Fr=function(t){var e=x(t),n="[object Object]"==e?t.constructor:void 0,r=n?Ae(n):"";if(r)switch(r){case Sr:return"[object DataView]";case Ur:return"[object Map]";case kr:return"[object Promise]";case Mr:return"[object Set]";case xr:return"[object WeakMap]"}return e});var Br=Fr,Gr="[object Object]",Vr=Object.prototype.hasOwnProperty;var zr=function(t,e,n,o,i,u){var a=r(t),c=r(e),s=a?"[object Array]":Br(t),l=c?"[object Array]":Br(e),f=(s="[object Arguments]"==s?Gr:s)==Gr,d=(l="[object Arguments]"==l?Gr:l)==Gr,p=s==l;if(p&&cr(t)){if(!cr(e))return!1;a=!0,f=!1}if(p&&!f)return u||(u=new Sn),a||Er(t)?Gn(t,e,n,o,i,u):Kn(t,e,s,n,o,i,u);if(!(1&n)){var v=f&&Vr.call(t,"__wrapped__"),h=d&&Vr.call(e,"__wrapped__");if(v||h){var _=v?t.value():t,E=h?e.value():e;return u||(u=new Sn),i(_,E,n,o,u)}}return!!p&&(u||(u=new Sn),wr(t,e,n,o,i,u))};var Hr=function t(e,n,r,o,i){return e===n||(null==e||null==n||!F(e)&&!F(n)?e!=e&&n!=n:zr(e,n,r,o,t,i))};var Wr=function(t,e,n,r){var o=n.length,i=o,u=!r;if(null==t)return!i;for(t=Object(t);o--;){var a=n[o];if(u&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var c=(a=n[o])[0],s=t[c],l=a[1];if(u&&a[2]){if(void 0===s&&!(c in t))return!1}else{var f=new Sn;if(r)var d=r(s,l,c,t,e,f);if(!(void 0===d?Hr(l,s,3,r,f):d))return!1}}return!0};var Yr=function(t){return t==t&&!rt(t)};var Kr=function(t){for(var e=Rr(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Yr(o)]}return e};var $r=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}};var Jr=function(t){var e=Kr(t);return 1==e.length&&e[0][2]?$r(e[0][0],e[0][1]):function(n){return n===t||Wr(n,t,e)}};var qr=function(t){return"symbol"==typeof t||F(t)&&"[object Symbol]"==x(t)},Zr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xr=/^\w*$/;var Qr=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!qr(t))||(Xr.test(t)||!Zr.test(t)||null!=e&&t in Object(e))};var to=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,eo=/\\(\\)?/g,no=function(t){var e=pn(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(to,(function(t,n,r,o){e.push(r?o.replace(eo,"$1"):n||t)})),e})),ro=w?w.prototype:void 0,oo=ro?ro.toString:void 0;var io=function t(e){if("string"==typeof e)return e;if(r(e))return Nn(e,t)+"";if(qr(e))return oo?oo.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};var uo=function(t){return null==t?"":io(t)};var ao=function(t,e){return r(t)?t:Qr(t,e)?[t]:no(uo(t))};var co=function(t){if("string"==typeof t||qr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var so=function(t,e){for(var n=0,r=(e=ao(e,t)).length;null!=t&&n<r;)t=t[co(e[n++])];return n&&n==r?t:void 0};var lo=function(t,e,n){var r=null==t?void 0:so(t,e);return void 0===r?n:r};var fo=function(t,e){return null!=t&&e in Object(t)};var po=function(t,e,n){for(var o=-1,i=(e=ao(e,t)).length,u=!1;++o<i;){var a=co(e[o]);if(!(u=null!=t&&n(t,a)))break;t=t[a]}return u||++o!=i?u:!!(i=null==t?0:t.length)&&fr(i)&&lr(a,i)&&(r(t)||ur(t))};var vo=function(t,e){return null!=t&&po(t,e,fo)};var ho=function(t,e){return Qr(t)&&Yr(e)?$r(co(t),e):function(n){var r=lo(n,t);return void 0===r&&r===e?vo(n,t):Hr(e,r,3)}};var _o=function(t){return t};var Eo=function(t){return function(e){return null==e?void 0:e[t]}};var yo=function(t){return function(e){return so(e,t)}};var bo=function(t){return Qr(t)?Eo(co(t)):yo(t)};var go=function(t){return"function"==typeof t?t:null==t?_o:"object"==typeof t?r(t)?ho(t[0],t[1]):Jr(t):bo(t)};var Oo=function(t){return function(e,n,r){for(var o=-1,i=Object(e),u=r(e),a=u.length;a--;){var c=u[t?a:++o];if(!1===n(i[c],c,i))break}return e}}();var To=function(t,e){return function(n,r){if(null==n)return n;if(!Ar(n))return t(n,r);for(var o=n.length,i=e?o:-1,u=Object(n);(e?i--:++i<o)&&!1!==r(u[i],i,u););return n}}((function(t,e){return t&&Oo(t,e,Rr)}));var mo=function(t,e){var n=-1,r=Ar(t)?Array(t.length):[];return To(t,(function(t,o,i){r[++n]=e(t,o,i)})),r};var Io=function(t,e){return(r(t)?Nn:mo)(t,go(e))},Ao=function(){function t(t,e,n){var r=this;this.observer=new ie,this.context=t,this.providerId=e,this.resolver=n,this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return r.updateState(t)})).catch((function(t){ne.error(Gt[Mt.STATE_FETCH_FAILED],t.message),r.context.eventing.track(Gt[Mt.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,n=this.state;this.updateState(y(y({},n),t)),this.resolver.update(this.context,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){ne.error(Gt[Mt.STATE_UPDATE_FAILED],t.message),e.context.eventing.track(Gt[Mt.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&e.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),Ro=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),No=Object.create(null),Do=function(){function t(t){this.cache=new Ro,this.options=y({},t||{})}return t.register=function(t,e){No[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,n=b(t,["type"]),r=No[e];return r?new r(n):null},t.prototype.toJSON=function(){return y({type:this.type},this.options)},t}();var wo=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var jo=function(t){return t!=t};var Co=function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1};var Po=function(t,e,n){return e==e?Co(t,e,n):wo(t,jo,n)};var Lo=function(t,e){return!!(null==t?0:t.length)&&Po(t,e,0)>-1};var So=function(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1};var Uo=function(){},ko=Pr&&1/Hn(new Pr([,-0]))[1]==1/0?function(t){return new Pr(t)}:Uo;var Mo=function(t,e,n){var r=-1,o=Lo,i=t.length,u=!0,a=[],c=a;if(n)u=!1,o=So;else if(i>=200){var s=e?null:ko(t);if(s)return Hn(s);u=!1,o=Bn,c=new xn}else c=e?[]:a;t:for(;++r<i;){var l=t[r],f=e?e(l):l;if(l=n||0!==l?l:0,u&&f==f){for(var d=c.length;d--;)if(c[d]===f)continue t;e&&c.push(f),a.push(l)}else o(c,f,n)||(c!==a&&c.push(f),a.push(l))}return a};var xo=function(t){return t&&t.length?Mo(t):[]},Fo=function(){function t(){}return t.get=function(e,r){var o=t.loaders.get(e);if(o)return o;var i=new n(r,{cache:!1});return t.loaders.set(e,i),i},t.loaders=new Map,t}(),Bo="https://api.candu.ai"+u,Go=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.prototype.retrieve=function(t,e){return g(this,void 0,void 0,(function(){var n,r,o=this;return O(this,(function(i){switch(i.label){case 0:return[4,Fo.get("cardStateApi",(function(e){return g(o,void 0,void 0,(function(){var n;return O(this,(function(r){switch(r.label){case 0:return[4,fetch(Bo+"?token="+t.clientToken+"&finder=byIds&ids="+xo(e).join(",")+"&userId="+t.userId).then((function(t){return t.json()}))];case 1:return n=r.sent(),[2,e.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return n=i.sent(),r={id:e,state:{dismissed:!1}},[2,n||r]}}))}))},e.prototype.update=function(t,e,n){return fetch(Bo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:n.state,userId:t.userId.toString()})}).then((function(t){return t.json()}))},e}(Do);Do.register(Tt.CardApi,Go);var Vo="https://api.candu.ai"+i;function zo(t){return{state:t.state,id:t.id}}function Ho(t){switch(t){case ct.Account:return"AccountId";case ct.User:default:return"UserId"}}var Wo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.prototype.getScopeAndFieldFromContext=function(t){var e=this.options.scopeTrait,n=this.options.scope||ct.User,r=t.userId.toString();return n===ct.Account&&(e&&t.traits[e]?r=t.traits[e]:(ee("trait '"+e+"' is not defined, falling back to user scope"),n=ct.User)),{scope:n,scopeField:r}},e.prototype.retrieve=function(t,e){return g(this,void 0,void 0,(function(){var n,r,o,i=this;return O(this,(function(u){switch(u.label){case 0:return n=this.getScopeAndFieldFromContext(t),r=n.scope,o=n.scopeField,[4,Fo.get("checklistState",(function(e){return g(i,void 0,void 0,(function(){var n;return O(this,(function(i){switch(i.label){case 0:return[4,fetch(Vo+"?token="+t.clientToken+"&byTrait="+Ho(r)+"&field="+o+"&finder=byIds&ids="+xo(e).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(zo)}))];case 1:return n=i.sent(),[2,e.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return[2,u.sent()||{id:e,state:at.NotStared}]}}))}))},e.prototype.update=function(t,e,n){var r=this.getScopeAndFieldFromContext(t),o=r.scope,i=r.scopeField;return fetch(Vo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(y(y({},n),{byTrait:Ho(o),field:i}))}).then((function(t){return t.json()})).then(zo)},e}(Do);function Yo(t,e){return Io(t,(function(t,n){var r=Do.fromJSON(t.resolver);return r?new Ao(e,n,r):null})).filter((function(t){return!!t}))}Do.register(Tt.CheckListApi,Wo);var Ko=function(t,e){for(var n=Object.values(t),r=function(t){var e=n.find((function(e){return e.position===t}));if(!e||e.status===at.NotStared)return{value:t}},o=0;o<e;o+=1){var i=r(o);if("object"==typeof i)return i.value}},$o=function(t,e){var n=Object.values(t).filter((function(t){return t.status===at.Done})).length;return{completedItems:n,percComplete:e?Math.round(100*n/e):0}},Jo=function(t){return t.filter((function(t){return t.resolver instanceof Wo}))},qo=function(t){var e={};return t.forEach((function(t,n){var r=t.getResolvedState();r&&(e[r.id]={status:r.state,position:n})})),e};export{G as ACTORS,vt as CANDU_PORTAL_CLASS,tt as CATEGORIES,nt as COLORS,At as CSSNodeTypes,Go as CardResolverInstance,at as CheckListItemStatus,Wo as CheckListResolverInstance,ct as CheckListScope,_n as DEFAULT_ALERT_COLOR,hn as DEFAULT_ALT,ut as DEFAULT_COLOR,m as DEFAULT_SEGMENT_ID,bn as DEFAULT_TAB_ACTIVE_COLOR,gn as DEFAULT_TAB_COLOR,En as DEFAULT_TAB_HEADER_COLOR,yn as DEFAULT_TAB_ITEM_COLOR,Gt as ERROR_MESSAGES,kt as ERROR_SLUGS,Mt as EVENT_NAMES,_t as FRAME_SIZES,et as HANDLER_TYPES,Y as IsNumericId,zt as LOGGER,V as MESSAGES,Ft as METRICS,it as Mark,ue as NodeManager,ie as Observer,yt as PREVIEW_COOKIE_NAME,gt as PREVIEW_FRAME_ID,Et as PREVIEW_MODES,mt as PREVIEW_SCRIPT_URL,bt as PREVIEW_URL_PARAM,ae as PreviewContainer,Qt as RESOURCES,On as STYLEGUIDE_COLORS,de as SingletonAPI,Ao as StateProviderInstance,Do as StateResolverInstance,Tt as StateResolverType,Ot as StateScope,It as StyleguideScope,Q as TRIGGERS,p as TutorialDependencies,mn as attachStylesheet,$o as calculateGroupCompletion,ht as canduPortalId,h as checkCyclicAndAdd,se as createSingleton,v as createTutorialDocumentContext,jt as cssInputObjToString,Ct as cssInputStringToObj,Vt as defaultStyleguide,In as detachStylesheet,qt as fetchFromApi,Zt as fetchFromCdn,d as fetchHead,Jt as fetchURL,Lt as findMatchingSegment,Jo as getCheckListStateProviders,ce as getContentState,Ko as getFirstNotStartedItem,qo as getInitialItems,Xt as getTutorialDocument,re as includeHTMLWhitespaces,Yo as initStateProviders,Ht as internalEventing,ot as isApiError,K as isClientToken,st as isContentHashId,W as isIdentifier,lt as isPortalId,ft as isPortalSlug,Rt as isStatePath,dt as isTutorialId,pt as isTutorialSlug,$ as isUserId,te as logError,ee as logWarning,ne as logger,ye as mapNodeToStyleguide,vn as mergeStyleguidesFromContext,Z as messageFactory,q as messages,$t as portalValidation,Yt as providerValidation,oe as stripHTML,Dt as stylguideClassNameMap,wt as toCssSelector,Pt as toStyleguideDecl,Kt as tutorialValidation,Rn as unpackShorthandStyles,X as windowStream};
//# sourceMappingURL=index.es.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@candulabs/eventing"),require("invariant"),require("setimmediate"),require("dataloader")):"function"==typeof define&&define.amd?define(["exports","@candulabs/eventing","invariant","setimmediate","dataloader"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@candulabs/core"]={},t.eventing,t.invariant,null,t.DataLoader)}(this,(function(t,e,n,r,o){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=i(n),u=i(o),c=Array.isArray;const s="0.7.1-alpha.22";var l="https://api.candu.ai",d="https://cdn.candu.ai",f="/api/checklistItems",p="/api/cards",v="/api/segmentMemberships",h="/api/segmentsDefinition",E="/api/tutorialMetadata",_="/api/tutorialDocumentsSdk",y=function(t){if(!document.querySelectorAll('[href="'+t+'"]').length){var e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.appendChild(e)}};var g=function(){function t(t){this.adjacencyList={},this.rootDocument=t,this.adjacencyList[t]=[]}return t.prototype.get=function(t){return this.adjacencyList[t]},t.prototype.add=function(t,e){var n=this;if(this.adjacencyList[t]||(this.adjacencyList[t]=[]),!this.adjacencyList[e])return this.adjacencyList[t].push(e),this.adjacencyList[e]=[],!0;if(this.adjacencyList[t].includes(e))return!0;var r=function(e){if(e===t)return!0;for(var o=0,i=n.adjacencyList[e];o<i.length;o++){var a=i[o];if(r(a))return!0}return!1};return!r(e)&&(this.adjacencyList[t].push(e),!0)},t}(),T=function(t,e){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function b(t,e){function n(){this.constructor=t}T(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var O=function(){return(O=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function S(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function A(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(a,u)}c((r=r.apply(t,e||[])).next())}))}function I(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function m(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}var R="Everyone",C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function N(t){var e={exports:{}};return t(e,e.exports),e.exports}var L="object"==typeof C&&C&&C.Object===Object&&C,D="object"==typeof self&&self&&self.Object===Object&&self,P=L||D||Function("return this")(),w=P.Symbol,j=Object.prototype,M=j.hasOwnProperty,k=j.toString,U=w?w.toStringTag:void 0;var G=function(t){var e=M.call(t,U),n=t[U];try{t[U]=void 0;var r=!0}catch(t){}var o=k.call(t);return r&&(e?t[U]=n:delete t[U]),o},F=Object.prototype.toString;var x=function(t){return F.call(t)},V=w?w.toStringTag:void 0;var B=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":V&&V in Object(t)?G(t):x(t)};var H=function(t){return null!=t&&"object"==typeof t};var W=function(t){return"string"==typeof t||!c(t)&&H(t)&&"[object String]"==B(t)};var Y,z,K=function(t){return"number"==typeof t||H(t)&&"[object Number]"==B(t)},$=/^([a-zA-Z0-9]|_|-)+$/,J=function(t){return W(t)&&t.length>=3&&t.length<100&&$.test(t)},q=function(t){return K(t)&&t>=0},Z=function(t){return W(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10},X=function(t){return q(t)||W(t)&&t.trim().length>0};t.ACTORS=void 0,(Y=t.ACTORS||(t.ACTORS={})).SDK="SDK",Y.PREVIEW="PREVIEW",t.MESSAGES=void 0,(z=t.MESSAGES||(t.MESSAGES={})).BOOTSTRAP="Bootstrap",z.CHANGE_POSITION="ChangePosition",z.CLOSE_PREVIEW="ClosePreview",z.PREVIEW_LOADED="PreviewLoaded",z.SET_AVALIABLE_PORTALS="SetAvaliablePortals",z.SET_CONTENT="SetContent",z.SET_SELECTED_ELEMENT="SetSelectedElement",z.SET_VIEW_MODE="SetViewMode",z.ADD_ELEMENT="AddElement",z.REMOVE_ELEMENT="RemoveElement",z.UPDATE_ELEMENT="UpdateElement",z.SET_ELEMENT="SetElement";var Q=function(t,e){return void 0===e&&(e={}),O({type:t},e)},tt={bootstrap:function(e,n,r,o){return Q(t.MESSAGES.BOOTSTRAP,{clientToken:e,userId:n,version:r,preview:o})},changePosition:function(e,n){return Q(t.MESSAGES.CHANGE_POSITION,{mouseEvent:e,top:n})},closePreview:function(){return Q(t.MESSAGES.CLOSE_PREVIEW)},previewLoaded:function(){return Q(t.MESSAGES.PREVIEW_LOADED)},setAvaliablePortals:function(e){return Q(t.MESSAGES.SET_AVALIABLE_PORTALS,{avaliablePortals:e})},addElement:function(e){return Q(t.MESSAGES.ADD_ELEMENT,{element:e})},removeElement:function(e){return Q(t.MESSAGES.REMOVE_ELEMENT,{id:e})},updateElement:function(e){return Q(t.MESSAGES.UPDATE_ELEMENT,{element:e})},setContent:function(e){return Q(t.MESSAGES.SET_CONTENT,{content:e})},setViewMode:function(e){return Q(t.MESSAGES.SET_VIEW_MODE,{viewMode:e})},setSelectedElement:function(e){return Q(t.MESSAGES.SET_SELECTED_ELEMENT,{element:e})}},et=function(t){var e=t.source,n=t.destination;return{read:function(t){var e=t.actor,r=t.message;return e===n?r:null},write:function(t){return{actor:e,message:t}}}};var nt,rt,ot,it=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};t.TRIGGERS=void 0,(t.TRIGGERS||(t.TRIGGERS={})).ON_CLICK="OnClick",t.CATEGORIES=void 0,(nt=t.CATEGORIES||(t.CATEGORIES={})).NATIVE="Native",nt.PENDO="Pendo",t.HANDLER_TYPES=void 0,(rt=t.HANDLER_TYPES||(t.HANDLER_TYPES={})).NAVIGATE="Navigate",rt.CHANGE_TUTORIAL="ChangeTutorial",rt.OPEN_GUIDE="OpenGuide",rt.DISMISSED_CARD="DismissedCard",t.COLORS=void 0,(ot=t.COLORS||(t.COLORS={})).PRIMARY="primary",ot.SECONDARY="primary",ot.WARNING="warning",ot.DANGER="danger",ot.NEUTRAL="neutral",ot.ACTIVE="active",ot.INFO="info";var at,ut=t.COLORS.PRIMARY;t.Mark=void 0,(at=t.Mark||(t.Mark={})).U="U",at.B="B",at.Em="Em",at.InlineCode="InlineCode";var ct,st,lt=function(t){return W(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/)},dt=function(t){return q(t)},ft=function(t){return J(t)};t.CheckListItemStatus=void 0,(ct=t.CheckListItemStatus||(t.CheckListItemStatus={})).NotStared="NotStarted",ct.InProgress="InProgress",ct.Done="Done",t.CheckListScope=void 0,(st=t.CheckListScope||(t.CheckListScope={})).User="User",st.Account="Account";var pt,vt;t.FRAME_SIZES=void 0,(pt=t.FRAME_SIZES||(t.FRAME_SIZES={})).COLLAPSED="Collapsed",pt.EXPANDED="Expanded",pt.MINIMIZED="Minimized",t.PREVIEW_MODES=void 0,(vt=t.PREVIEW_MODES||(t.PREVIEW_MODES={})).TUTORIAL="Tutorial",vt.PORTAL="Portal";var ht,Et;t.StateScope=void 0,(ht=t.StateScope||(t.StateScope={})).Global="Global",ht.Carried="Carried",t.StateResolverType=void 0,(Et=t.StateResolverType||(t.StateResolverType={})).CanduCdn="CanduCdn",Et.CheckListApi="CheckListApi",Et.CardApi="CardApi";var _t,yt;t.StyleguideScope=void 0,(_t=t.StyleguideScope||(t.StyleguideScope={})).Global="Global",_t.Organization="Organization",t.CSSNodeTypes=void 0,(yt=t.CSSNodeTypes||(t.CSSNodeTypes={})).Root="root",yt.Rule="rule",yt.Atrule="atrule",yt.Decl="decl",yt.Any="any";var gt,Tt={button:{childClassNames:{icon:"button-icon"},variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},badge:{variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},typography:{variants:{typography:function(t){return"typography-"+t}}}},bt=function(t){return"candu.sdk."+t},Ot=function(t){return bt("error."+t)},St={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",PROVIDER_ERROR:"provider_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},At={HEARTBEAT:bt("heartbeat"),PREVIEW_OPEN:bt("preview.open"),PORTAL:bt("portal"),TUTORIAL:bt("tutorial"),TUTORIAL_INTERACTION:bt("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Ot("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Ot("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Ot("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Ot("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Ot("commit_api"),TUTORIAL_LOADING_ERROR:Ot("tutorial"),UNKOWN_NODE_TYPE:Ot(St.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:Ot(St.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:Ot(St.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:Ot(St.TUTORIAL_ERROR),PORTAL_ERROR:Ot(St.PORTAL_ERROR),PROVIDER_ERROR:Ot(St.PROVIDER_ERROR),STYLEGUIDE_MAP_ERROR:Ot(St.TUTORIAL_ERROR),RENDER_NODE_ERROR:Ot(St.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Ot("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Ot("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Ot("state_fetch_failed"),STATE_UPDATE_FAILED:Ot("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Ot("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:bt("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:bt("tutorial.checklist_group_complete"),CARD_DISMISSED:bt("tutorial.card_dismissed")},It=function(t){return bt("metric."+t)},mt={SEGMENT_MEMBERSHIP_LOAD_TIME:It("segment_membership_load_time"),PORTAL_LOAD_TIME:It("portal_load_time"),CONTENT_LOAD_TIME:It("content_load_time"),TUTORIAL_LOAD_TIME:It("tutorial_load_time"),TUTORIAL_DOCUMENT_MOUNT_TIME:It("tutorial_document_mount_time")},Rt=function(t){return"An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: "+t+"."},Ct=((gt={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n"})[At.PORTAL_ASSET_NOT_FOUND]="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",gt[At.PORTAL_NO_SEGMENT_IDS]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",gt[At.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",gt[At.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",gt[At.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",gt[At.UNKOWN_INLINE_NODE_TYPE]=Rt(St.UNKOWN_INLINE_NODE_TYPE),gt[At.UNKOWN_NODE_TYPE]=Rt(St.UNKOWN_NODE_TYPE),gt[At.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",gt[At.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",gt[At.PORTAL_ERROR]="An error has occured within Portal",gt[At.PROVIDER_ERROR]="An error has occured within Provider",gt[At.TUTORIAL_ERROR]="An error has occured within Tutorial",gt[At.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",gt[At.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",gt[At.STATE_FETCH_FAILED]="An error has occured while fetching state:",gt[At.STATE_UPDATE_FAILED]="An error has occured while updating state:",gt[At.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",gt),Nt={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},Lt={error:console.error,warning:console.warn},Dt=function(t){return a.default(!t||it(t),"(Candu) styleguide must be undefined or an object")},Pt=function(t,e){return A(void 0,void 0,void 0,(function(){return I(this,(function(n){switch(n.label){case 0:return[4,fetch(t,e&&{headers:e})];case 1:return[2,n.sent().json()]}}))}))},wt=function(t){return Pt(""+l+t,{SDKVersion:s})},jt=function(t){return Pt(""+d+t,{SDKVersion:s})},Mt=function(t){return{byId:function(e){return wt(_+"?token="+t+"&finder=latestPublished&tutorialId="+e)},bySlug:function(e){return jt("/tutorials/"+t+"/"+e+".json")},byContentHash:function(e){return jt("/tutorials/"+t+"/"+e+".json")}}},kt={tutorialDocumentLatestSaved:function(t,e){return A(void 0,void 0,void 0,(function(){return I(this,(function(n){return[2,wt(_+"/"+e+"?token="+t)]}))}))},portalAsset:function(t,e,n){return A(void 0,void 0,void 0,(function(){var r,o;return I(this,(function(i){return(null===(o=n)||void 0===o?void 0:o.length)?(r="?segmentIds="+n.join(","),[2,jt("/portalMemberships/"+t+"/"+e+"/head.json"+r)]):[2,jt("/portals/"+t+"/"+e+"/head.json")]}))}))},contentDocument:function(t,e,n){return A(void 0,void 0,void 0,(function(){var r,o,i;return I(this,(function(a){switch(a.label){case 0:return r=(null===(i=n)||void 0===i?void 0:i.length)?"?segmentIds="+n.join(","):"",[4,fetch(d+"/contentDocument/"+t+"/"+e+".json"+r)];case 1:return[2,(o=a.sent()).ok?o.json():null]}}))}))},segmentMembership:function(t,e){return A(void 0,void 0,void 0,(function(){return I(this,(function(n){return[2,wt(v+"/"+e+"?token="+t)]}))}))},segmentDefinition:function(t){return A(void 0,void 0,void 0,(function(){return I(this,(function(e){return[2,wt(h+"?token="+t)]}))}))},tutorialMetadata:function(t){return A(void 0,void 0,void 0,(function(){return I(this,(function(e){return[2,wt(E+"?token="+t)]}))}))},tutorialDocument:function(t,e,n){var r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.slug,u=Mt(e);return ft(a)?u.bySlug(a):dt(o)?u.byId(o):lt(r)?u.byContentHash(r):it(i)?Promise.resolve(i):(Lt.error(Ct[At.NO_VALID_TUTORIAL_IDENTIFIER]),n.track(At.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},Ut=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.error.apply(console,t)},Gt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.warn.apply(console,t)},Ft={error:Ut,warning:Gt},xt=function(){function t(){this.subscribers=[]}return t.prototype.subscribe=function(t){var e=this;return this.subscribers.push(t),function(){e.subscribers[e.subscribers.indexOf(t)]=function(){}}},t.prototype.notify=function(t){this.subscribers.forEach((function(e){return e(t)}))},t.prototype.clear=function(){this.subscribers=[]},t}(),Vt=function(){function t(t,e){var n=this;this.state="waiting",this.currentElement=null,this.selector=t,this.renderToElement=e,this.findAndRender(),this.observer=new MutationObserver((function(t){switch(n.state){case"waiting":t.some((function(t){return!!t.addedNodes.length}))&&n.findAndRender();break;case"mounted":t.forEach((function(t){t.removedNodes.length&&t.removedNodes.forEach((function(t){t===n.currentElement&&(n.currentElement=null,n.state="waiting")}))}));break;default:throw new Error("Unhandled state: "+n.state)}})),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!1,characterData:!1})}return t.prototype.findAndRender=function(){var t=document.querySelector(this.selector);t&&(this.renderToElement(t),this.currentElement=t,this.state="mounted")},t.prototype.stopObserving=function(){this.observer.disconnect()},t}(),Bt=function(){function t(){this.onClientUpdateObserver=new xt}return t.prototype.attachClient=function(t){this.client=t,this.onClientUpdateObserver.notify({client:t})},t.prototype.detachClient=function(){this.client&&(this.client=null,this.onClientUpdateObserver.notify({client:null}))},t.prototype.onClientUpdate=function(t){var e=this.onClientUpdateObserver.subscribe(t);return this.client&&t({client:this.client}),e},t}();var Ht="@candulabs/core",Wt="0.7.1-alpha.22",Yt=function(){function t(t){this.init(t)}return t.prototype.getInfo=function(){return{core:{version:Wt,name:Ht},sdk:{version:this.version,name:this.name}}},t.prototype.attachClient=function(t){return this.provider.preview.attachClient(t)},t.prototype.detachClient=function(){return this.provider.preview.detachClient()},Object.defineProperty(t.prototype,"provider",{get:function(){return this.getProvider()},enumerable:!0,configurable:!0}),t}(),zt=function(e){switch(e.trigger){case t.TRIGGERS.ON_CLICK:default:return"onClick"}},Kt=function(e,n){var r,o,i,a,u,c;if("Link"===e.type&&(null===(r=e.props)||void 0===r?void 0:r.href)){var s=e.props.href+" Link Clicked",l=null===(i=null===(o=e)||void 0===o?void 0:o.nodes)||void 0===i?void 0:i[0];if(l){var d=n.document.nodes[l];"Text"===(null===(a=d)||void 0===a?void 0:a.type)&&(null===(c=null===(u=d)||void 0===u?void 0:u.props)||void 0===c?void 0:c.children)&&(s=d.props.children+" Link Clicked")}return{onClick:function(){var r;return n.provider.eventing.track(At.TUTORIAL_INTERACTION,{trigger:t.TRIGGERS.ON_CLICK,category:e.type,eventName:s,handler:{href:null===(r=e.props)||void 0===r?void 0:r.href,type:t.HANDLER_TYPES.NAVIGATE}})}}}if(!e.data||!e.data.actions)return{};var f=function(t,e){n.provider.eventing.track(At.TUTORIAL_INTERACTION,O(O({},t),e||{}))};return e.data.actions.map((function(e){return function(e,n,r){var o,i,a;switch(e.handler.type){case t.HANDLER_TYPES.NAVIGATE:return(o={})[zt(e)]=function(t){t.stopPropagation();var o=e.handler,i=o.href,a=o.target,u=r||{},c=u.parentTrackers,s=S(u,["parentTrackers"]);c&&c.forEach((function(t){return n(e,t)})),n(e,s),"Blank"===a?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},o;case t.HANDLER_TYPES.CHANGE_TUTORIAL:return(i={})[zt(e)]=function(){var t=e.handler.tutorialId;Ut("TODO -> change tutorial",t)},i;case t.HANDLER_TYPES.OPEN_GUIDE:return(a={})[zt(e)]=function(){var t=e.handler.guideId;Ut("TODO -> open guide",t)},a;default:return{}}}(e,f,n.trackingIdentifiers)})).reduce((function(t,e){return O(O({},t),e)}),{})},$t=function(t,e){var n=t.props||{},r=t.nodes,o=n.children;return o||(r?r.map(e):null)},Jt=function(t,e){var n=t.states;return n&&e.stateProviderInstances.filter((function(t){return!!n[t.providerId]}))},qt=function(t,e){var n=t.nodes;return n&&n.map((function(t){return e.document.nodes[t]})).filter((function(t){return!!t})).map((function(t){return Jt(t,e)||[]})).reduce((function(t,e){return t.concat(e)}),[])},Zt=function(t,e){try{var n=e.provider,r=e.document,o=e.trackingIdentifiers,i=r.nodes[t];if(!i)return Ft.error("Document is corrupted. Refusing to move further."),null;var a=function(t){return Zt(t,e)},u=i.type,c=i.props,s=i.css,l=O(O(O({},c||{}),{style:s||{},children:$t(i,a)}),Kt(i,{trackingIdentifiers:o,provider:n,document:r})),d={nodeId:t,node:i,document:r,render:{node:a,styleguide:function(t,n){return void 0===n&&(n={}),e.renderNode(t,{api:d,attributes:n})},tutorial:function(t){return e.renderTutorial(t)},portal:function(t){return e.renderPortal(t)}},trackingIdentifiers:o,stateInstances:Jt(i,e),childrenStateInstances:qt(i,e)},f=d.render.styleguide(u,l);return f||(Ft.error(Ct[At.UNKOWN_NODE_TYPE],{type:u}),n.eventing.error(new Error(Ct[At.UNKOWN_NODE_TYPE]),{type:u}),null)}catch(t){return Ft.error(Ct[At.STYLEGUIDE_MAP_ERROR],t),e.provider.eventing.error(t),null}};var Xt,Qt=function(t){if(!it(t))return!1;var e=B(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},te=P["__core-js_shared__"],ee=(Xt=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||""))?"Symbol(src)_1."+Xt:"";var ne=function(t){return!!ee&&ee in t},re=Function.prototype.toString;var oe=function(t){if(null!=t){try{return re.call(t)}catch(t){}try{return t+""}catch(t){}}return""},ie=/^\[object .+?Constructor\]$/,ae=Function.prototype,ue=Object.prototype,ce=ae.toString,se=ue.hasOwnProperty,le=RegExp("^"+ce.call(se).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var de=function(t){return!(!it(t)||ne(t))&&(Qt(t)?le:ie).test(oe(t))};var fe=function(t,e){return null==t?void 0:t[e]};var pe=function(t,e){var n=fe(t,e);return de(n)?n:void 0},ve=pe(Object,"create");var he=function(){this.__data__=ve?ve(null):{},this.size=0};var Ee=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},_e=Object.prototype.hasOwnProperty;var ye=function(t){var e=this.__data__;if(ve){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return _e.call(e,t)?e[t]:void 0},ge=Object.prototype.hasOwnProperty;var Te=function(t){var e=this.__data__;return ve?void 0!==e[t]:ge.call(e,t)};var be=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ve&&void 0===e?"__lodash_hash_undefined__":e,this};function Oe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Oe.prototype.clear=he,Oe.prototype.delete=Ee,Oe.prototype.get=ye,Oe.prototype.has=Te,Oe.prototype.set=be;var Se=Oe;var Ae=function(){this.__data__=[],this.size=0};var Ie=function(t,e){return t===e||t!=t&&e!=e};var me=function(t,e){for(var n=t.length;n--;)if(Ie(t[n][0],e))return n;return-1},Re=Array.prototype.splice;var Ce=function(t){var e=this.__data__,n=me(e,t);return!(n<0)&&(n==e.length-1?e.pop():Re.call(e,n,1),--this.size,!0)};var Ne=function(t){var e=this.__data__,n=me(e,t);return n<0?void 0:e[n][1]};var Le=function(t){return me(this.__data__,t)>-1};var De=function(t,e){var n=this.__data__,r=me(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function Pe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Pe.prototype.clear=Ae,Pe.prototype.delete=Ce,Pe.prototype.get=Ne,Pe.prototype.has=Le,Pe.prototype.set=De;var we=Pe,je=pe(P,"Map");var Me=function(){this.size=0,this.__data__={hash:new Se,map:new(je||we),string:new Se}};var ke=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ue=function(t,e){var n=t.__data__;return ke(e)?n["string"==typeof e?"string":"hash"]:n.map};var Ge=function(t){var e=Ue(this,t).delete(t);return this.size-=e?1:0,e};var Fe=function(t){return Ue(this,t).get(t)};var xe=function(t){return Ue(this,t).has(t)};var Ve=function(t,e){var n=Ue(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Be(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Be.prototype.clear=Me,Be.prototype.delete=Ge,Be.prototype.get=Fe,Be.prototype.has=xe,Be.prototype.set=Ve;var He=Be;function We(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(We.Cache||He),n}We.Cache=He;var Ye=We,ze=Ye((function(t,e){var n,r,o=t.provider,i=t.portal,a=t.tutorial,u=o.styleguide;return a&&(r=a.styleguide),i&&(n=i.styleguide),O(O(O(O({},u||{}),n||{}),r||{}),e||{})})),Ke=function(t){return"candu-styleguide-"+t},$e=function(t,e){var n,r,o,i,a="string"==typeof e&&e.split(" ");return a?1===a.length?((n={})[t+"Right"]=e,n[t+"Left"]=e,n[t+"Bottom"]=e,n[t+"Top"]=e,n):2===a.length?((r={})[t+"Top"]=a[0],r[t+"Right"]=a[1],r[t+"Bottom"]=a[0],r[t+"Left"]=a[1],r):3===a.length?((o={})[t+"Top"]=a[0],o[t+"Right"]=a[1],o[t+"Bottom"]=a[2],o[t+"Left"]=a[1],o):((i={})[t+"Top"]=a[0],i[t+"Right"]=a[1],i[t+"Bottom"]=a[2],i[t+"Left"]=a[3],i):{}};var Je=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o};var qe=function(){this.__data__=new we,this.size=0};var Ze=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Xe=function(t){return this.__data__.get(t)};var Qe=function(t){return this.__data__.has(t)};var tn=function(t,e){var n=this.__data__;if(n instanceof we){var r=n.__data__;if(!je||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new He(r)}return n.set(t,e),this.size=n.size,this};function en(t){var e=this.__data__=new we(t);this.size=e.size}en.prototype.clear=qe,en.prototype.delete=Ze,en.prototype.get=Xe,en.prototype.has=Qe,en.prototype.set=tn;var nn=en;var rn=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var on=function(t){return this.__data__.has(t)};function an(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new He;++e<n;)this.add(t[e])}an.prototype.add=an.prototype.push=rn,an.prototype.has=on;var un=an;var cn=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var sn=function(t,e){return t.has(e)};var ln=function(t,e,n,r,o,i){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(t);if(s&&i.get(e))return s==e;var l=-1,d=!0,f=2&n?new un:void 0;for(i.set(t,e),i.set(e,t);++l<u;){var p=t[l],v=e[l];if(r)var h=a?r(v,p,l,e,t,i):r(p,v,l,t,e,i);if(void 0!==h){if(h)continue;d=!1;break}if(f){if(!cn(e,(function(t,e){if(!sn(f,e)&&(p===t||o(p,t,n,r,i)))return f.push(e)}))){d=!1;break}}else if(p!==v&&!o(p,v,n,r,i)){d=!1;break}}return i.delete(t),i.delete(e),d},dn=P.Uint8Array;var fn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n};var pn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},vn=w?w.prototype:void 0,hn=vn?vn.valueOf:void 0;var En=function(t,e,n,r,o,i,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new dn(t),new dn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ie(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=fn;case"[object Set]":var c=1&r;if(u||(u=pn),t.size!=e.size&&!c)return!1;var s=a.get(t);if(s)return s==e;r|=2,a.set(t,e);var l=ln(u(t),u(e),r,o,i,a);return a.delete(t),l;case"[object Symbol]":if(hn)return hn.call(t)==hn.call(e)}return!1};var _n=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t};var yn=function(t,e,n){var r=e(t);return c(t)?r:_n(r,n(t))};var gn=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i};var Tn=function(){return[]},bn=Object.prototype.propertyIsEnumerable,On=Object.getOwnPropertySymbols,Sn=On?function(t){return null==t?[]:(t=Object(t),gn(On(t),(function(e){return bn.call(t,e)})))}:Tn;var An=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r};var In=function(t){return H(t)&&"[object Arguments]"==B(t)},mn=Object.prototype,Rn=mn.hasOwnProperty,Cn=mn.propertyIsEnumerable,Nn=In(function(){return arguments}())?In:function(t){return H(t)&&Rn.call(t,"callee")&&!Cn.call(t,"callee")};var Ln=function(){return!1},Dn=N((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?P.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ln;t.exports=i})),Pn=/^(?:0|[1-9]\d*)$/;var wn=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Pn.test(t))&&t>-1&&t%1==0&&t<e};var jn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Mn={};Mn["[object Float32Array]"]=Mn["[object Float64Array]"]=Mn["[object Int8Array]"]=Mn["[object Int16Array]"]=Mn["[object Int32Array]"]=Mn["[object Uint8Array]"]=Mn["[object Uint8ClampedArray]"]=Mn["[object Uint16Array]"]=Mn["[object Uint32Array]"]=!0,Mn["[object Arguments]"]=Mn["[object Array]"]=Mn["[object ArrayBuffer]"]=Mn["[object Boolean]"]=Mn["[object DataView]"]=Mn["[object Date]"]=Mn["[object Error]"]=Mn["[object Function]"]=Mn["[object Map]"]=Mn["[object Number]"]=Mn["[object Object]"]=Mn["[object RegExp]"]=Mn["[object Set]"]=Mn["[object String]"]=Mn["[object WeakMap]"]=!1;var kn=function(t){return H(t)&&jn(t.length)&&!!Mn[B(t)]};var Un=function(t){return function(e){return t(e)}},Gn=N((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&L.process,i=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),Fn=Gn&&Gn.isTypedArray,xn=Fn?Un(Fn):kn,Vn=Object.prototype.hasOwnProperty;var Bn=function(t,e){var n=c(t),r=!n&&Nn(t),o=!n&&!r&&Dn(t),i=!n&&!r&&!o&&xn(t),a=n||r||o||i,u=a?An(t.length,String):[],s=u.length;for(var l in t)!e&&!Vn.call(t,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||wn(l,s))||u.push(l);return u},Hn=Object.prototype;var Wn=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Hn)};var Yn=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),zn=Object.prototype.hasOwnProperty;var Kn=function(t){if(!Wn(t))return Yn(t);var e=[];for(var n in Object(t))zn.call(t,n)&&"constructor"!=n&&e.push(n);return e};var $n=function(t){return null!=t&&jn(t.length)&&!Qt(t)};var Jn=function(t){return $n(t)?Bn(t):Kn(t)};var qn=function(t){return yn(t,Jn,Sn)},Zn=Object.prototype.hasOwnProperty;var Xn=function(t,e,n,r,o,i){var a=1&n,u=qn(t),c=u.length;if(c!=qn(e).length&&!a)return!1;for(var s=c;s--;){var l=u[s];if(!(a?l in e:Zn.call(e,l)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var f=!0;i.set(t,e),i.set(e,t);for(var p=a;++s<c;){var v=t[l=u[s]],h=e[l];if(r)var E=a?r(h,v,l,e,t,i):r(v,h,l,t,e,i);if(!(void 0===E?v===h||o(v,h,n,r,i):E)){f=!1;break}p||(p="constructor"==l)}if(f&&!p){var _=t.constructor,y=e.constructor;_==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(f=!1)}return i.delete(t),i.delete(e),f},Qn=pe(P,"DataView"),tr=pe(P,"Promise"),er=pe(P,"Set"),nr=pe(P,"WeakMap"),rr="[object Map]",or="[object Promise]",ir="[object Set]",ar="[object WeakMap]",ur="[object DataView]",cr=oe(Qn),sr=oe(je),lr=oe(tr),dr=oe(er),fr=oe(nr),pr=B;(Qn&&pr(new Qn(new ArrayBuffer(1)))!=ur||je&&pr(new je)!=rr||tr&&pr(tr.resolve())!=or||er&&pr(new er)!=ir||nr&&pr(new nr)!=ar)&&(pr=function(t){var e=B(t),n="[object Object]"==e?t.constructor:void 0,r=n?oe(n):"";if(r)switch(r){case cr:return ur;case sr:return rr;case lr:return or;case dr:return ir;case fr:return ar}return e});var vr=pr,hr="[object Arguments]",Er="[object Array]",_r="[object Object]",yr=Object.prototype.hasOwnProperty;var gr=function(t,e,n,r,o,i){var a=c(t),u=c(e),s=a?Er:vr(t),l=u?Er:vr(e),d=(s=s==hr?_r:s)==_r,f=(l=l==hr?_r:l)==_r,p=s==l;if(p&&Dn(t)){if(!Dn(e))return!1;a=!0,d=!1}if(p&&!d)return i||(i=new nn),a||xn(t)?ln(t,e,n,r,o,i):En(t,e,s,n,r,o,i);if(!(1&n)){var v=d&&yr.call(t,"__wrapped__"),h=f&&yr.call(e,"__wrapped__");if(v||h){var E=v?t.value():t,_=h?e.value():e;return i||(i=new nn),o(E,_,n,r,i)}}return!!p&&(i||(i=new nn),Xn(t,e,n,r,o,i))};var Tr=function t(e,n,r,o,i){return e===n||(null==e||null==n||!H(e)&&!H(n)?e!=e&&n!=n:gr(e,n,r,o,t,i))};var br=function(t,e,n,r){var o=n.length,i=o,a=!r;if(null==t)return!i;for(t=Object(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var c=(u=n[o])[0],s=t[c],l=u[1];if(a&&u[2]){if(void 0===s&&!(c in t))return!1}else{var d=new nn;if(r)var f=r(s,l,c,t,e,d);if(!(void 0===f?Tr(l,s,3,r,d):f))return!1}}return!0};var Or=function(t){return t==t&&!it(t)};var Sr=function(t){for(var e=Jn(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Or(o)]}return e};var Ar=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}};var Ir=function(t){var e=Sr(t);return 1==e.length&&e[0][2]?Ar(e[0][0],e[0][1]):function(n){return n===t||br(n,t,e)}};var mr=function(t){return"symbol"==typeof t||H(t)&&"[object Symbol]"==B(t)},Rr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cr=/^\w*$/;var Nr=function(t,e){if(c(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!mr(t))||(Cr.test(t)||!Rr.test(t)||null!=e&&t in Object(e))};var Lr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dr=/\\(\\)?/g,Pr=function(t){var e=Ye(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Lr,(function(t,n,r,o){e.push(r?o.replace(Dr,"$1"):n||t)})),e})),wr=w?w.prototype:void 0,jr=wr?wr.toString:void 0;var Mr=function t(e){if("string"==typeof e)return e;if(c(e))return Je(e,t)+"";if(mr(e))return jr?jr.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};var kr=function(t){return null==t?"":Mr(t)};var Ur=function(t,e){return c(t)?t:Nr(t,e)?[t]:Pr(kr(t))};var Gr=function(t){if("string"==typeof t||mr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Fr=function(t,e){for(var n=0,r=(e=Ur(e,t)).length;null!=t&&n<r;)t=t[Gr(e[n++])];return n&&n==r?t:void 0};var xr=function(t,e,n){var r=null==t?void 0:Fr(t,e);return void 0===r?n:r};var Vr=function(t,e){return null!=t&&e in Object(t)};var Br=function(t,e,n){for(var r=-1,o=(e=Ur(e,t)).length,i=!1;++r<o;){var a=Gr(e[r]);if(!(i=null!=t&&n(t,a)))break;t=t[a]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&jn(o)&&wn(a,o)&&(c(t)||Nn(t))};var Hr=function(t,e){return null!=t&&Br(t,e,Vr)};var Wr=function(t,e){return Nr(t)&&Or(e)?Ar(Gr(t),e):function(n){var r=xr(n,t);return void 0===r&&r===e?Hr(n,t):Tr(e,r,3)}};var Yr=function(t){return t};var zr=function(t){return function(e){return null==e?void 0:e[t]}};var Kr=function(t){return function(e){return Fr(e,t)}};var $r=function(t){return Nr(t)?zr(Gr(t)):Kr(t)};var Jr=function(t){return"function"==typeof t?t:null==t?Yr:"object"==typeof t?c(t)?Wr(t[0],t[1]):Ir(t):$r(t)};var qr=function(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===n(i[c],c,i))break}return e}}();var Zr=function(t,e){return function(n,r){if(null==n)return n;if(!$n(n))return t(n,r);for(var o=n.length,i=e?o:-1,a=Object(n);(e?i--:++i<o)&&!1!==r(a[i],i,a););return n}}((function(t,e){return t&&qr(t,e,Jn)}));var Xr=function(t,e){var n=-1,r=$n(t)?Array(t.length):[];return Zr(t,(function(t,o,i){r[++n]=e(t,o,i)})),r};var Qr=function(t,e){return(c(t)?Je:Xr)(t,Jr(e))},to=function(){function t(t,e,n){var r=this;this.observer=new xt,this.context=t,this.providerId=e,this.resolver=n,this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return r.updateState(t)})).catch((function(t){Ft.error(Ct[At.STATE_FETCH_FAILED],t.message),r.context.eventing.track(Ct[At.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,n=this.state;this.updateState(O(O({},n),t)),this.resolver.update(this.context,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){Ft.error(Ct[At.STATE_UPDATE_FAILED],t.message),e.context.eventing.track(Ct[At.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&e.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),eo=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),no=Object.create(null),ro=function(){function t(t){this.cache=new eo,this.options=O({},t||{})}return t.register=function(t,e){no[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,n=S(t,["type"]),r=no[e];return r?new r(n):null},t.prototype.toJSON=function(){return O({type:this.type},this.options)},t}();var oo=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var io=function(t){return t!=t};var ao=function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1};var uo=function(t,e,n){return e==e?ao(t,e,n):oo(t,io,n)};var co=function(t,e){return!!(null==t?0:t.length)&&uo(t,e,0)>-1};var so=function(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1};var lo=function(){},fo=er&&1/pn(new er([,-0]))[1]==1/0?function(t){return new er(t)}:lo;var po=function(t,e,n){var r=-1,o=co,i=t.length,a=!0,u=[],c=u;if(n)a=!1,o=so;else if(i>=200){var s=e?null:fo(t);if(s)return pn(s);a=!1,o=sn,c=new un}else c=e?[]:u;t:for(;++r<i;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,n)||(c!==u&&c.push(d),u.push(l))}return u};var vo=function(t){return t&&t.length?po(t):[]},ho=function(){function t(){}return t.get=function(e,n){var r=t.loaders.get(e);if(r)return r;var o=new u.default(n,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),Eo=l+p,_o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e.prototype.retrieve=function(t,e){return A(this,void 0,void 0,(function(){var n,r,o=this;return I(this,(function(i){switch(i.label){case 0:return[4,ho.get("cardStateApi",(function(e){return A(o,void 0,void 0,(function(){var n;return I(this,(function(r){switch(r.label){case 0:return[4,fetch(Eo+"?token="+t.clientToken+"&finder=byIds&ids="+vo(e).join(",")+"&userId="+t.userId).then((function(t){return t.json()}))];case 1:return n=r.sent(),[2,e.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return n=i.sent(),r={id:e,state:{dismissed:!1}},[2,n||r]}}))}))},e.prototype.update=function(t,e,n){return fetch(Eo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:n.state,userId:t.userId.toString()})}).then((function(t){return t.json()}))},e}(ro);ro.register(t.StateResolverType.CardApi,_o);var yo=l+f;function go(t){return{state:t.state,id:t.id}}function To(e){switch(e){case t.CheckListScope.Account:return"AccountId";case t.CheckListScope.User:default:return"UserId"}}var bo=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return b(n,e),n.prototype.getScopeAndFieldFromContext=function(e){var n=this.options.scopeTrait,r=this.options.scope||t.CheckListScope.User,o=e.userId.toString();return r===t.CheckListScope.Account&&(n&&e.traits[n]?o=e.traits[n]:(Gt("trait '"+n+"' is not defined, falling back to user scope"),r=t.CheckListScope.User)),{scope:r,scopeField:o}},n.prototype.retrieve=function(e,n){return A(this,void 0,void 0,(function(){var r,o,i,a=this;return I(this,(function(u){switch(u.label){case 0:return r=this.getScopeAndFieldFromContext(e),o=r.scope,i=r.scopeField,[4,ho.get("checklistState",(function(t){return A(a,void 0,void 0,(function(){var n;return I(this,(function(r){switch(r.label){case 0:return[4,fetch(yo+"?token="+e.clientToken+"&byTrait="+To(o)+"&field="+i+"&finder=byIds&ids="+vo(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(go)}))];case 1:return n=r.sent(),[2,t.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(n)];case 1:return[2,u.sent()||{id:n,state:t.CheckListItemStatus.NotStared}]}}))}))},n.prototype.update=function(t,e,n){var r=this.getScopeAndFieldFromContext(t),o=r.scope,i=r.scopeField;return fetch(yo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(O(O({},n),{byTrait:To(o),field:i}))}).then((function(t){return t.json()})).then(go)},n}(ro);ro.register(t.StateResolverType.CheckListApi,bo);t.CANDU_PORTAL_CLASS="candu_portal",t.CardResolverInstance=_o,t.CheckListResolverInstance=bo,t.DEFAULT_ALERT_COLOR="#EDEDED",t.DEFAULT_ALT="",t.DEFAULT_COLOR=ut,t.DEFAULT_SEGMENT_ID=R,t.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",t.DEFAULT_TAB_COLOR="#FEFEFE",t.DEFAULT_TAB_HEADER_COLOR="#333745",t.DEFAULT_TAB_ITEM_COLOR="#838792",t.ERROR_MESSAGES=Ct,t.ERROR_SLUGS=St,t.EVENT_NAMES=At,t.IsNumericId=q,t.LOGGER=Lt,t.METRICS=mt,t.NodeManager=Vt,t.Observer=xt,t.PREVIEW_COOKIE_NAME="candu.preview",t.PREVIEW_FRAME_ID="canduPreview",t.PREVIEW_SCRIPT_URL="https://app.candu.ai/preview.html",t.PREVIEW_URL_PARAM="candu_preview",t.PreviewContainer=Bt,t.RESOURCES=kt,t.STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},t.SingletonAPI=Yt,t.StateProviderInstance=to,t.StateResolverInstance=ro,t.TutorialDependencies=g,t.attachStylesheet=function(t,e){void 0===e&&(e="main");var n=Ke(t);if(!document.getElementById(n)){var r=document.createElement("link");r.setAttribute("id",n),r.setAttribute("rel","stylesheet"),r.setAttribute("href",d+"/styleguides/applications/"+t+"/default/"+e+".css"),document.head.appendChild(r)}},t.calculateGroupCompletion=function(e,n){var r=Object.values(e).filter((function(e){return e.status===t.CheckListItemStatus.Done})).length;return{completedItems:r,percComplete:n?Math.round(100*r/n):0}},t.canduPortalId=function(t){return"candu_portal_"+t},t.checkCyclicAndAdd=function(t,e){return t.dependencies.add(t.id,e)},t.createSingleton=function(t){var e,n,r=function(t){return function(){for(var e,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(n.api)return(e=n.api)[t].apply(e,r);console.warn("Please initialize the SDK by calling Candu.init() before attempting to call "+t)}};return(e=function(){function e(){}return e.init=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this.api||(e.api=new(t.bind.apply(t,m([void 0],n)))),e.subscriberCallbacks.forEach((function(t){return t()})),e.subscriberCallbacks=[],window.postMessage({source:"CANDU_SINGLETON",payload:{type:"INIT"}},window&&window.origin?window.origin:"*"),e},e.onProviderReady=function(t){if(e.api)return t();e.subscriberCallbacks.push(t)},e}()).subscriberCallbacks=[],e.renderTutorial=r("renderTutorial"),e.renderPortal=r("renderPortal"),e.renderContent=r("renderContent"),e.attachClient=r("attachClient"),e.detachClient=r("detachClient"),e.getProvider=r("getProvider"),e.getInfo=r("getInfo"),n=e,window.Candu=n,n},t.createTutorialDocumentContext=function(t,e){return{id:t,dependencies:e?e.dependencies:new g(t)}},t.cssInputObjToString=function(t){return Object.keys(t).reduce((function(e,n){return""+e+n+": "+t[n]+";"}),"")},t.cssInputStringToObj=function(t){return t.split(";").reduce((function(t,e){var n,r=e.split(":"),o=r[0],i=r[1];return o&&i?O(O({},t),((n={})[o.trim()]=i.trim(),n)):t}),{})},t.defaultStyleguide=Nt,t.detachStylesheet=function(t){var e=document.getElementById(Ke(t));e&&e.remove()},t.fetchFromApi=wt,t.fetchFromCdn=jt,t.fetchHead=function(t,e){t&&c(t)&&(!function(t,e){var n="candu-stylesheet-"+t;if(!document.getElementById(n)){var r=document.createElement("style");r.setAttribute("id",n),r.setAttribute("type","text/css"),r.appendChild(document.createTextNode(e)),document.head.append(r)}}("document",".candu-document * {\n box-sizing: border-box;\n }\n "),t.map((function(t){var n=t.nodeType,r=t.url;return y("EmbedTutorial"===n?d+"/tutorials/"+e+"/"+r+".json":"EmbedPortal"===n?d+"/portals/"+e+"/"+r+"/head.json":r)})))},t.fetchURL=Pt,t.findMatchingSegment=function(t,e){var n=e.reduce((function(t,e){var n;return O(O({},t),((n={})[e]=e,n))}),{});if(c(t.content))return t.content.find((function(t){var e=t.segmentId;return!!n[e]||e===R}))},t.getCheckListStateProviders=function(t){return t.filter((function(t){return t.resolver instanceof bo}))},t.getContentState=function(t){return t.lastModifiedAt===t.lastPublishedAt?"Published":t.lastPublishedAt?"Unsynced":"Draft"},t.getFirstNotStartedItem=function(e,n){for(var r=Object.values(e),o=function(e){var n=r.find((function(t){return t.position===e}));if(!n||n.status===t.CheckListItemStatus.NotStared)return{value:e}},i=0;i<n;i+=1){var a=o(i);if("object"==typeof a)return a.value}},t.getInitialItems=function(t){var e={};return t.forEach((function(t,n){var r=t.getResolvedState();r&&(e[r.id]={status:r.state,position:n})})),e},t.getTutorialDocument=Mt,t.includeHTMLWhitespaces=function(t){return t.replace(/\s/g,"&nbsp;")},t.initStateProviders=function(t,e){return Qr(t,(function(t,n){var r=ro.fromJSON(t.resolver);return r?new to(e,n,r):null})).filter((function(t){return!!t}))},t.internalEventing=function(t){var e=t.identify,n=t.track;return{provider:function(t){var r=t.userId,o=t.traits,i=t.styleguide;e(r,o),n(At.HEARTBEAT,function(t){var e={};return Object.keys(t).forEach((function(n){Nt[n]&&(e["styleguide."+n]=t[n].displayName||!0)})),e}(i))},tutorialDocumentLoadingError:function(t){var e=t.tutorialId,r=t.slug,o=t.contentHashId;Lt.error(Ct[At.TUTORIAL_LOADING_ERROR]),n(At.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:r,contentHashId:o})}}},t.isApiError=function(t){return it(t)&&W(t.errorCode)},t.isClientToken=Z,t.isContentHashId=lt,t.isIdentifier=J,t.isPortalId=function(t){return q(t)},t.isPortalSlug=function(t){return J(t)},t.isStatePath=function(t){return W(t)&&!!t.match(/^@(\w|\d|_|-|\.){3,20}\$/)},t.isTutorialId=dt,t.isTutorialSlug=ft,t.isUserId=X,t.logError=Ut,t.logWarning=Gt,t.logger=Ft,t.mapNodeToStyleguide=Zt,t.mergeStyleguidesFromContext=ze,t.messageFactory=et,t.messages=tt,t.portalValidation=function(t){var e=t.slug,n=t.styleguide;return Dt(n),{slug:e,styleguide:n||{}}},t.providerValidation=function(t){var n=t.clientToken,r=t.userId,o=t.traits,i=t.options,u=t.styleguide,c=S(t,["clientToken","userId","traits","options","styleguide"]);return a.default(Z(n),"(Candu) you must provide a valid clientToken"),a.default(!r||X(r),"(Candu) you must provide a valid userId"),Dt(u),a.default(!o||it(o),"(Candu) traits must be undefined or an object"),a.default(!i||it(i),"(Candu) options must be undefined or an object"),O(O({},c),{clientToken:n,traits:o||{},options:i||{},styleguide:u||{},userId:r||e.getAnonymousId()})},t.stripHTML=function(t){return DOMParser?(new DOMParser).parseFromString(t,"text/html").body.textContent||"":t},t.stylguideClassNameMap=Tt,t.toCssSelector=function(t,e){var n=O({className:"root",variant:void 0,selector:"",output:"css"},e||{}),r=n.className,o=n.variant,i=n.selector,a=n.output,u="candu-"+t;if("global"===r)return"html"===a?"":":root";var c=null,s=[],l=Tt[t]||{};if(o&&l.variants){var d=l.variants;s=Object.keys(o).reduce((function(t,e){var n=o[e],r=d[e];return t.push(r?r(n):e+"-"+n),t}),[])}return"root"!==r&&l.childClassNames&&l.childClassNames[r]&&(c="candu-"+t+"--"+l.childClassNames[r]),"css"===a?[u,c,i].reduce((function(t,e,n){return e&&""!==e?0===n?"."+u+s.map((function(t){return"."+t})).join(""):1===n?t+" ."+e:""+t+e:t}),"")||"":"root"===r?m([u],s).filter((function(t){return!!t})).join(" ")||"":c||""},t.toStyleguideDecl=function(e){return Object.keys(e).reduce((function(n,r){return m(n,[{type:t.CSSNodeTypes.Decl,prop:r,value:e[r]}])}),[])},t.tutorialValidation=function(t){var e=t.slug,n=t.styleguide,r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.renderedByClient,u=S(t,["slug","styleguide","contentHashId","tutorialId","tutorialDocument","renderedByClient"]);return Dt(n),O(O({},u),{slug:e,styleguide:n||{},contentHashId:r,tutorialId:o,tutorialDocument:i,renderedByClient:a})},t.unpackShorthandStyles=function(t){var e=t.padding,n=t.margin,r=S(t,["padding","margin"]),o={};return e&&(o=O(O({},o),$e("padding",e))),n&&(o=O(O({},o),$e("margin",n))),O(O({},o),r)},t.windowStream=function(t){var e=t.source,n=t.destination,r=t.targetOrigin,o=t.targetWindow,i=t.originWindow,a=t.onRecieveMessage,u=et({source:e,destination:n}),c=u.read,s=u.write,l=function(t){var e=c(t.data);e&&a(e)};return i.addEventListener("message",l,!1),{close:function(){i.removeEventListener("message",l)},send:function(t){o.postMessage(s(t),r)}}},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@candulabs/eventing"),require("invariant"),require("setimmediate"),require("dataloader")):"function"==typeof define&&define.amd?define(["exports","@candulabs/eventing","invariant","setimmediate","dataloader"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@candulabs/core"]={},t.eventing,t.invariant,null,t.DataLoader)}(this,(function(t,e,n,r,o){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=i(n),u=i(o),c=Array.isArray;const s="0.7.1-alpha.23";var l="https://api.candu.ai",d="https://cdn.candu.ai",f="/api/checklistItems",p="/api/cards",v="/api/segmentMemberships",h="/api/segmentsDefinition",E="/api/tutorialMetadata",_="/api/tutorialDocumentsSdk",y=function(t){if(!document.querySelectorAll('[href="'+t+'"]').length){var e=document.createElement("link");e.setAttribute("rel","prefetch"),e.setAttribute("href",t),document.head.appendChild(e)}};var g=function(){function t(t){this.adjacencyList={},this.rootDocument=t,this.adjacencyList[t]=[]}return t.prototype.get=function(t){return this.adjacencyList[t]},t.prototype.add=function(t,e){var n=this;if(this.adjacencyList[t]||(this.adjacencyList[t]=[]),!this.adjacencyList[e])return this.adjacencyList[t].push(e),this.adjacencyList[e]=[],!0;if(this.adjacencyList[t].includes(e))return!0;var r=function(e){if(e===t)return!0;for(var o=0,i=n.adjacencyList[e];o<i.length;o++){var a=i[o];if(r(a))return!0}return!1};return!r(e)&&(this.adjacencyList[t].push(e),!0)},t}(),T=function(t,e){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function b(t,e){function n(){this.constructor=t}T(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var O=function(){return(O=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function S(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function A(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(a,u)}c((r=r.apply(t,e||[])).next())}))}function I(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function m(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}var R="Everyone",C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function N(t){var e={exports:{}};return t(e,e.exports),e.exports}var L="object"==typeof C&&C&&C.Object===Object&&C,D="object"==typeof self&&self&&self.Object===Object&&self,P=L||D||Function("return this")(),w=P.Symbol,j=Object.prototype,M=j.hasOwnProperty,k=j.toString,U=w?w.toStringTag:void 0;var G=function(t){var e=M.call(t,U),n=t[U];try{t[U]=void 0;var r=!0}catch(t){}var o=k.call(t);return r&&(e?t[U]=n:delete t[U]),o},F=Object.prototype.toString;var x=function(t){return F.call(t)},V=w?w.toStringTag:void 0;var B=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":V&&V in Object(t)?G(t):x(t)};var H=function(t){return null!=t&&"object"==typeof t};var W=function(t){return"string"==typeof t||!c(t)&&H(t)&&"[object String]"==B(t)};var Y,z,K=function(t){return"number"==typeof t||H(t)&&"[object Number]"==B(t)},$=/^([a-zA-Z0-9]|_|-)+$/,J=function(t){return W(t)&&t.length>=3&&t.length<100&&$.test(t)},q=function(t){return K(t)&&t>=0},Z=function(t){return W(t)&&!!t.match(/^[0-9a-zA-Z]*$/)&&t.length>=10},X=function(t){return q(t)||W(t)&&t.trim().length>0};t.ACTORS=void 0,(Y=t.ACTORS||(t.ACTORS={})).SDK="SDK",Y.PREVIEW="PREVIEW",t.MESSAGES=void 0,(z=t.MESSAGES||(t.MESSAGES={})).BOOTSTRAP="Bootstrap",z.CHANGE_POSITION="ChangePosition",z.CLOSE_PREVIEW="ClosePreview",z.PREVIEW_LOADED="PreviewLoaded",z.SET_AVALIABLE_PORTALS="SetAvaliablePortals",z.SET_CONTENT="SetContent",z.SET_SELECTED_ELEMENT="SetSelectedElement",z.SET_VIEW_MODE="SetViewMode",z.ADD_ELEMENT="AddElement",z.REMOVE_ELEMENT="RemoveElement",z.UPDATE_ELEMENT="UpdateElement",z.SET_ELEMENT="SetElement";var Q=function(t,e){return void 0===e&&(e={}),O({type:t},e)},tt={bootstrap:function(e,n,r,o){return Q(t.MESSAGES.BOOTSTRAP,{clientToken:e,userId:n,version:r,preview:o})},changePosition:function(e,n){return Q(t.MESSAGES.CHANGE_POSITION,{mouseEvent:e,top:n})},closePreview:function(){return Q(t.MESSAGES.CLOSE_PREVIEW)},previewLoaded:function(){return Q(t.MESSAGES.PREVIEW_LOADED)},setAvaliablePortals:function(e){return Q(t.MESSAGES.SET_AVALIABLE_PORTALS,{avaliablePortals:e})},addElement:function(e){return Q(t.MESSAGES.ADD_ELEMENT,{element:e})},removeElement:function(e){return Q(t.MESSAGES.REMOVE_ELEMENT,{id:e})},updateElement:function(e){return Q(t.MESSAGES.UPDATE_ELEMENT,{element:e})},setContent:function(e){return Q(t.MESSAGES.SET_CONTENT,{content:e})},setViewMode:function(e){return Q(t.MESSAGES.SET_VIEW_MODE,{viewMode:e})},setSelectedElement:function(e){return Q(t.MESSAGES.SET_SELECTED_ELEMENT,{element:e})}},et=function(t){var e=t.source,n=t.destination;return{read:function(t){var e=t.actor,r=t.message;return e===n?r:null},write:function(t){return{actor:e,message:t}}}};var nt,rt,ot,it=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};t.TRIGGERS=void 0,(t.TRIGGERS||(t.TRIGGERS={})).ON_CLICK="OnClick",t.CATEGORIES=void 0,(nt=t.CATEGORIES||(t.CATEGORIES={})).NATIVE="Native",nt.PENDO="Pendo",t.HANDLER_TYPES=void 0,(rt=t.HANDLER_TYPES||(t.HANDLER_TYPES={})).NAVIGATE="Navigate",rt.CHANGE_TUTORIAL="ChangeTutorial",rt.OPEN_GUIDE="OpenGuide",rt.DISMISSED_CARD="DismissedCard",t.COLORS=void 0,(ot=t.COLORS||(t.COLORS={})).PRIMARY="primary",ot.SECONDARY="primary",ot.WARNING="warning",ot.DANGER="danger",ot.NEUTRAL="neutral",ot.ACTIVE="active",ot.INFO="info";var at,ut=t.COLORS.PRIMARY;t.Mark=void 0,(at=t.Mark||(t.Mark={})).U="U",at.B="B",at.Em="Em",at.InlineCode="InlineCode";var ct,st,lt=function(t){return W(t)&&!!t.match(/^[0-9a-zA-Z]{40}$/)},dt=function(t){return q(t)},ft=function(t){return J(t)};t.CheckListItemStatus=void 0,(ct=t.CheckListItemStatus||(t.CheckListItemStatus={})).NotStared="NotStarted",ct.InProgress="InProgress",ct.Done="Done",t.CheckListScope=void 0,(st=t.CheckListScope||(t.CheckListScope={})).User="User",st.Account="Account";var pt,vt;t.FRAME_SIZES=void 0,(pt=t.FRAME_SIZES||(t.FRAME_SIZES={})).COLLAPSED="Collapsed",pt.EXPANDED="Expanded",pt.MINIMIZED="Minimized",t.PREVIEW_MODES=void 0,(vt=t.PREVIEW_MODES||(t.PREVIEW_MODES={})).TUTORIAL="Tutorial",vt.PORTAL="Portal";var ht,Et;t.StateScope=void 0,(ht=t.StateScope||(t.StateScope={})).Global="Global",ht.Carried="Carried",t.StateResolverType=void 0,(Et=t.StateResolverType||(t.StateResolverType={})).CanduCdn="CanduCdn",Et.CheckListApi="CheckListApi",Et.CardApi="CardApi";var _t,yt;t.StyleguideScope=void 0,(_t=t.StyleguideScope||(t.StyleguideScope={})).Global="Global",_t.Organization="Organization",t.CSSNodeTypes=void 0,(yt=t.CSSNodeTypes||(t.CSSNodeTypes={})).Root="root",yt.Rule="rule",yt.Atrule="atrule",yt.Decl="decl",yt.Any="any";var gt,Tt={button:{childClassNames:{icon:"button-icon"},variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},badge:{variants:{color:function(t){return"color-"+t},outline:function(t){return"outline-"+t}}},typography:{variants:{typography:function(t){return"typography-"+t}}}},bt=function(t){return"candu.sdk."+t},Ot=function(t){return bt("error."+t)},St={UNKOWN_NODE_TYPE:"unknown_node_type",UNKOWN_BLOCK_NODE_TYPE:"unkown_block_node_type",UNKOWN_INLINE_NODE_TYPE:"unkown_inline_node_type",UNKOWN_NODE_OBJECT_TYPE:"unkown_node_object_type",TUTORIAL_ERROR:"tutorial_error_boundary",PORTAL_ERROR:"portal_error_boundary",PROVIDER_ERROR:"provider_error_boundary",STYLEGUIDE_MAP_ERROR:"styleguide_map",RENDER_NODE_ERROR:"render_node"},At={HEARTBEAT:bt("heartbeat"),PREVIEW_OPEN:bt("preview.open"),PORTAL:bt("portal"),TUTORIAL:bt("tutorial"),TUTORIAL_INTERACTION:bt("tutorial.interaction"),PORTAL_ASSET_NOT_FOUND:Ot("portal_asset_not_found"),PORTAL_NO_SEGMENT_IDS:Ot("portal_no_segment_ids"),NO_MATCHING_TUTORIALS:Ot("no_matching_tutorials"),NO_VALID_TUTORIAL_IDENTIFIER:Ot("no_valid_tutorial_identifier"),COMMIT_API_LOADING_ERROR:Ot("commit_api"),TUTORIAL_LOADING_ERROR:Ot("tutorial"),UNKOWN_NODE_TYPE:Ot(St.UNKOWN_NODE_TYPE),UNKOWN_INLINE_NODE_TYPE:Ot(St.UNKOWN_INLINE_NODE_TYPE),UNKOWN_NODE_OBJECT_TYPE:Ot(St.UNKOWN_NODE_OBJECT_TYPE),TUTORIAL_ERROR:Ot(St.TUTORIAL_ERROR),PORTAL_ERROR:Ot(St.PORTAL_ERROR),PROVIDER_ERROR:Ot(St.PROVIDER_ERROR),STYLEGUIDE_MAP_ERROR:Ot(St.TUTORIAL_ERROR),RENDER_NODE_ERROR:Ot(St.TUTORIAL_ERROR),CIRCULAR_DEPENDENCY_EMBED_PORTAL:Ot("circular_dependecy_embed_portal"),CIRCULAR_DEPENDENCY_EMBED_TUTORIAL:Ot("circular_dependecy_embed_tutorial"),STATE_FETCH_FAILED:Ot("state_fetch_failed"),STATE_UPDATE_FAILED:Ot("state_update_failed"),SEGMENT_MEMBERSHIP_TIMEOUT:Ot("segment_membership_timeout"),CHECKLIST_ITEM_STATE_UPDATED:bt("tutorial.checklist_item_state_updated"),CHECKLIST_GROUP_COMPLETE:bt("tutorial.checklist_group_complete"),CARD_DISMISSED:bt("tutorial.card_dismissed")},It=function(t){return bt("metric."+t)},mt={SEGMENT_MEMBERSHIP_LOAD_TIME:It("segment_membership_load_time"),PORTAL_LOAD_TIME:It("portal_load_time"),CONTENT_LOAD_TIME:It("content_load_time"),TUTORIAL_LOAD_TIME:It("tutorial_load_time"),TUTORIAL_DOCUMENT_MOUNT_TIME:It("tutorial_document_mount_time")},Rt=function(t){return"An error has occured while trying to parse your Tutorial.\nUpgrade the SDK to the latest version to get rid of this error.\nErrorCode: "+t+"."},Ct=((gt={EVENTING_NOT_INITIALIZED:"You tried to send an event, but you haven't initialized eventing.\nThis is happening because you called eventing outside the scope of the CanduProvider. It can be fixed by:\n1. Adding CanduProvider to the root of the application.\n2. Initializing a new Eventing object outside of Candu.\nRead here for more context: http://udn.ac/tracking-not-init.\n"})[At.PORTAL_ASSET_NOT_FOUND]="Could not find the requested Portal. This could happen because:\n1. The Portal does not exist or it was deleted.\n2. The Portal has not been made avaliable to be rendered.\n3. CORS Authenticaton failed.\nSee http://udn.ac/portal-not-found for more information.\n",gt[At.PORTAL_NO_SEGMENT_IDS]="You have tried to render a Portal that doesn't contain any content.\nAdd content to your Portal: https://udn.ac/update-portals.\n",gt[At.NO_MATCHING_TUTORIALS]="The Tutorial will not be rendered because there are no matching segments for the given user.",gt[At.NO_VALID_TUTORIAL_IDENTIFIER]="(Candu/Tutorial) You must define one of tutorialId, slug, commitId or contentHashId.",gt[At.TUTORIAL_LOADING_ERROR]="An error has occurred while trying to load the Tutorial",gt[At.UNKOWN_INLINE_NODE_TYPE]=Rt(St.UNKOWN_INLINE_NODE_TYPE),gt[At.UNKOWN_NODE_TYPE]=Rt(St.UNKOWN_NODE_TYPE),gt[At.CIRCULAR_DEPENDENCY_EMBED_PORTAL]="Circular dependency found on Embeded Portal. Please take a look at the Portal Content.",gt[At.CIRCULAR_DEPENDENCY_EMBED_TUTORIAL]="Circular dependency found on Embeded Tutorial. Please take a look at the Tutorial Content.",gt[At.PORTAL_ERROR]="An error has occured within Portal",gt[At.PROVIDER_ERROR]="An error has occured within Provider",gt[At.TUTORIAL_ERROR]="An error has occured within Tutorial",gt[At.RENDER_NODE_ERROR]="An error has occured while rendering tutorial node",gt[At.STYLEGUIDE_MAP_ERROR]="An error has occured while mapping node to styleguide",gt[At.STATE_FETCH_FAILED]="An error has occured while fetching state:",gt[At.STATE_UPDATE_FAILED]="An error has occured while updating state:",gt[At.SEGMENT_MEMBERSHIP_TIMEOUT]="Segment membership fetch has timed out",gt),Nt={Alert:!0,B:!0,Badge:!0,Button:!0,Card:!0,Code:!0,Document:!0,Em:!0,EmbedPortal:!0,EmbedTutorial:!0,Flex:!0,FlexItem:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,Image:!0,InlineCode:!0,Link:!0,List:!0,ListItem:!0,P:!0,RichText:!0,Spacing:!0,Text:!0,U:!0,View:!0,Player:!0},Lt={error:console.error,warning:console.warn},Dt=function(t){return a.default(!t||it(t),"(Candu) styleguide must be undefined or an object")},Pt=function(t,e){return A(void 0,void 0,void 0,(function(){return I(this,(function(n){switch(n.label){case 0:return[4,fetch(t,e&&{headers:e})];case 1:return[2,n.sent().json()]}}))}))},wt=function(t){return Pt(""+l+t,{SDKVersion:s})},jt=function(t){return Pt(""+d+t,{SDKVersion:s})},Mt=function(t){return{byId:function(e){return wt(_+"?token="+t+"&finder=latestPublished&tutorialId="+e)},bySlug:function(e){return jt("/tutorials/"+t+"/"+e+".json")},byContentHash:function(e){return jt("/tutorials/"+t+"/"+e+".json")}}},kt={tutorialDocumentLatestSaved:function(t,e){return A(void 0,void 0,void 0,(function(){return I(this,(function(n){return[2,wt(_+"/"+e+"?token="+t)]}))}))},portalAsset:function(t,e,n){return A(void 0,void 0,void 0,(function(){var r,o;return I(this,(function(i){return(null===(o=n)||void 0===o?void 0:o.length)?(r="?segmentIds="+n.join(","),[2,jt("/portalMemberships/"+t+"/"+e+"/head.json"+r)]):[2,jt("/portals/"+t+"/"+e+"/head.json")]}))}))},contentDocument:function(t,e,n){return A(void 0,void 0,void 0,(function(){var r,o,i;return I(this,(function(a){switch(a.label){case 0:return r=(null===(i=n)||void 0===i?void 0:i.length)?"?segmentIds="+n.join(","):"",[4,fetch(d+"/contentDocument/"+t+"/"+e+".json"+r)];case 1:return[2,(o=a.sent()).ok?o.json():null]}}))}))},segmentMembership:function(t,e){return A(void 0,void 0,void 0,(function(){return I(this,(function(n){return[2,wt(v+"/"+e+"?token="+t)]}))}))},segmentDefinition:function(t){return A(void 0,void 0,void 0,(function(){return I(this,(function(e){return[2,wt(h+"?token="+t)]}))}))},tutorialMetadata:function(t){return A(void 0,void 0,void 0,(function(){return I(this,(function(e){return[2,wt(E+"?token="+t)]}))}))},tutorialDocument:function(t,e,n){var r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.slug,u=Mt(e);return ft(a)?u.bySlug(a):dt(o)?u.byId(o):lt(r)?u.byContentHash(r):it(i)?Promise.resolve(i):(Lt.error(Ct[At.NO_VALID_TUTORIAL_IDENTIFIER]),n.track(At.NO_VALID_TUTORIAL_IDENTIFIER,{slug:t.slug}),null)}},Ut=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.error.apply(console,t)},Gt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.warn.apply(console,t)},Ft={error:Ut,warning:Gt},xt=function(){function t(){this.subscribers=[]}return t.prototype.subscribe=function(t){var e=this;return this.subscribers.push(t),function(){e.subscribers[e.subscribers.indexOf(t)]=function(){}}},t.prototype.notify=function(t){this.subscribers.forEach((function(e){return e(t)}))},t.prototype.clear=function(){this.subscribers=[]},t}(),Vt=function(){function t(t,e){var n=this;this.state="waiting",this.currentElement=null,this.selector=t,this.renderToElement=e,this.findAndRender(),this.observer=new MutationObserver((function(t){switch(n.state){case"waiting":t.some((function(t){return!!t.addedNodes.length}))&&n.findAndRender();break;case"mounted":t.forEach((function(t){t.removedNodes.length&&t.removedNodes.forEach((function(t){t===n.currentElement&&(n.currentElement=null,n.state="waiting")}))}));break;default:throw new Error("Unhandled state: "+n.state)}})),this.observer.observe(document,{childList:!0,subtree:!0,attributes:!1,characterData:!1})}return t.prototype.findAndRender=function(){var t=document.querySelector(this.selector);t&&(this.renderToElement(t),this.currentElement=t,this.state="mounted")},t.prototype.stopObserving=function(){this.observer.disconnect()},t}(),Bt=function(){function t(){this.onClientUpdateObserver=new xt}return t.prototype.attachClient=function(t){this.client=t,this.onClientUpdateObserver.notify({client:t})},t.prototype.detachClient=function(){this.client&&(this.client=null,this.onClientUpdateObserver.notify({client:null}))},t.prototype.onClientUpdate=function(t){var e=this.onClientUpdateObserver.subscribe(t);return this.client&&t({client:this.client}),e},t}();var Ht="@candulabs/core",Wt="0.7.1-alpha.23",Yt=function(){function t(t){this.init(t)}return t.prototype.getInfo=function(){return{core:{version:Wt,name:Ht},sdk:{version:this.version,name:this.name}}},t.prototype.attachClient=function(t){return this.provider.preview.attachClient(t)},t.prototype.detachClient=function(){return this.provider.preview.detachClient()},Object.defineProperty(t.prototype,"provider",{get:function(){return this.getProvider()},enumerable:!0,configurable:!0}),t}(),zt=function(e){switch(e.trigger){case t.TRIGGERS.ON_CLICK:default:return"onClick"}},Kt=function(e,n){var r,o,i,a,u,c;if("Link"===e.type&&(null===(r=e.props)||void 0===r?void 0:r.href)){var s=e.props.href+" Link Clicked",l=null===(i=null===(o=e)||void 0===o?void 0:o.nodes)||void 0===i?void 0:i[0];if(l){var d=n.document.nodes[l];"Text"===(null===(a=d)||void 0===a?void 0:a.type)&&(null===(c=null===(u=d)||void 0===u?void 0:u.props)||void 0===c?void 0:c.children)&&(s=d.props.children+" Link Clicked")}return{onClick:function(){var r;return n.provider.eventing.track(At.TUTORIAL_INTERACTION,{trigger:t.TRIGGERS.ON_CLICK,category:e.type,eventName:s,handler:{href:null===(r=e.props)||void 0===r?void 0:r.href,type:t.HANDLER_TYPES.NAVIGATE}})}}}if(!e.data||!e.data.actions)return{};var f=function(t,e){n.provider.eventing.track(At.TUTORIAL_INTERACTION,O(O({},t),e||{}))};return e.data.actions.map((function(e){return function(e,n,r){var o,i,a;switch(e.handler.type){case t.HANDLER_TYPES.NAVIGATE:return(o={})[zt(e)]=function(t){t.stopPropagation();var o=e.handler,i=o.href,a=o.target,u=r||{},c=u.parentTrackers,s=S(u,["parentTrackers"]);c&&c.forEach((function(t){return n(e,t)})),n(e,s),"Blank"===a?window.open(i,"_blank"):i&&i.includes("mailto:")?window.location=i:document.location.href=i},o;case t.HANDLER_TYPES.CHANGE_TUTORIAL:return(i={})[zt(e)]=function(){var t=e.handler.tutorialId;Ut("TODO -> change tutorial",t)},i;case t.HANDLER_TYPES.OPEN_GUIDE:return(a={})[zt(e)]=function(){var t=e.handler.guideId;Ut("TODO -> open guide",t)},a;default:return{}}}(e,f,n.trackingIdentifiers)})).reduce((function(t,e){return O(O({},t),e)}),{})},$t=function(t,e){var n=t.props||{},r=t.nodes,o=n.children;return o||(r?r.map(e):null)},Jt=function(t,e){var n=t.states;return n&&e.stateProviderInstances.filter((function(t){return!!n[t.providerId]}))},qt=function(t,e){var n=t.nodes;return n&&n.map((function(t){return e.document.nodes[t]})).filter((function(t){return!!t})).map((function(t){return Jt(t,e)||[]})).reduce((function(t,e){return t.concat(e)}),[])},Zt=function(t,e){try{var n=e.provider,r=e.document,o=e.trackingIdentifiers,i=r.nodes[t];if(!i)return Ft.error("Document is corrupted. Refusing to move further."),null;var a=function(t){return Zt(t,e)},u=i.type,c=i.props,s=i.css,l=O(O(O({},c||{}),{style:s||{},children:$t(i,a)}),Kt(i,{trackingIdentifiers:o,provider:n,document:r})),d={nodeId:t,node:i,document:r,render:{node:a,styleguide:function(t,n){return void 0===n&&(n={}),e.renderNode(t,{api:d,attributes:n})},tutorial:function(t){return e.renderTutorial(t)},portal:function(t){return e.renderPortal(t)}},trackingIdentifiers:o,stateInstances:Jt(i,e),childrenStateInstances:qt(i,e)},f=d.render.styleguide(u,l);return f||(Ft.error(Ct[At.UNKOWN_NODE_TYPE],{type:u}),n.eventing.error(new Error(Ct[At.UNKOWN_NODE_TYPE]),{type:u}),null)}catch(t){return Ft.error(Ct[At.STYLEGUIDE_MAP_ERROR],t),e.provider.eventing.error(t),null}};var Xt,Qt=function(t){if(!it(t))return!1;var e=B(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},te=P["__core-js_shared__"],ee=(Xt=/[^.]+$/.exec(te&&te.keys&&te.keys.IE_PROTO||""))?"Symbol(src)_1."+Xt:"";var ne=function(t){return!!ee&&ee in t},re=Function.prototype.toString;var oe=function(t){if(null!=t){try{return re.call(t)}catch(t){}try{return t+""}catch(t){}}return""},ie=/^\[object .+?Constructor\]$/,ae=Function.prototype,ue=Object.prototype,ce=ae.toString,se=ue.hasOwnProperty,le=RegExp("^"+ce.call(se).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var de=function(t){return!(!it(t)||ne(t))&&(Qt(t)?le:ie).test(oe(t))};var fe=function(t,e){return null==t?void 0:t[e]};var pe=function(t,e){var n=fe(t,e);return de(n)?n:void 0},ve=pe(Object,"create");var he=function(){this.__data__=ve?ve(null):{},this.size=0};var Ee=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},_e=Object.prototype.hasOwnProperty;var ye=function(t){var e=this.__data__;if(ve){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return _e.call(e,t)?e[t]:void 0},ge=Object.prototype.hasOwnProperty;var Te=function(t){var e=this.__data__;return ve?void 0!==e[t]:ge.call(e,t)};var be=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ve&&void 0===e?"__lodash_hash_undefined__":e,this};function Oe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Oe.prototype.clear=he,Oe.prototype.delete=Ee,Oe.prototype.get=ye,Oe.prototype.has=Te,Oe.prototype.set=be;var Se=Oe;var Ae=function(){this.__data__=[],this.size=0};var Ie=function(t,e){return t===e||t!=t&&e!=e};var me=function(t,e){for(var n=t.length;n--;)if(Ie(t[n][0],e))return n;return-1},Re=Array.prototype.splice;var Ce=function(t){var e=this.__data__,n=me(e,t);return!(n<0)&&(n==e.length-1?e.pop():Re.call(e,n,1),--this.size,!0)};var Ne=function(t){var e=this.__data__,n=me(e,t);return n<0?void 0:e[n][1]};var Le=function(t){return me(this.__data__,t)>-1};var De=function(t,e){var n=this.__data__,r=me(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function Pe(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Pe.prototype.clear=Ae,Pe.prototype.delete=Ce,Pe.prototype.get=Ne,Pe.prototype.has=Le,Pe.prototype.set=De;var we=Pe,je=pe(P,"Map");var Me=function(){this.size=0,this.__data__={hash:new Se,map:new(je||we),string:new Se}};var ke=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Ue=function(t,e){var n=t.__data__;return ke(e)?n["string"==typeof e?"string":"hash"]:n.map};var Ge=function(t){var e=Ue(this,t).delete(t);return this.size-=e?1:0,e};var Fe=function(t){return Ue(this,t).get(t)};var xe=function(t){return Ue(this,t).has(t)};var Ve=function(t,e){var n=Ue(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Be(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Be.prototype.clear=Me,Be.prototype.delete=Ge,Be.prototype.get=Fe,Be.prototype.has=xe,Be.prototype.set=Ve;var He=Be;function We(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=t.apply(this,r);return n.cache=i.set(o,a)||i,a};return n.cache=new(We.Cache||He),n}We.Cache=He;var Ye=We,ze=Ye((function(t,e){var n,r,o=t.provider,i=t.portal,a=t.tutorial,u=o.styleguide;return a&&(r=a.styleguide),i&&(n=i.styleguide),O(O(O(O({},u||{}),n||{}),r||{}),e||{})})),Ke=function(t){return"candu-styleguide-"+t},$e=function(t,e){var n,r,o,i,a="string"==typeof e&&e.split(" ");return a?1===a.length?((n={})[t+"Right"]=e,n[t+"Left"]=e,n[t+"Bottom"]=e,n[t+"Top"]=e,n):2===a.length?((r={})[t+"Top"]=a[0],r[t+"Right"]=a[1],r[t+"Bottom"]=a[0],r[t+"Left"]=a[1],r):3===a.length?((o={})[t+"Top"]=a[0],o[t+"Right"]=a[1],o[t+"Bottom"]=a[2],o[t+"Left"]=a[1],o):((i={})[t+"Top"]=a[0],i[t+"Right"]=a[1],i[t+"Bottom"]=a[2],i[t+"Left"]=a[3],i):{}};var Je=function(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o};var qe=function(){this.__data__=new we,this.size=0};var Ze=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Xe=function(t){return this.__data__.get(t)};var Qe=function(t){return this.__data__.has(t)};var tn=function(t,e){var n=this.__data__;if(n instanceof we){var r=n.__data__;if(!je||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new He(r)}return n.set(t,e),this.size=n.size,this};function en(t){var e=this.__data__=new we(t);this.size=e.size}en.prototype.clear=qe,en.prototype.delete=Ze,en.prototype.get=Xe,en.prototype.has=Qe,en.prototype.set=tn;var nn=en;var rn=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var on=function(t){return this.__data__.has(t)};function an(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new He;++e<n;)this.add(t[e])}an.prototype.add=an.prototype.push=rn,an.prototype.has=on;var un=an;var cn=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1};var sn=function(t,e){return t.has(e)};var ln=function(t,e,n,r,o,i){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(t);if(s&&i.get(e))return s==e;var l=-1,d=!0,f=2&n?new un:void 0;for(i.set(t,e),i.set(e,t);++l<u;){var p=t[l],v=e[l];if(r)var h=a?r(v,p,l,e,t,i):r(p,v,l,t,e,i);if(void 0!==h){if(h)continue;d=!1;break}if(f){if(!cn(e,(function(t,e){if(!sn(f,e)&&(p===t||o(p,t,n,r,i)))return f.push(e)}))){d=!1;break}}else if(p!==v&&!o(p,v,n,r,i)){d=!1;break}}return i.delete(t),i.delete(e),d},dn=P.Uint8Array;var fn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n};var pn=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},vn=w?w.prototype:void 0,hn=vn?vn.valueOf:void 0;var En=function(t,e,n,r,o,i,a){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new dn(t),new dn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Ie(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=fn;case"[object Set]":var c=1&r;if(u||(u=pn),t.size!=e.size&&!c)return!1;var s=a.get(t);if(s)return s==e;r|=2,a.set(t,e);var l=ln(u(t),u(e),r,o,i,a);return a.delete(t),l;case"[object Symbol]":if(hn)return hn.call(t)==hn.call(e)}return!1};var _n=function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t};var yn=function(t,e,n){var r=e(t);return c(t)?r:_n(r,n(t))};var gn=function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var a=t[n];e(a,n,t)&&(i[o++]=a)}return i};var Tn=function(){return[]},bn=Object.prototype.propertyIsEnumerable,On=Object.getOwnPropertySymbols,Sn=On?function(t){return null==t?[]:(t=Object(t),gn(On(t),(function(e){return bn.call(t,e)})))}:Tn;var An=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r};var In=function(t){return H(t)&&"[object Arguments]"==B(t)},mn=Object.prototype,Rn=mn.hasOwnProperty,Cn=mn.propertyIsEnumerable,Nn=In(function(){return arguments}())?In:function(t){return H(t)&&Rn.call(t,"callee")&&!Cn.call(t,"callee")};var Ln=function(){return!1},Dn=N((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n?P.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ln;t.exports=i})),Pn=/^(?:0|[1-9]\d*)$/;var wn=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Pn.test(t))&&t>-1&&t%1==0&&t<e};var jn=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991},Mn={};Mn["[object Float32Array]"]=Mn["[object Float64Array]"]=Mn["[object Int8Array]"]=Mn["[object Int16Array]"]=Mn["[object Int32Array]"]=Mn["[object Uint8Array]"]=Mn["[object Uint8ClampedArray]"]=Mn["[object Uint16Array]"]=Mn["[object Uint32Array]"]=!0,Mn["[object Arguments]"]=Mn["[object Array]"]=Mn["[object ArrayBuffer]"]=Mn["[object Boolean]"]=Mn["[object DataView]"]=Mn["[object Date]"]=Mn["[object Error]"]=Mn["[object Function]"]=Mn["[object Map]"]=Mn["[object Number]"]=Mn["[object Object]"]=Mn["[object RegExp]"]=Mn["[object Set]"]=Mn["[object String]"]=Mn["[object WeakMap]"]=!1;var kn=function(t){return H(t)&&jn(t.length)&&!!Mn[B(t)]};var Un=function(t){return function(e){return t(e)}},Gn=N((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,o=r&&r.exports===n&&L.process,i=function(){try{var t=r&&r.require&&r.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),Fn=Gn&&Gn.isTypedArray,xn=Fn?Un(Fn):kn,Vn=Object.prototype.hasOwnProperty;var Bn=function(t,e){var n=c(t),r=!n&&Nn(t),o=!n&&!r&&Dn(t),i=!n&&!r&&!o&&xn(t),a=n||r||o||i,u=a?An(t.length,String):[],s=u.length;for(var l in t)!e&&!Vn.call(t,l)||a&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||wn(l,s))||u.push(l);return u},Hn=Object.prototype;var Wn=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Hn)};var Yn=function(t,e){return function(n){return t(e(n))}}(Object.keys,Object),zn=Object.prototype.hasOwnProperty;var Kn=function(t){if(!Wn(t))return Yn(t);var e=[];for(var n in Object(t))zn.call(t,n)&&"constructor"!=n&&e.push(n);return e};var $n=function(t){return null!=t&&jn(t.length)&&!Qt(t)};var Jn=function(t){return $n(t)?Bn(t):Kn(t)};var qn=function(t){return yn(t,Jn,Sn)},Zn=Object.prototype.hasOwnProperty;var Xn=function(t,e,n,r,o,i){var a=1&n,u=qn(t),c=u.length;if(c!=qn(e).length&&!a)return!1;for(var s=c;s--;){var l=u[s];if(!(a?l in e:Zn.call(e,l)))return!1}var d=i.get(t);if(d&&i.get(e))return d==e;var f=!0;i.set(t,e),i.set(e,t);for(var p=a;++s<c;){var v=t[l=u[s]],h=e[l];if(r)var E=a?r(h,v,l,e,t,i):r(v,h,l,t,e,i);if(!(void 0===E?v===h||o(v,h,n,r,i):E)){f=!1;break}p||(p="constructor"==l)}if(f&&!p){var _=t.constructor,y=e.constructor;_==y||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof y&&y instanceof y||(f=!1)}return i.delete(t),i.delete(e),f},Qn=pe(P,"DataView"),tr=pe(P,"Promise"),er=pe(P,"Set"),nr=pe(P,"WeakMap"),rr="[object Map]",or="[object Promise]",ir="[object Set]",ar="[object WeakMap]",ur="[object DataView]",cr=oe(Qn),sr=oe(je),lr=oe(tr),dr=oe(er),fr=oe(nr),pr=B;(Qn&&pr(new Qn(new ArrayBuffer(1)))!=ur||je&&pr(new je)!=rr||tr&&pr(tr.resolve())!=or||er&&pr(new er)!=ir||nr&&pr(new nr)!=ar)&&(pr=function(t){var e=B(t),n="[object Object]"==e?t.constructor:void 0,r=n?oe(n):"";if(r)switch(r){case cr:return ur;case sr:return rr;case lr:return or;case dr:return ir;case fr:return ar}return e});var vr=pr,hr="[object Arguments]",Er="[object Array]",_r="[object Object]",yr=Object.prototype.hasOwnProperty;var gr=function(t,e,n,r,o,i){var a=c(t),u=c(e),s=a?Er:vr(t),l=u?Er:vr(e),d=(s=s==hr?_r:s)==_r,f=(l=l==hr?_r:l)==_r,p=s==l;if(p&&Dn(t)){if(!Dn(e))return!1;a=!0,d=!1}if(p&&!d)return i||(i=new nn),a||xn(t)?ln(t,e,n,r,o,i):En(t,e,s,n,r,o,i);if(!(1&n)){var v=d&&yr.call(t,"__wrapped__"),h=f&&yr.call(e,"__wrapped__");if(v||h){var E=v?t.value():t,_=h?e.value():e;return i||(i=new nn),o(E,_,n,r,i)}}return!!p&&(i||(i=new nn),Xn(t,e,n,r,o,i))};var Tr=function t(e,n,r,o,i){return e===n||(null==e||null==n||!H(e)&&!H(n)?e!=e&&n!=n:gr(e,n,r,o,t,i))};var br=function(t,e,n,r){var o=n.length,i=o,a=!r;if(null==t)return!i;for(t=Object(t);o--;){var u=n[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var c=(u=n[o])[0],s=t[c],l=u[1];if(a&&u[2]){if(void 0===s&&!(c in t))return!1}else{var d=new nn;if(r)var f=r(s,l,c,t,e,d);if(!(void 0===f?Tr(l,s,3,r,d):f))return!1}}return!0};var Or=function(t){return t==t&&!it(t)};var Sr=function(t){for(var e=Jn(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Or(o)]}return e};var Ar=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}};var Ir=function(t){var e=Sr(t);return 1==e.length&&e[0][2]?Ar(e[0][0],e[0][1]):function(n){return n===t||br(n,t,e)}};var mr=function(t){return"symbol"==typeof t||H(t)&&"[object Symbol]"==B(t)},Rr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cr=/^\w*$/;var Nr=function(t,e){if(c(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!mr(t))||(Cr.test(t)||!Rr.test(t)||null!=e&&t in Object(e))};var Lr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dr=/\\(\\)?/g,Pr=function(t){var e=Ye(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Lr,(function(t,n,r,o){e.push(r?o.replace(Dr,"$1"):n||t)})),e})),wr=w?w.prototype:void 0,jr=wr?wr.toString:void 0;var Mr=function t(e){if("string"==typeof e)return e;if(c(e))return Je(e,t)+"";if(mr(e))return jr?jr.call(e):"";var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};var kr=function(t){return null==t?"":Mr(t)};var Ur=function(t,e){return c(t)?t:Nr(t,e)?[t]:Pr(kr(t))};var Gr=function(t){if("string"==typeof t||mr(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Fr=function(t,e){for(var n=0,r=(e=Ur(e,t)).length;null!=t&&n<r;)t=t[Gr(e[n++])];return n&&n==r?t:void 0};var xr=function(t,e,n){var r=null==t?void 0:Fr(t,e);return void 0===r?n:r};var Vr=function(t,e){return null!=t&&e in Object(t)};var Br=function(t,e,n){for(var r=-1,o=(e=Ur(e,t)).length,i=!1;++r<o;){var a=Gr(e[r]);if(!(i=null!=t&&n(t,a)))break;t=t[a]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&jn(o)&&wn(a,o)&&(c(t)||Nn(t))};var Hr=function(t,e){return null!=t&&Br(t,e,Vr)};var Wr=function(t,e){return Nr(t)&&Or(e)?Ar(Gr(t),e):function(n){var r=xr(n,t);return void 0===r&&r===e?Hr(n,t):Tr(e,r,3)}};var Yr=function(t){return t};var zr=function(t){return function(e){return null==e?void 0:e[t]}};var Kr=function(t){return function(e){return Fr(e,t)}};var $r=function(t){return Nr(t)?zr(Gr(t)):Kr(t)};var Jr=function(t){return"function"==typeof t?t:null==t?Yr:"object"==typeof t?c(t)?Wr(t[0],t[1]):Ir(t):$r(t)};var qr=function(t){return function(e,n,r){for(var o=-1,i=Object(e),a=r(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===n(i[c],c,i))break}return e}}();var Zr=function(t,e){return function(n,r){if(null==n)return n;if(!$n(n))return t(n,r);for(var o=n.length,i=e?o:-1,a=Object(n);(e?i--:++i<o)&&!1!==r(a[i],i,a););return n}}((function(t,e){return t&&qr(t,e,Jn)}));var Xr=function(t,e){var n=-1,r=$n(t)?Array(t.length):[];return Zr(t,(function(t,o,i){r[++n]=e(t,o,i)})),r};var Qr=function(t,e){return(c(t)?Je:Xr)(t,Jr(e))},to=function(){function t(t,e,n){var r=this;this.observer=new xt,this.context=t,this.providerId=e,this.resolver=n,this.state=this.resolver.cache.load(this.providerId),this.resolver.retrieve(t,e).then((function(t){return r.updateState(t)})).catch((function(t){Ft.error(Ct[At.STATE_FETCH_FAILED],t.message),r.context.eventing.track(Ct[At.STATE_FETCH_FAILED],{errorMessage:t.message})}))}return t.prototype.mutate=function(t){var e=this,n=this.state;this.updateState(O(O({},n),t)),this.resolver.update(this.context,this.providerId,t).then((function(t){return e.updateState(t)})).catch((function(t){Ft.error(Ct[At.STATE_UPDATE_FAILED],t.message),e.context.eventing.track(Ct[At.STATE_UPDATE_FAILED],{errorMessage:t.message}),n&&e.updateState(n)}))},t.prototype.subscribe=function(t){var e=this.observer.subscribe(t);return this.state&&t(this.state),e},t.prototype.getResolvedState=function(){return this.state},t.prototype.updateState=function(t){this.state=t,this.resolver.cache.save(this.providerId,t),this.observer.notify(t)},t}(),eo=function(){function t(t){void 0===t&&(t="candu-state:"),this.prefix=t}return t.prototype.save=function(t,e){try{window.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(t){}},t.prototype.load=function(t){try{var e=window.localStorage.getItem(this.prefix+t);return e&&JSON.parse(e)}catch(t){return null}},t}(),no=Object.create(null),ro=function(){function t(t){this.cache=new eo,this.options=O({},t||{})}return t.register=function(t,e){no[t]=e,e.prototype.type=t},t.fromJSON=function(t){var e=t.type,n=S(t,["type"]),r=no[e];return r?new r(n):null},t.prototype.toJSON=function(){return O({type:this.type},this.options)},t}();var oo=function(t,e,n,r){for(var o=t.length,i=n+(r?1:-1);r?i--:++i<o;)if(e(t[i],i,t))return i;return-1};var io=function(t){return t!=t};var ao=function(t,e,n){for(var r=n-1,o=t.length;++r<o;)if(t[r]===e)return r;return-1};var uo=function(t,e,n){return e==e?ao(t,e,n):oo(t,io,n)};var co=function(t,e){return!!(null==t?0:t.length)&&uo(t,e,0)>-1};var so=function(t,e,n){for(var r=-1,o=null==t?0:t.length;++r<o;)if(n(e,t[r]))return!0;return!1};var lo=function(){},fo=er&&1/pn(new er([,-0]))[1]==1/0?function(t){return new er(t)}:lo;var po=function(t,e,n){var r=-1,o=co,i=t.length,a=!0,u=[],c=u;if(n)a=!1,o=so;else if(i>=200){var s=e?null:fo(t);if(s)return pn(s);a=!1,o=sn,c=new un}else c=e?[]:u;t:for(;++r<i;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var f=c.length;f--;)if(c[f]===d)continue t;e&&c.push(d),u.push(l)}else o(c,d,n)||(c!==u&&c.push(d),u.push(l))}return u};var vo=function(t){return t&&t.length?po(t):[]},ho=function(){function t(){}return t.get=function(e,n){var r=t.loaders.get(e);if(r)return r;var o=new u.default(n,{cache:!1});return t.loaders.set(e,o),o},t.loaders=new Map,t}(),Eo=l+p,_o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b(e,t),e.prototype.retrieve=function(t,e){return A(this,void 0,void 0,(function(){var n,r,o=this;return I(this,(function(i){switch(i.label){case 0:return[4,ho.get("cardStateApi",(function(e){return A(o,void 0,void 0,(function(){var n;return I(this,(function(r){switch(r.label){case 0:return[4,fetch(Eo+"?token="+t.clientToken+"&finder=byIds&ids="+vo(e).join(",")+"&userId="+t.userId).then((function(t){return t.json()}))];case 1:return n=r.sent(),[2,e.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(e)];case 1:return n=i.sent(),r={id:e,state:{dismissed:!1}},[2,n||r]}}))}))},e.prototype.update=function(t,e,n){return fetch(Eo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({state:n.state,userId:t.userId.toString()})}).then((function(t){return t.json()}))},e}(ro);ro.register(t.StateResolverType.CardApi,_o);var yo=l+f;function go(t){return{state:t.state,id:t.id}}function To(e){switch(e){case t.CheckListScope.Account:return"AccountId";case t.CheckListScope.User:default:return"UserId"}}var bo=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return b(n,e),n.prototype.getScopeAndFieldFromContext=function(e){var n=this.options.scopeTrait,r=this.options.scope||t.CheckListScope.User,o=e.userId.toString();return r===t.CheckListScope.Account&&(n&&e.traits[n]?o=e.traits[n]:(Gt("trait '"+n+"' is not defined, falling back to user scope"),r=t.CheckListScope.User)),{scope:r,scopeField:o}},n.prototype.retrieve=function(e,n){return A(this,void 0,void 0,(function(){var r,o,i,a=this;return I(this,(function(u){switch(u.label){case 0:return r=this.getScopeAndFieldFromContext(e),o=r.scope,i=r.scopeField,[4,ho.get("checklistState",(function(t){return A(a,void 0,void 0,(function(){var n;return I(this,(function(r){switch(r.label){case 0:return[4,fetch(yo+"?token="+e.clientToken+"&byTrait="+To(o)+"&field="+i+"&finder=byIds&ids="+vo(t).join(",")).then((function(t){return t.json()})).then((function(t){return t.map(go)}))];case 1:return n=r.sent(),[2,t.map((function(t){return n.find((function(e){return e.id===t}))}))]}}))}))})).load(n)];case 1:return[2,u.sent()||{id:n,state:t.CheckListItemStatus.NotStared}]}}))}))},n.prototype.update=function(t,e,n){var r=this.getScopeAndFieldFromContext(t),o=r.scope,i=r.scopeField;return fetch(yo+"/"+e+"?token="+t.clientToken,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(O(O({},n),{byTrait:To(o),field:i}))}).then((function(t){return t.json()})).then(go)},n}(ro);ro.register(t.StateResolverType.CheckListApi,bo);t.CANDU_PORTAL_CLASS="candu_portal",t.CardResolverInstance=_o,t.CheckListResolverInstance=bo,t.DEFAULT_ALERT_COLOR="#EDEDED",t.DEFAULT_ALT="",t.DEFAULT_COLOR=ut,t.DEFAULT_SEGMENT_ID=R,t.DEFAULT_TAB_ACTIVE_COLOR="#FEFEFE",t.DEFAULT_TAB_COLOR="#FEFEFE",t.DEFAULT_TAB_HEADER_COLOR="#333745",t.DEFAULT_TAB_ITEM_COLOR="#838792",t.ERROR_MESSAGES=Ct,t.ERROR_SLUGS=St,t.EVENT_NAMES=At,t.IsNumericId=q,t.LOGGER=Lt,t.METRICS=mt,t.NodeManager=Vt,t.Observer=xt,t.PREVIEW_COOKIE_NAME="candu.preview",t.PREVIEW_FRAME_ID="canduPreview",t.PREVIEW_SCRIPT_URL="https://app.candu.ai/preview.html",t.PREVIEW_URL_PARAM="candu_preview",t.PreviewContainer=Bt,t.RESOURCES=kt,t.STYLEGUIDE_COLORS={primary:"#6310E5",secondary:"#59C3C3",tertiary:"#4D515D",warning:"#FCAD0D",danger:"#EE4266"},t.SingletonAPI=Yt,t.StateProviderInstance=to,t.StateResolverInstance=ro,t.TutorialDependencies=g,t.attachStylesheet=function(t,e){void 0===e&&(e="main");var n=Ke(t);if(!document.getElementById(n)){var r=document.createElement("link");r.setAttribute("id",n),r.setAttribute("rel","stylesheet"),r.setAttribute("href",d+"/styleguides/applications/"+t+"/default/"+e+".css"),document.head.appendChild(r)}},t.calculateGroupCompletion=function(e,n){var r=Object.values(e).filter((function(e){return e.status===t.CheckListItemStatus.Done})).length;return{completedItems:r,percComplete:n?Math.round(100*r/n):0}},t.canduPortalId=function(t){return"candu_portal_"+t},t.checkCyclicAndAdd=function(t,e){return t.dependencies.add(t.id,e)},t.createSingleton=function(t){var e,n,r=function(t){return function(){for(var e,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];if(n.api)return(e=n.api)[t].apply(e,r);console.warn("Please initialize the SDK by calling Candu.init() before attempting to call "+t)}};return(e=function(){function e(){}return e.init=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this.api||(e.api=new(t.bind.apply(t,m([void 0],n)))),e.subscriberCallbacks.forEach((function(t){return t()})),e.subscriberCallbacks=[],window.postMessage({source:"CANDU_SINGLETON",payload:{type:"INIT"}},window&&window.origin?window.origin:"*"),e},e.onProviderReady=function(t){if(e.api)return t();e.subscriberCallbacks.push(t)},e}()).subscriberCallbacks=[],e.renderTutorial=r("renderTutorial"),e.renderPortal=r("renderPortal"),e.renderContent=r("renderContent"),e.attachClient=r("attachClient"),e.detachClient=r("detachClient"),e.getProvider=r("getProvider"),e.getInfo=r("getInfo"),n=e,window.Candu=n,n},t.createTutorialDocumentContext=function(t,e){return{id:t,dependencies:e?e.dependencies:new g(t)}},t.cssInputObjToString=function(t){return Object.keys(t).reduce((function(e,n){return""+e+n+": "+t[n]+";"}),"")},t.cssInputStringToObj=function(t){return t.split(";").reduce((function(t,e){var n,r=e.split(":"),o=r[0],i=r[1];return o&&i?O(O({},t),((n={})[o.trim()]=i.trim(),n)):t}),{})},t.defaultStyleguide=Nt,t.detachStylesheet=function(t){var e=document.getElementById(Ke(t));e&&e.remove()},t.fetchFromApi=wt,t.fetchFromCdn=jt,t.fetchHead=function(t,e){t&&c(t)&&(!function(t,e){var n="candu-stylesheet-"+t;if(!document.getElementById(n)){var r=document.createElement("style");r.setAttribute("id",n),r.setAttribute("type","text/css"),r.appendChild(document.createTextNode(e)),document.head.append(r)}}("document",".candu-document * {\n box-sizing: border-box;\n }\n "),t.map((function(t){var n=t.nodeType,r=t.url;return y("EmbedTutorial"===n?d+"/tutorials/"+e+"/"+r+".json":"EmbedPortal"===n?d+"/portals/"+e+"/"+r+"/head.json":r)})))},t.fetchURL=Pt,t.findMatchingSegment=function(t,e){var n=e.reduce((function(t,e){var n;return O(O({},t),((n={})[e]=e,n))}),{});if(c(t.content))return t.content.find((function(t){var e=t.segmentId;return!!n[e]||e===R}))},t.getCheckListStateProviders=function(t){return t.filter((function(t){return t.resolver instanceof bo}))},t.getContentState=function(t){return t.lastModifiedAt===t.lastPublishedAt?"Published":t.lastPublishedAt?"Unsynced":"Draft"},t.getFirstNotStartedItem=function(e,n){for(var r=Object.values(e),o=function(e){var n=r.find((function(t){return t.position===e}));if(!n||n.status===t.CheckListItemStatus.NotStared)return{value:e}},i=0;i<n;i+=1){var a=o(i);if("object"==typeof a)return a.value}},t.getInitialItems=function(t){var e={};return t.forEach((function(t,n){var r=t.getResolvedState();r&&(e[r.id]={status:r.state,position:n})})),e},t.getTutorialDocument=Mt,t.includeHTMLWhitespaces=function(t){return t.replace(/\s/g,"&nbsp;")},t.initStateProviders=function(t,e){return Qr(t,(function(t,n){var r=ro.fromJSON(t.resolver);return r?new to(e,n,r):null})).filter((function(t){return!!t}))},t.internalEventing=function(t){var e=t.identify,n=t.track;return{provider:function(t){var r=t.userId,o=t.traits,i=t.styleguide;e(r,o),n(At.HEARTBEAT,function(t){var e={};return Object.keys(t).forEach((function(n){Nt[n]&&(e["styleguide."+n]=t[n].displayName||!0)})),e}(i))},tutorialDocumentLoadingError:function(t){var e=t.tutorialId,r=t.slug,o=t.contentHashId;Lt.error(Ct[At.TUTORIAL_LOADING_ERROR]),n(At.TUTORIAL_LOADING_ERROR,{tutorialId:e,slug:r,contentHashId:o})}}},t.isApiError=function(t){return it(t)&&W(t.errorCode)},t.isClientToken=Z,t.isContentHashId=lt,t.isIdentifier=J,t.isPortalId=function(t){return q(t)},t.isPortalSlug=function(t){return J(t)},t.isStatePath=function(t){return W(t)&&!!t.match(/^@(\w|\d|_|-|\.){3,20}\$/)},t.isTutorialId=dt,t.isTutorialSlug=ft,t.isUserId=X,t.logError=Ut,t.logWarning=Gt,t.logger=Ft,t.mapNodeToStyleguide=Zt,t.mergeStyleguidesFromContext=ze,t.messageFactory=et,t.messages=tt,t.portalValidation=function(t){var e=t.slug,n=t.styleguide;return Dt(n),{slug:e,styleguide:n||{}}},t.providerValidation=function(t){var n=t.clientToken,r=t.userId,o=t.traits,i=t.options,u=t.styleguide,c=S(t,["clientToken","userId","traits","options","styleguide"]);return a.default(Z(n),"(Candu) you must provide a valid clientToken"),a.default(!r||X(r),"(Candu) you must provide a valid userId"),Dt(u),a.default(!o||it(o),"(Candu) traits must be undefined or an object"),a.default(!i||it(i),"(Candu) options must be undefined or an object"),O(O({},c),{clientToken:n,traits:o||{},options:i||{},styleguide:u||{},userId:r||e.getAnonymousId()})},t.stripHTML=function(t){return DOMParser?(new DOMParser).parseFromString(t,"text/html").body.textContent||"":t},t.stylguideClassNameMap=Tt,t.toCssSelector=function(t,e){var n=O({className:"root",variant:void 0,selector:"",output:"css"},e||{}),r=n.className,o=n.variant,i=n.selector,a=n.output,u="candu-"+t;if("global"===r)return"html"===a?"":":root";var c=null,s=[],l=Tt[t]||{};if(o&&l.variants){var d=l.variants;s=Object.keys(o).reduce((function(t,e){var n=o[e],r=d[e];return t.push(r?r(n):e+"-"+n),t}),[])}return"root"!==r&&l.childClassNames&&l.childClassNames[r]&&(c="candu-"+t+"--"+l.childClassNames[r]),"css"===a?[u,c,i].reduce((function(t,e,n){return e&&""!==e?0===n?"."+u+s.map((function(t){return"."+t})).join(""):1===n?t+" ."+e:""+t+e:t}),"")||"":"root"===r?m([u],s).filter((function(t){return!!t})).join(" ")||"":c||""},t.toStyleguideDecl=function(e){return Object.keys(e).reduce((function(n,r){return m(n,[{type:t.CSSNodeTypes.Decl,prop:r,value:e[r]}])}),[])},t.tutorialValidation=function(t){var e=t.slug,n=t.styleguide,r=t.contentHashId,o=t.tutorialId,i=t.tutorialDocument,a=t.renderedByClient,u=S(t,["slug","styleguide","contentHashId","tutorialId","tutorialDocument","renderedByClient"]);return Dt(n),O(O({},u),{slug:e,styleguide:n||{},contentHashId:r,tutorialId:o,tutorialDocument:i,renderedByClient:a})},t.unpackShorthandStyles=function(t){var e=t.padding,n=t.margin,r=S(t,["padding","margin"]),o={};return e&&(o=O(O({},o),$e("padding",e))),n&&(o=O(O({},o),$e("margin",n))),O(O({},o),r)},t.windowStream=function(t){var e=t.source,n=t.destination,r=t.targetOrigin,o=t.targetWindow,i=t.originWindow,a=t.onRecieveMessage,u=et({source:e,destination:n}),c=u.read,s=u.write,l=function(t){var e=c(t.data);e&&a(e)};return i.addEventListener("message",l,!1),{close:function(){i.removeEventListener("message",l)},send:function(t){o.postMessage(s(t),r)}}},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map

@@ -12,3 +12,3 @@ {

},
"version": "0.7.1-alpha.22",
"version": "0.7.1-alpha.23",
"main": "dist/index.js",

@@ -28,7 +28,7 @@ "module": "dist/index.es.js",

"dependencies": {
"@candulabs/eventing": "^0.7.1-alpha.22",
"@candulabs/eventing": "^0.7.1-alpha.23",
"dataloader": "^2.0.0",
"setimmediate": "^1.0.5"
},
"gitHead": "b5e4d2386bf7082094ed14269e48de9877bf4882"
"gitHead": "3b1ed63bbca2c198d4ed780de9603cbd8212c845"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc