@census-ai/census-sdk 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,57 @@
1
- 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var kt="https://api.census.ai",ze=class{constructor(e){this.currentUserId=null;if(!e.apiKey)throw new Error("Census: apiKey is required");["cs_live_","cs_test_","op_live_","op_test_"].some(r=>e.apiKey.startsWith(r))||console.warn('Census: API key should start with "cs_live_" or "cs_test_"'),this.apiKey=e.apiKey,this.baseUrl=e.baseUrl||kt,this.debug=e.debug||false,this.log("Initialized with base URL:",this.baseUrl);}async identify(e){if(!e.userId)throw new Error("Census: userId is required for identify()");this.currentUserId=e.userId,await this.request("/api/sdk/identify","POST",{userId:e.userId,email:e.email,name:e.name,avatarUrl:e.avatarUrl,metadata:e.metadata,organizationId:e.organizationId,organizationName:e.organizationName,organizationDomain:e.organizationDomain,organizationPlan:e.organizationPlan}),this.log("User identified:",e.userId);}reset(){this.currentUserId=null,this.log("User identity reset");}async submitFeedback(e){let t=["feedback","bug_report","feature_request","article_rating"];if(!e.type||!t.includes(e.type))throw new Error(`Census: type must be one of: ${t.join(", ")}`);if(e.type==="article_rating"){if(e.rating===void 0&&e.helpful===void 0)throw new Error("Census: article_rating requires rating or helpful field")}else if(!e.message)throw new Error("Census: message is required for this feedback type");let r=await this.request("/api/sdk/feedback","POST",{type:e.type,message:e.message,rating:e.rating,helpful:e.helpful,userId:this.currentUserId,articleId:e.articleId,pageUrl:typeof window<"u"?window.location.href:void 0,metadata:e.metadata});return this.log("Feedback submitted:",r.feedbackId),{feedbackId:r.feedbackId}}async getArticles(e){let t=new URLSearchParams;e?.category&&t.set("category",e.category),e?.search&&t.set("search",e.search),e?.limit&&t.set("limit",String(e.limit)),e?.offset&&t.set("offset",String(e.offset));let r=t.toString(),i=`/api/sdk/articles${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched articles:",n.articles.length),n}async getArticle(e){try{let t=await this.request(`/api/sdk/articles/${encodeURIComponent(e)}`,"GET");return this.log("Fetched article:",e),t.article}catch(t){if(t.status===404)return null;throw t}}async getFeatureGroups(){let e=await this.request("/api/sdk/feature-groups","GET");return this.log("Fetched feature groups:",e.feature_groups.length),e}async getRequests(e){if(!this.currentUserId)throw new Error("Census: User must be identified before fetching requests. Call identify() first.");let t=new URLSearchParams;t.set("userId",this.currentUserId),e?.status&&t.set("status",e.status),e?.type&&t.set("type",e.type),e?.limit&&t.set("limit",String(e.limit)),e?.offset&&t.set("offset",String(e.offset));let r=await this.request(`/api/sdk/requests?${t.toString()}`,"GET");return this.log("Fetched requests:",r.requests.length),r}async track(e,t){if(!e)throw new Error("Census: eventType is required for track()");await this.request("/api/sdk/events","POST",{eventType:e,userId:this.currentUserId,properties:t}),this.log("Event tracked:",e);}async trackBatch(e){if(!e.events||e.events.length===0)throw new Error("Census: at least one event is required");if(e.events.length>100)throw new Error("Census: maximum 100 events per batch");let t=e.events.map(r=>({eventType:r.eventType,userId:this.currentUserId,articleId:r.articleId,featureId:r.featureId,properties:r.properties}));await this.request("/api/sdk/events","POST",{events:t}),this.log("Batch events tracked:",e.events.length);}async getGuides(e){let t=new URLSearchParams;e?.projectId&&t.set("project_id",e.projectId),e?.url&&t.set("url",e.url),e?.userId&&t.set("user_id",e.userId);let r=t.toString(),i=`/api/sdk/guides${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched guides:",n.guides.length),n}async getGuide(e){try{let t=await this.request(`/api/sdk/guides/${encodeURIComponent(e)}`,"GET");return this.log("Fetched guide:",e),t.guide}catch(t){if(t.status===404)return null;throw t}}async createGuide(e){if(!e.name||!e.slug)throw new Error("Census: name and slug are required for createGuide()");let t=await this.request("/api/sdk/guides","POST",{name:e.name,slug:e.slug,description:e.description,project_id:e.projectId,trigger_type:e.triggerType||"manual",trigger_config:e.triggerConfig||{},theme:e.theme||{},allow_skip:e.allowSkip??true,show_progress:e.showProgress??true});return this.log("Guide created:",t.guide.id),t.guide}async updateGuide(e,t){if(!e)throw new Error("Census: guideId is required for updateGuide()");let r={};t.name!==void 0&&(r.name=t.name),t.slug!==void 0&&(r.slug=t.slug),t.description!==void 0&&(r.description=t.description),t.triggerType!==void 0&&(r.trigger_type=t.triggerType),t.triggerConfig!==void 0&&(r.trigger_config=t.triggerConfig),t.theme!==void 0&&(r.theme=t.theme),t.allowSkip!==void 0&&(r.allow_skip=t.allowSkip),t.showProgress!==void 0&&(r.show_progress=t.showProgress),t.status!==void 0&&(r.status=t.status);let i=await this.request(`/api/sdk/guides/${encodeURIComponent(e)}`,"PUT",r);return this.log("Guide updated:",e),i.guide}async deleteGuide(e){if(!e)throw new Error("Census: guideId is required for deleteGuide()");await this.request(`/api/sdk/guides/${encodeURIComponent(e)}`,"DELETE"),this.log("Guide deleted:",e);}async getGuideSteps(e){let t=await this.request(`/api/sdk/guides/${encodeURIComponent(e)}/steps`,"GET");return this.log("Fetched steps for guide:",e),t.steps}async addGuideStep(e,t){if(!e)throw new Error("Census: guideId is required for addGuideStep()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(e)}/steps`,"POST",{step_type:t.stepType||"tooltip",sort_order:t.sortOrder,selector_strategy:t.selectorStrategy||{},title:t.title,content:t.content,tooltip_position:t.tooltipPosition||"auto",rich_content:t.richContent||{},display_config:t.displayConfig||{},advance_config:t.advanceConfig||{trigger:"button"},style_config:t.styleConfig||{}});return this.log("Step added to guide:",e),r.step}async updateGuideStep(e,t,r){if(!e||!t)throw new Error("Census: guideId and stepId are required for updateGuideStep()");let i={};r.stepType!==void 0&&(i.step_type=r.stepType),r.sortOrder!==void 0&&(i.sort_order=r.sortOrder),r.selectorStrategy!==void 0&&(i.selector_strategy=r.selectorStrategy),r.title!==void 0&&(i.title=r.title),r.content!==void 0&&(i.content=r.content),r.tooltipPosition!==void 0&&(i.tooltip_position=r.tooltipPosition),r.richContent!==void 0&&(i.rich_content=r.richContent),r.displayConfig!==void 0&&(i.display_config=r.displayConfig),r.advanceConfig!==void 0&&(i.advance_config=r.advanceConfig),r.styleConfig!==void 0&&(i.style_config=r.styleConfig);let n=await this.request(`/api/sdk/guides/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}`,"PUT",i);return this.log("Step updated:",t),n.step}async deleteGuideStep(e,t){if(!e||!t)throw new Error("Census: guideId and stepId are required for deleteGuideStep()");await this.request(`/api/sdk/guides/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}`,"DELETE"),this.log("Step deleted:",t);}async reorderGuideSteps(e,t){if(!e)throw new Error("Census: guideId is required for reorderGuideSteps()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(e)}/steps`,"PUT",{steps:t});return this.log("Steps reordered for guide:",e),r.steps}async trackGuideEvent(e){if(!e.guideId||!e.eventType||!e.sessionId)throw new Error("Census: guideId, eventType, and sessionId are required for trackGuideEvent()");await this.request("/api/sdk/guides/events","POST",{guideId:e.guideId,eventType:e.eventType,stepId:e.stepId,stepIndex:e.stepIndex,pageUrl:e.pageUrl||(typeof window<"u"?window.location.href:void 0),sessionId:e.sessionId,userId:e.userId||this.currentUserId,metadata:e.metadata}),this.log("Guide event tracked:",e.eventType,e.guideId);}async markGuideCompleted(e){if(!e)throw new Error("Census: guideId is required for markGuideCompleted()");if(!this.currentUserId)throw new Error("Census: User must be identified before marking guides complete. Call identify() first.");await this.request("/api/sdk/guides/complete","POST",{guideId:e,userId:this.currentUserId}),this.log("Guide marked completed:",e);}getCurrentUserId(){return this.currentUserId}isIdentified(){return this.currentUserId!==null}async request(e,t,r){let i=`${this.baseUrl}${e}`,n={"X-Census-Key":this.apiKey};r&&(n["Content-Type"]="application/json"),this.log(`${t} ${e}`,r);let s=await fetch(i,{method:t,headers:n,body:r?JSON.stringify(r):void 0});if(!s.ok){let p=`Request failed with status ${s.status}`;try{p=(await s.json()).error||p;}catch{}throw {error:p,status:s.status}}return s.json()}log(...e){this.debug&&console.log("[Census]",...e);}};function Ye(o){return new ze(o)}var Ae=react.createContext(null);function Pt({apiKey:o,baseUrl:e,debug:t,user:r,theme:i={},children:n}){let[s,p]=react.useState(false),[a,l]=react.useState(false),d=react.useMemo(()=>Ye({apiKey:o,baseUrl:e,debug:t}),[o,e,t]);react.useEffect(()=>{r?d.identify(r).then(()=>{l(true),p(true);}).catch(f=>{console.error("[Census] Failed to identify user:",f),p(true);}):p(true);},[d,r]);let c=react.useMemo(()=>({client:d,theme:i,isReady:s,isIdentified:a}),[d,i,s,a]);return jsxRuntime.jsx(Ae.Provider,{value:c,children:n})}function Et(){let o=react.useContext(Ae);if(!o)throw new Error("useCensus must be used within a CensusProvider");return o.client}function O(){let o=react.useContext(Ae);if(!o)throw new Error("useCensusContext must be used within a CensusProvider");return o}function _t(){let{client:o}=O(),[e,t]=react.useState(false),[r,i]=react.useState(null);return {identify:async p=>{t(true),i(null);try{await o.identify(p);}catch(a){throw i(a instanceof Error?a:new Error("Failed to identify user")),a}finally{t(false);}},reset:()=>{o.reset();},isIdentifying:e,isIdentified:o.isIdentified(),error:r}}function Le(){let{client:o}=O(),[e,t]=react.useState(false),[r,i]=react.useState(false),[n,s]=react.useState(null),[p,a]=react.useState(null),l=react.useCallback(async c=>{t(true),i(false),s(null),a(null);try{let f=await o.submitFeedback(c);return a(f.feedbackId),i(!0),f}catch(f){let g=f instanceof Error?f:new Error("Failed to submit feedback");throw s(g),g}finally{t(false);}},[o]),d=react.useCallback(()=>{i(false),s(null),a(null);},[]);return {submitFeedback:l,reset:d,isSubmitting:e,isSuccess:r,error:n,feedbackId:p}}function ue(o){let{client:e,isReady:t}=O(),[r,i]=react.useState(null),[n,s]=react.useState(true),[p,a]=react.useState(null),l=react.useCallback(async()=>{s(true),a(null);try{let d=await e.getArticles(o);i(d);}catch(d){a(d instanceof Error?d:new Error("Failed to fetch articles"));}finally{s(false);}},[e,o?.category,o?.search,o?.limit,o?.offset]);return react.useEffect(()=>{t&&l();},[t,l]),{articles:r?.articles||[],pagination:r?.pagination,isLoading:n,error:p,refetch:l}}function fe(o){let{client:e,isReady:t}=O(),[r,i]=react.useState(null),[n,s]=react.useState(true),[p,a]=react.useState(null),l=react.useCallback(async()=>{if(!o){i(null),s(false);return}s(true),a(null);try{let d=await e.getArticle(o);i(d);}catch(d){a(d instanceof Error?d:new Error("Failed to fetch article"));}finally{s(false);}},[e,o]);return react.useEffect(()=>{t&&l();},[t,l]),{article:r,isLoading:n,error:p,refetch:l}}function qe(){let{client:o,isReady:e}=O(),[t,r]=react.useState([]),[i,n]=react.useState(true),[s,p]=react.useState(null),a=react.useCallback(async()=>{n(true),p(null);try{let l=await o.getFeatureGroups();r(l.feature_groups);}catch(l){p(l instanceof Error?l:new Error("Failed to fetch feature groups"));}finally{n(false);}},[o]);return react.useEffect(()=>{e&&a();},[e,a]),{featureGroups:t,isLoading:i,error:s,refetch:a}}function ne(o){let{client:e,isReady:t,isIdentified:r}=O(),[i,n]=react.useState(null),[s,p]=react.useState(true),[a,l]=react.useState(null),d=react.useCallback(async()=>{if(!r){n(null),p(false);return}p(true),l(null);try{let c=await e.getRequests(o);n(c);}catch(c){l(c instanceof Error?c:new Error("Failed to fetch requests"));}finally{p(false);}},[e,r,o?.status,o?.type,o?.limit,o?.offset]);return react.useEffect(()=>{t&&r&&d();},[t,r,d]),{requests:i?.requests||[],pagination:i?.pagination,isLoading:s,error:a,refetch:d}}function Bt(){let{client:o}=O(),e=react.useCallback(async(r,i)=>{await o.track(r,i);},[o]),t=react.useCallback(async r=>{await o.trackBatch({events:r});},[o]);return {track:e,trackBatch:t}}function Ft(o){let{client:e,isReady:t}=O(),[r,i]=react.useState(null),[n,s]=react.useState(true),[p,a]=react.useState(null),l=react.useCallback(async()=>{s(true),a(null);try{let d=await e.getGuides(o);i(d);}catch(d){a(d instanceof Error?d:new Error("Failed to fetch guides"));}finally{s(false);}},[e,o?.projectId,o?.url,o?.userId]);return react.useEffect(()=>{t&&l();},[t,l]),{guides:r?.guides||[],completedGuides:r?.completedGuides||[],isLoading:n,error:p,refetch:l}}function Oe(){let{client:o,isReady:e}=O(),[t,r]=react.useState(null),[i,n]=react.useState([]),[s,p]=react.useState(false),[a,l]=react.useState(false),[d,c]=react.useState(null),[f,g]=react.useState(null),u=react.useRef(false),R=react.useCallback(async G=>{p(true),c(null);try{let y=await o.getGuide(G);return y&&(r(y),n(y.guide_steps||[]),g(y.guide_steps?.[0]?.id||null)),y}catch(y){return c(y instanceof Error?y:new Error("Failed to load guide")),null}finally{p(false);}},[o]),S=react.useCallback(async G=>{l(true),c(null);try{let y=await o.createGuide(G);return r(y),n([]),g(null),y}catch(y){throw c(y instanceof Error?y:new Error("Failed to create guide")),y}finally{l(false);}},[o]),h=react.useCallback(async G=>{if(!t)throw new Error("No guide loaded");l(true),c(null);try{let y=await o.updateGuide(t.id,G);return r(y),u.current=!1,y}catch(y){throw c(y instanceof Error?y:new Error("Failed to update guide")),y}finally{l(false);}},[o,t]),w=react.useCallback(async()=>h({status:"published"}),[h]),b=react.useCallback(async()=>h({status:"draft"}),[h]),C=react.useCallback(async()=>{if(!t)throw new Error("No guide loaded");l(true),c(null);try{await o.deleteGuide(t.id),r(null),n([]),g(null);}catch(G){throw c(G instanceof Error?G:new Error("Failed to delete guide")),G}finally{l(false);}},[o,t]),E=react.useCallback(async G=>{if(!t)throw new Error("No guide loaded");l(true),c(null);try{let y=await o.addGuideStep(t.id,G);return n(N=>[...N,y]),g(y.id),u.current=!0,y}catch(y){throw c(y instanceof Error?y:new Error("Failed to add step")),y}finally{l(false);}},[o,t]),k=react.useCallback(async(G,y)=>{if(!t)throw new Error("No guide loaded");l(true),c(null);try{let N=await o.updateGuideStep(t.id,G,y);return n(P=>P.map(D=>D.id===G?N:D)),u.current=!0,N}catch(N){throw c(N instanceof Error?N:new Error("Failed to update step")),N}finally{l(false);}},[o,t]),_=react.useCallback(async G=>{if(!t)throw new Error("No guide loaded");l(true),c(null);try{await o.deleteGuideStep(t.id,G),n(y=>y.filter(N=>N.id!==G)),f===G&&g(i[0]?.id||null),u.current=!0;}catch(y){throw c(y instanceof Error?y:new Error("Failed to delete step")),y}finally{l(false);}},[o,t,f,i]),m=react.useCallback(async G=>{if(!t)throw new Error("No guide loaded");l(true),c(null);try{let y=await o.reorderGuideSteps(t.id,G);return n(y),u.current=!0,y}catch(y){throw c(y instanceof Error?y:new Error("Failed to reorder steps")),y}finally{l(false);}},[o,t]),L=react.useCallback(async G=>{let y=i.findIndex(P=>P.id===G);if(y<=0)return;let N=i.map((P,D)=>D===y?{id:P.id,sort_order:y-1}:D===y-1?{id:P.id,sort_order:y}:{id:P.id,sort_order:D});return m(N)},[i,m]),U=react.useCallback(async G=>{let y=i.findIndex(P=>P.id===G);if(y<0||y>=i.length-1)return;let N=i.map((P,D)=>D===y?{id:P.id,sort_order:y+1}:D===y+1?{id:P.id,sort_order:y}:{id:P.id,sort_order:D});return m(N)},[i,m]),j=f&&i.find(G=>G.id===f)||null,T=react.useCallback(()=>{r(null),n([]),g(null),c(null),u.current=false;},[]);return {guide:t,steps:i,selectedStep:j,selectedStepId:f,isLoading:s,isSaving:a,error:d,isReady:e,hasUnsavedChanges:u.current,loadGuide:R,createGuide:S,updateGuide:h,publishGuide:w,unpublishGuide:b,deleteGuide:C,addStep:E,updateStep:k,deleteStep:_,reorderSteps:m,moveStepUp:L,moveStepDown:U,setSelectedStepId:g,reset:T}}function zt(){let{client:o,isReady:e}=O(),[t,r]=react.useState(null),[i,n]=react.useState(0),[s,p]=react.useState(false),[a,l]=react.useState([]),[d,c]=react.useState([]),f=react.useCallback((T,G=0)=>{r(T),n(G),p(true);},[]),g=react.useCallback(()=>{if(!t)return;let T=t.guide_steps||[];i<T.length-1?n(G=>G+1):(l(G=>[...G,t.id]),p(false),r(null));},[t,i]),u=react.useCallback(()=>{i>0&&n(T=>T-1);},[i]),R=react.useCallback(T=>{if(!t)return;let G=t.guide_steps||[];T>=0&&T<G.length&&n(T);},[t]),S=react.useCallback(()=>{t&&c(T=>[...T,t.id]),p(false),r(null),n(0);},[t]),h=react.useCallback(()=>{p(false);},[]),w=react.useCallback(()=>{t&&p(true);},[t]),b=react.useCallback(async(T,G)=>{let y=T.guide_steps?.[G];if(y)try{await o.track("guide_step_viewed",{guide_id:T.id,guide_name:T.name,step_id:y.id,step_index:G,step_type:y.step_type});}catch{}},[o]),C=react.useCallback(async T=>{try{await o.track("guide_completed",{guide_id:T.id,guide_name:T.name,total_steps:T.guide_steps?.length||0});}catch{}},[o]),E=react.useCallback(async(T,G)=>{try{await o.track("guide_dismissed",{guide_id:T.id,guide_name:T.name,dismissed_at_step:G,total_steps:T.guide_steps?.length||0});}catch{}},[o]),k=t?.guide_steps?.[i]||null,_=t?.guide_steps?.length||0,m=i===_-1,L=i===0,U=react.useCallback(T=>a.includes(T),[a]),j=react.useCallback(T=>d.includes(T),[d]);return {activeGuide:t,currentStep:k,currentStepIndex:i,totalSteps:_,isPlaying:s,isFirstStep:L,isLastStep:m,isReady:e,startGuide:f,nextStep:g,prevStep:u,goToStep:R,dismiss:S,pause:h,resume:w,trackStepView:b,trackGuideComplete:C,trackGuideDismiss:E,completedGuideIds:a,dismissedGuideIds:d,isGuideCompleted:U,isGuideDismissed:j}}var oe={button:{position:"fixed",padding:"12px 20px",border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"transform 0.2s, box-shadow 0.2s",zIndex:9999},modal:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4},modalContent:{backgroundColor:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"400px",margin:"16px",boxShadow:"0 20px 50px rgba(0, 0, 0, 0.2)",fontFamily:"system-ui, -apple-system, sans-serif"},textarea:{width:"100%",padding:"10px 12px",border:"1px solid #e0e0e0",borderRadius:"6px",fontSize:"14px",marginBottom:"16px",minHeight:"100px",resize:"vertical",boxSizing:"border-box",fontFamily:"inherit"},submitButton:{width:"100%",padding:"12px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"opacity 0.2s"},typeButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"6px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"}},At={"bottom-right":{bottom:"20px",right:"20px"},"bottom-left":{bottom:"20px",left:"20px"},"top-right":{top:"20px",right:"20px"},"top-left":{top:"20px",left:"20px"}},Lt={feedback:"General Feedback",bug_report:"Bug Report",feature_request:"Feature Request",article_rating:"Article Rating"},qt={feedback:"\u{1F4AC}",bug_report:"\u{1F41B}",feature_request:"\u{1F4A1}",article_rating:"\u2B50"};function Ot(o){return {primaryColor:o.primaryColor||"#000000",textColor:o.textColor||"#333333",backgroundColor:o.backgroundColor||"#ffffff",borderRadius:o.borderRadius||"8px",fontFamily:o.fontFamily||"system-ui, -apple-system, sans-serif"}}function Dt({position:o="bottom-right",text:e="Feedback",allowedTypes:t=["feedback","bug_report","feature_request"],theme:r,onSubmit:i,onError:n,children:s}){let{theme:p}=O(),{submitFeedback:a,isSubmitting:l,isSuccess:d,reset:c}=Le(),[f,g]=react.useState(false),[u,R]=react.useState(t[0]),[S,h]=react.useState(""),w={...p,...r},b=Ot(w),C=react.useCallback(()=>{g(true),c();},[c]),E=react.useCallback(()=>{g(false),h(""),R(t[0]);},[t]),k=react.useCallback(async _=>{_.preventDefault();let m={type:u,message:S};try{await a(m),i?.(m),setTimeout(E,1500);}catch(L){n?.(L instanceof Error?L:new Error("Failed to submit feedback"));}},[u,S,a,i,n,E]);return s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{onClick:C,style:{cursor:"pointer"},children:s}),f&&jsxRuntime.jsx(Ze,{isOpen:f,onClose:E,selectedType:u,onTypeChange:R,allowedTypes:t,message:S,onMessageChange:h,onSubmit:k,isSubmitting:l,isSuccess:d,themeStyles:b})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:C,style:{...oe.button,...At[o],backgroundColor:b.primaryColor,color:"white",borderRadius:b.borderRadius,fontFamily:b.fontFamily},"aria-label":"Open feedback form",children:e}),f&&jsxRuntime.jsx(Ze,{isOpen:f,onClose:E,selectedType:u,onTypeChange:R,allowedTypes:t,message:S,onMessageChange:h,onSubmit:k,isSubmitting:l,isSuccess:d,themeStyles:b})]})}function Ze({isOpen:o,onClose:e,selectedType:t,onTypeChange:r,allowedTypes:i,message:n,onMessageChange:s,onSubmit:p,isSubmitting:a,isSuccess:l,themeStyles:d}){return o?l?jsxRuntime.jsx("div",{style:oe.modal,onClick:e,children:jsxRuntime.jsxs("div",{style:{...oe.modalContent,textAlign:"center",fontFamily:d.fontFamily},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\u{1F389}"}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",color:d.textColor},children:"Thanks for your feedback!"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#666"},children:"We appreciate you taking the time to share."})]})}):jsxRuntime.jsx("div",{style:oe.modal,onClick:e,children:jsxRuntime.jsxs("div",{style:{...oe.modalContent,fontFamily:d.fontFamily},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntime.jsx("h3",{style:{margin:0,color:d.textColor},children:"Send Feedback"}),jsxRuntime.jsx("button",{onClick:e,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",lineHeight:"1"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("form",{onSubmit:p,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"16px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"What kind of feedback?"}),jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap"},children:i.map(c=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>r(c),style:{...oe.typeButton,backgroundColor:t===c?d.primaryColor:"white",color:t===c?"white":d.textColor,borderColor:t===c?d.primaryColor:"#e0e0e0"},children:[qt[c]," ",Lt[c]]},c))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"Your message"}),jsxRuntime.jsx("textarea",{value:n,onChange:c=>s(c.target.value),placeholder:t==="bug_report"?"Describe the bug and steps to reproduce...":t==="feature_request"?"Describe the feature you would like...":"Share your thoughts...",style:oe.textarea,required:true})]}),jsxRuntime.jsx("button",{type:"submit",disabled:a||!n.trim(),style:{...oe.submitButton,backgroundColor:d.primaryColor,color:"white",opacity:a||!n.trim()?.6:1,cursor:a||!n.trim()?"not-allowed":"pointer"},children:a?"Sending...":"Send Feedback"})]})]})}):null}var q={container:{fontFamily:"system-ui, -apple-system, sans-serif",maxWidth:"800px"},searchInput:{width:"100%",padding:"12px 16px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"15px",marginBottom:"24px",boxSizing:"border-box"},categoryButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"20px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"},articleCard:{padding:"20px",border:"1px solid #e0e0e0",borderRadius:"8px",marginBottom:"12px",cursor:"pointer",transition:"box-shadow 0.2s, border-color 0.2s",backgroundColor:"white"},articleTitle:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"},articleDescription:{margin:0,fontSize:"14px",color:"#666",lineHeight:1.5},articleMeta:{display:"flex",gap:"16px",marginTop:"12px",fontSize:"12px",color:"#999"},backButton:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#666",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},loading:{textAlign:"center",padding:"40px",color:"#666"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"8px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"40px",color:"#666"}};function Ut(o){return {primaryColor:o.primaryColor||"#000000",textColor:o.textColor||"#333333",backgroundColor:o.backgroundColor||"#ffffff",borderRadius:o.borderRadius||"8px",fontFamily:o.fontFamily||"system-ui, -apple-system, sans-serif"}}function Nt({showSearch:o=true,showCategories:e=true,defaultCategory:t,theme:r,className:i,onArticleView:n}){let{theme:s}=O(),[p,a]=react.useState(""),[l,d]=react.useState(t),[c,f]=react.useState(null),g={...s,...r},u=Ut(g),{articles:R,isLoading:S,error:h}=ue({category:l,search:p||void 0}),{article:w,isLoading:b,error:C}=fe(c||""),E=react.useMemo(()=>{let m=new Set;return R.forEach(L=>{L.category&&m.add(L.category);}),Array.from(m).sort()},[R]),k=m=>{f(m.slug),n?.(m);},_=()=>{f(null);};return c?b?jsxRuntime.jsx("div",{style:{...q.container,fontFamily:u.fontFamily},className:i,children:jsxRuntime.jsx("div",{style:q.loading,children:"Loading article..."})}):C?jsxRuntime.jsxs("div",{style:{...q.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:_,style:q.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:q.error,children:"Failed to load article. Please try again."})]}):w?jsxRuntime.jsxs("div",{style:{...q.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:_,style:q.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 16px 0",color:u.textColor},children:w.title}),w.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"},children:[w.read_time_minutes," min read"]}),w.content_html?jsxRuntime.jsx("div",{style:{...q.articleContent,color:u.textColor},dangerouslySetInnerHTML:{__html:w.content_html}}):jsxRuntime.jsx("div",{style:{...q.articleContent,color:u.textColor},children:typeof w.content=="string"?w.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{style:{...q.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:_,style:q.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:q.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{style:{...q.container,fontFamily:u.fontFamily},className:i,children:[o&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:p,onChange:m=>a(m.target.value),style:q.searchInput}),e&&E.length>0&&jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("button",{onClick:()=>d(void 0),style:{...q.categoryButton,backgroundColor:l?"white":u.primaryColor,color:l?u.textColor:"white",borderColor:l?"#e0e0e0":u.primaryColor},children:"All"}),E.map(m=>jsxRuntime.jsx("button",{onClick:()=>d(m),style:{...q.categoryButton,backgroundColor:l===m?u.primaryColor:"white",color:l===m?"white":u.textColor,borderColor:l===m?u.primaryColor:"#e0e0e0"},children:m},m))]}),S&&jsxRuntime.jsx("div",{style:q.loading,children:"Loading articles..."}),h&&jsxRuntime.jsx("div",{style:q.error,children:"Failed to load articles. Please try again."}),!S&&!h&&R.length===0&&jsxRuntime.jsx("div",{style:q.empty,children:p?`No articles found for "${p}"`:"No articles available yet."}),!S&&!h&&R.length>0&&jsxRuntime.jsx("div",{children:R.map(m=>jsxRuntime.jsxs("div",{onClick:()=>k(m),style:q.articleCard,role:"button",tabIndex:0,onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&k(m);},children:[jsxRuntime.jsx("h3",{style:{...q.articleTitle,color:u.textColor},children:m.title}),m.seo_description&&jsxRuntime.jsx("p",{style:q.articleDescription,children:m.seo_description}),jsxRuntime.jsxs("div",{style:q.articleMeta,children:[m.category&&jsxRuntime.jsx("span",{children:m.category}),m.read_time_minutes&&jsxRuntime.jsxs("span",{children:[m.read_time_minutes," min read"]})]})]},m.id))})]})}var K={container:{fontFamily:"system-ui, -apple-system, sans-serif"},list:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"},card:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},cardHover:{borderColor:"#d1d5db",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"},badges:{display:"flex",alignItems:"center",gap:"6px"},badge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},message:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},meta:{display:"flex",gap:"12px",marginTop:"8px",fontSize:"12px",color:"#6b7280"},empty:{textAlign:"center",padding:"32px 16px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 12px",color:"#d1d5db"},loading:{textAlign:"center",padding:"24px",color:"#6b7280"},error:{textAlign:"center",padding:"24px",color:"#dc2626"}},tt={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},ot={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},reviewed:{label:"Reviewed",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function Ht(o){return new Date(o).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Vt({status:o,type:e,limit:t=50,className:r,showEmptyState:i=true,onRequestClick:n}){let{isIdentified:s}=O(),[p,a]=react.useState(null),{requests:l,isLoading:d,error:c,refetch:f}=ne({status:o,type:e,limit:t}),g=react.useCallback(u=>{n?.(u);},[n]);return s?d?jsxRuntime.jsx("div",{style:K.loading,children:jsxRuntime.jsx("p",{children:"Loading requests..."})}):c?jsxRuntime.jsx("div",{style:K.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests. ",jsxRuntime.jsx("button",{onClick:f,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})}):l.length===0&&i?jsxRuntime.jsxs("div",{style:K.empty,children:[jsxRuntime.jsx("svg",{style:K.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"When you submit feedback, bug reports, or feature requests, they'll appear here."})]}):jsxRuntime.jsx("div",{style:K.container,className:r,children:jsxRuntime.jsx("ul",{style:K.list,children:l.map(u=>{let R=tt[u.feedback_type]||tt.feedback,S=ot[u.status]||ot.new,h=p===u.id;return jsxRuntime.jsxs("li",{style:{...K.card,...h?K.cardHover:{}},onMouseEnter:()=>a(u.id),onMouseLeave:()=>a(null),onClick:()=>g(u),role:"button",tabIndex:0,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&g(u);},children:[jsxRuntime.jsx("div",{style:K.header,children:jsxRuntime.jsxs("div",{style:K.badges,children:[jsxRuntime.jsx("span",{style:{...K.badge,color:R.color,backgroundColor:R.bg},children:R.label}),jsxRuntime.jsx("span",{style:{...K.badge,color:S.color,backgroundColor:S.bg},children:S.label})]})}),jsxRuntime.jsx("p",{style:K.message,children:u.message||"No message provided"}),jsxRuntime.jsxs("div",{style:K.meta,children:[jsxRuntime.jsx("span",{children:Ht(u.created_at)}),u.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",u.page_url]})]})]},u.id)})})}):i?jsxRuntime.jsx("div",{style:K.empty,children:jsxRuntime.jsx("p",{children:"Please sign in to view your requests."})}):null}var x={container:{fontFamily:"system-ui, -apple-system, sans-serif",display:"flex",minHeight:"400px"},sidebar:{width:"240px",flexShrink:0,borderRight:"1px solid #e5e7eb",paddingRight:"16px",marginRight:"24px"},sidebarSection:{marginBottom:"24px"},sidebarLabel:{fontSize:"11px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"#6b7280",marginBottom:"8px",paddingLeft:"8px"},sidebarItem:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 12px",borderRadius:"6px",cursor:"pointer",fontSize:"14px",color:"#374151",transition:"background-color 0.15s, color 0.15s",border:"none",background:"none",width:"100%",textAlign:"left"},sidebarItemActive:{backgroundColor:"#f3f4f6",color:"#111827",fontWeight:500},sidebarFeature:{padding:"6px 12px 6px 32px",fontSize:"13px"},sidebarBadge:{marginLeft:"auto",padding:"2px 6px",borderRadius:"9999px",fontSize:"11px",fontWeight:500,backgroundColor:"#e5e7eb",color:"#374151"},main:{flex:1,minWidth:0},tabs:{display:"flex",gap:"4px",marginBottom:"24px",borderBottom:"1px solid #e5e7eb"},tab:{padding:"12px 20px",border:"none",background:"none",cursor:"pointer",fontSize:"14px",fontWeight:500,color:"#6b7280",borderBottom:"2px solid transparent",marginBottom:"-1px",transition:"color 0.15s, border-color 0.15s"},tabActive:{color:"#111827",borderBottomColor:"#111827"},tabBadge:{marginLeft:"6px",padding:"2px 6px",borderRadius:"9999px",fontSize:"11px",fontWeight:600,backgroundColor:"#e5e7eb",color:"#374151"},groupCardsGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"16px",marginBottom:"24px"},groupCard:{padding:"20px",border:"1px solid #e5e7eb",borderRadius:"12px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s",backgroundColor:"white"},groupCardName:{fontSize:"16px",fontWeight:600,color:"#111827",margin:0},groupCardMeta:{fontSize:"13px",color:"#6b7280",marginTop:"4px"},searchInput:{width:"100%",padding:"10px 14px",border:"1px solid #e5e7eb",borderRadius:"8px",fontSize:"14px",marginBottom:"20px",boxSizing:"border-box"},articleCard:{padding:"16px",border:"1px solid #e5e7eb",borderRadius:"10px",marginBottom:"12px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s",backgroundColor:"white"},articleTitle:{margin:"0 0 6px 0",fontSize:"15px",fontWeight:600},articleDescription:{margin:0,fontSize:"14px",color:"#6b7280",lineHeight:1.5},articleMeta:{display:"flex",gap:"12px",marginTop:"10px",fontSize:"12px",color:"#9ca3af"},backButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#6b7280",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},requestCard:{border:"1px solid #e5e7eb",borderRadius:"10px",padding:"16px",backgroundColor:"#ffffff",marginBottom:"12px",transition:"border-color 0.15s"},requestHeader:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px",marginBottom:"8px"},badge:{display:"inline-flex",alignItems:"center",padding:"3px 10px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},requestMessage:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},requestMeta:{display:"flex",gap:"12px",marginTop:"10px",fontSize:"12px",color:"#9ca3af"},sectionHeader:{marginBottom:"16px"},sectionTitle:{fontSize:"18px",fontWeight:600,color:"#111827",margin:"0 0 4px 0"},sectionDescription:{fontSize:"14px",color:"#6b7280",margin:0},loading:{textAlign:"center",padding:"40px",color:"#6b7280"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"10px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"48px 24px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 16px",color:"#d1d5db"}},rt={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Rating",color:"#7c3aed",bg:"#ede9fe"}},nt={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},planned:{label:"Planned",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function Kt(o){return new Date(o).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function jt(o){return {primaryColor:o.primaryColor||"#111827",textColor:o.textColor||"#111827",backgroundColor:o.backgroundColor||"#ffffff",borderRadius:o.borderRadius||"10px",fontFamily:o.fontFamily||"system-ui, -apple-system, sans-serif"}}var Xt={articles:"Articles",requests:"My Requests"};function Yt({group:o,onClick:e}){return jsxRuntime.jsxs("div",{style:x.groupCard,onClick:e,role:"button",tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&e();},children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{style:x.groupCardName,children:o.name}),jsxRuntime.jsxs("p",{style:x.groupCardMeta,children:[o.feature_count," feature",o.feature_count!==1?"s":""," \xB7 ",o.article_count," article",o.article_count!==1?"s":""]})]}),o.description&&jsxRuntime.jsx("p",{style:{...x.articleDescription,marginTop:"8px"},children:o.description})]})}function it({featureId:o,featureName:e,showSearch:t,themeStyles:r,onArticleView:i,onBack:n}){let[s,p]=react.useState(""),[a,l]=react.useState(null),{articles:d,isLoading:c,error:f}=ue({search:s||void 0}),{article:g,isLoading:u,error:R}=fe(a||""),S=react.useMemo(()=>o?d.filter(b=>b.features?.id===o):d,[d,o]),h=b=>{l(b.slug),i?.(b);},w=()=>{l(null);};return a?u?jsxRuntime.jsx("div",{style:x.loading,children:"Loading article..."}):R?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:w,style:x.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:x.error,children:"Failed to load article."})]}):g?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:w,style:x.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 12px 0",fontSize:"24px",color:r.textColor},children:g.title}),g.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#6b7280",marginBottom:"24px"},children:[g.read_time_minutes," min read"]}),g.content_html?jsxRuntime.jsx("div",{style:{...x.articleContent,color:r.textColor},dangerouslySetInnerHTML:{__html:g.content_html}}):jsxRuntime.jsx("div",{style:{...x.articleContent,color:r.textColor},children:typeof g.content=="string"?g.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:w,style:x.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:x.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{children:[e&&n&&jsxRuntime.jsxs("div",{style:x.sectionHeader,children:[jsxRuntime.jsx("button",{onClick:n,style:x.backButton,children:"\u2190 Back to features"}),jsxRuntime.jsx("h2",{style:x.sectionTitle,children:e}),jsxRuntime.jsx("p",{style:x.sectionDescription,children:"Documentation and guides for this feature"})]}),t&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:s,onChange:b=>p(b.target.value),style:x.searchInput}),c&&jsxRuntime.jsx("div",{style:x.loading,children:"Loading articles..."}),f&&jsxRuntime.jsx("div",{style:x.error,children:"Failed to load articles. Please try again."}),!c&&!f&&S.length===0&&jsxRuntime.jsxs("div",{style:x.empty,children:[jsxRuntime.jsx("svg",{style:x.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:s?`No articles found for "${s}"`:"No articles yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"Check back soon for helpful content."})]}),!c&&!f&&S.length>0&&jsxRuntime.jsx("div",{children:S.map(b=>jsxRuntime.jsxs("div",{onClick:()=>h(b),style:x.articleCard,role:"button",tabIndex:0,onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&h(b);},children:[jsxRuntime.jsx("h3",{style:{...x.articleTitle,color:r.textColor},children:b.title}),b.seo_description&&jsxRuntime.jsx("p",{style:x.articleDescription,children:b.seo_description}),jsxRuntime.jsxs("div",{style:x.articleMeta,children:[b.category&&jsxRuntime.jsx("span",{children:b.category}),b.read_time_minutes&&jsxRuntime.jsxs("span",{children:[b.read_time_minutes," min read"]})]})]},b.id))})]})}function Qt({onRequestClick:o}){let{isIdentified:e}=O(),{requests:t,isLoading:r,error:i,refetch:n}=ne({limit:50});return e?r?jsxRuntime.jsx("div",{style:x.loading,children:"Loading requests..."}):i?jsxRuntime.jsx("div",{style:x.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests."," ",jsxRuntime.jsx("button",{onClick:n,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})}):t.length===0?jsxRuntime.jsxs("div",{style:x.empty,children:[jsxRuntime.jsx("svg",{style:x.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"When you submit feedback, bug reports, or feature requests, they'll appear here."})]}):jsxRuntime.jsx("div",{children:t.map(s=>{let p=rt[s.feedback_type]||rt.feedback,a=nt[s.status]||nt.new;return jsxRuntime.jsxs("div",{style:x.requestCard,onClick:()=>o?.(s),role:o?"button":void 0,tabIndex:o?0:void 0,onKeyDown:o?l=>{(l.key==="Enter"||l.key===" ")&&o(s);}:void 0,children:[jsxRuntime.jsxs("div",{style:x.requestHeader,children:[jsxRuntime.jsx("span",{style:{...x.badge,color:p.color,backgroundColor:p.bg},children:p.label}),jsxRuntime.jsx("span",{style:{...x.badge,color:a.color,backgroundColor:a.bg},children:a.label}),s.feature_group&&jsxRuntime.jsx("span",{style:{...x.badge,color:s.feature_group.color||"#6b7280",backgroundColor:s.feature_group.color?`${s.feature_group.color}20`:"#f3f4f6",border:`1px solid ${s.feature_group.color||"#e5e7eb"}`},children:s.feature_group.name}),s.feature&&jsxRuntime.jsx("span",{style:{...x.badge,color:"#374151",backgroundColor:"#f3f4f6",border:"1px solid #e5e7eb"},children:s.feature.name})]}),jsxRuntime.jsx("p",{style:x.requestMessage,children:s.message||"No message provided"}),jsxRuntime.jsxs("div",{style:x.requestMeta,children:[jsxRuntime.jsx("span",{children:Kt(s.created_at)}),s.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",s.page_url]})]})]},s.id)})}):jsxRuntime.jsxs("div",{style:x.empty,children:[jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"Sign in required"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"Please sign in to view your requests."})]})}function Jt({tabs:o=["articles","requests"],defaultTab:e,tabLabels:t,showSearch:r=true,showCategories:i=true,theme:n,className:s,onArticleView:p,onRequestClick:a,onTabChange:l}){let{theme:d}=O(),c={...d,...n},f=jt(c),g=e&&o.includes(e)?e:o[0],[u,R]=react.useState(g),[S,h]=react.useState(null),[w,b]=react.useState(null),{featureGroups:C,isLoading:E}=qe(),{requests:k}=ne({limit:100}),_=k.filter(P=>["new","planned","in_progress"].includes(P.status)).length,m={...Xt,...t},L=react.useMemo(()=>C.find(P=>P.id===S)||null,[C,S]),U=P=>{R(P),h(null),b(null),l?.(P);},j=P=>{h(P.id),b(null);},T=P=>{b(P);},G=()=>{h(null),b(null);},y=()=>{b(null);},N=o.length>1;return jsxRuntime.jsxs("div",{style:{...x.container,fontFamily:f.fontFamily},className:s,children:[u==="articles"&&C.length>0&&jsxRuntime.jsxs("div",{style:x.sidebar,children:[jsxRuntime.jsxs("div",{style:x.sidebarSection,children:[jsxRuntime.jsx("div",{style:x.sidebarLabel,children:"Resources"}),jsxRuntime.jsxs("button",{style:{...x.sidebarItem,...S?{}:x.sidebarItemActive},onClick:G,children:[jsxRuntime.jsx("span",{children:"\u{1F3E0}"}),jsxRuntime.jsx("span",{children:"All Features"})]})]}),jsxRuntime.jsxs("div",{style:x.sidebarSection,children:[jsxRuntime.jsx("div",{style:x.sidebarLabel,children:"Features"}),E?jsxRuntime.jsx("div",{style:{padding:"8px 12px",fontSize:"13px",color:"#6b7280"},children:"Loading..."}):C.map(P=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("button",{style:{...x.sidebarItem,...S===P.id?x.sidebarItemActive:{}},onClick:()=>j(P),children:[jsxRuntime.jsx("span",{style:{flex:1},children:P.name}),jsxRuntime.jsx("span",{style:x.sidebarBadge,children:P.feature_count})]}),S===P.id&&jsxRuntime.jsx("div",{children:P.features.map(D=>jsxRuntime.jsxs("button",{style:{...x.sidebarItem,...x.sidebarFeature,...w?.id===D.id?x.sidebarItemActive:{}},onClick:()=>T(D),children:[D.name,D.article_count>0&&jsxRuntime.jsx("span",{style:x.sidebarBadge,children:D.article_count})]},D.id))})]},P.id))]})]}),jsxRuntime.jsxs("div",{style:x.main,children:[N&&jsxRuntime.jsx("div",{style:x.tabs,children:o.map(P=>jsxRuntime.jsxs("button",{onClick:()=>U(P),style:{...x.tab,...u===P?x.tabActive:{},...u===P?{borderBottomColor:f.primaryColor,color:f.primaryColor}:{}},children:[m[P],P==="requests"&&_>0&&jsxRuntime.jsx("span",{style:x.tabBadge,children:_})]},P))}),u==="articles"&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!S&&!w&&C.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{style:x.sectionHeader,children:[jsxRuntime.jsx("h2",{style:x.sectionTitle,children:"Browse by Feature"}),jsxRuntime.jsx("p",{style:x.sectionDescription,children:"Select a feature group to find relevant documentation"})]}),jsxRuntime.jsx("div",{style:x.groupCardsGrid,children:C.map(P=>jsxRuntime.jsx(Yt,{group:P,onClick:()=>j(P)},P.id))})]}),L&&!w&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{style:x.sectionHeader,children:[jsxRuntime.jsx("button",{onClick:G,style:x.backButton,children:"\u2190 Back to all features"}),jsxRuntime.jsx("h2",{style:x.sectionTitle,children:L.name}),L.description&&jsxRuntime.jsx("p",{style:x.sectionDescription,children:L.description})]}),jsxRuntime.jsx("div",{style:x.groupCardsGrid,children:L.features.map(P=>jsxRuntime.jsxs("div",{style:x.groupCard,onClick:()=>T(P),role:"button",tabIndex:0,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&T(P);},children:[jsxRuntime.jsx("h3",{style:x.groupCardName,children:P.name}),jsxRuntime.jsxs("p",{style:x.groupCardMeta,children:[P.article_count," article",P.article_count!==1?"s":""]}),P.description&&jsxRuntime.jsx("p",{style:{...x.articleDescription,marginTop:"8px"},children:P.description})]},P.id))})]}),w&&jsxRuntime.jsx(it,{featureId:w.id,featureName:w.name,showSearch:r,themeStyles:f,onArticleView:p,onBack:y}),C.length===0&&jsxRuntime.jsx(it,{showSearch:r,themeStyles:f,onArticleView:p})]}),u==="requests"&&jsxRuntime.jsx(Qt,{onRequestClick:a})]})]})}var at={tooltip:"Tooltip",modal:"Modal",slideout:"Slideout",hotspot:"Hotspot",banner:"Banner"},to={tooltip:"Points to a specific element with an arrow",modal:"Centered overlay that grabs attention",slideout:"Slides in from the side of the screen",hotspot:"Pulsing beacon that expands on click",banner:"Top or bottom bar announcement"},oo=[{value:"auto",label:"Auto"},{value:"top",label:"Top"},{value:"bottom",label:"Bottom"},{value:"left",label:"Left"},{value:"right",label:"Right"}],ro=[{value:"button",label:"Button click"},{value:"click",label:"Click anywhere"},{value:"delay",label:"After delay"},{value:"form-submit",label:"Form submit"}];function lt({step:o,onUpdate:e,onSelectElement:t,isSelectingElement:r}){let[i,n]=react.useState(false),[s,p]=react.useState(o.step_type),[a,l]=react.useState(o.rich_content?.title||o.title||""),[d,c]=react.useState(o.rich_content?.body||o.content||""),[f,g]=react.useState(o.tooltip_position||o.display_config?.position||"auto"),[u,R]=react.useState(o.selector_strategy?.css||""),[S,h]=react.useState(o.display_config?.backdrop!==false),[w,b]=react.useState(o.advance_config?.trigger||"button"),[C,E]=react.useState(o.advance_config?.delay||3e3),k=react.useCallback(async()=>{n(true);try{let m=u?{css:u}:void 0,L={title:a||void 0,body:d||void 0},U={position:f!=="auto"?f:void 0,backdrop:S},j={trigger:w,delay:w==="delay"?C:void 0};await e(o.id,{stepType:s,selectorStrategy:m,richContent:L,displayConfig:U,advanceConfig:j,tooltipPosition:f});}finally{n(false);}},[o.id,s,a,d,f,u,S,w,C,e]),_=s==="tooltip"||s==="hotspot";return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[jsxRuntime.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid #e5e7eb",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsx("span",{style:{fontWeight:500},children:"Edit Step"}),jsxRuntime.jsx("button",{onClick:k,disabled:i,style:{padding:"6px 12px",fontSize:"13px",border:"none",borderRadius:"4px",backgroundColor:"#2563eb",color:"white",cursor:i?"wait":"pointer",opacity:i?.7:1},children:i?"Saving...":"Save Changes"})]}),jsxRuntime.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Step Type"}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"8px"},children:Object.keys(at).map(m=>jsxRuntime.jsxs("button",{onClick:()=>p(m),style:{padding:"10px",border:`2px solid ${s===m?"#2563eb":"#e5e7eb"}`,borderRadius:"6px",backgroundColor:s===m?"#eff6ff":"white",cursor:"pointer",textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:at[m]}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:to[m]})]},m))})]}),_&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Target Element"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsx("input",{type:"text",value:u,onChange:m=>R(m.target.value),placeholder:"CSS selector (e.g., #my-button)",style:{flex:1,padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",fontFamily:"monospace"}}),jsxRuntime.jsx("button",{onClick:t,disabled:r,style:{padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:r?"#f3f4f6":"white",cursor:r?"wait":"pointer"},children:r?"Selecting...":"Select"})]}),jsxRuntime.jsx("p",{style:{fontSize:"11px",color:"#6b7280",marginTop:"4px"},children:'Click "Select" to pick an element on the page, or enter a CSS selector manually'})]}),jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Title"}),jsxRuntime.jsx("input",{type:"text",value:a,onChange:m=>l(m.target.value),placeholder:"Enter step title",style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px"}})]}),jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Content"}),jsxRuntime.jsx("textarea",{value:d,onChange:m=>c(m.target.value),placeholder:"Enter step content (HTML supported)",rows:4,style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",resize:"vertical",fontFamily:"inherit"}})]}),(s==="tooltip"||s==="hotspot")&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Position"}),jsxRuntime.jsx("select",{value:f,onChange:m=>g(m.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:oo.map(m=>jsxRuntime.jsx("option",{value:m.value,children:m.label},m.value))})]}),s==="banner"&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Banner Position"}),jsxRuntime.jsxs("select",{value:f==="bottom"?"bottom":"top",onChange:m=>g(m.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:[jsxRuntime.jsx("option",{value:"top",children:"Top"}),jsxRuntime.jsx("option",{value:"bottom",children:"Bottom"})]})]}),s==="slideout"&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Slideout Side"}),jsxRuntime.jsxs("select",{value:f==="left"?"left":"right",onChange:m=>g(m.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:[jsxRuntime.jsx("option",{value:"right",children:"Right"}),jsxRuntime.jsx("option",{value:"left",children:"Left"})]})]}),(s==="tooltip"||s==="modal")&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[jsxRuntime.jsx("input",{type:"checkbox",checked:S,onChange:m=>h(m.target.checked),style:{width:"16px",height:"16px"}}),jsxRuntime.jsx("span",{style:{fontSize:"13px",fontWeight:500},children:"Show backdrop overlay"})]}),jsxRuntime.jsx("p",{style:{fontSize:"11px",color:"#6b7280",marginTop:"4px",marginLeft:"24px"},children:"Dims the background to focus attention on the step"})]}),jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Advance When"}),jsxRuntime.jsx("select",{value:w,onChange:m=>b(m.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:ro.map(m=>jsxRuntime.jsx("option",{value:m.value,children:m.label},m.value))})]}),w==="delay"&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Delay (seconds)"}),jsxRuntime.jsx("input",{type:"number",value:C/1e3,onChange:m=>E(Number(m.target.value)*1e3),min:1,max:60,style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px"}})]})]})]})}function io(o){let e={},t=o.getAttribute("data-testid");if(t)return e.testId=t,e.css=`[data-testid="${t}"]`,e;if(o.id)return e.css=`#${CSS.escape(o.id)}`,e;let r=[],i=o,n=0,s=5;for(;i&&i!==document.body&&n<s;){let a=i.tagName.toLowerCase(),l=Array.from(i.classList).filter(f=>!f.startsWith("hover")&&!f.startsWith("focus")&&!f.startsWith("active")).slice(0,2);l.length>0&&(a+="."+l.map(f=>CSS.escape(f)).join("."));let d=i.parentElement;if(d){let f=Array.from(d.children).filter(g=>g.tagName===i.tagName);if(f.length>1){let g=f.indexOf(i)+1;a+=`:nth-of-type(${g})`;}}r.unshift(a);let c=r.join(" > ");try{if(document.querySelectorAll(c).length===1){e.css=c;break}}catch{}i=i.parentElement,n++;}!e.css&&r.length>0&&(e.css=r.join(" > "));let p=o.textContent?.trim();return p&&p.length<100&&p.length>2&&(e.text=p.slice(0,50)),e}function so(o){let e=0;if(o.css)try{e=document.querySelectorAll(o.css).length;}catch{}return o.testId&&(e=document.querySelectorAll(`[data-testid="${o.testId}"]`).length),{isUnique:e===1,count:e}}function pt({isActive:o,onSelect:e,onCancel:t,ignoreSelector:r="[data-census-builder]",zIndex:i=99999}){let[n,s]=react.useState(null),[p,a]=react.useState(null),[l,d]=react.useState(null),c=react.useRef(null),f=react.useCallback(()=>{if(!n){a(null);return}a(n.getBoundingClientRect());},[n]);react.useEffect(()=>{if(!o)return;let R=h=>{let b=document.elementsFromPoint(h.clientX,h.clientY).find(C=>!(c.current?.contains(C)||r&&C.closest(r)||C===document.body||C===document.documentElement));b!==n&&(s(b||null),d(b?io(b):null));},S=()=>{f();};return document.addEventListener("mousemove",R,true),window.addEventListener("scroll",S,true),window.addEventListener("resize",S),()=>{document.removeEventListener("mousemove",R,true),window.removeEventListener("scroll",S,true),window.removeEventListener("resize",S);}},[o,n,r,f]),react.useEffect(()=>{f();},[n,f]);let g=react.useCallback(R=>{R.preventDefault(),R.stopPropagation(),n&&l&&e(l,n);},[n,l,e]);if(react.useEffect(()=>{if(!o)return;let R=S=>{S.key==="Escape"&&t();};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[o,t]),!o)return null;let u=l?so(l):null;return jsxRuntime.jsxs("div",{ref:c,"data-census-builder":true,style:{position:"fixed",inset:0,zIndex:i,cursor:"crosshair"},onClick:g,children:[p&&jsxRuntime.jsx("div",{style:{position:"fixed",top:p.top,left:p.left,width:p.width,height:p.height,border:"2px solid #2563eb",borderRadius:"4px",backgroundColor:"rgba(37, 99, 235, 0.1)",pointerEvents:"none",transition:"all 0.1s ease-out"}}),p&&l&&jsxRuntime.jsxs("div",{style:{position:"fixed",top:Math.max(8,p.top-40),left:p.left,padding:"6px 10px",backgroundColor:"#1f2937",color:"white",fontSize:"12px",fontFamily:"monospace",borderRadius:"4px",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af"},children:l.testId?"data-testid: ":""}),l.testId||l.css,u&&jsxRuntime.jsxs("span",{style:{marginLeft:"8px",color:u.isUnique?"#4ade80":"#fbbf24"},children:["(",u.count," match",u.count!==1?"es":"",")"]})]}),jsxRuntime.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,padding:"12px 20px",backgroundColor:"#1f2937",color:"white",display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px"},children:[jsxRuntime.jsxs("span",{children:["Click on any element to select it, or press ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"#374151",borderRadius:"4px",marginLeft:"4px",marginRight:"4px"},children:"Esc"})," to cancel"]}),jsxRuntime.jsx("button",{onClick:R=>{R.stopPropagation(),t();},style:{padding:"6px 12px",border:"1px solid #4b5563",borderRadius:"4px",backgroundColor:"transparent",color:"white",cursor:"pointer"},children:"Cancel"})]})]})}function ao({isOpen:o,onClose:e,guideId:t,onSave:r,onPublish:i,trigger:n,className:s}){let[p,a]=react.useState(false),l=o??p,{guide:d,steps:c,selectedStep:f,selectedStepId:g,isLoading:u,isSaving:R,error:S,loadGuide:h,updateGuide:w,publishGuide:b,addStep:C,updateStep:E,deleteStep:k,moveStepUp:_,moveStepDown:m,setSelectedStepId:L,reset:U}=Oe(),j=react.useCallback(async()=>{a(true),t&&await h(t);},[t,h]),T=react.useCallback(()=>{a(false),U(),e?.();},[U,e]),G=react.useCallback(async()=>{if(d)try{await w({}),r?.(d);}catch{}},[d,w,r]),y=react.useCallback(async()=>{if(d)try{let P=await b();i?.(P);}catch{}},[d,b,i]),N=react.useCallback(async(P="tooltip")=>{try{await C({stepType:P,richContent:{title:"New Step",body:"Click to edit..."}});}catch{}},[C]);return n&&o===void 0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{onClick:j,children:n}),l&&jsxRuntime.jsx(ct,{guide:d,steps:c,selectedStep:f,selectedStepId:g,isLoading:u,isSaving:R,error:S,onClose:T,onSave:G,onPublish:y,onAddStep:N,onSelectStep:L,onUpdateStep:E,onDeleteStep:k,onMoveStepUp:_,onMoveStepDown:m,className:s})]}):l?jsxRuntime.jsx(ct,{guide:d,steps:c,selectedStep:f,selectedStepId:g,isLoading:u,isSaving:R,error:S,onClose:T,onSave:G,onPublish:y,onAddStep:N,onSelectStep:L,onUpdateStep:E,onDeleteStep:k,onMoveStepUp:_,onMoveStepDown:m,className:s}):null}function ct({guide:o,steps:e,selectedStep:t,selectedStepId:r,isLoading:i,isSaving:n,error:s,onClose:p,onSave:a,onPublish:l,onAddStep:d,onSelectStep:c,onUpdateStep:f,onDeleteStep:g,onMoveStepUp:u,onMoveStepDown:R,className:S}){let[h,w]=react.useState(false),b={tooltip:"Tooltip",modal:"Modal",slideout:"Slideout",hotspot:"Hotspot",banner:"Banner"},C=react.useCallback((E,k)=>{t&&f(t.id,{selectorStrategy:E}),w(false);},[t,f]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(pt,{isActive:h,onSelect:C,onCancel:()=>w(false),ignoreSelector:"[data-census-builder]"}),jsxRuntime.jsxs("div",{className:S,"data-census-builder":true,style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",backgroundColor:"#f8f9fa",fontFamily:"system-ui, -apple-system, sans-serif"},children:[jsxRuntime.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",backgroundColor:"white",borderBottom:"1px solid #e5e7eb"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[jsxRuntime.jsx("button",{onClick:p,style:{padding:"8px 12px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",cursor:"pointer"},children:"Close"}),jsxRuntime.jsx("h1",{style:{margin:0,fontSize:"18px",fontWeight:600},children:o?o.name:"Guide Builder"}),o?.status&&jsxRuntime.jsx("span",{style:{padding:"2px 8px",fontSize:"12px",borderRadius:"4px",backgroundColor:o.status==="published"?"#dcfce7":"#fef3c7",color:o.status==="published"?"#166534":"#92400e"},children:o.status})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[s&&jsxRuntime.jsx("span",{style:{color:"#dc2626",fontSize:"14px"},children:s.message}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!o,style:{padding:"8px 16px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",cursor:n?"wait":"pointer",opacity:n?.5:1},children:n?"Saving...":"Save"}),jsxRuntime.jsx("button",{onClick:l,disabled:n||!o||o.status==="published",style:{padding:"8px 16px",border:"none",borderRadius:"6px",backgroundColor:"#2563eb",color:"white",cursor:n?"wait":"pointer",opacity:n||o?.status==="published"?.5:1},children:"Publish"})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[jsxRuntime.jsxs("aside",{style:{width:"280px",backgroundColor:"white",borderRight:"1px solid #e5e7eb",display:"flex",flexDirection:"column"},children:[jsxRuntime.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid #e5e7eb",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("span",{style:{fontWeight:500},children:["Steps (",e.length,")"]}),jsxRuntime.jsx("button",{onClick:()=>d("tooltip"),disabled:!o,style:{padding:"6px 12px",fontSize:"13px",border:"none",borderRadius:"4px",backgroundColor:"#2563eb",color:"white",cursor:o?"pointer":"not-allowed",opacity:o?1:.5},children:"+ Add Step"})]}),jsxRuntime.jsx("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:i?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#6b7280"},children:"Loading..."}):e.length===0?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#6b7280"},children:'No steps yet. Click "Add Step" to get started.'}):e.map((E,k)=>jsxRuntime.jsxs("div",{onClick:()=>c(E.id),style:{padding:"12px",marginBottom:"4px",borderRadius:"6px",backgroundColor:r===E.id?"#eff6ff":"white",border:`1px solid ${r===E.id?"#3b82f6":"#e5e7eb"}`,cursor:"pointer"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("span",{style:{fontWeight:500,fontSize:"14px"},children:[k+1,". ",b[E.step_type]]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),u(E.id);},disabled:k===0,style:{padding:"2px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",backgroundColor:"white",cursor:k===0?"not-allowed":"pointer",opacity:k===0?.3:1},children:"Up"}),jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),R(E.id);},disabled:k===e.length-1,style:{padding:"2px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",backgroundColor:"white",cursor:k===e.length-1?"not-allowed":"pointer",opacity:k===e.length-1?.3:1},children:"Down"}),jsxRuntime.jsx("button",{onClick:_=>{_.stopPropagation(),confirm("Delete this step?")&&g(E.id);},style:{padding:"2px 6px",fontSize:"12px",border:"1px solid #fecaca",borderRadius:"3px",backgroundColor:"#fef2f2",color:"#dc2626",cursor:"pointer"},children:"Delete"})]})]}),jsxRuntime.jsx("p",{style:{margin:"4px 0 0",fontSize:"13px",color:"#6b7280"},children:E.rich_content?.title||E.title||"Untitled"})]},E.id))})]}),jsxRuntime.jsxs("main",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"#f3f4f6"},children:[jsxRuntime.jsx("div",{style:{padding:"16px",borderBottom:"1px solid #e5e7eb",backgroundColor:"white"},children:jsxRuntime.jsx("span",{style:{fontWeight:500},children:"Preview"})}),jsxRuntime.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280"},children:t?jsxRuntime.jsxs("div",{style:{padding:"24px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)",maxWidth:"400px",width:"100%"},children:[jsxRuntime.jsx("div",{style:{marginBottom:"12px"},children:jsxRuntime.jsx("span",{style:{padding:"4px 8px",fontSize:"11px",fontWeight:500,borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",textTransform:"uppercase"},children:b[t.step_type]})}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px",fontSize:"16px"},children:t.rich_content?.title||t.title||"Step Preview"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#4b5563"},children:t.rich_content?.body||t.content||"No content"}),t.rich_content?.media&&jsxRuntime.jsx("div",{style:{marginTop:"12px"},children:t.rich_content.media.type==="image"&&jsxRuntime.jsx("img",{src:t.rich_content.media.url,alt:t.rich_content.media.alt||"",style:{maxWidth:"100%",borderRadius:"4px"}})}),t.rich_content?.buttons&&t.rich_content.buttons.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",display:"flex",gap:"8px"},children:t.rich_content.buttons.map((E,k)=>jsxRuntime.jsx("span",{style:{padding:"6px 12px",fontSize:"13px",borderRadius:"4px",backgroundColor:E.style==="primary"?"#2563eb":"#f3f4f6",color:E.style==="primary"?"white":"#374151"},children:E.label},k))}),t.selector_strategy?.css&&jsxRuntime.jsxs("div",{style:{marginTop:"16px",padding:"8px",backgroundColor:"#f9fafb",borderRadius:"4px",fontSize:"11px",fontFamily:"monospace",color:"#6b7280"},children:["Target: ",t.selector_strategy.css]})]}):jsxRuntime.jsx("p",{children:"Select a step to preview"})})]}),jsxRuntime.jsx("aside",{style:{width:"360px",backgroundColor:"white",borderLeft:"1px solid #e5e7eb",display:"flex",flexDirection:"column",overflow:"hidden"},children:t?jsxRuntime.jsx(lt,{step:t,onUpdate:f,onSelectElement:()=>w(true),isSelectingElement:h}):jsxRuntime.jsx("div",{style:{padding:"16px"},children:jsxRuntime.jsx("p",{style:{color:"#6b7280"},children:"Select a step to edit its settings"})})})]})]})]})}function He(o){let e=o.getBoundingClientRect();return {top:e.top+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX,bottom:e.bottom+window.scrollY,width:e.width,height:e.height}}function Ve(){return {width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY}}function $e(o,e,t,r,i){let n=Ve(),{scrollX:s,scrollY:p,width:a,height:l}=n;switch(r){case "top":return o.top-p-t-i>0&&o.left-s+o.width/2-e/2>0&&o.left-s+o.width/2+e/2<a;case "bottom":return o.bottom-p+t+i<l&&o.left-s+o.width/2-e/2>0&&o.left-s+o.width/2+e/2<a;case "left":return o.left-s-e-i>0&&o.top-p+o.height/2-t/2>0&&o.top-p+o.height/2+t/2<l;case "right":return o.right-s+e+i<a&&o.top-p+o.height/2-t/2>0&&o.top-p+o.height/2+t/2<l;default:return true}}function lo(o,e,t,r){let i=["bottom","top","right","left"];for(let n of i)if($e(o,e,t,n,r))return n;return "bottom"}function we(o,e,t,r){let{preferredPosition:i,offset:n={x:0,y:0},containerPadding:s=10,arrowSize:p=8}=r,a=He(o),l=Ve(),d=i;if(i==="auto")d=lo(a,e,t,s);else if(!$e(a,e,t,i,s)){let k={top:"bottom",bottom:"top",left:"right",right:"left"}[i];k&&$e(a,e,t,k,s)&&(d=k);}let c=0,f=0,g={},u=p+4;switch(d){case "top":c=a.top-t-u+n.y,f=a.left+a.width/2-e/2+n.x,g={left:e/2-p/2,top:t,transform:"rotate(180deg)"};break;case "bottom":c=a.bottom+u+n.y,f=a.left+a.width/2-e/2+n.x,g={left:e/2-p/2,top:-p};break;case "left":c=a.top+a.height/2-t/2+n.y,f=a.left-e-u+n.x,g={top:t/2-p/2,left:e,transform:"rotate(-90deg)"};break;case "right":c=a.top+a.height/2-t/2+n.y,f=a.right+u+n.x,g={top:t/2-p/2,left:-p,transform:"rotate(90deg)"};break}let R=l.scrollX+s,S=l.scrollX+l.width-e-s,h=l.scrollY+s,w=l.scrollY+l.height-t-s,b=f;f=Math.max(R,Math.min(S,f)),(d==="top"||d==="bottom")&&(g.left=(g.left||0)+(b-f));let C=c;return c=Math.max(h,Math.min(w,c)),(d==="left"||d==="right")&&(g.top=(g.top||0)+(C-c)),{top:c,left:f,placement:d,arrowPosition:g}}function ke(o,e=100){let t=o.getBoundingClientRect(),r=Ve(),i=t.top<e,n=t.bottom>r.height-e,s=t.left<e,p=t.right>r.width-e;(i||n||s||p)&&o.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});}function Ge(o){if(!o)return null;if(o.css)try{let e=document.querySelector(o.css);if(e)return e}catch{}if(o.testId){let e=document.querySelector(`[data-testid="${o.testId}"]`);if(e)return e}if(o.xpath)try{let e=document.evaluate(o.xpath,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);if(e.singleNodeValue)return e.singleNodeValue}catch{}if(o.text){let e=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT),t;for(;t=e.nextNode();)if(t.textContent?.includes(o.text))return t.parentElement}return null}function gt(o,e=8){let t=o.getBoundingClientRect(),r={top:t.top-e,left:t.left-e,right:t.right+e,bottom:t.bottom+e,width:t.width+e*2,height:t.height+e*2};return `polygon(
1
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Vt="https://api.census.ai",Me=class{constructor(t){this.currentUserId=null;if(!t.apiKey)throw new Error("Census: apiKey is required");["cs_live_","cs_test_","op_live_","op_test_"].some(r=>t.apiKey.startsWith(r))||console.warn('Census: API key should start with "cs_live_" or "cs_test_"'),this.apiKey=t.apiKey,this.baseUrl=t.baseUrl||Vt,this.debug=t.debug||false,this.log("Initialized with base URL:",this.baseUrl);}async identify(t){if(!t.userId)throw new Error("Census: userId is required for identify()");this.currentUserId=t.userId,await this.request("/api/sdk/identify","POST",{userId:t.userId,email:t.email,name:t.name,avatarUrl:t.avatarUrl,metadata:t.metadata,organizationId:t.organizationId,organizationName:t.organizationName,organizationDomain:t.organizationDomain,organizationPlan:t.organizationPlan}),this.log("User identified:",t.userId);}reset(){this.currentUserId=null,this.log("User identity reset");}async submitFeedback(t){let o=["feedback","bug_report","feature_request","article_rating"];if(!t.type||!o.includes(t.type))throw new Error(`Census: type must be one of: ${o.join(", ")}`);if(t.type==="article_rating"){if(t.rating===void 0&&t.helpful===void 0)throw new Error("Census: article_rating requires rating or helpful field")}else if(!t.message)throw new Error("Census: message is required for this feedback type");let r=await this.request("/api/sdk/feedback","POST",{type:t.type,message:t.message,rating:t.rating,helpful:t.helpful,userId:this.currentUserId,articleId:t.articleId,pageUrl:typeof window<"u"?window.location.href:void 0,metadata:t.metadata});return this.log("Feedback submitted:",r.feedbackId),{feedbackId:r.feedbackId}}async getArticles(t){let o=new URLSearchParams;t?.category&&o.set("category",t.category),t?.search&&o.set("search",t.search),t?.limit&&o.set("limit",String(t.limit)),t?.offset&&o.set("offset",String(t.offset));let r=o.toString(),i=`/api/sdk/articles${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched articles:",n.articles.length),n}async getArticle(t){try{let o=await this.request(`/api/sdk/articles/${encodeURIComponent(t)}`,"GET");return this.log("Fetched article:",t),o.article}catch(o){if(o.status===404)return null;throw o}}async getFeatureGroups(){let t=await this.request("/api/sdk/feature-groups","GET");return this.log("Fetched feature groups:",t.feature_groups.length),t}async getRequests(t){if(!this.currentUserId)throw new Error("Census: User must be identified before fetching requests. Call identify() first.");let o=new URLSearchParams;o.set("userId",this.currentUserId),t?.status&&o.set("status",t.status),t?.type&&o.set("type",t.type),t?.limit&&o.set("limit",String(t.limit)),t?.offset&&o.set("offset",String(t.offset));let r=await this.request(`/api/sdk/requests?${o.toString()}`,"GET");return this.log("Fetched requests:",r.requests.length),r}async track(t,o){if(!t)throw new Error("Census: eventType is required for track()");await this.request("/api/sdk/events","POST",{eventType:t,userId:this.currentUserId,properties:o}),this.log("Event tracked:",t);}async trackBatch(t){if(!t.events||t.events.length===0)throw new Error("Census: at least one event is required");if(t.events.length>100)throw new Error("Census: maximum 100 events per batch");let o=t.events.map(r=>({eventType:r.eventType,userId:this.currentUserId,articleId:r.articleId,featureId:r.featureId,properties:r.properties}));await this.request("/api/sdk/events","POST",{events:o}),this.log("Batch events tracked:",t.events.length);}async getGuides(t){let o=new URLSearchParams;t?.projectId&&o.set("project_id",t.projectId),t?.url&&o.set("url",t.url),t?.userId&&o.set("user_id",t.userId);let r=o.toString(),i=`/api/sdk/guides${r?`?${r}`:""}`,n=await this.request(i,"GET");return this.log("Fetched guides:",n.guides.length),n}async getGuide(t){try{let o=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"GET");return this.log("Fetched guide:",t),o.guide}catch(o){if(o.status===404)return null;throw o}}async createGuide(t){if(!t.name||!t.slug)throw new Error("Census: name and slug are required for createGuide()");let o=await this.request("/api/sdk/guides","POST",{name:t.name,slug:t.slug,description:t.description,project_id:t.projectId,trigger_type:t.triggerType||"manual",trigger_config:t.triggerConfig||{},theme:t.theme||{},allow_skip:t.allowSkip??true,show_progress:t.showProgress??true});return this.log("Guide created:",o.guide.id),o.guide}async updateGuide(t,o){if(!t)throw new Error("Census: guideId is required for updateGuide()");let r={};o.name!==void 0&&(r.name=o.name),o.slug!==void 0&&(r.slug=o.slug),o.description!==void 0&&(r.description=o.description),o.triggerType!==void 0&&(r.trigger_type=o.triggerType),o.triggerConfig!==void 0&&(r.trigger_config=o.triggerConfig),o.theme!==void 0&&(r.theme=o.theme),o.allowSkip!==void 0&&(r.allow_skip=o.allowSkip),o.showProgress!==void 0&&(r.show_progress=o.showProgress),o.status!==void 0&&(r.status=o.status);let i=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"PUT",r);return this.log("Guide updated:",t),i.guide}async deleteGuide(t){if(!t)throw new Error("Census: guideId is required for deleteGuide()");await this.request(`/api/sdk/guides/${encodeURIComponent(t)}`,"DELETE"),this.log("Guide deleted:",t);}async getGuideSteps(t){let o=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"GET");return this.log("Fetched steps for guide:",t),o.steps}async addGuideStep(t,o){if(!t)throw new Error("Census: guideId is required for addGuideStep()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"POST",{step_type:o.stepType||"tooltip",sort_order:o.sortOrder,selector_strategy:o.selectorStrategy||{},title:o.title,content:o.content,tooltip_position:o.tooltipPosition||"auto",rich_content:o.richContent||{},display_config:o.displayConfig||{},advance_config:o.advanceConfig||{trigger:"button"},style_config:o.styleConfig||{}});return this.log("Step added to guide:",t),r.step}async updateGuideStep(t,o,r){if(!t||!o)throw new Error("Census: guideId and stepId are required for updateGuideStep()");let i={};r.stepType!==void 0&&(i.step_type=r.stepType),r.sortOrder!==void 0&&(i.sort_order=r.sortOrder),r.selectorStrategy!==void 0&&(i.selector_strategy=r.selectorStrategy),r.title!==void 0&&(i.title=r.title),r.content!==void 0&&(i.content=r.content),r.tooltipPosition!==void 0&&(i.tooltip_position=r.tooltipPosition),r.richContent!==void 0&&(i.rich_content=r.richContent),r.displayConfig!==void 0&&(i.display_config=r.displayConfig),r.advanceConfig!==void 0&&(i.advance_config=r.advanceConfig),r.styleConfig!==void 0&&(i.style_config=r.styleConfig);let n=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps/${encodeURIComponent(o)}`,"PUT",i);return this.log("Step updated:",o),n.step}async deleteGuideStep(t,o){if(!t||!o)throw new Error("Census: guideId and stepId are required for deleteGuideStep()");await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps/${encodeURIComponent(o)}`,"DELETE"),this.log("Step deleted:",o);}async reorderGuideSteps(t,o){if(!t)throw new Error("Census: guideId is required for reorderGuideSteps()");let r=await this.request(`/api/sdk/guides/${encodeURIComponent(t)}/steps`,"PUT",{steps:o});return this.log("Steps reordered for guide:",t),r.steps}async trackGuideEvent(t){if(!t.guideId||!t.eventType||!t.sessionId)throw new Error("Census: guideId, eventType, and sessionId are required for trackGuideEvent()");await this.request("/api/sdk/guides/events","POST",{guideId:t.guideId,eventType:t.eventType,stepId:t.stepId,stepIndex:t.stepIndex,pageUrl:t.pageUrl||(typeof window<"u"?window.location.href:void 0),sessionId:t.sessionId,userId:t.userId||this.currentUserId,metadata:t.metadata}),this.log("Guide event tracked:",t.eventType,t.guideId);}async markGuideCompleted(t){if(!t)throw new Error("Census: guideId is required for markGuideCompleted()");if(!this.currentUserId)throw new Error("Census: User must be identified before marking guides complete. Call identify() first.");await this.request("/api/sdk/guides/complete","POST",{guideId:t,userId:this.currentUserId}),this.log("Guide marked completed:",t);}getCurrentUserId(){return this.currentUserId}isIdentified(){return this.currentUserId!==null}async request(t,o,r){let i=`${this.baseUrl}${t}`,n={"X-Census-Key":this.apiKey};r&&(n["Content-Type"]="application/json"),this.log(`${o} ${t}`,r);let c=await fetch(i,{method:o,headers:n,body:r?JSON.stringify(r):void 0});if(!c.ok){let d=`Request failed with status ${c.status}`;try{d=(await c.json()).error||d;}catch{}throw {error:d,status:c.status}}return c.json()}log(...t){this.debug&&console.log("[Census]",...t);}};function at(e){return new Me(e)}var De=react.createContext(null);function Yt({apiKey:e,baseUrl:t,debug:o,user:r,theme:i={},children:n}){let[c,d]=react.useState(false),[a,l]=react.useState(false),s=react.useMemo(()=>at({apiKey:e,baseUrl:t,debug:o}),[e,t,o]);react.useEffect(()=>{r?s.identify(r).then(()=>{l(true),d(true);}).catch(f=>{console.error("[Census] Failed to identify user:",f),d(true);}):d(true);},[s,r]);let p=react.useMemo(()=>({client:s,theme:i,isReady:c,isIdentified:a}),[s,i,c,a]);return jsxRuntime.jsx(De.Provider,{value:p,children:n})}function Qt(){let e=react.useContext(De);if(!e)throw new Error("useCensus must be used within a CensusProvider");return e.client}function N(){let e=react.useContext(De);if(!e)throw new Error("useCensusContext must be used within a CensusProvider");return e}function Jt(){let{client:e}=N(),[t,o]=react.useState(false),[r,i]=react.useState(null);return {identify:async d=>{o(true),i(null);try{await e.identify(d);}catch(a){throw i(a instanceof Error?a:new Error("Failed to identify user")),a}finally{o(false);}},reset:()=>{e.reset();},isIdentifying:t,isIdentified:e.isIdentified(),error:r}}function me(){let{client:e}=N(),[t,o]=react.useState(false),[r,i]=react.useState(false),[n,c]=react.useState(null),[d,a]=react.useState(null),l=react.useCallback(async p=>{o(true),i(false),c(null),a(null);try{let f=await e.submitFeedback(p);return a(f.feedbackId),i(!0),f}catch(f){let m=f instanceof Error?f:new Error("Failed to submit feedback");throw c(m),m}finally{o(false);}},[e]),s=react.useCallback(()=>{i(false),c(null),a(null);},[]);return {submitFeedback:l,reset:s,isSubmitting:t,isSuccess:r,error:n,feedbackId:d}}function be(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{c(true),a(null);try{let s=await t.getArticles(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch articles"));}finally{c(false);}},[t,e?.category,e?.search,e?.limit,e?.offset]);return react.useEffect(()=>{o&&l();},[o,l]),{articles:r?.articles||[],pagination:r?.pagination,isLoading:n,error:d,refetch:l}}function ye(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{if(!e){i(null),c(false);return}c(true),a(null);try{let s=await t.getArticle(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch article"));}finally{c(false);}},[t,e]);return react.useEffect(()=>{o&&l();},[o,l]),{article:r,isLoading:n,error:d,refetch:l}}function Oe(){let{client:e,isReady:t}=N(),[o,r]=react.useState([]),[i,n]=react.useState(true),[c,d]=react.useState(null),a=react.useCallback(async()=>{n(true),d(null);try{let l=await e.getFeatureGroups();r(l.feature_groups);}catch(l){d(l instanceof Error?l:new Error("Failed to fetch feature groups"));}finally{n(false);}},[e]);return react.useEffect(()=>{t&&a();},[t,a]),{featureGroups:o,isLoading:i,error:c,refetch:a}}function xe(e){let{client:t,isReady:o,isIdentified:r}=N(),[i,n]=react.useState(null),[c,d]=react.useState(true),[a,l]=react.useState(null),s=react.useCallback(async()=>{if(!r){n(null),d(false);return}d(true),l(null);try{let p=await t.getRequests(e);n(p);}catch(p){l(p instanceof Error?p:new Error("Failed to fetch requests"));}finally{d(false);}},[t,r,e?.status,e?.type,e?.limit,e?.offset]);return react.useEffect(()=>{o&&r&&s();},[o,r,s]),{requests:i?.requests||[],pagination:i?.pagination,isLoading:c,error:a,refetch:s}}function to(){let{client:e}=N(),t=react.useCallback(async(r,i)=>{await e.track(r,i);},[e]),o=react.useCallback(async r=>{await e.trackBatch({events:r});},[e]);return {track:t,trackBatch:o}}function oo(e){let{client:t,isReady:o}=N(),[r,i]=react.useState(null),[n,c]=react.useState(true),[d,a]=react.useState(null),l=react.useCallback(async()=>{c(true),a(null);try{let s=await t.getGuides(e);i(s);}catch(s){a(s instanceof Error?s:new Error("Failed to fetch guides"));}finally{c(false);}},[t,e?.projectId,e?.url,e?.userId]);return react.useEffect(()=>{o&&l();},[o,l]),{guides:r?.guides||[],completedGuides:r?.completedGuides||[],isLoading:n,error:d,refetch:l}}function Ne(){let{client:e,isReady:t}=N(),[o,r]=react.useState(null),[i,n]=react.useState([]),[c,d]=react.useState(false),[a,l]=react.useState(false),[s,p]=react.useState(null),[f,m]=react.useState(null),u=react.useRef(false),k=react.useCallback(async w=>{d(true),p(null);try{let x=await e.getGuide(w);return x&&(r(x),n(x.guide_steps||[]),m(x.guide_steps?.[0]?.id||null)),x}catch(x){return p(x instanceof Error?x:new Error("Failed to load guide")),null}finally{d(false);}},[e]),G=react.useCallback(async w=>{l(true),p(null);try{let x=await e.createGuide(w);return r(x),n([]),m(null),x}catch(x){throw p(x instanceof Error?x:new Error("Failed to create guide")),x}finally{l(false);}},[e]),h=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.updateGuide(o.id,w);return r(x),u.current=!1,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to update guide")),x}finally{l(false);}},[e,o]),T=react.useCallback(async()=>h({status:"published"}),[h]),R=react.useCallback(async()=>h({status:"draft"}),[h]),C=react.useCallback(async()=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{await e.deleteGuide(o.id),r(null),n([]),m(null);}catch(w){throw p(w instanceof Error?w:new Error("Failed to delete guide")),w}finally{l(false);}},[e,o]),E=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.addGuideStep(o.id,w);return n(W=>[...W,x]),m(x.id),u.current=!0,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to add step")),x}finally{l(false);}},[e,o]),v=react.useCallback(async(w,x)=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let W=await e.updateGuideStep(o.id,w,x);return n(q=>q.map(Y=>Y.id===w?W:Y)),u.current=!0,W}catch(W){throw p(W instanceof Error?W:new Error("Failed to update step")),W}finally{l(false);}},[e,o]),I=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{await e.deleteGuideStep(o.id,w),n(x=>x.filter(W=>W.id!==w)),f===w&&m(i[0]?.id||null),u.current=!0;}catch(x){throw p(x instanceof Error?x:new Error("Failed to delete step")),x}finally{l(false);}},[e,o,f,i]),g=react.useCallback(async w=>{if(!o)throw new Error("No guide loaded");l(true),p(null);try{let x=await e.reorderGuideSteps(o.id,w);return n(x),u.current=!0,x}catch(x){throw p(x instanceof Error?x:new Error("Failed to reorder steps")),x}finally{l(false);}},[e,o]),A=react.useCallback(async w=>{let x=i.findIndex(q=>q.id===w);if(x<=0)return;let W=i.map((q,Y)=>Y===x?{id:q.id,sort_order:x-1}:Y===x-1?{id:q.id,sort_order:x}:{id:q.id,sort_order:Y});return g(W)},[i,g]),D=react.useCallback(async w=>{let x=i.findIndex(q=>q.id===w);if(x<0||x>=i.length-1)return;let W=i.map((q,Y)=>Y===x?{id:q.id,sort_order:x+1}:Y===x+1?{id:q.id,sort_order:x}:{id:q.id,sort_order:Y});return g(W)},[i,g]),y=f&&i.find(w=>w.id===f)||null,P=react.useCallback(()=>{r(null),n([]),m(null),p(null),u.current=false;},[]);return {guide:o,steps:i,selectedStep:y,selectedStepId:f,isLoading:c,isSaving:a,error:s,isReady:t,hasUnsavedChanges:u.current,loadGuide:k,createGuide:G,updateGuide:h,publishGuide:T,unpublishGuide:R,deleteGuide:C,addStep:E,updateStep:v,deleteStep:I,reorderSteps:g,moveStepUp:A,moveStepDown:D,setSelectedStepId:m,reset:P}}function ro(){let{client:e,isReady:t}=N(),[o,r]=react.useState(null),[i,n]=react.useState(0),[c,d]=react.useState(false),[a,l]=react.useState([]),[s,p]=react.useState([]),f=react.useCallback((P,w=0)=>{r(P),n(w),d(true);},[]),m=react.useCallback(()=>{if(!o)return;let P=o.guide_steps||[];i<P.length-1?n(w=>w+1):(l(w=>[...w,o.id]),d(false),r(null));},[o,i]),u=react.useCallback(()=>{i>0&&n(P=>P-1);},[i]),k=react.useCallback(P=>{if(!o)return;let w=o.guide_steps||[];P>=0&&P<w.length&&n(P);},[o]),G=react.useCallback(()=>{o&&p(P=>[...P,o.id]),d(false),r(null),n(0);},[o]),h=react.useCallback(()=>{d(false);},[]),T=react.useCallback(()=>{o&&d(true);},[o]),R=react.useCallback(async(P,w)=>{let x=P.guide_steps?.[w];if(x)try{await e.track("guide_step_viewed",{guide_id:P.id,guide_name:P.name,step_id:x.id,step_index:w,step_type:x.step_type});}catch{}},[e]),C=react.useCallback(async P=>{try{await e.track("guide_completed",{guide_id:P.id,guide_name:P.name,total_steps:P.guide_steps?.length||0});}catch{}},[e]),E=react.useCallback(async(P,w)=>{try{await e.track("guide_dismissed",{guide_id:P.id,guide_name:P.name,dismissed_at_step:w,total_steps:P.guide_steps?.length||0});}catch{}},[e]),v=o?.guide_steps?.[i]||null,I=o?.guide_steps?.length||0,g=i===I-1,A=i===0,D=react.useCallback(P=>a.includes(P),[a]),y=react.useCallback(P=>s.includes(P),[s]);return {activeGuide:o,currentStep:v,currentStepIndex:i,totalSteps:I,isPlaying:c,isFirstStep:A,isLastStep:g,isReady:t,startGuide:f,nextStep:m,prevStep:u,goToStep:k,dismiss:G,pause:h,resume:T,trackStepView:R,trackGuideComplete:C,trackGuideDismiss:E,completedGuideIds:a,dismissedGuideIds:s,isGuideCompleted:D,isGuideDismissed:y}}var ie={button:{position:"fixed",padding:"12px 20px",border:"none",borderRadius:"8px",cursor:"pointer",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px",fontWeight:"500",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",transition:"transform 0.2s, box-shadow 0.2s",zIndex:9999},modal:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:1e4},modalContent:{backgroundColor:"white",borderRadius:"12px",padding:"24px",width:"100%",maxWidth:"400px",margin:"16px",boxShadow:"0 20px 50px rgba(0, 0, 0, 0.2)",fontFamily:"system-ui, -apple-system, sans-serif"},textarea:{width:"100%",padding:"10px 12px",border:"1px solid #e0e0e0",borderRadius:"6px",fontSize:"14px",marginBottom:"16px",minHeight:"100px",resize:"vertical",boxSizing:"border-box",fontFamily:"inherit"},submitButton:{width:"100%",padding:"12px",border:"none",borderRadius:"6px",cursor:"pointer",fontSize:"14px",fontWeight:"500",transition:"opacity 0.2s"},typeButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"6px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"}},no={"bottom-right":{bottom:"20px",right:"20px"},"bottom-left":{bottom:"20px",left:"20px"},"top-right":{top:"20px",right:"20px"},"top-left":{top:"20px",left:"20px"}},io={feedback:"General Feedback",bug_report:"Bug Report",feature_request:"Feature Request",article_rating:"Article Rating"},so={feedback:"\u{1F4AC}",bug_report:"\u{1F41B}",feature_request:"\u{1F4A1}",article_rating:"\u2B50"};function ao(e){return {primaryColor:e.primaryColor||"#000000",textColor:e.textColor||"#333333",backgroundColor:e.backgroundColor||"#ffffff",borderRadius:e.borderRadius||"8px",fontFamily:e.fontFamily||"system-ui, -apple-system, sans-serif"}}function lo({position:e="bottom-right",text:t="Feedback",allowedTypes:o=["feedback","bug_report","feature_request"],theme:r,onSubmit:i,onError:n,children:c}){let{theme:d}=N(),{submitFeedback:a,isSubmitting:l,isSuccess:s,reset:p}=me(),[f,m]=react.useState(false),[u,k]=react.useState(o[0]),[G,h]=react.useState(""),T={...d,...r},R=ao(T),C=react.useCallback(()=>{m(true),p();},[p]),E=react.useCallback(()=>{m(false),h(""),k(o[0]);},[o]),v=react.useCallback(async I=>{I.preventDefault();let g={type:u,message:G};try{await a(g),i?.(g),setTimeout(E,1500);}catch(A){n?.(A instanceof Error?A:new Error("Failed to submit feedback"));}},[u,G,a,i,n,E]);return c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{onClick:C,style:{cursor:"pointer"},children:c}),f&&jsxRuntime.jsx(ct,{isOpen:f,onClose:E,selectedType:u,onTypeChange:k,allowedTypes:o,message:G,onMessageChange:h,onSubmit:v,isSubmitting:l,isSuccess:s,themeStyles:R})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{onClick:C,style:{...ie.button,...no[e],backgroundColor:R.primaryColor,color:"white",borderRadius:R.borderRadius,fontFamily:R.fontFamily},"aria-label":"Open feedback form",children:t}),f&&jsxRuntime.jsx(ct,{isOpen:f,onClose:E,selectedType:u,onTypeChange:k,allowedTypes:o,message:G,onMessageChange:h,onSubmit:v,isSubmitting:l,isSuccess:s,themeStyles:R})]})}function ct({isOpen:e,onClose:t,selectedType:o,onTypeChange:r,allowedTypes:i,message:n,onMessageChange:c,onSubmit:d,isSubmitting:a,isSuccess:l,themeStyles:s}){return e?l?jsxRuntime.jsx("div",{style:ie.modal,onClick:t,children:jsxRuntime.jsxs("div",{style:{...ie.modalContent,textAlign:"center",fontFamily:s.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"\u{1F389}"}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",color:s.textColor},children:"Thanks for your feedback!"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#666"},children:"We appreciate you taking the time to share."})]})}):jsxRuntime.jsx("div",{style:ie.modal,onClick:t,children:jsxRuntime.jsxs("div",{style:{...ie.modalContent,fontFamily:s.fontFamily},onClick:p=>p.stopPropagation(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[jsxRuntime.jsx("h3",{style:{margin:0,color:s.textColor},children:"Send Feedback"}),jsxRuntime.jsx("button",{onClick:t,style:{background:"none",border:"none",fontSize:"24px",cursor:"pointer",color:"#999",padding:"0",lineHeight:"1"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("form",{onSubmit:d,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"16px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"What kind of feedback?"}),jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap"},children:i.map(p=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>r(p),style:{...ie.typeButton,backgroundColor:o===p?s.primaryColor:"white",color:o===p?"white":s.textColor,borderColor:o===p?s.primaryColor:"#e0e0e0"},children:[so[p]," ",io[p]]},p))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"8px",fontSize:"13px",color:"#666",fontWeight:"500"},children:"Your message"}),jsxRuntime.jsx("textarea",{value:n,onChange:p=>c(p.target.value),placeholder:o==="bug_report"?"Describe the bug and steps to reproduce...":o==="feature_request"?"Describe the feature you would like...":"Share your thoughts...",style:ie.textarea,required:true})]}),jsxRuntime.jsx("button",{type:"submit",disabled:a||!n.trim(),style:{...ie.submitButton,backgroundColor:s.primaryColor,color:"white",opacity:a||!n.trim()?.6:1,cursor:a||!n.trim()?"not-allowed":"pointer"},children:a?"Sending...":"Send Feedback"})]})]})}):null}var M={container:{fontFamily:"system-ui, -apple-system, sans-serif",maxWidth:"800px"},searchInput:{width:"100%",padding:"12px 16px",border:"1px solid #e0e0e0",borderRadius:"8px",fontSize:"15px",marginBottom:"24px",boxSizing:"border-box"},categoryButton:{padding:"8px 16px",border:"1px solid #e0e0e0",borderRadius:"20px",cursor:"pointer",fontSize:"13px",backgroundColor:"white",transition:"all 0.2s",marginRight:"8px",marginBottom:"8px"},articleCard:{padding:"20px",border:"1px solid #e0e0e0",borderRadius:"8px",marginBottom:"12px",cursor:"pointer",transition:"box-shadow 0.2s, border-color 0.2s",backgroundColor:"white"},articleTitle:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:"600"},articleDescription:{margin:0,fontSize:"14px",color:"#666",lineHeight:1.5},articleMeta:{display:"flex",gap:"16px",marginTop:"12px",fontSize:"12px",color:"#999"},backButton:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"8px 0",border:"none",background:"none",cursor:"pointer",fontSize:"14px",color:"#666",marginBottom:"16px"},articleContent:{lineHeight:1.7,fontSize:"15px"},loading:{textAlign:"center",padding:"40px",color:"#666"},error:{padding:"20px",backgroundColor:"#fef2f2",borderRadius:"8px",color:"#b91c1c",textAlign:"center"},empty:{textAlign:"center",padding:"40px",color:"#666"}};function po(e){return {primaryColor:e.primaryColor||"#000000",textColor:e.textColor||"#333333",backgroundColor:e.backgroundColor||"#ffffff",borderRadius:e.borderRadius||"8px",fontFamily:e.fontFamily||"system-ui, -apple-system, sans-serif"}}function uo({showSearch:e=true,showCategories:t=true,defaultCategory:o,theme:r,className:i,onArticleView:n}){let{theme:c}=N(),[d,a]=react.useState(""),[l,s]=react.useState(o),[p,f]=react.useState(null),m={...c,...r},u=po(m),{articles:k,isLoading:G,error:h}=be({category:l,search:d||void 0}),{article:T,isLoading:R,error:C}=ye(p||""),E=react.useMemo(()=>{let g=new Set;return k.forEach(A=>{A.category&&g.add(A.category);}),Array.from(g).sort()},[k]),v=g=>{f(g.slug),n?.(g);},I=()=>{f(null);};return p?R?jsxRuntime.jsx("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:jsxRuntime.jsx("div",{style:M.loading,children:"Loading article..."})}):C?jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:M.error,children:"Failed to load article. Please try again."})]}):T?jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsxs("article",{children:[jsxRuntime.jsx("h1",{style:{margin:"0 0 16px 0",color:u.textColor},children:T.title}),T.read_time_minutes&&jsxRuntime.jsxs("div",{style:{fontSize:"14px",color:"#666",marginBottom:"24px"},children:[T.read_time_minutes," min read"]}),T.content_html?jsxRuntime.jsx("div",{style:{...M.articleContent,color:u.textColor},dangerouslySetInnerHTML:{__html:T.content_html}}):jsxRuntime.jsx("div",{style:{...M.articleContent,color:u.textColor},children:typeof T.content=="string"?T.content:"No content available."})]})]}):jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[jsxRuntime.jsx("button",{onClick:I,style:M.backButton,children:"\u2190 Back to articles"}),jsxRuntime.jsx("div",{style:M.empty,children:"Article not found."})]}):jsxRuntime.jsxs("div",{style:{...M.container,fontFamily:u.fontFamily},className:i,children:[e&&jsxRuntime.jsx("input",{type:"text",placeholder:"Search articles...",value:d,onChange:g=>a(g.target.value),style:M.searchInput}),t&&E.length>0&&jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("button",{onClick:()=>s(void 0),style:{...M.categoryButton,backgroundColor:l?"white":u.primaryColor,color:l?u.textColor:"white",borderColor:l?"#e0e0e0":u.primaryColor},children:"All"}),E.map(g=>jsxRuntime.jsx("button",{onClick:()=>s(g),style:{...M.categoryButton,backgroundColor:l===g?u.primaryColor:"white",color:l===g?"white":u.textColor,borderColor:l===g?u.primaryColor:"#e0e0e0"},children:g},g))]}),G&&jsxRuntime.jsx("div",{style:M.loading,children:"Loading articles..."}),h&&jsxRuntime.jsx("div",{style:M.error,children:"Failed to load articles. Please try again."}),!G&&!h&&k.length===0&&jsxRuntime.jsx("div",{style:M.empty,children:d?`No articles found for "${d}"`:"No articles available yet."}),!G&&!h&&k.length>0&&jsxRuntime.jsx("div",{children:k.map(g=>jsxRuntime.jsxs("div",{onClick:()=>v(g),style:M.articleCard,role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&v(g);},children:[jsxRuntime.jsx("h3",{style:{...M.articleTitle,color:u.textColor},children:g.title}),g.seo_description&&jsxRuntime.jsx("p",{style:M.articleDescription,children:g.seo_description}),jsxRuntime.jsxs("div",{style:M.articleMeta,children:[g.category&&jsxRuntime.jsx("span",{children:g.category}),g.read_time_minutes&&jsxRuntime.jsxs("span",{children:[g.read_time_minutes," min read"]})]})]},g.id))})]})}var K={container:{fontFamily:"system-ui, -apple-system, sans-serif"},list:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:"12px"},card:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",backgroundColor:"#ffffff",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},cardHover:{borderColor:"#d1d5db",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",marginBottom:"8px"},badges:{display:"flex",alignItems:"center",gap:"6px"},badge:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"9999px",fontSize:"12px",fontWeight:500},message:{fontSize:"14px",color:"#111827",margin:0,lineHeight:1.5},meta:{display:"flex",gap:"12px",marginTop:"8px",fontSize:"12px",color:"#6b7280"},empty:{textAlign:"center",padding:"32px 16px",color:"#6b7280"},emptyIcon:{width:"48px",height:"48px",margin:"0 auto 12px",color:"#d1d5db"},loading:{textAlign:"center",padding:"24px",color:"#6b7280"},error:{textAlign:"center",padding:"24px",color:"#dc2626"}},ut={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},ft={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},reviewed:{label:"Reviewed",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function mo(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function bo({status:e,type:t,limit:o=50,className:r,showEmptyState:i=true,onRequestClick:n}){let{isIdentified:c}=N(),[d,a]=react.useState(null),{requests:l,isLoading:s,error:p,refetch:f}=xe({status:e,type:t,limit:o}),m=react.useCallback(u=>{n?.(u);},[n]);return c?s?jsxRuntime.jsx("div",{style:K.loading,children:jsxRuntime.jsx("p",{children:"Loading requests..."})}):p?jsxRuntime.jsx("div",{style:K.error,children:jsxRuntime.jsxs("p",{children:["Failed to load requests. ",jsxRuntime.jsx("button",{onClick:f,style:{color:"inherit",textDecoration:"underline",background:"none",border:"none",cursor:"pointer"},children:"Try again"})]})}):l.length===0&&i?jsxRuntime.jsxs("div",{style:K.empty,children:[jsxRuntime.jsx("svg",{style:K.emptyIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),jsxRuntime.jsx("p",{style:{margin:0,fontWeight:500,color:"#111827"},children:"No requests yet"}),jsxRuntime.jsx("p",{style:{margin:"8px 0 0",fontSize:"14px"},children:"When you submit feedback, bug reports, or feature requests, they'll appear here."})]}):jsxRuntime.jsx("div",{style:K.container,className:r,children:jsxRuntime.jsx("ul",{style:K.list,children:l.map(u=>{let k=ut[u.feedback_type]||ut.feedback,G=ft[u.status]||ft.new,h=d===u.id;return jsxRuntime.jsxs("li",{style:{...K.card,...h?K.cardHover:{}},onMouseEnter:()=>a(u.id),onMouseLeave:()=>a(null),onClick:()=>m(u),role:"button",tabIndex:0,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&m(u);},children:[jsxRuntime.jsx("div",{style:K.header,children:jsxRuntime.jsxs("div",{style:K.badges,children:[jsxRuntime.jsx("span",{style:{...K.badge,color:k.color,backgroundColor:k.bg},children:k.label}),jsxRuntime.jsx("span",{style:{...K.badge,color:G.color,backgroundColor:G.bg},children:G.label})]})}),jsxRuntime.jsx("p",{style:K.message,children:u.message||"No message provided"}),jsxRuntime.jsxs("div",{style:K.meta,children:[jsxRuntime.jsx("span",{children:mo(u.created_at)}),u.page_url&&jsxRuntime.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"},children:["From: ",u.page_url]})]})]},u.id)})})}):i?jsxRuntime.jsx("div",{style:K.empty,children:jsxRuntime.jsx("p",{children:"Please sign in to view your requests."})}):null}var ho={articles:"Documentation",requests:"My Requests"},mt={feedback:{label:"Feedback",color:"#2563eb",bg:"#dbeafe"},bug_report:{label:"Bug Report",color:"#dc2626",bg:"#fee2e2"},feature_request:{label:"Feature Request",color:"#d97706",bg:"#fef3c7"},article_rating:{label:"Article Rating",color:"#7c3aed",bg:"#ede9fe"}},bt={new:{label:"New",color:"#6b7280",bg:"#f3f4f6"},planned:{label:"Planned",color:"#2563eb",bg:"#dbeafe"},in_progress:{label:"In Progress",color:"#d97706",bg:"#fef3c7"},resolved:{label:"Resolved",color:"#059669",bg:"#d1fae5"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}};function vo(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}var So=[{value:"feedback",label:"Feedback"},{value:"bug_report",label:"Bug"},{value:"feature_request",label:"Feature"}],Co=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),yt=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"})}),xt=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),wo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),ko=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"})}),Ro=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),Go=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),To=()=>jsxRuntime.jsx("svg",{width:"48",height:"48",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z"})}),Eo=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),je=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",style:{animation:"spin 1s linear infinite"},children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),ht={light:{primary:"#c45a2c",primaryHover:"#a84a24",primaryLight:"rgba(196, 90, 44, 0.08)",primaryLightHover:"rgba(196, 90, 44, 0.15)",background:"transparent",surface:"#ffffff",surfaceHover:"#fafafa",border:"rgba(0, 0, 0, 0.08)",borderHover:"rgba(196, 90, 44, 0.25)",text:"#1a1a1a",textSecondary:"#525252",textMuted:"#737373",textLight:"#a3a3a3"},dark:{primary:"#e07347",primaryHover:"#f08a5d",primaryLight:"rgba(224, 115, 71, 0.12)",primaryLightHover:"rgba(224, 115, 71, 0.2)",background:"transparent",surface:"rgba(255, 255, 255, 0.03)",surfaceHover:"rgba(255, 255, 255, 0.06)",border:"rgba(255, 255, 255, 0.08)",borderHover:"rgba(224, 115, 71, 0.35)",text:"#fafafa",textSecondary:"#d4d4d4",textMuted:"#a3a3a3",textLight:"#737373"}},Io=e=>({container:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',minHeight:"400px",color:e.text},grid:{display:"grid",gridTemplateColumns:"220px 1fr",gap:"40px"},sidebar:{position:"sticky",top:"24px",height:"fit-content"},main:{minWidth:0},tabs:{display:"flex",borderBottom:`1px solid ${e.border}`,marginBottom:"28px",gap:"0"},tab:{padding:"10px 20px",fontSize:"14px",fontWeight:500,border:"none",borderBottom:"2px solid transparent",cursor:"pointer",transition:"all 0.15s",backgroundColor:"transparent",color:e.textMuted,marginBottom:"-1px"},tabActive:{color:e.primary,borderBottomColor:e.primary},searchContainer:{position:"relative",marginBottom:"20px"},searchIcon:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:e.textLight},searchInput:{width:"100%",padding:"8px 10px 8px 32px",fontSize:"13px",border:`1px solid ${e.border}`,borderRadius:"6px",outline:"none",backgroundColor:"transparent",color:e.text,boxSizing:"border-box"},sectionTitle:{fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:e.textLight,marginBottom:"8px",marginTop:"20px"},navList:{listStyle:"none",padding:0,margin:0},navItem:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",fontSize:"13px",color:e.textSecondary,backgroundColor:"transparent",border:"none",borderRadius:"6px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},navItemActive:{backgroundColor:e.surfaceHover,color:e.text,fontWeight:500},subNav:{marginLeft:"20px",marginTop:"2px",paddingLeft:"10px",borderLeft:`1px solid ${e.border}`},articleGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px"},articleCard:{display:"flex",alignItems:"flex-start",gap:"12px",padding:"14px",border:`1px solid ${e.border}`,borderRadius:"8px",backgroundColor:e.surface,cursor:"pointer",transition:"all 0.2s ease",textAlign:"left"},articleIcon:{flexShrink:0,width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.primaryLight,borderRadius:"8px",color:e.primary,transition:"background-color 0.2s"},articleContent:{flex:1,minWidth:0},articleTitle:{fontSize:"14px",fontWeight:500,color:e.text,margin:0,lineHeight:1.4},articleDesc:{fontSize:"12px",color:e.textMuted,margin:"4px 0 0",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",lineHeight:1.5},articleMeta:{fontSize:"11px",color:e.textLight,marginTop:"6px"},articleChevron:{flexShrink:0,color:e.textLight,transition:"color 0.2s"},backButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"6px 0",fontSize:"13px",color:e.textMuted,backgroundColor:"transparent",border:"none",cursor:"pointer",marginBottom:"20px",transition:"color 0.15s"},articleDetail:{maxWidth:"720px"},articleDetailTitle:{fontSize:"28px",fontWeight:600,color:e.text,margin:0,lineHeight:1.3},articleDetailMeta:{display:"flex",alignItems:"center",gap:"6px",fontSize:"13px",color:e.textMuted,marginTop:"10px"},articleDetailContent:{marginTop:"28px",fontSize:"15px",lineHeight:1.7,color:e.textSecondary},emptyState:{textAlign:"center",padding:"48px 24px",color:e.textMuted},emptyIcon:{color:e.textLight,marginBottom:"12px",opacity:.5},emptyTitle:{fontSize:"16px",fontWeight:500,color:e.text,margin:"0 0 6px"},emptyText:{fontSize:"13px",margin:0,color:e.textMuted},loading:{display:"flex",alignItems:"center",justifyContent:"center",gap:"10px",padding:"48px",color:e.textMuted,fontSize:"13px"},requestCard:{border:`1px solid ${e.border}`,borderRadius:"8px",padding:"16px",backgroundColor:e.surface,marginBottom:"10px",transition:"border-color 0.2s"},requestHeader:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"},badge:{display:"inline-flex",alignItems:"center",padding:"3px 8px",borderRadius:"9999px",fontSize:"11px",fontWeight:500},requestMessage:{fontSize:"14px",color:e.text,margin:0,lineHeight:1.5},requestMeta:{display:"flex",gap:"12px",marginTop:"10px",fontSize:"12px",color:e.textMuted},form:{padding:"16px",backgroundColor:e.surface,borderRadius:"8px",border:`1px solid ${e.border}`,marginBottom:"20px"},formHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},formTitle:{fontSize:"14px",fontWeight:500,color:e.text,margin:0},typeSelector:{display:"flex",gap:"6px",marginBottom:"12px"},typeButton:{padding:"6px 12px",borderRadius:"6px",border:`1px solid ${e.border}`,backgroundColor:"transparent",color:e.textSecondary,fontSize:"13px",cursor:"pointer",transition:"all 0.15s",fontWeight:500},typeButtonActive:{backgroundColor:e.primary,borderColor:e.primary,color:"#ffffff"},textarea:{width:"100%",padding:"10px 12px",borderRadius:"6px",border:`1px solid ${e.border}`,fontSize:"13px",resize:"vertical",minHeight:"80px",fontFamily:"inherit",marginBottom:"12px",boxSizing:"border-box",backgroundColor:"transparent",color:e.text},submitButton:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:e.primary,color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer",transition:"all 0.15s"},newRequestButton:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:e.primary,color:"#ffffff",fontSize:"13px",fontWeight:500,cursor:"pointer",marginBottom:"20px",transition:"background-color 0.15s"},successMessage:{padding:"12px 14px",backgroundColor:"rgba(5, 150, 105, 0.1)",borderRadius:"6px",color:"#059669",fontSize:"13px",marginBottom:"12px",fontWeight:500}}),Po=(e,t)=>`
2
+ @keyframes spin {
3
+ from { transform: rotate(0deg); }
4
+ to { transform: rotate(360deg); }
5
+ }
6
+
7
+ .census-hc .census-article-card:hover {
8
+ border-color: ${e.borderHover} !important;
9
+ box-shadow: ${t?"0 4px 12px rgba(0, 0, 0, 0.3)":"0 4px 12px rgba(0, 0, 0, 0.06)"};
10
+ }
11
+
12
+ .census-hc .census-article-card:hover .census-article-icon {
13
+ background-color: ${e.primaryLightHover} !important;
14
+ }
15
+
16
+ .census-hc .census-article-card:hover .census-article-chevron {
17
+ color: ${e.textSecondary} !important;
18
+ }
19
+
20
+ .census-hc .census-nav-item:hover {
21
+ background-color: ${e.surfaceHover} !important;
22
+ color: ${e.text} !important;
23
+ }
24
+
25
+ .census-hc .census-back-btn:hover {
26
+ color: ${e.text} !important;
27
+ }
28
+
29
+ .census-hc .census-submit-btn:hover {
30
+ background-color: ${e.primaryHover} !important;
31
+ }
32
+
33
+ .census-hc .census-new-request-btn:hover {
34
+ background-color: ${e.primaryHover} !important;
35
+ }
36
+
37
+ .census-hc .census-tab:hover {
38
+ color: ${e.text} !important;
39
+ }
40
+
41
+ .census-hc .census-search-input:focus {
42
+ border-color: ${e.primary} !important;
43
+ outline: none !important;
44
+ box-shadow: 0 0 0 1px ${e.primary} !important;
45
+ }
46
+
47
+ .census-hc .census-search-input::placeholder {
48
+ color: ${e.textLight};
49
+ }
50
+
51
+ .census-hc .census-textarea::placeholder {
52
+ color: ${e.textLight};
53
+ }
54
+ `;function _o({tabs:e=["articles","requests"],defaultTab:t="articles",tabLabels:o={},showSearch:r=true,className:i,theme:n="auto"}){let[c,d]=react.useState(t),[a,l]=react.useState(""),[s,p]=react.useState(null),[f,m]=react.useState(new Set),[u,k]=react.useState(null),[G,h]=react.useState(false),[T,R]=react.useState("feedback"),[C,E]=react.useState(""),v=react.useRef(null),[I,g]=react.useState(false);react.useEffect(()=>{if(n==="auto"){let S=window.matchMedia("(prefers-color-scheme: dark)");g(S.matches);let O=J=>g(J.matches);return S.addEventListener("change",O),()=>S.removeEventListener("change",O)}},[n]);let A=n==="dark"||n==="auto"&&I,D=A?ht.dark:ht.light,y=react.useMemo(()=>Io(D),[D]),P=react.useMemo(()=>Po(D,A),[D,A]),{isIdentified:w}=N(),{articles:x,isLoading:W}=be({search:a||void 0}),{article:q,isLoading:Y}=ye(s?.slug||""),{requests:tt,isLoading:qt,refetch:ot}=xe({limit:50}),{featureGroups:rt,isLoading:Mt}=Oe(),{submitFeedback:nt,isSubmitting:fe,isSuccess:Dt,reset:it}=me(),Ot={...ho,...o};react.useEffect(()=>{let S=O=>{(O.metaKey||O.ctrlKey)&&O.key==="k"&&(O.preventDefault(),v.current?.focus());};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[]);let Nt=S=>{m(O=>{let J=new Set(O);return J.has(S)?J.delete(S):J.add(S),J});},st=react.useMemo(()=>x.filter(S=>!u||S.feature_id===u),[x,u]),Ut=react.useCallback(async S=>{if(S.preventDefault(),!(!C.trim()||fe))try{await nt({type:T,message:C}),E(""),h(!1),setTimeout(()=>{ot(),it();},500);}catch{}},[T,C,fe,nt,ot,it]),Wt=()=>Y||!q?jsxRuntime.jsxs("div",{style:y.loading,children:[jsxRuntime.jsx(je,{}),jsxRuntime.jsx("span",{children:"Loading article..."})]}):jsxRuntime.jsxs("div",{style:y.articleDetail,children:[jsxRuntime.jsxs("button",{onClick:()=>p(null),style:y.backButton,className:"census-back-btn",children:[jsxRuntime.jsx(ko,{}),"Back to articles"]}),jsxRuntime.jsx("h1",{style:y.articleDetailTitle,children:q.title}),q.read_time_minutes&&jsxRuntime.jsxs("div",{style:y.articleDetailMeta,children:[jsxRuntime.jsx(Ro,{}),q.read_time_minutes," min read"]}),q.content_html?jsxRuntime.jsx("div",{style:y.articleDetailContent,dangerouslySetInnerHTML:{__html:q.content_html}}):jsxRuntime.jsx("p",{style:{...y.articleDetailContent,color:"#6b7280"},children:"No content available."})]}),Ht=()=>s?Wt():W||Mt?jsxRuntime.jsxs("div",{style:y.loading,children:[jsxRuntime.jsx(je,{}),jsxRuntime.jsx("span",{children:"Loading..."})]}):st.length===0?jsxRuntime.jsxs("div",{style:y.emptyState,children:[jsxRuntime.jsx("div",{style:y.emptyIcon,children:jsxRuntime.jsx(yt,{})}),jsxRuntime.jsx("h3",{style:y.emptyTitle,children:"No articles found"}),jsxRuntime.jsx("p",{style:y.emptyText,children:a?`No results for "${a}"`:"No documentation articles available yet."})]}):jsxRuntime.jsx("div",{style:y.articleGrid,children:st.map(S=>jsxRuntime.jsxs("button",{onClick:()=>p(S),style:y.articleCard,className:"census-article-card",children:[jsxRuntime.jsx("div",{style:y.articleIcon,className:"census-article-icon",children:jsxRuntime.jsx(yt,{})}),jsxRuntime.jsxs("div",{style:y.articleContent,children:[jsxRuntime.jsx("h3",{style:y.articleTitle,children:S.title}),S.seo_description&&jsxRuntime.jsx("p",{style:y.articleDesc,children:S.seo_description}),S.read_time_minutes&&jsxRuntime.jsxs("p",{style:y.articleMeta,children:[S.read_time_minutes," min read"]})]}),jsxRuntime.jsx("span",{style:y.articleChevron,className:"census-article-chevron",children:jsxRuntime.jsx(xt,{})})]},S.id))}),$t=()=>Dt?jsxRuntime.jsx("div",{style:y.successMessage,children:"Thanks for your feedback! It has been submitted."}):G?jsxRuntime.jsxs("form",{onSubmit:Ut,style:y.form,children:[jsxRuntime.jsxs("div",{style:y.formHeader,children:[jsxRuntime.jsx("p",{style:y.formTitle,children:"Submit a request"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>h(false),style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",fontSize:"18px"},children:"\xD7"})]}),jsxRuntime.jsx("div",{style:y.typeSelector,children:So.map(S=>jsxRuntime.jsx("button",{type:"button",onClick:()=>R(S.value),style:{...y.typeButton,...T===S.value?y.typeButtonActive:{}},children:S.label},S.value))}),jsxRuntime.jsx("textarea",{value:C,onChange:S=>E(S.target.value),placeholder:"Describe your request...",style:y.textarea,className:"census-textarea",required:true}),jsxRuntime.jsx("button",{type:"submit",style:{...y.submitButton,opacity:fe?.6:1},disabled:fe,className:"census-submit-btn",children:fe?"Submitting...":"Submit"})]}):jsxRuntime.jsxs("button",{onClick:()=>h(true),style:y.newRequestButton,className:"census-new-request-btn",children:[jsxRuntime.jsx(Eo,{}),"New Request"]}),jt=()=>w?qt?jsxRuntime.jsxs("div",{style:y.loading,children:[jsxRuntime.jsx(je,{}),jsxRuntime.jsx("span",{children:"Loading requests..."})]}):jsxRuntime.jsxs("div",{children:[$t(),tt.length===0?jsxRuntime.jsxs("div",{style:y.emptyState,children:[jsxRuntime.jsx("div",{style:y.emptyIcon,children:jsxRuntime.jsx(To,{})}),jsxRuntime.jsx("h3",{style:y.emptyTitle,children:"No requests yet"}),jsxRuntime.jsx("p",{style:y.emptyText,children:"Submit your first request above."})]}):jsxRuntime.jsx("div",{children:tt.map(S=>{let O=mt[S.feedback_type]||mt.feedback,J=bt[S.status]||bt.new;return jsxRuntime.jsxs("div",{style:y.requestCard,children:[jsxRuntime.jsxs("div",{style:{...y.requestHeader,flexWrap:"wrap"},children:[jsxRuntime.jsx("span",{style:{...y.badge,color:O.color,backgroundColor:O.bg},children:O.label}),jsxRuntime.jsx("span",{style:{...y.badge,color:J.color,backgroundColor:J.bg},children:J.label}),S.feature_group&&jsxRuntime.jsx("span",{style:{...y.badge,color:S.feature_group.color||"#6b7280",backgroundColor:S.feature_group.color?`${S.feature_group.color}20`:"#f3f4f6",border:`1px solid ${S.feature_group.color||"#e5e7eb"}`},children:S.feature_group.name}),S.feature&&jsxRuntime.jsx("span",{style:{...y.badge,color:"#374151",backgroundColor:"#f3f4f6",border:"1px solid #e5e7eb"},children:S.feature.name})]}),jsxRuntime.jsx("p",{style:y.requestMessage,children:S.message||"No message provided"}),jsxRuntime.jsx("div",{style:y.requestMeta,children:jsxRuntime.jsx("span",{children:vo(S.created_at)})})]},S.id)})})]}):jsxRuntime.jsx("div",{style:y.emptyState,children:jsxRuntime.jsx("p",{style:y.emptyText,children:"Please sign in to view your requests."})});return jsxRuntime.jsxs("div",{style:y.container,className:`census-hc ${i||""}`,children:[jsxRuntime.jsx("style",{children:P}),e.length>1&&jsxRuntime.jsx("div",{style:y.tabs,children:e.map(S=>jsxRuntime.jsx("button",{onClick:()=>d(S),style:{...y.tab,...c===S?y.tabActive:{}},className:c!==S?"census-tab":void 0,children:Ot[S]},S))}),jsxRuntime.jsxs("div",{style:y.grid,children:[jsxRuntime.jsxs("aside",{style:y.sidebar,children:[r&&c==="articles"&&jsxRuntime.jsxs("div",{style:y.searchContainer,children:[jsxRuntime.jsx("div",{style:y.searchIcon,children:jsxRuntime.jsx(Co,{})}),jsxRuntime.jsx("input",{ref:v,type:"text",placeholder:"Search...",value:a,onChange:S=>l(S.target.value),style:y.searchInput,className:"census-search-input"})]}),c==="articles"&&rt.length>0&&jsxRuntime.jsxs("nav",{children:[jsxRuntime.jsx("h3",{style:y.sectionTitle,children:"Features"}),jsxRuntime.jsxs("ul",{style:y.navList,children:[jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{onClick:()=>k(null),style:{...y.navItem,...u?{}:y.navItemActive},className:u?"census-nav-item":void 0,children:"All Articles"})}),rt.map(S=>jsxRuntime.jsxs("li",{children:[jsxRuntime.jsxs("button",{onClick:()=>Nt(S.id),style:y.navItem,className:"census-nav-item",children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(Go,{}),S.name]}),f.has(S.id)?jsxRuntime.jsx(wo,{}):jsxRuntime.jsx(xt,{})]}),f.has(S.id)&&S.features.length>0&&jsxRuntime.jsx("ul",{style:y.subNav,children:S.features.map(O=>jsxRuntime.jsx("li",{children:jsxRuntime.jsx("button",{onClick:()=>k(O.id),style:{...y.navItem,padding:"6px 12px",fontSize:"13px",...u===O.id?y.navItemActive:{}},className:u!==O.id?"census-nav-item":void 0,children:O.name})},O.id))})]},S.id))]})]})]}),jsxRuntime.jsxs("main",{style:y.main,children:[c==="articles"&&Ht(),c==="requests"&&jt()]})]})]})}var vt={tooltip:"Tooltip",modal:"Modal",slideout:"Slideout",hotspot:"Hotspot",banner:"Banner"},Lo={tooltip:"Points to a specific element with an arrow",modal:"Centered overlay that grabs attention",slideout:"Slides in from the side of the screen",hotspot:"Pulsing beacon that expands on click",banner:"Top or bottom bar announcement"},Fo=[{value:"auto",label:"Auto"},{value:"top",label:"Top"},{value:"bottom",label:"Bottom"},{value:"left",label:"Left"},{value:"right",label:"Right"}],zo=[{value:"button",label:"Button click"},{value:"click",label:"Click anywhere"},{value:"delay",label:"After delay"},{value:"form-submit",label:"Form submit"}];function St({step:e,onUpdate:t,onSelectElement:o,isSelectingElement:r}){let[i,n]=react.useState(false),[c,d]=react.useState(e.step_type),[a,l]=react.useState(e.rich_content?.title||e.title||""),[s,p]=react.useState(e.rich_content?.body||e.content||""),[f,m]=react.useState(e.tooltip_position||e.display_config?.position||"auto"),[u,k]=react.useState(e.selector_strategy?.css||""),[G,h]=react.useState(e.display_config?.backdrop!==false),[T,R]=react.useState(e.advance_config?.trigger||"button"),[C,E]=react.useState(e.advance_config?.delay||3e3),v=react.useCallback(async()=>{n(true);try{let g=u?{css:u}:void 0,A={title:a||void 0,body:s||void 0},D={position:f!=="auto"?f:void 0,backdrop:G},y={trigger:T,delay:T==="delay"?C:void 0};await t(e.id,{stepType:c,selectorStrategy:g,richContent:A,displayConfig:D,advanceConfig:y,tooltipPosition:f});}finally{n(false);}},[e.id,c,a,s,f,u,G,T,C,t]),I=c==="tooltip"||c==="hotspot";return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[jsxRuntime.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid #e5e7eb",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsx("span",{style:{fontWeight:500},children:"Edit Step"}),jsxRuntime.jsx("button",{onClick:v,disabled:i,style:{padding:"6px 12px",fontSize:"13px",border:"none",borderRadius:"4px",backgroundColor:"#2563eb",color:"white",cursor:i?"wait":"pointer",opacity:i?.7:1},children:i?"Saving...":"Save Changes"})]}),jsxRuntime.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Step Type"}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"8px"},children:Object.keys(vt).map(g=>jsxRuntime.jsxs("button",{onClick:()=>d(g),style:{padding:"10px",border:`2px solid ${c===g?"#2563eb":"#e5e7eb"}`,borderRadius:"6px",backgroundColor:c===g?"#eff6ff":"white",cursor:"pointer",textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:vt[g]}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"#6b7280",marginTop:"2px"},children:Lo[g]})]},g))})]}),I&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Target Element"}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsx("input",{type:"text",value:u,onChange:g=>k(g.target.value),placeholder:"CSS selector (e.g., #my-button)",style:{flex:1,padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",fontFamily:"monospace"}}),jsxRuntime.jsx("button",{onClick:o,disabled:r,style:{padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:r?"#f3f4f6":"white",cursor:r?"wait":"pointer"},children:r?"Selecting...":"Select"})]}),jsxRuntime.jsx("p",{style:{fontSize:"11px",color:"#6b7280",marginTop:"4px"},children:'Click "Select" to pick an element on the page, or enter a CSS selector manually'})]}),jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Title"}),jsxRuntime.jsx("input",{type:"text",value:a,onChange:g=>l(g.target.value),placeholder:"Enter step title",style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px"}})]}),jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Content"}),jsxRuntime.jsx("textarea",{value:s,onChange:g=>p(g.target.value),placeholder:"Enter step content (HTML supported)",rows:4,style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",resize:"vertical",fontFamily:"inherit"}})]}),(c==="tooltip"||c==="hotspot")&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Position"}),jsxRuntime.jsx("select",{value:f,onChange:g=>m(g.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:Fo.map(g=>jsxRuntime.jsx("option",{value:g.value,children:g.label},g.value))})]}),c==="banner"&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Banner Position"}),jsxRuntime.jsxs("select",{value:f==="bottom"?"bottom":"top",onChange:g=>m(g.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:[jsxRuntime.jsx("option",{value:"top",children:"Top"}),jsxRuntime.jsx("option",{value:"bottom",children:"Bottom"})]})]}),c==="slideout"&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Slideout Side"}),jsxRuntime.jsxs("select",{value:f==="left"?"left":"right",onChange:g=>m(g.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:[jsxRuntime.jsx("option",{value:"right",children:"Right"}),jsxRuntime.jsx("option",{value:"left",children:"Left"})]})]}),(c==="tooltip"||c==="modal")&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[jsxRuntime.jsx("input",{type:"checkbox",checked:G,onChange:g=>h(g.target.checked),style:{width:"16px",height:"16px"}}),jsxRuntime.jsx("span",{style:{fontSize:"13px",fontWeight:500},children:"Show backdrop overlay"})]}),jsxRuntime.jsx("p",{style:{fontSize:"11px",color:"#6b7280",marginTop:"4px",marginLeft:"24px"},children:"Dims the background to focus attention on the step"})]}),jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Advance When"}),jsxRuntime.jsx("select",{value:T,onChange:g=>R(g.target.value),style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white"},children:zo.map(g=>jsxRuntime.jsx("option",{value:g.value,children:g.label},g.value))})]}),T==="delay"&&jsxRuntime.jsxs("div",{style:{marginBottom:"20px"},children:[jsxRuntime.jsx("label",{style:{display:"block",marginBottom:"6px",fontSize:"13px",fontWeight:500},children:"Delay (seconds)"}),jsxRuntime.jsx("input",{type:"number",value:C/1e3,onChange:g=>E(Number(g.target.value)*1e3),min:1,max:60,style:{width:"100%",padding:"8px 12px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"6px"}})]})]})]})}function qo(e){let t={},o=e.getAttribute("data-testid");if(o)return t.testId=o,t.css=`[data-testid="${o}"]`,t;if(e.id)return t.css=`#${CSS.escape(e.id)}`,t;let r=[],i=e,n=0,c=5;for(;i&&i!==document.body&&n<c;){let a=i.tagName.toLowerCase(),l=Array.from(i.classList).filter(f=>!f.startsWith("hover")&&!f.startsWith("focus")&&!f.startsWith("active")).slice(0,2);l.length>0&&(a+="."+l.map(f=>CSS.escape(f)).join("."));let s=i.parentElement;if(s){let f=Array.from(s.children).filter(m=>m.tagName===i.tagName);if(f.length>1){let m=f.indexOf(i)+1;a+=`:nth-of-type(${m})`;}}r.unshift(a);let p=r.join(" > ");try{if(document.querySelectorAll(p).length===1){t.css=p;break}}catch{}i=i.parentElement,n++;}!t.css&&r.length>0&&(t.css=r.join(" > "));let d=e.textContent?.trim();return d&&d.length<100&&d.length>2&&(t.text=d.slice(0,50)),t}function Mo(e){let t=0;if(e.css)try{t=document.querySelectorAll(e.css).length;}catch{}return e.testId&&(t=document.querySelectorAll(`[data-testid="${e.testId}"]`).length),{isUnique:t===1,count:t}}function wt({isActive:e,onSelect:t,onCancel:o,ignoreSelector:r="[data-census-builder]",zIndex:i=99999}){let[n,c]=react.useState(null),[d,a]=react.useState(null),[l,s]=react.useState(null),p=react.useRef(null),f=react.useCallback(()=>{if(!n){a(null);return}a(n.getBoundingClientRect());},[n]);react.useEffect(()=>{if(!e)return;let k=h=>{let R=document.elementsFromPoint(h.clientX,h.clientY).find(C=>!(p.current?.contains(C)||r&&C.closest(r)||C===document.body||C===document.documentElement));R!==n&&(c(R||null),s(R?qo(R):null));},G=()=>{f();};return document.addEventListener("mousemove",k,true),window.addEventListener("scroll",G,true),window.addEventListener("resize",G),()=>{document.removeEventListener("mousemove",k,true),window.removeEventListener("scroll",G,true),window.removeEventListener("resize",G);}},[e,n,r,f]),react.useEffect(()=>{f();},[n,f]);let m=react.useCallback(k=>{k.preventDefault(),k.stopPropagation(),n&&l&&t(l,n);},[n,l,t]);if(react.useEffect(()=>{if(!e)return;let k=G=>{G.key==="Escape"&&o();};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[e,o]),!e)return null;let u=l?Mo(l):null;return jsxRuntime.jsxs("div",{ref:p,"data-census-builder":true,style:{position:"fixed",inset:0,zIndex:i,cursor:"crosshair"},onClick:m,children:[d&&jsxRuntime.jsx("div",{style:{position:"fixed",top:d.top,left:d.left,width:d.width,height:d.height,border:"2px solid #2563eb",borderRadius:"4px",backgroundColor:"rgba(37, 99, 235, 0.1)",pointerEvents:"none",transition:"all 0.1s ease-out"}}),d&&l&&jsxRuntime.jsxs("div",{style:{position:"fixed",top:Math.max(8,d.top-40),left:d.left,padding:"6px 10px",backgroundColor:"#1f2937",color:"white",fontSize:"12px",fontFamily:"monospace",borderRadius:"4px",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",pointerEvents:"none",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af"},children:l.testId?"data-testid: ":""}),l.testId||l.css,u&&jsxRuntime.jsxs("span",{style:{marginLeft:"8px",color:u.isUnique?"#4ade80":"#fbbf24"},children:["(",u.count," match",u.count!==1?"es":"",")"]})]}),jsxRuntime.jsxs("div",{style:{position:"fixed",bottom:0,left:0,right:0,padding:"12px 20px",backgroundColor:"#1f2937",color:"white",display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:"system-ui, -apple-system, sans-serif",fontSize:"14px"},children:[jsxRuntime.jsxs("span",{children:["Click on any element to select it, or press ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"#374151",borderRadius:"4px",marginLeft:"4px",marginRight:"4px"},children:"Esc"})," to cancel"]}),jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),o();},style:{padding:"6px 12px",border:"1px solid #4b5563",borderRadius:"4px",backgroundColor:"transparent",color:"white",cursor:"pointer"},children:"Cancel"})]})]})}function Do({isOpen:e,onClose:t,guideId:o,onSave:r,onPublish:i,trigger:n,className:c}){let[d,a]=react.useState(false),l=e??d,{guide:s,steps:p,selectedStep:f,selectedStepId:m,isLoading:u,isSaving:k,error:G,loadGuide:h,updateGuide:T,publishGuide:R,addStep:C,updateStep:E,deleteStep:v,moveStepUp:I,moveStepDown:g,setSelectedStepId:A,reset:D}=Ne(),y=react.useCallback(async()=>{a(true),o&&await h(o);},[o,h]),P=react.useCallback(()=>{a(false),D(),t?.();},[D,t]),w=react.useCallback(async()=>{if(s)try{await T({}),r?.(s);}catch{}},[s,T,r]),x=react.useCallback(async()=>{if(s)try{let q=await R();i?.(q);}catch{}},[s,R,i]),W=react.useCallback(async(q="tooltip")=>{try{await C({stepType:q,richContent:{title:"New Step",body:"Click to edit..."}});}catch{}},[C]);return n&&e===void 0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{onClick:y,children:n}),l&&jsxRuntime.jsx(kt,{guide:s,steps:p,selectedStep:f,selectedStepId:m,isLoading:u,isSaving:k,error:G,onClose:P,onSave:w,onPublish:x,onAddStep:W,onSelectStep:A,onUpdateStep:E,onDeleteStep:v,onMoveStepUp:I,onMoveStepDown:g,className:c})]}):l?jsxRuntime.jsx(kt,{guide:s,steps:p,selectedStep:f,selectedStepId:m,isLoading:u,isSaving:k,error:G,onClose:P,onSave:w,onPublish:x,onAddStep:W,onSelectStep:A,onUpdateStep:E,onDeleteStep:v,onMoveStepUp:I,onMoveStepDown:g,className:c}):null}function kt({guide:e,steps:t,selectedStep:o,selectedStepId:r,isLoading:i,isSaving:n,error:c,onClose:d,onSave:a,onPublish:l,onAddStep:s,onSelectStep:p,onUpdateStep:f,onDeleteStep:m,onMoveStepUp:u,onMoveStepDown:k,className:G}){let[h,T]=react.useState(false),R={tooltip:"Tooltip",modal:"Modal",slideout:"Slideout",hotspot:"Hotspot",banner:"Banner"},C=react.useCallback((E,v)=>{o&&f(o.id,{selectorStrategy:E}),T(false);},[o,f]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(wt,{isActive:h,onSelect:C,onCancel:()=>T(false),ignoreSelector:"[data-census-builder]"}),jsxRuntime.jsxs("div",{className:G,"data-census-builder":true,style:{position:"fixed",inset:0,zIndex:9999,display:"flex",flexDirection:"column",backgroundColor:"#f8f9fa",fontFamily:"system-ui, -apple-system, sans-serif"},children:[jsxRuntime.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 20px",backgroundColor:"white",borderBottom:"1px solid #e5e7eb"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[jsxRuntime.jsx("button",{onClick:d,style:{padding:"8px 12px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",cursor:"pointer"},children:"Close"}),jsxRuntime.jsx("h1",{style:{margin:0,fontSize:"18px",fontWeight:600},children:e?e.name:"Guide Builder"}),e?.status&&jsxRuntime.jsx("span",{style:{padding:"2px 8px",fontSize:"12px",borderRadius:"4px",backgroundColor:e.status==="published"?"#dcfce7":"#fef3c7",color:e.status==="published"?"#166534":"#92400e"},children:e.status})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[c&&jsxRuntime.jsx("span",{style:{color:"#dc2626",fontSize:"14px"},children:c.message}),jsxRuntime.jsx("button",{onClick:a,disabled:n||!e,style:{padding:"8px 16px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",cursor:n?"wait":"pointer",opacity:n?.5:1},children:n?"Saving...":"Save"}),jsxRuntime.jsx("button",{onClick:l,disabled:n||!e||e.status==="published",style:{padding:"8px 16px",border:"none",borderRadius:"6px",backgroundColor:"#2563eb",color:"white",cursor:n?"wait":"pointer",opacity:n||e?.status==="published"?.5:1},children:"Publish"})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[jsxRuntime.jsxs("aside",{style:{width:"280px",backgroundColor:"white",borderRight:"1px solid #e5e7eb",display:"flex",flexDirection:"column"},children:[jsxRuntime.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid #e5e7eb",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("span",{style:{fontWeight:500},children:["Steps (",t.length,")"]}),jsxRuntime.jsx("button",{onClick:()=>s("tooltip"),disabled:!e,style:{padding:"6px 12px",fontSize:"13px",border:"none",borderRadius:"4px",backgroundColor:"#2563eb",color:"white",cursor:e?"pointer":"not-allowed",opacity:e?1:.5},children:"+ Add Step"})]}),jsxRuntime.jsx("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:i?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#6b7280"},children:"Loading..."}):t.length===0?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"#6b7280"},children:'No steps yet. Click "Add Step" to get started.'}):t.map((E,v)=>jsxRuntime.jsxs("div",{onClick:()=>p(E.id),style:{padding:"12px",marginBottom:"4px",borderRadius:"6px",backgroundColor:r===E.id?"#eff6ff":"white",border:`1px solid ${r===E.id?"#3b82f6":"#e5e7eb"}`,cursor:"pointer"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("span",{style:{fontWeight:500,fontSize:"14px"},children:[v+1,". ",R[E.step_type]]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"4px"},children:[jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),u(E.id);},disabled:v===0,style:{padding:"2px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",backgroundColor:"white",cursor:v===0?"not-allowed":"pointer",opacity:v===0?.3:1},children:"Up"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),k(E.id);},disabled:v===t.length-1,style:{padding:"2px 6px",fontSize:"12px",border:"1px solid #d1d5db",borderRadius:"3px",backgroundColor:"white",cursor:v===t.length-1?"not-allowed":"pointer",opacity:v===t.length-1?.3:1},children:"Down"}),jsxRuntime.jsx("button",{onClick:I=>{I.stopPropagation(),confirm("Delete this step?")&&m(E.id);},style:{padding:"2px 6px",fontSize:"12px",border:"1px solid #fecaca",borderRadius:"3px",backgroundColor:"#fef2f2",color:"#dc2626",cursor:"pointer"},children:"Delete"})]})]}),jsxRuntime.jsx("p",{style:{margin:"4px 0 0",fontSize:"13px",color:"#6b7280"},children:E.rich_content?.title||E.title||"Untitled"})]},E.id))})]}),jsxRuntime.jsxs("main",{style:{flex:1,display:"flex",flexDirection:"column",backgroundColor:"#f3f4f6"},children:[jsxRuntime.jsx("div",{style:{padding:"16px",borderBottom:"1px solid #e5e7eb",backgroundColor:"white"},children:jsxRuntime.jsx("span",{style:{fontWeight:500},children:"Preview"})}),jsxRuntime.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280"},children:o?jsxRuntime.jsxs("div",{style:{padding:"24px",backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgb(0 0 0 / 0.1)",maxWidth:"400px",width:"100%"},children:[jsxRuntime.jsx("div",{style:{marginBottom:"12px"},children:jsxRuntime.jsx("span",{style:{padding:"4px 8px",fontSize:"11px",fontWeight:500,borderRadius:"4px",backgroundColor:"#f3f4f6",color:"#6b7280",textTransform:"uppercase"},children:R[o.step_type]})}),jsxRuntime.jsx("h3",{style:{margin:"0 0 8px",fontSize:"16px"},children:o.rich_content?.title||o.title||"Step Preview"}),jsxRuntime.jsx("p",{style:{margin:0,color:"#4b5563"},children:o.rich_content?.body||o.content||"No content"}),o.rich_content?.media&&jsxRuntime.jsx("div",{style:{marginTop:"12px"},children:o.rich_content.media.type==="image"&&jsxRuntime.jsx("img",{src:o.rich_content.media.url,alt:o.rich_content.media.alt||"",style:{maxWidth:"100%",borderRadius:"4px"}})}),o.rich_content?.buttons&&o.rich_content.buttons.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",display:"flex",gap:"8px"},children:o.rich_content.buttons.map((E,v)=>jsxRuntime.jsx("span",{style:{padding:"6px 12px",fontSize:"13px",borderRadius:"4px",backgroundColor:E.style==="primary"?"#2563eb":"#f3f4f6",color:E.style==="primary"?"white":"#374151"},children:E.label},v))}),o.selector_strategy?.css&&jsxRuntime.jsxs("div",{style:{marginTop:"16px",padding:"8px",backgroundColor:"#f9fafb",borderRadius:"4px",fontSize:"11px",fontFamily:"monospace",color:"#6b7280"},children:["Target: ",o.selector_strategy.css]})]}):jsxRuntime.jsx("p",{children:"Select a step to preview"})})]}),jsxRuntime.jsx("aside",{style:{width:"360px",backgroundColor:"white",borderLeft:"1px solid #e5e7eb",display:"flex",flexDirection:"column",overflow:"hidden"},children:o?jsxRuntime.jsx(St,{step:o,onUpdate:f,onSelectElement:()=>T(true),isSelectingElement:h}):jsxRuntime.jsx("div",{style:{padding:"16px"},children:jsxRuntime.jsx("p",{style:{color:"#6b7280"},children:"Select a step to edit its settings"})})})]})]})]})}function Ye(e){let t=e.getBoundingClientRect();return {top:t.top+window.scrollY,left:t.left+window.scrollX,right:t.right+window.scrollX,bottom:t.bottom+window.scrollY,width:t.width,height:t.height}}function Qe(){return {width:window.innerWidth,height:window.innerHeight,scrollX:window.scrollX,scrollY:window.scrollY}}function Xe(e,t,o,r,i){let n=Qe(),{scrollX:c,scrollY:d,width:a,height:l}=n;switch(r){case "top":return e.top-d-o-i>0&&e.left-c+e.width/2-t/2>0&&e.left-c+e.width/2+t/2<a;case "bottom":return e.bottom-d+o+i<l&&e.left-c+e.width/2-t/2>0&&e.left-c+e.width/2+t/2<a;case "left":return e.left-c-t-i>0&&e.top-d+e.height/2-o/2>0&&e.top-d+e.height/2+o/2<l;case "right":return e.right-c+t+i<a&&e.top-d+e.height/2-o/2>0&&e.top-d+e.height/2+o/2<l;default:return true}}function Oo(e,t,o,r){let i=["bottom","top","right","left"];for(let n of i)if(Xe(e,t,o,n,r))return n;return "bottom"}function Te(e,t,o,r){let{preferredPosition:i,offset:n={x:0,y:0},containerPadding:c=10,arrowSize:d=8}=r,a=Ye(e),l=Qe(),s=i;if(i==="auto")s=Oo(a,t,o,c);else if(!Xe(a,t,o,i,c)){let v={top:"bottom",bottom:"top",left:"right",right:"left"}[i];v&&Xe(a,t,o,v,c)&&(s=v);}let p=0,f=0,m={},u=d+4;switch(s){case "top":p=a.top-o-u+n.y,f=a.left+a.width/2-t/2+n.x,m={left:t/2-d/2,top:o,transform:"rotate(180deg)"};break;case "bottom":p=a.bottom+u+n.y,f=a.left+a.width/2-t/2+n.x,m={left:t/2-d/2,top:-d};break;case "left":p=a.top+a.height/2-o/2+n.y,f=a.left-t-u+n.x,m={top:o/2-d/2,left:t,transform:"rotate(-90deg)"};break;case "right":p=a.top+a.height/2-o/2+n.y,f=a.right+u+n.x,m={top:o/2-d/2,left:-d,transform:"rotate(90deg)"};break}let k=l.scrollX+c,G=l.scrollX+l.width-t-c,h=l.scrollY+c,T=l.scrollY+l.height-o-c,R=f;f=Math.max(k,Math.min(G,f)),(s==="top"||s==="bottom")&&(m.left=(m.left||0)+(R-f));let C=p;return p=Math.max(h,Math.min(T,p)),(s==="left"||s==="right")&&(m.top=(m.top||0)+(C-p)),{top:p,left:f,placement:s,arrowPosition:m}}function Ee(e,t=100){let o=e.getBoundingClientRect(),r=Qe(),i=o.top<t,n=o.bottom>r.height-t,c=o.left<t,d=o.right>r.width-t;(i||n||c||d)&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});}function Ie(e){if(!e)return null;if(e.css)try{let t=document.querySelector(e.css);if(t)return t}catch{}if(e.testId){let t=document.querySelector(`[data-testid="${e.testId}"]`);if(t)return t}if(e.xpath)try{let t=document.evaluate(e.xpath,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);if(t.singleNodeValue)return t.singleNodeValue}catch{}if(e.text){let t=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT),o;for(;o=t.nextNode();)if(o.textContent?.includes(e.text))return o.parentElement}return null}function Tt(e,t=8){let o=e.getBoundingClientRect(),r={top:o.top-t,left:o.left-t,right:o.right+t,bottom:o.bottom+t,width:o.width+t*2,height:o.height+t*2};return `polygon(
2
55
  0 0,
3
56
  100% 0,
4
57
  100% 100%,
@@ -9,20 +62,20 @@
9
62
  ${r.right}px ${r.bottom}px,
10
63
  ${r.right}px ${r.top}px,
11
64
  ${r.left}px ${r.top}px
12
- )`}function ee({visible:o,spotlightElement:e,spotlightPadding:t=8,onClick:r,dismissOnClick:i=false,zIndex:n=9998,opacity:s=.5}){let[p,a]=react.useState(),l=react.useCallback(()=>{a(e?gt(e,t):void 0);},[e,t]);return react.useEffect(()=>{if(o)return l(),window.addEventListener("scroll",l,true),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l,true),window.removeEventListener("resize",l);}},[o,l]),o?jsxRuntime.jsx("div",{onClick:c=>{i&&r&&r(),c.stopPropagation();},style:{position:"fixed",inset:0,zIndex:n,backgroundColor:`rgba(0, 0, 0, ${s})`,clipPath:p,transition:"clip-path 0.2s ease-out",cursor:i?"pointer":"default",pointerEvents:"auto"},"aria-hidden":"true"}):null}function X({buttons:o,currentStep:e,isLastStep:t,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,accentColor:p="#2563eb"}){if(!o||o.length===0)return jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"16px"},children:[jsxRuntime.jsx("div",{children:e>0&&jsxRuntime.jsx("button",{onClick:i,style:{padding:"8px 16px",fontSize:"14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",color:"#374151",cursor:"pointer"},children:"Back"})}),jsxRuntime.jsx("button",{onClick:t?n:r,style:{padding:"8px 16px",fontSize:"14px",border:"none",borderRadius:"6px",backgroundColor:p,color:"white",cursor:"pointer"},children:t?"Done":"Next"})]});let a=d=>{switch(d.action){case "next":r();break;case "prev":i();break;case "dismiss":n();break;case "url":d.url&&window.open(d.url,"_blank","noopener,noreferrer");break;case "custom":d.customAction&&s&&s(d.customAction);break}},l=d=>{switch(d){case "primary":return {padding:"8px 16px",fontSize:"14px",border:"none",borderRadius:"6px",backgroundColor:p,color:"white",cursor:"pointer"};case "text":return {padding:"8px 16px",fontSize:"14px",border:"none",borderRadius:"6px",backgroundColor:"transparent",color:p,cursor:"pointer"};default:return {padding:"8px 16px",fontSize:"14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",color:"#374151",cursor:"pointer"}}};return jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"16px"},children:o.map((d,c)=>jsxRuntime.jsx("button",{onClick:()=>a(d),style:l(d.style),children:d.label},c))})}function Y({step:o,textColor:e="#1f2937",showTitle:t=true}){let r=o.rich_content,i=r?.title||o.title,n=r?.body||o.content;return jsxRuntime.jsxs("div",{children:[t&&i&&jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:600,color:e,lineHeight:1.4},children:i}),n&&jsxRuntime.jsx("div",{style:{fontSize:"14px",color:e,opacity:.9,lineHeight:1.5},dangerouslySetInnerHTML:n.includes("<")?{__html:mo(n)}:void 0,children:n.includes("<")?null:n}),r?.media&&jsxRuntime.jsxs("div",{style:{marginTop:"12px"},children:[r.media.type==="image"&&jsxRuntime.jsx("img",{src:r.media.url,alt:r.media.alt||"",style:{maxWidth:"100%",height:"auto",borderRadius:"4px"}}),r.media.type==="video"&&jsxRuntime.jsx("video",{src:r.media.url,controls:true,style:{maxWidth:"100%",height:"auto",borderRadius:"4px"},children:"Your browser does not support the video tag."})]})]})}function mo(o){let e=["p","br","b","i","strong","em","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","code","pre","blockquote","span","div"];if(typeof document>"u")return o.replace(/<[^>]*>/g,"");let t=document.createElement("div");return t.innerHTML=o,t.querySelectorAll("script").forEach(n=>n.remove()),t.querySelectorAll("*").forEach(n=>{if(!e.includes(n.tagName.toLowerCase())){let p=document.createTextNode(n.textContent||"");n.parentNode?.replaceChild(p,n);return}Array.from(n.attributes).forEach(p=>{let a=p.name.toLowerCase();if(a.startsWith("on")&&n.removeAttribute(p.name),a==="href"||a==="src"){let d=p.value.toLowerCase().trim();(d.startsWith("javascript:")||d.startsWith("data:"))&&n.removeAttribute(p.name);}["href","target","rel","class","style"].includes(a)||n.removeAttribute(p.name);}),n.tagName.toLowerCase()==="a"&&(n.setAttribute("rel","noopener noreferrer"),n.setAttribute("target","_blank"));}),t.innerHTML}function ye({step:o,currentStep:e,totalSteps:t,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,showProgress:p=true,globalStyle:a,zIndex:l=9999}){let d=react.useRef(null),[c,f]=react.useState(null),[g,u]=react.useState(null),[R,S]=react.useState(false),h={...a,...o.style_config},w=h.backgroundColor||"white",b=h.textColor||"#1f2937",C=h.accentColor||"#2563eb",E=h.borderRadius||8;react.useEffect(()=>{let _=Ge(o.selector_strategy);f(_),_&&ke(_,120);},[o.selector_strategy]);let k=react.useCallback(()=>{if(!c||!d.current)return;let _=d.current.getBoundingClientRect(),m=we(c,_.width,_.height,{preferredPosition:o.tooltip_position||o.display_config?.position||"auto",offset:o.display_config?.offset,arrowSize:8});u(m),S(true);},[c,o.tooltip_position,o.display_config]);return react.useEffect(()=>{let _=setTimeout(k,10);return window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{clearTimeout(_),window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[k]),c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ee,{visible:o.display_config?.backdrop!==false,spotlightElement:c,spotlightPadding:o.display_config?.spotlightPadding||8,dismissOnClick:false}),jsxRuntime.jsxs("div",{ref:d,style:{position:"absolute",top:g?.top||0,left:g?.left||0,zIndex:l,padding:"16px 20px",backgroundColor:w,color:b,borderRadius:E,boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",maxWidth:o.display_config?.width||320,fontFamily:"system-ui, -apple-system, sans-serif",opacity:R?1:0,transition:"opacity 0.15s ease-out"},children:[g&&jsxRuntime.jsx("div",{style:{position:"absolute",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${w}`,top:g.arrowPosition.top,left:g.arrowPosition.left,transform:g.arrowPosition.transform}}),jsxRuntime.jsx(Y,{step:o,textColor:b}),p&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"8px"},children:["Step ",e+1," of ",t]}),jsxRuntime.jsx(X,{buttons:o.rich_content?.buttons,currentStep:e,totalSteps:t,isLastStep:e===t-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,accentColor:C})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ee,{visible:true}),jsxRuntime.jsxs("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:l,padding:"24px",backgroundColor:w,color:b,borderRadius:E,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxWidth:"400px",width:"90%",fontFamily:"system-ui, -apple-system, sans-serif"},children:[jsxRuntime.jsx(Y,{step:o,textColor:b}),p&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"8px"},children:["Step ",e+1," of ",t]}),jsxRuntime.jsx(X,{buttons:o.rich_content?.buttons,currentStep:e,totalSteps:t,isLastStep:e===t-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,accentColor:C})]})]})}function Pe({step:o,currentStep:e,totalSteps:t,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,showProgress:p=true,globalStyle:a,zIndex:l=9999}){let d={...a,...o.style_config},c=d.backgroundColor||"white",f=d.textColor||"#1f2937",g=d.accentColor||"#2563eb",u=d.borderRadius||12,R=o.display_config||{},S=R.width||480,h=R.position||"center",w=R.backdrop!==false;return react.useEffect(()=>{let C=E=>{E.key==="Escape"&&n();};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ee,{visible:true,onClick:w?n:void 0,dismissOnClick:w,opacity:.6}),jsxRuntime.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"guide-modal-title",style:{position:"fixed",...(()=>{switch(h){case "top":return {top:"10%",left:"50%",transform:"translateX(-50%)"};case "bottom":return {bottom:"10%",left:"50%",transform:"translateX(-50%)"};default:return {top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}})(),zIndex:l,width:"90%",maxWidth:S,maxHeight:"85vh",overflow:"auto",padding:"24px",backgroundColor:c,color:f,borderRadius:u,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",fontFamily:"system-ui, -apple-system, sans-serif"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":"Close",style:{position:"absolute",top:"12px",right:"12px",width:"28px",height:"28px",border:"none",borderRadius:"50%",backgroundColor:"transparent",color:"#9ca3af",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.15s"},onMouseEnter:C=>C.currentTarget.style.color="#6b7280",onMouseLeave:C=>C.currentTarget.style.color="#9ca3af",children:"\xD7"}),jsxRuntime.jsx(Y,{step:o,textColor:f}),p&&t>1&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"6px",marginTop:"16px"},children:Array.from({length:t}).map((C,E)=>jsxRuntime.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:E===e?g:"#e5e7eb",transition:"background-color 0.15s"}},E))}),jsxRuntime.jsx(X,{buttons:o.rich_content?.buttons,currentStep:e,totalSteps:t,isLastStep:e===t-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,accentColor:g})]})]})}function Ee({step:o,currentStep:e,totalSteps:t,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,showProgress:p=true,globalStyle:a,zIndex:l=9999}){let[d,c]=react.useState(true),f={...a,...o.style_config},g=f.backgroundColor||"white",u=f.textColor||"#1f2937",R=f.accentColor||"#2563eb",S=f.borderRadius||0,h=o.display_config||{},w=h.width||400,b=h.position==="left"?"left":"right",C=h.backdrop!==false;return react.useEffect(()=>{let k=setTimeout(()=>c(false),50);return ()=>clearTimeout(k)},[]),react.useEffect(()=>{let k=_=>{_.key==="Escape"&&n();};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[n]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[C&&jsxRuntime.jsx(ee,{visible:true,onClick:n,dismissOnClick:true,opacity:.4}),jsxRuntime.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"guide-slideout-title",style:(()=>{let k={position:"fixed",top:0,bottom:0,width:"90%",maxWidth:w,zIndex:l,backgroundColor:g,color:u,boxShadow:b==="right"?"-10px 0 30px -5px rgba(0, 0, 0, 0.1)":"10px 0 30px -5px rgba(0, 0, 0, 0.1)",fontFamily:"system-ui, -apple-system, sans-serif",overflow:"auto",transition:"transform 0.3s ease-out"};return b==="right"?{...k,right:0,borderTopLeftRadius:S,borderBottomLeftRadius:S,transform:d?"translateX(100%)":"translateX(0)"}:{...k,left:0,borderTopRightRadius:S,borderBottomRightRadius:S,transform:d?"translateX(-100%)":"translateX(0)"}})(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #e5e7eb",position:"sticky",top:0,backgroundColor:g,zIndex:1},children:[jsxRuntime.jsx("h2",{id:"guide-slideout-title",style:{margin:0,fontSize:"18px",fontWeight:600,color:u},children:o.rich_content?.title||o.title||"Guide"}),jsxRuntime.jsx("button",{onClick:n,"aria-label":"Close",style:{width:"28px",height:"28px",border:"none",borderRadius:"50%",backgroundColor:"transparent",color:"#9ca3af",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),jsxRuntime.jsxs("div",{style:{padding:"20px"},children:[jsxRuntime.jsx(Y,{step:o,textColor:u,showTitle:false}),p&&t>1&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"16px"},children:["Step ",e+1," of ",t]})]}),jsxRuntime.jsx("div",{style:{padding:"16px 20px",borderTop:"1px solid #e5e7eb",position:"sticky",bottom:0,backgroundColor:g},children:jsxRuntime.jsx(X,{buttons:o.rich_content?.buttons,currentStep:e,totalSteps:t,isLastStep:e===t-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,accentColor:R})})]})]})}function Te({step:o,currentStep:e,totalSteps:t,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,showProgress:p=true,globalStyle:a,zIndex:l=9999}){let d=react.useRef(null),[c,f]=react.useState(null),[g,u]=react.useState(false),[R,S]=react.useState({top:0,left:0}),[h,w]=react.useState(null),b={...a,...o.style_config},C=b.backgroundColor||"white",E=b.textColor||"#1f2937",k=b.accentColor||"#2563eb",_=b.borderRadius||8,m=o.display_config||{};react.useEffect(()=>{let G=Ge(o.selector_strategy);f(G),G&&ke(G,120);},[o.selector_strategy]);let U=react.useCallback(()=>{if(!c)return;let G=He(c);S({top:G.top-8,left:G.right-8});},[c]),j=react.useCallback(()=>{if(!c||!d.current||!g)return;let G=d.current.getBoundingClientRect(),y=we(c,G.width,G.height,{preferredPosition:o.tooltip_position||"auto",offset:o.display_config?.offset,arrowSize:8});w(y);},[c,g,o.tooltip_position,o.display_config?.offset]);if(react.useEffect(()=>(U(),g&&setTimeout(j,10),window.addEventListener("scroll",U,true),window.addEventListener("resize",U),()=>{window.removeEventListener("scroll",U,true),window.removeEventListener("resize",U);}),[U,j,g]),react.useEffect(()=>{if(!g)return;let G=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[g]),!c)return null;let T=`
65
+ )`}function re({visible:e,spotlightElement:t,spotlightPadding:o=8,onClick:r,dismissOnClick:i=false,zIndex:n=9998,opacity:c=.5}){let[d,a]=react.useState(),l=react.useCallback(()=>{a(t?Tt(t,o):void 0);},[t,o]);return react.useEffect(()=>{if(e)return l(),window.addEventListener("scroll",l,true),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l,true),window.removeEventListener("resize",l);}},[e,l]),e?jsxRuntime.jsx("div",{onClick:p=>{i&&r&&r(),p.stopPropagation();},style:{position:"fixed",inset:0,zIndex:n,backgroundColor:`rgba(0, 0, 0, ${c})`,clipPath:d,transition:"clip-path 0.2s ease-out",cursor:i?"pointer":"default",pointerEvents:"auto"},"aria-hidden":"true"}):null}function X({buttons:e,currentStep:t,isLastStep:o,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,accentColor:d="#2563eb"}){if(!e||e.length===0)return jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"16px"},children:[jsxRuntime.jsx("div",{children:t>0&&jsxRuntime.jsx("button",{onClick:i,style:{padding:"8px 16px",fontSize:"14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",color:"#374151",cursor:"pointer"},children:"Back"})}),jsxRuntime.jsx("button",{onClick:o?n:r,style:{padding:"8px 16px",fontSize:"14px",border:"none",borderRadius:"6px",backgroundColor:d,color:"white",cursor:"pointer"},children:o?"Done":"Next"})]});let a=s=>{switch(s.action){case "next":r();break;case "prev":i();break;case "dismiss":n();break;case "url":s.url&&window.open(s.url,"_blank","noopener,noreferrer");break;case "custom":s.customAction&&c&&c(s.customAction);break}},l=s=>{switch(s){case "primary":return {padding:"8px 16px",fontSize:"14px",border:"none",borderRadius:"6px",backgroundColor:d,color:"white",cursor:"pointer"};case "text":return {padding:"8px 16px",fontSize:"14px",border:"none",borderRadius:"6px",backgroundColor:"transparent",color:d,cursor:"pointer"};default:return {padding:"8px 16px",fontSize:"14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"white",color:"#374151",cursor:"pointer"}}};return jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"16px"},children:e.map((s,p)=>jsxRuntime.jsx("button",{onClick:()=>a(s),style:l(s.style),children:s.label},p))})}function Q({step:e,textColor:t="#1f2937",showTitle:o=true}){let r=e.rich_content,i=r?.title||e.title,n=r?.body||e.content;return jsxRuntime.jsxs("div",{children:[o&&i&&jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",fontSize:"16px",fontWeight:600,color:t,lineHeight:1.4},children:i}),n&&jsxRuntime.jsx("div",{style:{fontSize:"14px",color:t,opacity:.9,lineHeight:1.5},dangerouslySetInnerHTML:n.includes("<")?{__html:jo(n)}:void 0,children:n.includes("<")?null:n}),r?.media&&jsxRuntime.jsxs("div",{style:{marginTop:"12px"},children:[r.media.type==="image"&&jsxRuntime.jsx("img",{src:r.media.url,alt:r.media.alt||"",style:{maxWidth:"100%",height:"auto",borderRadius:"4px"}}),r.media.type==="video"&&jsxRuntime.jsx("video",{src:r.media.url,controls:true,style:{maxWidth:"100%",height:"auto",borderRadius:"4px"},children:"Your browser does not support the video tag."})]})]})}function jo(e){let t=["p","br","b","i","strong","em","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","code","pre","blockquote","span","div"];if(typeof document>"u")return e.replace(/<[^>]*>/g,"");let o=document.createElement("div");return o.innerHTML=e,o.querySelectorAll("script").forEach(n=>n.remove()),o.querySelectorAll("*").forEach(n=>{if(!t.includes(n.tagName.toLowerCase())){let d=document.createTextNode(n.textContent||"");n.parentNode?.replaceChild(d,n);return}Array.from(n.attributes).forEach(d=>{let a=d.name.toLowerCase();if(a.startsWith("on")&&n.removeAttribute(d.name),a==="href"||a==="src"){let s=d.value.toLowerCase().trim();(s.startsWith("javascript:")||s.startsWith("data:"))&&n.removeAttribute(d.name);}["href","target","rel","class","style"].includes(a)||n.removeAttribute(d.name);}),n.tagName.toLowerCase()==="a"&&(n.setAttribute("rel","noopener noreferrer"),n.setAttribute("target","_blank"));}),o.innerHTML}function Se({step:e,currentStep:t,totalSteps:o,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,showProgress:d=true,globalStyle:a,zIndex:l=9999}){let s=react.useRef(null),[p,f]=react.useState(null),[m,u]=react.useState(null),[k,G]=react.useState(false),h={...a,...e.style_config},T=h.backgroundColor||"white",R=h.textColor||"#1f2937",C=h.accentColor||"#2563eb",E=h.borderRadius||8;react.useEffect(()=>{let I=Ie(e.selector_strategy);f(I),I&&Ee(I,120);},[e.selector_strategy]);let v=react.useCallback(()=>{if(!p||!s.current)return;let I=s.current.getBoundingClientRect(),g=Te(p,I.width,I.height,{preferredPosition:e.tooltip_position||e.display_config?.position||"auto",offset:e.display_config?.offset,arrowSize:8});u(g),G(true);},[p,e.tooltip_position,e.display_config]);return react.useEffect(()=>{let I=setTimeout(v,10);return window.addEventListener("scroll",v,true),window.addEventListener("resize",v),()=>{clearTimeout(I),window.removeEventListener("scroll",v,true),window.removeEventListener("resize",v);}},[v]),p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(re,{visible:e.display_config?.backdrop!==false,spotlightElement:p,spotlightPadding:e.display_config?.spotlightPadding||8,dismissOnClick:false}),jsxRuntime.jsxs("div",{ref:s,style:{position:"absolute",top:m?.top||0,left:m?.left||0,zIndex:l,padding:"16px 20px",backgroundColor:T,color:R,borderRadius:E,boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",maxWidth:e.display_config?.width||320,fontFamily:"system-ui, -apple-system, sans-serif",opacity:k?1:0,transition:"opacity 0.15s ease-out"},children:[m&&jsxRuntime.jsx("div",{style:{position:"absolute",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${T}`,top:m.arrowPosition.top,left:m.arrowPosition.left,transform:m.arrowPosition.transform}}),jsxRuntime.jsx(Q,{step:e,textColor:R}),d&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"8px"},children:["Step ",t+1," of ",o]}),jsxRuntime.jsx(X,{buttons:e.rich_content?.buttons,currentStep:t,totalSteps:o,isLastStep:t===o-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,accentColor:C})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(re,{visible:true}),jsxRuntime.jsxs("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:l,padding:"24px",backgroundColor:T,color:R,borderRadius:E,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxWidth:"400px",width:"90%",fontFamily:"system-ui, -apple-system, sans-serif"},children:[jsxRuntime.jsx(Q,{step:e,textColor:R}),d&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"8px"},children:["Step ",t+1," of ",o]}),jsxRuntime.jsx(X,{buttons:e.rich_content?.buttons,currentStep:t,totalSteps:o,isLastStep:t===o-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,accentColor:C})]})]})}function _e({step:e,currentStep:t,totalSteps:o,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,showProgress:d=true,globalStyle:a,zIndex:l=9999}){let s={...a,...e.style_config},p=s.backgroundColor||"white",f=s.textColor||"#1f2937",m=s.accentColor||"#2563eb",u=s.borderRadius||12,k=e.display_config||{},G=k.width||480,h=k.position||"center",T=k.backdrop!==false;return react.useEffect(()=>{let C=E=>{E.key==="Escape"&&n();};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[n]),react.useEffect(()=>{let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(re,{visible:true,onClick:T?n:void 0,dismissOnClick:T,opacity:.6}),jsxRuntime.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"guide-modal-title",style:{position:"fixed",...(()=>{switch(h){case "top":return {top:"10%",left:"50%",transform:"translateX(-50%)"};case "bottom":return {bottom:"10%",left:"50%",transform:"translateX(-50%)"};default:return {top:"50%",left:"50%",transform:"translate(-50%, -50%)"}}})(),zIndex:l,width:"90%",maxWidth:G,maxHeight:"85vh",overflow:"auto",padding:"24px",backgroundColor:p,color:f,borderRadius:u,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",fontFamily:"system-ui, -apple-system, sans-serif"},children:[jsxRuntime.jsx("button",{onClick:n,"aria-label":"Close",style:{position:"absolute",top:"12px",right:"12px",width:"28px",height:"28px",border:"none",borderRadius:"50%",backgroundColor:"transparent",color:"#9ca3af",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"color 0.15s"},onMouseEnter:C=>C.currentTarget.style.color="#6b7280",onMouseLeave:C=>C.currentTarget.style.color="#9ca3af",children:"\xD7"}),jsxRuntime.jsx(Q,{step:e,textColor:f}),d&&o>1&&jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"center",gap:"6px",marginTop:"16px"},children:Array.from({length:o}).map((C,E)=>jsxRuntime.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:E===t?m:"#e5e7eb",transition:"background-color 0.15s"}},E))}),jsxRuntime.jsx(X,{buttons:e.rich_content?.buttons,currentStep:t,totalSteps:o,isLastStep:t===o-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,accentColor:m})]})]})}function Be({step:e,currentStep:t,totalSteps:o,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,showProgress:d=true,globalStyle:a,zIndex:l=9999}){let[s,p]=react.useState(true),f={...a,...e.style_config},m=f.backgroundColor||"white",u=f.textColor||"#1f2937",k=f.accentColor||"#2563eb",G=f.borderRadius||0,h=e.display_config||{},T=h.width||400,R=h.position==="left"?"left":"right",C=h.backdrop!==false;return react.useEffect(()=>{let v=setTimeout(()=>p(false),50);return ()=>clearTimeout(v)},[]),react.useEffect(()=>{let v=I=>{I.key==="Escape"&&n();};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[n]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[C&&jsxRuntime.jsx(re,{visible:true,onClick:n,dismissOnClick:true,opacity:.4}),jsxRuntime.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"guide-slideout-title",style:(()=>{let v={position:"fixed",top:0,bottom:0,width:"90%",maxWidth:T,zIndex:l,backgroundColor:m,color:u,boxShadow:R==="right"?"-10px 0 30px -5px rgba(0, 0, 0, 0.1)":"10px 0 30px -5px rgba(0, 0, 0, 0.1)",fontFamily:"system-ui, -apple-system, sans-serif",overflow:"auto",transition:"transform 0.3s ease-out"};return R==="right"?{...v,right:0,borderTopLeftRadius:G,borderBottomLeftRadius:G,transform:s?"translateX(100%)":"translateX(0)"}:{...v,left:0,borderTopRightRadius:G,borderBottomRightRadius:G,transform:s?"translateX(-100%)":"translateX(0)"}})(),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid #e5e7eb",position:"sticky",top:0,backgroundColor:m,zIndex:1},children:[jsxRuntime.jsx("h2",{id:"guide-slideout-title",style:{margin:0,fontSize:"18px",fontWeight:600,color:u},children:e.rich_content?.title||e.title||"Guide"}),jsxRuntime.jsx("button",{onClick:n,"aria-label":"Close",style:{width:"28px",height:"28px",border:"none",borderRadius:"50%",backgroundColor:"transparent",color:"#9ca3af",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]}),jsxRuntime.jsxs("div",{style:{padding:"20px"},children:[jsxRuntime.jsx(Q,{step:e,textColor:u,showTitle:false}),d&&o>1&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"16px"},children:["Step ",t+1," of ",o]})]}),jsxRuntime.jsx("div",{style:{padding:"16px 20px",borderTop:"1px solid #e5e7eb",position:"sticky",bottom:0,backgroundColor:m},children:jsxRuntime.jsx(X,{buttons:e.rich_content?.buttons,currentStep:t,totalSteps:o,isLastStep:t===o-1,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,accentColor:k})})]})]})}function Fe({step:e,currentStep:t,totalSteps:o,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,showProgress:d=true,globalStyle:a,zIndex:l=9999}){let s=react.useRef(null),[p,f]=react.useState(null),[m,u]=react.useState(false),[k,G]=react.useState({top:0,left:0}),[h,T]=react.useState(null),R={...a,...e.style_config},C=R.backgroundColor||"white",E=R.textColor||"#1f2937",v=R.accentColor||"#2563eb",I=R.borderRadius||8,g=e.display_config||{};react.useEffect(()=>{let w=Ie(e.selector_strategy);f(w),w&&Ee(w,120);},[e.selector_strategy]);let D=react.useCallback(()=>{if(!p)return;let w=Ye(p);G({top:w.top-8,left:w.right-8});},[p]),y=react.useCallback(()=>{if(!p||!s.current||!m)return;let w=s.current.getBoundingClientRect(),x=Te(p,w.width,w.height,{preferredPosition:e.tooltip_position||"auto",offset:e.display_config?.offset,arrowSize:8});T(x);},[p,m,e.tooltip_position,e.display_config?.offset]);if(react.useEffect(()=>(D(),m&&setTimeout(y,10),window.addEventListener("scroll",D,true),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,true),window.removeEventListener("resize",D);}),[D,y,m]),react.useEffect(()=>{if(!m)return;let w=x=>{s.current&&!s.current.contains(x.target)&&u(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[m]),!p)return null;let P=`
13
66
  @keyframes census-hotspot-pulse {
14
67
  0% {
15
68
  transform: scale(1);
16
- box-shadow: 0 0 0 0 ${k}66;
69
+ box-shadow: 0 0 0 0 ${v}66;
17
70
  }
18
71
  70% {
19
72
  transform: scale(1.1);
20
- box-shadow: 0 0 0 10px ${k}00;
73
+ box-shadow: 0 0 0 10px ${v}00;
21
74
  }
22
75
  100% {
23
76
  transform: scale(1);
24
- box-shadow: 0 0 0 0 ${k}00;
77
+ box-shadow: 0 0 0 0 ${v}00;
25
78
  }
26
79
  }
27
- `;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:T}}),jsxRuntime.jsx("button",{onClick:()=>u(!g),"aria-label":"Show more information","aria-expanded":g,style:{position:"absolute",top:R.top,left:R.left,width:"24px",height:"24px",borderRadius:"50%",border:"none",backgroundColor:k,color:"white",cursor:"pointer",zIndex:l,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:600,animation:!g?"census-hotspot-pulse 2s infinite":"none",transition:"transform 0.15s"},children:"?"}),g&&jsxRuntime.jsxs("div",{ref:d,style:{position:"absolute",top:h?.top||R.top+30,left:h?.left||R.left-140,zIndex:l+1,padding:"16px 20px",backgroundColor:C,color:E,borderRadius:_,boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",maxWidth:m.width||300,fontFamily:"system-ui, -apple-system, sans-serif"},children:[h&&jsxRuntime.jsx("div",{style:{position:"absolute",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${C}`,top:h.arrowPosition.top,left:h.arrowPosition.left,transform:h.arrowPosition.transform}}),jsxRuntime.jsx(Y,{step:o,textColor:E}),p&&t>1&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"8px"},children:["Step ",e+1," of ",t]}),jsxRuntime.jsx(X,{buttons:o.rich_content?.buttons,currentStep:e,totalSteps:t,isLastStep:e===t-1,onNext:()=>{u(false),r();},onPrev:()=>{u(false),i();},onDismiss:()=>{u(false),n();},onCustomAction:s,accentColor:k})]})]})}var Ie={info:{bg:"#eff6ff",text:"#1e40af",icon:"i"},warning:{bg:"#fef3c7",text:"#92400e",icon:"!"},success:{bg:"#dcfce7",text:"#166534",icon:"\u2713"},custom:{bg:"#2563eb",text:"white",icon:""}};function Be({step:o,currentStep:e,totalSteps:t,onNext:r,onPrev:i,onDismiss:n,onCustomAction:s,showProgress:p=true,globalStyle:a,zIndex:l=9999}){let [d,c]=react.useState(true),[f,g]=react.useState(true),u={...a,...o.style_config},S=(o.display_config||{}).bannerPosition||"top",h="custom",w=u.backgroundColor||Ie[h].bg,b=u.textColor||Ie[h].text;react.useEffect(()=>{let U=setTimeout(()=>c(false),50);return ()=>clearTimeout(U)},[]);let E=()=>{c(true),setTimeout(()=>{g(false),n();},200);};if(!f)return null;let k=o.rich_content,_=k?.title||o.title,m=k?.body||o.content,L=k?.buttons&&k.buttons.length>0;return jsxRuntime.jsx("div",{role:"alert",style:{position:"fixed",left:0,right:0,[S]:0,zIndex:l,padding:"12px 20px",backgroundColor:w,color:b,boxShadow:S==="top"?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"0 -4px 6px -1px rgba(0, 0, 0, 0.1)",fontFamily:"system-ui, -apple-system, sans-serif",transform:d?S==="top"?"translateY(-100%)":"translateY(100%)":"translateY(0)",transition:"transform 0.2s ease-out"},children:jsxRuntime.jsxs("div",{style:{maxWidth:"1200px",margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"16px"},children:[jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"12px"},children:[Ie[h].icon,jsxRuntime.jsxs("div",{style:{flex:1},children:[_&&jsxRuntime.jsx("strong",{style:{display:"block",marginBottom:m?"2px":0},children:_}),m&&jsxRuntime.jsx("span",{style:{opacity:.9,fontSize:"14px"},children:m})]}),p&&t>1&&jsxRuntime.jsxs("span",{style:{fontSize:"12px",opacity:.7,flexShrink:0},children:[e+1,"/",t]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[L?jsxRuntime.jsx(X,{buttons:k.buttons,currentStep:e,totalSteps:t,isLastStep:e===t-1,onNext:r,onPrev:i,onDismiss:E,onCustomAction:s,accentColor:"white"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e<t-1?jsxRuntime.jsx("button",{onClick:r,style:{padding:"6px 12px",fontSize:"14px",border:"none",borderRadius:"4px",backgroundColor:"rgba(255,255,255,0.2)",color:b,cursor:"pointer"},children:"Next"}):jsxRuntime.jsx("button",{onClick:E,style:{padding:"6px 12px",fontSize:"14px",border:"none",borderRadius:"4px",backgroundColor:"rgba(255,255,255,0.2)",color:b,cursor:"pointer"},children:"Got it"})}),jsxRuntime.jsx("button",{onClick:E,"aria-label":"Dismiss",style:{width:"28px",height:"28px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:b,opacity:.7,fontSize:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]})]})})}function Ro({guide:o,onComplete:e,onDismiss:t,onStepChange:r,onCustomAction:i,globalStyle:n,startStep:s=0,zIndex:p=9999}){let[a,l]=react.useState(s),[d,c]=react.useState(true),f=o.guide_steps||[],g=f.length,u=f[a];react.useEffect(()=>{r?.(a,g);},[a,g,r]);let R=react.useCallback(()=>{a<g-1?l(C=>C+1):(c(false),e?.(o));},[a,g,o,e]),S=react.useCallback(()=>{a>0&&l(C=>C-1);},[a]),h=react.useCallback(()=>{c(false),t?.(o,a);},[o,a,t]),w=react.useCallback(C=>{u&&i?.(C,u);},[u,i]);if(!d||!u||f.length===0)return null;let b={step:u,currentStep:a,totalSteps:g,onNext:R,onPrev:S,onDismiss:h,onCustomAction:w,showProgress:o.show_progress!==false,globalStyle:{...o.theme,...n},zIndex:p};switch(u.step_type){case "tooltip":return jsxRuntime.jsx(ye,{...b});case "modal":return jsxRuntime.jsx(Pe,{...b});case "slideout":return jsxRuntime.jsx(Ee,{...b});case "hotspot":return jsxRuntime.jsx(Te,{...b});case "banner":return jsxRuntime.jsx(Be,{...b});default:return jsxRuntime.jsx(ye,{...b})}}exports.Backdrop=ee;exports.BannerStep=Be;exports.CensusProvider=Pt;exports.FeedbackButton=Dt;exports.GuideBuilder=ao;exports.GuideRenderer=Ro;exports.HelpCenter=Jt;exports.HotspotStep=Te;exports.KnowledgeBase=Nt;exports.ModalStep=Pe;exports.Requests=Vt;exports.SlideoutStep=Ee;exports.StepButtons=X;exports.StepContent=Y;exports.TooltipStep=ye;exports.useArticle=fe;exports.useArticles=ue;exports.useCensus=Et;exports.useCensusContext=O;exports.useFeatureGroups=qe;exports.useFeedback=Le;exports.useGuideBuilder=Oe;exports.useGuideRenderer=zt;exports.useGuides=Ft;exports.useIdentify=_t;exports.useRequests=ne;exports.useTrack=Bt;//# sourceMappingURL=index.cjs.map
80
+ `;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:P}}),jsxRuntime.jsx("button",{onClick:()=>u(!m),"aria-label":"Show more information","aria-expanded":m,style:{position:"absolute",top:k.top,left:k.left,width:"24px",height:"24px",borderRadius:"50%",border:"none",backgroundColor:v,color:"white",cursor:"pointer",zIndex:l,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:600,animation:!m?"census-hotspot-pulse 2s infinite":"none",transition:"transform 0.15s"},children:"?"}),m&&jsxRuntime.jsxs("div",{ref:s,style:{position:"absolute",top:h?.top||k.top+30,left:h?.left||k.left-140,zIndex:l+1,padding:"16px 20px",backgroundColor:C,color:E,borderRadius:I,boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)",maxWidth:g.width||300,fontFamily:"system-ui, -apple-system, sans-serif"},children:[h&&jsxRuntime.jsx("div",{style:{position:"absolute",width:0,height:0,borderLeft:"8px solid transparent",borderRight:"8px solid transparent",borderBottom:`8px solid ${C}`,top:h.arrowPosition.top,left:h.arrowPosition.left,transform:h.arrowPosition.transform}}),jsxRuntime.jsx(Q,{step:e,textColor:E}),d&&o>1&&jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"#6b7280",marginTop:"8px"},children:["Step ",t+1," of ",o]}),jsxRuntime.jsx(X,{buttons:e.rich_content?.buttons,currentStep:t,totalSteps:o,isLastStep:t===o-1,onNext:()=>{u(false),r();},onPrev:()=>{u(false),i();},onDismiss:()=>{u(false),n();},onCustomAction:c,accentColor:v})]})]})}var ze={info:{bg:"#eff6ff",text:"#1e40af",icon:"i"},warning:{bg:"#fef3c7",text:"#92400e",icon:"!"},success:{bg:"#dcfce7",text:"#166534",icon:"\u2713"},custom:{bg:"#2563eb",text:"white",icon:""}};function Ae({step:e,currentStep:t,totalSteps:o,onNext:r,onPrev:i,onDismiss:n,onCustomAction:c,showProgress:d=true,globalStyle:a,zIndex:l=9999}){let [s,p]=react.useState(true),[f,m]=react.useState(true),u={...a,...e.style_config},G=(e.display_config||{}).bannerPosition||"top",h="custom",T=u.backgroundColor||ze[h].bg,R=u.textColor||ze[h].text;react.useEffect(()=>{let D=setTimeout(()=>p(false),50);return ()=>clearTimeout(D)},[]);let E=()=>{p(true),setTimeout(()=>{m(false),n();},200);};if(!f)return null;let v=e.rich_content,I=v?.title||e.title,g=v?.body||e.content,A=v?.buttons&&v.buttons.length>0;return jsxRuntime.jsx("div",{role:"alert",style:{position:"fixed",left:0,right:0,[G]:0,zIndex:l,padding:"12px 20px",backgroundColor:T,color:R,boxShadow:G==="top"?"0 4px 6px -1px rgba(0, 0, 0, 0.1)":"0 -4px 6px -1px rgba(0, 0, 0, 0.1)",fontFamily:"system-ui, -apple-system, sans-serif",transform:s?G==="top"?"translateY(-100%)":"translateY(100%)":"translateY(0)",transition:"transform 0.2s ease-out"},children:jsxRuntime.jsxs("div",{style:{maxWidth:"1200px",margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"16px"},children:[jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",gap:"12px"},children:[ze[h].icon,jsxRuntime.jsxs("div",{style:{flex:1},children:[I&&jsxRuntime.jsx("strong",{style:{display:"block",marginBottom:g?"2px":0},children:I}),g&&jsxRuntime.jsx("span",{style:{opacity:.9,fontSize:"14px"},children:g})]}),d&&o>1&&jsxRuntime.jsxs("span",{style:{fontSize:"12px",opacity:.7,flexShrink:0},children:[t+1,"/",o]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[A?jsxRuntime.jsx(X,{buttons:v.buttons,currentStep:t,totalSteps:o,isLastStep:t===o-1,onNext:r,onPrev:i,onDismiss:E,onCustomAction:c,accentColor:"white"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:t<o-1?jsxRuntime.jsx("button",{onClick:r,style:{padding:"6px 12px",fontSize:"14px",border:"none",borderRadius:"4px",backgroundColor:"rgba(255,255,255,0.2)",color:R,cursor:"pointer"},children:"Next"}):jsxRuntime.jsx("button",{onClick:E,style:{padding:"6px 12px",fontSize:"14px",border:"none",borderRadius:"4px",backgroundColor:"rgba(255,255,255,0.2)",color:R,cursor:"pointer"},children:"Got it"})}),jsxRuntime.jsx("button",{onClick:E,"aria-label":"Dismiss",style:{width:"28px",height:"28px",border:"none",borderRadius:"4px",backgroundColor:"transparent",color:R,opacity:.7,fontSize:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:"\xD7"})]})]})})}function rr({guide:e,onComplete:t,onDismiss:o,onStepChange:r,onCustomAction:i,globalStyle:n,startStep:c=0,zIndex:d=9999}){let[a,l]=react.useState(c),[s,p]=react.useState(true),f=e.guide_steps||[],m=f.length,u=f[a];react.useEffect(()=>{r?.(a,m);},[a,m,r]);let k=react.useCallback(()=>{a<m-1?l(C=>C+1):(p(false),t?.(e));},[a,m,e,t]),G=react.useCallback(()=>{a>0&&l(C=>C-1);},[a]),h=react.useCallback(()=>{p(false),o?.(e,a);},[e,a,o]),T=react.useCallback(C=>{u&&i?.(C,u);},[u,i]);if(!s||!u||f.length===0)return null;let R={step:u,currentStep:a,totalSteps:m,onNext:k,onPrev:G,onDismiss:h,onCustomAction:T,showProgress:e.show_progress!==false,globalStyle:{...e.theme,...n},zIndex:d};switch(u.step_type){case "tooltip":return jsxRuntime.jsx(Se,{...R});case "modal":return jsxRuntime.jsx(_e,{...R});case "slideout":return jsxRuntime.jsx(Be,{...R});case "hotspot":return jsxRuntime.jsx(Fe,{...R});case "banner":return jsxRuntime.jsx(Ae,{...R});default:return jsxRuntime.jsx(Se,{...R})}}exports.Backdrop=re;exports.BannerStep=Ae;exports.CensusProvider=Yt;exports.FeedbackButton=lo;exports.GuideBuilder=Do;exports.GuideRenderer=rr;exports.HelpCenter=_o;exports.HotspotStep=Fe;exports.KnowledgeBase=uo;exports.ModalStep=_e;exports.Requests=bo;exports.SlideoutStep=Be;exports.StepButtons=X;exports.StepContent=Q;exports.TooltipStep=Se;exports.useArticle=ye;exports.useArticles=be;exports.useCensus=Qt;exports.useCensusContext=N;exports.useFeatureGroups=Oe;exports.useFeedback=me;exports.useGuideBuilder=Ne;exports.useGuideRenderer=ro;exports.useGuides=oo;exports.useIdentify=Jt;exports.useRequests=xe;exports.useTrack=to;//# sourceMappingURL=index.cjs.map
28
81
  //# sourceMappingURL=index.cjs.map