@opengovsg/confetti 0.9.0 → 0.9.1

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.
@@ -0,0 +1,7 @@
1
+ import e,{createContext as t,forwardRef as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"ky";import u from"clsx";import"react-dom";const d=l.create({prefixUrl:`https://confetti.gov.sg`,retry:{limit:3,methods:[`get`,`head`]},timeout:6e4});function f({publishableKey:e,apiBaseUrl:t}){return o(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),d.extend(n)},[t,e])}const p=typeof document<`u`?e.useLayoutEffect:()=>{};typeof window<`u`&&window.document&&window.document.createElement;let m=new Map;typeof FinalizationRegistry<`u`&&new FinalizationRegistry(e=>{m.delete(e)});function h(e,t){if(e===t)return e;let n=m.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=m.get(t);return r?(r.forEach(t=>t.current=e),e):t}function g(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function _(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=v(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():v(e[n],null)})}}}function v(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function y(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=g(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=u(n,i):e===`id`&&n&&i?t.id=h(n,i):e===`ref`&&n&&i?t.ref=_(n,i):t[e]=i===void 0?n:i}}return t}const b=new Set([`id`]),x=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),S=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),C=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),w=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),T=/^(data-.*)$/;function E(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(b.has(t)||n&&x.has(t)||r&&S.has(t)||i&&C.has(t)||a&&(w.has(t)||t.endsWith(`Capture`)&&w.has(t.slice(0,-7)))||o?.has(t)||T.test(t))&&(s[t]=e[t]);return s}function D(e){let t=s(null),n=s(void 0),i=r(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}else if(e)return e.current=t,()=>{e.current=null}},[e]);return o(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=i(e))}}),[i])}const O=Symbol(`default`);function k({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function ee(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:s,values:c,render:l}=e;return o(()=>{let e,o,u;return e=typeof t==`function`?t({...c,defaultClassName:i}):t,o=typeof n==`function`?n({...c,defaultStyle:s||{}}):n,u=typeof r==`function`?r({...c,defaultChildren:a}):r??a,{className:e??i,style:o||s?{...s,...o}:void 0,children:u??a,"data-rac":``,render:l?e=>l(e,c):void 0}},[t,n,r,i,a,s,c,l])}function te(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function A(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||O;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:`A slot prop is required.`;throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function ne(e,t,n){let{ref:r,...i}=A(n,e.slot)||{},a=D(o(()=>_(t,r),[t,r])),s=y(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?s.style=t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:s.style={...i.style,...e.style}),[s,a]}function re(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return p(()=>{i.current||n(!1)},[]),[a,t]}function ie(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function ae(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>_(r,c),[r,c]);p(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const oe={},se=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=oe[t];return r||(r=n(ae.bind(null,t)),oe[t]=r),r}});typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const ce=t(!1);function le(e){let t=(t,n)=>i(ce)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}function j(e){if(de())e.focus({preventScroll:!0});else{let t=fe(e);e.focus(),pe(t)}}let ue=null;function de(){if(ue==null){ue=!1;try{document.createElement(`div`).focus({get preventScroll(){return ue=!0,!0}})}catch{}}return ue}function fe(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function pe(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}const M=e=>e?.ownerDocument??document,N=e=>e&&`window`in e&&e.window===e?e:M(e).defaultView||window;function me(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function he(e){return me(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function P(){return!1}function F(e,t){if(!P())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:he(n)?n.host:n.parentNode}return!1}const I=(e=document)=>{if(!P())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function L(e){if(P()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function ge(e){if(!e)return!1;let t=e.getRootNode(),n=N(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}const _e=typeof Element<`u`&&`checkVisibility`in Element.prototype;function ve(e){let t=N(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=N(e),{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function ye(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function be(e,t){return _e?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&ve(e)&&ye(e,t)&&(!e.parentElement||be(e.parentElement,e))}const xe=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable^="false"])`,`permission`],Se=xe.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;xe.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const Ce=xe.join(`:not([hidden]):not([tabindex="-1"]),`);function we(e,t){return e.matches(Se)&&!Ee(e)&&(t?.skipVisibilityCheck||be(e))}function Te(e){return e.matches(Ce)&&be(e)&&!Ee(e)}function Ee(e){let t=e;for(;t!=null;){if(t instanceof N(t).HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}const R=typeof document<`u`?e.useLayoutEffect:()=>{};function De(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Oe(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function ke(e){let t=s({isFocused:!1,observer:null});return R(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=L(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=De(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===I()?null:I();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let Ae=!1;function je(e){for(;e&&!we(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=N(e),n=t.document.activeElement;if(!n||n===e)return;Ae=!0;let r=!1,i=e=>{(L(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(L(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,j(n),c()))},o=t=>{(L(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(L(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,j(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),Ae=!1,r=!1},l=requestAnimationFrame(c);return c}function Me(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Ne(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function z(e){let t=null;return()=>(t??=e(),t)}const B=z(function(){return Ne(/^Mac/i)}),Pe=z(function(){return Ne(/^iPhone/i)}),Fe=z(function(){return Ne(/^iPad/i)||B()&&navigator.maxTouchPoints>1}),Ie=z(function(){return Pe()||Fe()}),Le=z(function(){return Me(/AppleWebKit/i)&&!Re()}),Re=z(function(){return Me(/Chrome/i)}),ze=z(function(){return Me(/Android/i)}),Be=z(function(){return Me(/Firefox/i)});function Ve(e){return e.pointerType===``&&e.isTrusted?!0:ze()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function He(e){return!ze()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function V(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;Be()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(B()?r=!0:i=!0);let s=Le()&&B()&&!Fe()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});V.isOpening=n,j(e),e.dispatchEvent(s),V.isOpening=!1}V.isOpening=!1;const Ue={prefix:String(Math.round(Math.random()*1e10)),current:0},We=e.createContext(Ue),Ge=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let Ke=new WeakMap;function qe(t=!1){let n=i(We),r=s(null);if(r.current===null&&!t){let t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(t){let e=Ke.get(t);e==null?Ke.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,Ke.delete(t))}r.current=++n.current}return r.current}function Je(e){let t=i(We),n=qe(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function Ye(t){let n=e.useId(),[r]=c(et()),i=r?`react-aria`:`react-aria${Ue.prefix}`;return t||`${i}-${n}`}const Xe=typeof e.useId==`function`?Ye:Je;function Ze(){return!1}function Qe(){return!0}function $e(e){return()=>{}}function et(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore($e,Ze,Qe):i(Ge)}let H=null;const tt=new Set;let U=new Map,W=!1,nt=!1;const rt={Tab:!0,Escape:!0};function it(e,t){for(let n of tt)n(e,t)}function at(e){return!(e.metaKey||!B()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function ot(e){W=!0,!V.isOpening&&at(e)&&(H=`keyboard`,it(`keyboard`,e))}function G(e){H=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(W=!0,it(`pointer`,e))}function st(e){!V.isOpening&&Ve(e)&&(W=!0,H=`virtual`)}function ct(e){let t=N(L(e)),n=M(L(e));L(e)===t||L(e)===n||Ae||!e.isTrusted||(!W&&!nt&&(H=`virtual`,it(`virtual`,e)),W=!1,nt=!1)}function lt(){Ae||(W=!1,nt=!0)}function ut(e){if(typeof window>`u`||typeof document>`u`)return;let t=N(e),n=M(e);if(U.get(t))return;let r=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){W=!0,r.apply(this,arguments)}}),n.addEventListener(`keydown`,ot,!0),n.addEventListener(`keyup`,ot,!0),n.addEventListener(`click`,st,!0),t.addEventListener(`focus`,ct,!0),t.addEventListener(`blur`,lt,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,G,!0),n.addEventListener(`pointermove`,G,!0),n.addEventListener(`pointerup`,G,!0)),t.addEventListener(`beforeunload`,()=>{dt(e)},{once:!0}),U.set(t,{focus:r})}const dt=(e,t)=>{let n=N(e),r=M(e);t&&r.removeEventListener(`DOMContentLoaded`,t),U.has(n)&&(Reflect.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:U.get(n).focus}),r.removeEventListener(`keydown`,ot,!0),r.removeEventListener(`keyup`,ot,!0),r.removeEventListener(`click`,st,!0),n.removeEventListener(`focus`,ct,!0),n.removeEventListener(`blur`,lt,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,G,!0),r.removeEventListener(`pointermove`,G,!0),r.removeEventListener(`pointerup`,G,!0)),U.delete(n))};function ft(e){let t=M(e),n;return t.readyState===`loading`?(n=()=>{ut(e)},t.addEventListener(`DOMContentLoaded`,n)):ut(e),()=>dt(e,n)}typeof document<`u`&&ft();function pt(){return H!==`pointer`}function mt(){return H}function ht(e){H=e,it(e,null)}const gt=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function _t(e,t,n){let r=n?L(n):void 0,i=M(r),a=N(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=I(i);return e=e||u instanceof o&&!gt.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!rt[n.key])}function vt(e,t,n){ut(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{_t(!!n?.isTextInput,t,r)&&e(pt())};return tt.add(t),()=>{tt.delete(t)}},t)}let K=new Map,yt=new Set;function bt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=L(t);if(!e(t)||!r)return;let i=K.get(r);i||(i=new Set,K.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=L(t);if(!e(t)||!r)return;let i=K.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),K.delete(r)),K.size===0)){for(let e of yt)e();yt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,bt):bt());function xt(){for(let[e]of K)`isConnected`in e&&!e.isConnected&&K.delete(e)}function St(e){requestAnimationFrame(()=>{xt(),K.size===0?e():yt.add(e)})}function Ct(e){if(!e.isConnected)return;let t=M(e);if(mt()===`virtual`){let n=I(t);St(()=>{let r=I(t);(r===n||r===t.body)&&e.isConnected&&j(e)})}else j(e)}function wt(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}function Tt(e){let[t,n]=c(e),i=s(t),a=s(null),o=s(()=>{if(!a.current)return;let e=a.current.next();if(e.done){a.current=null;return}i.current===e.value?o.current():n(e.value)});return R(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let Et=!!(typeof window<`u`&&window.document&&window.document.createElement),q=new Map,J;typeof FinalizationRegistry<`u`&&(J=new FinalizationRegistry(e=>{q.delete(e)}));function Dt(e){let[t,n]=c(e),r=s(null),i=Xe(t),o=s(null);if(J&&J.register(o,i),Et){let e=q.get(i);e&&!e.includes(r)?e.push(r):q.set(i,[r])}return R(()=>{let e=i;return()=>{J&&J.unregister(o),q.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function Ot(e,t){if(e===t)return e;let n=q.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=q.get(t);return r?(r.forEach(t=>t.current=e),e):t}function kt(e=[]){let t=Dt(),[n,i]=Tt(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return R(a,[t,a,...e]),n}function At(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=jt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():jt(e[n],null)})}}}function jt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Y(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=wt(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=u(n,i):e===`id`&&n&&i?t.id=Ot(n,i):e===`ref`&&n&&i?t.ref=At(n,i):t[e]=i===void 0?n:i}}return t}function Mt(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(L(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=ke(o),c=r(e=>{let t=L(e),r=M(t),i=r?I(r):I();t===e.currentTarget&&t===i&&(n&&n(e),a&&a(!0),s(e))},[a,n,s]);return{focusProps:{onFocus:!t&&(n||a||i)?c:void 0,onBlur:!t&&(i||a)?o:void 0}}}function Nt(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1,typeof n.continuePropagation==`function`&&n.continuePropagation()},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function Pt(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:Nt(e.onKeyDown),onKeyUp:Nt(e.onKeyUp)}}}function Ft(e,t){R(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}let It=e.createContext(null);function Lt(e){let t=i(It)||{};Ft(t,e);let{ref:n,...r}=t;return r}function Rt(e,t){let{focusProps:n}=Mt(e),{keyboardProps:r}=Pt(e),i=Y(n,r),o=Lt(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&Ct(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:Y({...i,tabIndex:u},c)}}const zt=e.useInsertionEffect??R;function Bt(e){let t=s(null);return zt(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}const Vt=new Set([`id`]),Ht=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Ut=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),Wt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Gt=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),Kt=/^(data-.*)$/;function qt(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(Vt.has(t)||n&&Ht.has(t)||r&&Ut.has(t)||i&&Wt.has(t)||a&&(Gt.has(t)||t.endsWith(`Capture`)&&Gt.has(t.slice(0,-7)))||o?.has(t)||Kt.test(t))&&(s[t]=e[t]);return s}let X=`default`,Jt=``,Z=new WeakMap;function Yt(e){if(Ie()){if(X==="default"){let t=M(e);Jt=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}X=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;Z.set(e,e.style[t]),e.style[t]=`none`}}function Xt(e){if(Ie()){if(X!==`disabled`)return;X=`restoring`,setTimeout(()=>{St(()=>{if(X===`restoring`){let t=M(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=Jt||``),Jt=``,X=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&Z.has(e)){let t=Z.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),Z.delete(e)}}function Zt(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let Qt=new WeakMap;function $t(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Zt(t);if(Qt.has(t))return Qt.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof N(n).HTMLMetaElement&&(n.nonce||n.content)||Zt(t)||void 0;return r!==void 0&&Qt.set(t,r),r}const en=e.createContext({register:()=>{}});en.displayName=`PressResponderContext`;function tn(){let e=s(new Map),t=r((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=r((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),i=r(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a(()=>i,[i]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:i}}function nn(e){let t=i(en);if(t){let{register:n,ref:r,...i}=t;e=Y(i,e),n()}return Ft(t,e.ref),e}var rn=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}};const an=Symbol(`linkClicked`),on=`react-aria-pressable-style`,sn=`data-react-aria-pressable`;function cn(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=nn(e),[y,b]=c(!1),x=s({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=tn(),w=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new rn(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,b(!0),a},[f,i,n]),T=r((e,r,i=!0)=>{let a=x.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let o=!0;if(l){let t=new rn(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&i&&!f){let n=new rn(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),E=Bt(T),D=Bt(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new rn(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),O=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(Q(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||Xt(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,T]),k=Bt(O);a(()=>{f&&x.current.isPressed&&k({currentTarget:x.current.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})},[f]);let ee=r(e=>{h&&O(e)},[h,O]),te=r(e=>{f||d?.(e)},[f,d]),A=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);Oe(n,t),d(De(n))}},[f,d]),ne=o(()=>{let e=x.current,t={onKeyDown(t){if(un(t.nativeEvent,t.currentTarget)&&F(t.currentTarget,L(t))){fn(L(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=w(t,`keyboard`));let i=t.currentTarget;S(M(t.currentTarget),`keyup`,wt(t=>{un(t,i)&&!t.repeat&&F(i,L(t))&&e.target&&D(Q(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&B()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!F(t.currentTarget,L(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!V.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ve(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);te(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(Q(t.currentTarget,t),r),a=E(Q(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,te(t),k(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&un(t,e.target)){fn(L(t),t.key)&&t.preventDefault();let n=L(t),r=F(e.target,n);E(Q(e.target,t),`keyboard`,r),r&&A(t,e.target),C(),t.key!==`Enter`&&ln(e.target)&&F(e.target,n)&&!t[an]&&(t[an]=!0,V(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())e.target?.dispatchEvent(new KeyboardEvent(`keyup`,n))}};if(typeof PointerEvent<`u`){t.onPointerDown=t=>{if(t.button!==0||!F(t.currentTarget,L(t)))return;if(He(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,g||Yt(e.target),i=w(t,e.pointerType);let a=L(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(M(t.currentTarget),`pointerup`,n,!1),S(M(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(F(t.currentTarget,L(t))&&t.button===0){if(m){let n=je(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!F(t.currentTarget,L(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&D(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(Q(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(Q(e.target,t),e.pointerType,!1),ee(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(F(e.target,L(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?k(t):(j(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else k(t);e.isOverTarget=!1}},r=e=>{k(e)};t.onDragStart=e=>{F(e.currentTarget,L(e))&&k(e)}}return t},[S,f,m,C,g,ee,w,te,A]);return a(()=>{if(!_)return;let e=M(_.current);if(!e||!e.head||e.getElementById(on))return;let t=e.createElement(`style`);t.id=on;let n=$t(e);n&&(t.nonce=n),t.textContent=`
2
+ @layer {
3
+ [${sn}] {
4
+ touch-action: pan-x pan-y pinch-zoom;
5
+ }
6
+ }
7
+ `.trim(),e.head.prepend(t)},[_]),a(()=>{let e=x.current;return()=>{g||Xt(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:Y(v,ne,{[sn]:!0})}}function ln(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function un(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof N(i).HTMLInputElement&&!mn(i,n)||i instanceof N(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&ln(i))&&n!==`Enter`)}function Q(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function dn(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!ln(e)}function fn(e,t){return e instanceof HTMLInputElement?!mn(e,t):dn(e)}const pn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function mn(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:pn.has(e.type)}function hn(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=cn({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Rt(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=Y(y,_,qt(e,{labelable:!0}));return{isPressed:v,buttonProps:Y(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}function gn(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=tn(),u=r(e=>{F(e.currentTarget,L(e))&&o.current.isFocusWithin&&!F(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=ke(u),f=r(e=>{if(!F(e.currentTarget,L(e)))return;let t=L(e),n=M(t),r=I(n);if(!o.current.isFocusWithin&&r===t){i&&i(e),a&&a(!0),o.current.isFocusWithin=!0,d(e);let t=e.currentTarget;c(n,`focus`,e=>{let r=L(e);if(o.current.isFocusWithin&&!F(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});Oe(e,t);let i=De(e);u(i)}},{capture:!0})}},[i,a,d,c,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:u}}}function _n(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||pt()}),[o,l]=c(!1),[u,d]=c(()=>a.current.isFocused&&a.current.isFocusVisible),f=r(()=>d(a.current.isFocused&&a.current.isFocusVisible),[]),p=r(e=>{a.current.isFocused=e,a.current.isFocusVisible=pt(),l(e),f()},[f]);vt(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=Mt({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=gn({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let vn=!1,yn=0;function bn(){vn=!0,setTimeout(()=>{vn=!1},500)}function xn(e){e.pointerType===`touch`&&bn()}function Sn(){let e=M(null);if(e!==void 0)return yn===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,xn),yn++,()=>{yn--,!(yn>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,xn)}}function Cn(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[l,u]=c(!1),d=s({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;a(Sn,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=tn(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!F(e.currentTarget,L(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(M(L(e)),`pointerover`,e=>{d.isHovered&&d.target&&!F(d.target,L(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:o,pointerType:r}),n&&n(!0),u(!0)},a=(e,t)=>{let i=d.target;d.pointerType=``,d.target=null,!(t===`touch`||!d.isHovered||!i)&&(d.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),u(!1))},o={};return typeof PointerEvent<`u`&&(o.onPointerEnter=t=>{vn&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&F(e.currentTarget,L(e))&&a(e,e.pointerType)}),{hoverProps:o,triggerHoverEnd:a}},[t,n,r,i,d,f,p]);return a(()=>{i&&h({currentTarget:d.target},d.pointerType)},[i]),{hoverProps:m,isHovered:l}}const wn=t(null),Tn=7e3;let $=null;function En(e,t=`assertive`,n=Tn){$?$.announce(e,t,n):($=new Dn,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var Dn=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=Tn){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const On=t({}),kn=le(function(t,n){[t,n]=ne(t,n,On);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=hn(t,n);o=jn(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=_n(t),{hoverProps:f,isHovered:p}=Cn({...t,isDisabled:t.isDisabled||i}),m={isHovered:p,isPressed:(r.isPressed||c)&&!i,isFocused:u,isFocusVisible:d,isDisabled:t.isDisabled||!1,isPending:i??!1},h=ee({...t,values:m,defaultClassName:`react-aria-Button`}),g=Dt(o.id),_=Dt(),v=o[`aria-labelledby`];i&&(v?v=`${v} ${_}`:o[`aria-label`]&&(v=`${g} ${_}`));let y=s(i);a(()=>{let e={"aria-labelledby":v||g};(!y.current&&u&&i||y.current&&u&&!i)&&En(e,`assertive`),y.current=i},[i,u,v,g]);let b=E(t,{global:!0});return delete b.onClick,e.createElement(se.button,{...Y(b,h,o,l,f),type:o.type===`submit`&&i?`button`:o.type,id:g,ref:n,"aria-labelledby":v,slot:t.slot||void 0,"aria-disabled":i?`true`:o[`aria-disabled`],"data-disabled":t.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":u||void 0,"data-pending":i||void 0,"data-focus-visible":d||void 0},e.createElement(wn.Provider,{value:{id:_}},h.children))}),An=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function jn(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!An.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{P as A,se as B,R as C,ge as D,F as E,ne as F,y as G,A as H,ee as I,f as J,_ as K,re as L,N as M,le as N,I as O,k as P,te as R,Ie as S,Te as T,D as U,ie as V,E as W,mt as _,gn as a,Re as b,$t as c,Rt as d,Y as f,Ct as g,wt as h,_n as i,M as j,L as k,qt as l,Dt as m,kn as n,cn as o,kt as p,p as q,Cn as r,en as s,On as t,Bt as u,ht as v,we as w,ze as x,et as y,O as z};
@@ -1,4 +1,4 @@
1
- import { a as BugReportAnswer, c as SingleSelectAnswer, n as PublicGetSurveyOutput, o as MultiSelectAnswer, r as Locale, s as RatingAnswer, t as PublicPutResponseOutput } from "./index-BgEIWUUt.js";
1
+ import { a as BugReportAnswer, c as SingleSelectAnswer, n as PublicGetSurveyOutput, o as MultiSelectAnswer, r as Locale, s as RatingAnswer, t as PublicPutResponseOutput } from "./index-DLqC_qk3.js";
2
2
  import { PropsWithChildren, ReactNode } from "react";
3
3
 
4
4
  //#region src/core/types.d.ts
@@ -0,0 +1 @@
1
+ import{n as e}from"./Button-D3Wb2KZB.js";import{t}from"./src-DG66KK2l.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l(e){return typeof e!=`boolean`}function u({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const d={lastRespondedAt:null,lastDismissedAt:null};async function f({client:e,surveyId:n,respondent:r,signal:i}){try{let a=await e.get(`api/v1/cfti/${encodeURIComponent(n)}/respondent/${encodeURIComponent(r)}`,{signal:i}).json(),o=t.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),d)}catch{return d}}function p({client:e,surveyId:t,respondent:i,enabled:a=!0}){let[o,s]=r(d),[c,l]=r(()=>!a),[u,p]=r({client:e,surveyId:t,respondent:i,enabled:a});return(u.client!==e||u.surveyId!==t||u.respondent!==i||u.enabled!==a)&&(p({client:e,surveyId:t,respondent:i,enabled:a}),s(d),l(!a)),n(()=>{if(!a||!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;f({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(s(e),l(!0))})};r();let o=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,o),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,o)}},[e,t,i,a]),{state:o,isSettled:c}}function m({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${encodeURIComponent(t)}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const h=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),g=({onClick:t,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(e,{onPress:t,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(h,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{u as a,p as i,h as n,c as o,m as r,l as s,g as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,o as n,r,s as i}from"./DefaultConfettiTrigger-iGndzjo2.js";import{B as a,C as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,P as g,R as _,U as v,V as y,W as b,a as x,d as S,f as C,i as w,k as T,l as E,m as D,n as O,o as k,p as A,r as j,u as M,v as N}from"./Button-D3Wb2KZB.js";import{c as ee,d as te,f as ne,h as re,l as ie,m as ae,o as oe,p as se,s as ce,u as le}from"./src-DG66KK2l.js";import{a as ue,n as de,o as fe,r as pe,t as me}from"./internals-DKNTeE-L.js";import{S as he,_ as ge,a as P,b as _e,c as ve,g as ye,h as be,i as xe,l as Se,o as Ce,p as we,r as Te,s as Ee,u as De,v as Oe,x as ke,y as Ae}from"./ModalContainer-kQ-gmZ0r.js";import F,{Suspense as je,cloneElement as Me,createContext as I,forwardRef as L,isValidElement as Ne,lazy as Pe,useCallback as R,useContext as z,useEffect as B,useMemo as V,useRef as H,useState as U}from"react";import{useTimeout as Fe}from"usehooks-ts";import{Fragment as W,jsx as G,jsxs as K}from"react/jsx-runtime";import q from"clsx";import"react-dom";function Ie(e,t,n){let r=M(e=>{n&&!e.defaultPrevented&&n(t)});B(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Le(e,t,n){let{validationBehavior:r,focus:i}=e;o(()=>{if(r===`native`&&n?.current&&`setCustomValidity`in n.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(ze(n.current))}});let a=H(!1),s=M(()=>{a.current||t.resetValidation()}),c=M(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Be(r)===n.current&&(i?i():n.current?.focus(),N(`keyboard`)),e.preventDefault()}),l=M(()=>{t.commitValidation()});B(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&T(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,c),e.addEventListener(`change`,l),t?.addEventListener(`reset`,s),()=>{e.removeEventListener(`invalid`,c),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,s),t&&(t.reset=r)}},[n,r])}function Re(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function ze(e){return{isInvalid:!e.validity.valid,validationDetails:Re(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Be(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}function Ve(e=!0){let[t,n]=U(e),r=H(!1),i=R(e=>{r.current=!0,n(!!e)},[]);return o(()=>{r.current||n(!1)},[]),[i,t]}function He(e=!0){let t=D(),[n,r]=Ve(e);return{id:r?t:void 0,ref:n}}const Ue={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},We={...Ue,customError:!0,valid:!1},J={isInvalid:!1,validationDetails:Ue,validationErrors:[]},Ge=I({}),Ke=`__reactAriaFormValidationState`;function Y(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Ke];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return qe(e)}function qe(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:We},l=V(()=>!o||i==null?null:Xe(Ye(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=z(Ge),d=V(()=>r?Array.isArray(r)?r.flatMap(e=>Je(u[e])):Je(u[r]):[],[u,r]),[f,p]=U(u),[m,h]=U(!1);u!==f&&(p(u),h(!1));let g=V(()=>Xe(m?[]:d),[m,d]),_=H(J),[v,y]=U(J),b=H(J),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Ze(e,b.current)||(b.current=e,y(e))},[S,C]=U(!1);return B(x),{realtimeValidation:c||g||l||a||J,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Ze(v,e)?y(e):_.current=e},resetValidation(){let e=J;Ze(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function Je(e){return e?Array.isArray(e)?e:[e]:[]}function Ye(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Je(n)}return[]}function Xe(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:We}:null}function Ze(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Qe(...e){let t=new Set,n=!1,r={...Ue};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function $e(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:a,name:o,form:s,children:c,isRequired:l,validationBehavior:u=`aria`,"aria-label":d,"aria-labelledby":f,"aria-describedby":p,onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:v,onClick:y}=e,b=Y({...e,value:t.isSelected}),{isInvalid:x,validationErrors:w,validationDetails:D}=b.displayValidation;Le(e,b,n);let O=e=>{e.stopPropagation(),t.setSelected(T(e).checked)},{pressProps:A,isPressed:j}=k({onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:v,onClick:y,isDisabled:r}),[M,N]=U(!1),{pressProps:ee}=k({onPressStart(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}m?.(e),g?.(!0),N(!0)},onPressEnd(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}h?.(e),g?.(!1),N(!1)},onPressUp(e){if(e.pointerType===`keyboard`||e.pointerType===`virtual`){e.continuePropagation();return}v?.(e)},onClick:y,onPress(r){if(r.pointerType===`keyboard`||r.pointerType===`virtual`){r.continuePropagation();return}_?.(r),t.toggle(),n.current?.focus();let{[Ke]:i}=e,{commitValidation:a}=i||b;a()},isDisabled:r||i}),{focusableProps:te}=S(e,n),ne=C(A,te),re=E(e,{labelable:!0});Ie(n,t.defaultSelected,t.setSelected);let ie=He(),ae=He();return{labelProps:C(ee,{onClick:e=>e.preventDefault()}),inputProps:C(re,{checked:t.isSelected,"aria-required":l&&u===`aria`||void 0,required:l&&u===`native`,"aria-invalid":x||e.validationState===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,"aria-describedby":[ie.id,ae.id,p].filter(Boolean).join(` `)||void 0,onChange:O,disabled:r,...a==null?{}:{value:a},name:o,form:s,type:`checkbox`,...ne}),descriptionProps:ie,errorMessageProps:ae,isSelected:t.isSelected,isPressed:j||M,isDisabled:r,isReadOnly:i,isInvalid:x||e.validationState===`invalid`,validationErrors:w,validationDetails:D}}function et(e,t,n){let{labelProps:r,inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:c,isDisabled:l,isReadOnly:u,isInvalid:d,validationErrors:f,validationDetails:p}=$e(e,t,n),{isIndeterminate:m}=e;return B(()=>{n.current&&(n.current.indeterminate=!!m)}),{labelProps:C(r,V(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:i,descriptionProps:a,errorMessageProps:o,isSelected:s,isPressed:c,isDisabled:l,isReadOnly:u,isInvalid:d,validationErrors:f,validationDetails:p}}const tt=new WeakMap;function nt(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=D(t);let o=D(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=_e({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function rt(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=nt(e),s=A([!!t,!!n,r,i]),c=A([!!t,!!n,r,i]);return o=C(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function it(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:a=`aria`}=e,{isInvalid:o,validationErrors:s,validationDetails:c}=t.displayValidation,{labelProps:l,fieldProps:u,descriptionProps:d,errorMessageProps:f}=rt({...e,labelElementType:`span`,isInvalid:o,errorMessage:e.errorMessage||s});tt.set(t,{name:r,form:i,descriptionId:d.id,errorMessageId:f.id,validationBehavior:a});let p=E(e,{labelable:!0}),{focusWithinProps:m}=x({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:C(p,{role:`group`,"aria-disabled":n||void 0,...u,...m}),labelProps:l,descriptionProps:d,errorMessageProps:f,isInvalid:o,validationErrors:s,validationDetails:c}}function at(e={}){let{isReadOnly:t}=e,[n,r]=ge(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=U(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function ot(e,t,n){let r=at({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=tt.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=Y({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=H(J),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};B(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=et({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[Ke]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[m.inputProps[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}function st(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:a=!1,type:o=`text`,validationBehavior:s=`aria`}=e,[c,l]=ge(e.value,e.defaultValue||``,e.onChange),{focusableProps:u}=S(e,t),d=Y({...e,value:c}),{isInvalid:f,validationErrors:p,validationDetails:m}=d.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:_,errorMessageProps:v}=rt({...e,isInvalid:f,errorMessage:e.errorMessage||p}),y=E(e,{labelable:!0}),b={type:o,pattern:e.pattern},[x]=U(c);return Ie(t,e.defaultValue??x,l),Le(e,d,t),{labelProps:h,inputProps:C(y,n===`input`?b:void 0,{disabled:r,readOnly:a,required:i&&s===`native`,"aria-required":i&&s===`aria`||void 0,"aria-invalid":f||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:c,onChange:e=>l(T(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(F.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...u,...g}),descriptionProps:_,errorMessageProps:v,isInvalid:f,validationErrors:p,validationDetails:m}}const ct=new WeakMap;function lt(e,t,n){let{value:r,children:i,"aria-label":a,"aria-labelledby":o,onPressStart:s,onPressEnd:c,onPressChange:l,onPress:u,onPressUp:d,onClick:f}=e,p=e.isDisabled||t.isDisabled,m=t.selectedValue===r,h=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:g,isPressed:_}=k({onPressStart:s,onPressEnd:c,onPressChange:l,onPress:u,onPressUp:d,onClick:f,isDisabled:p}),{pressProps:v,isPressed:y}=k({onPressStart:s,onPressEnd:c,onPressChange:l,onPressUp:d,onClick:f,isDisabled:p,onPress(e){u?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:b}=S(C(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),x=C(g,b),w=E(e,{labelable:!0}),T=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(T=0):t.selectedValue===r&&(T=0),p&&(T=void 0);let{name:D,form:O,descriptionId:A,errorMessageId:j,validationBehavior:M}=ct.get(t);Ie(n,t.defaultSelectedValue,t.setSelectedValue),Le({validationBehavior:M},t,n);let N=He();return{labelProps:C(v,V(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:C(w,{...x,type:`radio`,name:D,form:O,tabIndex:T,disabled:p,required:t.isRequired&&M===`native`,checked:m,value:r,onChange:h,"aria-describedby":[e[`aria-describedby`],N.id,t.isInvalid?j:null,A].filter(Boolean).join(` `)||void 0}),descriptionProps:N,isDisabled:p,isSelected:m,isPressed:_||y}}function ut(e,t){let{name:n,form:r,isReadOnly:i,isRequired:a,isDisabled:o,orientation:s=`vertical`,validationBehavior:c=`aria`}=e,{direction:l}=Ae(),{isInvalid:u,validationErrors:d,validationDetails:f}=t.displayValidation,{labelProps:p,fieldProps:h,descriptionProps:g,errorMessageProps:_}=rt({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||d}),v=E(e,{labelable:!0}),{focusWithinProps:y}=x({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),b=e=>{let n;switch(e.key){case`ArrowRight`:n=l===`rtl`&&s!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=l===`rtl`&&s!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=Oe(e.currentTarget,{from:T(e),accept:e=>e instanceof m(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},S=D(n);return ct.set(t,{name:S,form:r,descriptionId:g.id,errorMessageId:_.id,validationBehavior:c}),{radioGroupProps:C(v,{role:`radiogroup`,onKeyDown:b,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":a||void 0,"aria-disabled":o||void 0,"aria-orientation":s,...h,...y}),labelProps:p,descriptionProps:g,errorMessageProps:_,isInvalid:u,validationErrors:d,validationDetails:f}}const dt=I({}),X=h(function(e,t){[e,t]=s(e,t,dt);let{elementType:n=`label`,...r}=e,i=a[n];return F.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),ft=I({}),Z=L(function(e,t){[e,t]=s(e,t,ft);let{elementType:n=`span`,...r}=e,i=a[n];return F.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function pt(e={}){let[t,n]=ge(e.value,e.defaultValue||[],e.onChange),[r]=U(t),i=!!e.isRequired&&t.length===0,a=H(new Map),o=Y({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Qe(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let mt=Math.round(Math.random()*1e10),ht=0;function gt(e){let t=V(()=>e.name||`radio-group-${mt}-${++ht}`,[e.name]),[n,r]=ge(e.value,e.defaultValue??null,e.onChange),[i]=U(n),[a,o]=U(null),s=Y({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const _t=I(null),vt=L(function(e,t){return z(_t)?.isInvalid?F.createElement(yt,{...e,ref:t}):null}),yt=L((e,t)=>{let n=z(_t),r=b(e,{global:!0}),i=u({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:F.createElement(Z,{slot:`errorMessage`,...r,...i,ref:t})}),bt=I(null),xt=I(null),St=I(null),Ct=L(function(e,t){[e,t]=s(e,t,xt);let{validationBehavior:n}=l(bt)||{},r=e.validationBehavior??n??`native`,i=pt({...e,validationBehavior:r}),[o,c]=p(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:d,labelProps:f,descriptionProps:m,errorMessageProps:h,..._}=it({...e,label:c,validationBehavior:r},i),v=u({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),y=b(e,{global:!0});return F.createElement(a.div,{...C(y,v,d),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},F.createElement(g,{values:[[St,i],[dt,{...f,ref:o,elementType:`span`}],[ft,{slots:{description:m,errorMessage:h}}],[_t,_]]},v.children))}),wt=L(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=s(r,t,he);let{validationBehavior:i}=l(bt)||{},o=e.validationBehavior??i??`native`,c=z(St),d=v(V(()=>f(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:p,inputProps:m,isSelected:h,isDisabled:g,isReadOnly:_,isPressed:x,isInvalid:S}=c?ot({...y(e),value:e.value,children:typeof e.children==`function`||e.children},c,d):et({...y(e),children:typeof e.children==`function`||e.children,validationBehavior:o},at(e),d),{isFocused:T,isFocusVisible:E,focusProps:D}=w(),O=g||_,{hoverProps:k,isHovered:A}=j({...e,isDisabled:O}),M=u({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:h,isIndeterminate:e.isIndeterminate||!1,isPressed:x,isHovered:A,isFocused:T,isFocusVisible:E,isDisabled:g,isReadOnly:_,isInvalid:S,isRequired:e.isRequired||!1}}),N=b(e,{global:!0});return delete N.id,delete N.onClick,F.createElement(a.label,{...C(N,p,k,M),ref:t,slot:e.slot||void 0,"data-selected":h||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":x||void 0,"data-hovered":A||void 0,"data-focused":T||void 0,"data-focus-visible":E||void 0,"data-disabled":g||void 0,"data-readonly":_||void 0,"data-invalid":S||void 0,"data-required":e.isRequired||void 0},F.createElement(ye,{elementType:`span`},F.createElement(`input`,{...C(m,D),ref:d})),M.children)}),Tt=I({}),Et=I({});let Dt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ot=h(function(e,t){[e,t]=s(e,t,Et);let{hoverProps:n,isHovered:r}=j({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:o,focusProps:c}=w({isTextInput:!0,autoFocus:e.autoFocus}),l=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,d=u({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:l},defaultClassName:`react-aria-Input`});return F.createElement(a.input,{...C(Dt(e),c,n),...d,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":l||void 0})}),kt=I(null);function At(e){let t=H({});return F.createElement(kt.Provider,{value:t},e.children)}const jt=I({isSelected:!1}),Mt=I(null),Nt=I(null),Pt=I(null),Ft=L(function(e,t){[e,t]=s(e,t,Mt);let{validationBehavior:n}=l(bt)||{},r=e.validationBehavior??n??`native`,i=gt({...e,validationBehavior:r}),[o,d]=p(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:f,labelProps:m,descriptionProps:h,errorMessageProps:_,...v}=ut({...e,label:d,validationBehavior:r},i),y=u({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),x=b(e,{global:!0});return F.createElement(a.div,{...c(x,y,f),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},F.createElement(g,{values:[[Pt,i],[dt,{...m,ref:o,elementType:`span`}],[ft,{slots:{description:h,errorMessage:_}}],[_t,v]]},F.createElement(At,null,y.children)))}),It=L(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=s(r,t,Nt);let i=F.useContext(Pt),o=v(V(()=>f(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:l,inputProps:d,isSelected:p,isDisabled:m,isPressed:h}=lt({...y(e),children:typeof e.children==`function`||e.children},i,o),{isFocused:g,isFocusVisible:_,focusProps:x}=w(),S=m||i.isReadOnly,{hoverProps:C,isHovered:T}=j({...e,isDisabled:S}),E=u({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:p,isPressed:h,isHovered:T,isFocused:g,isFocusVisible:_,isDisabled:m,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),D=b(e,{global:!0});return delete D.id,delete D.onClick,F.createElement(a.label,{...c(D,l,C,E),ref:t,"data-selected":p||void 0,"data-pressed":h||void 0,"data-hovered":T||void 0,"data-focused":g||void 0,"data-focus-visible":_||void 0,"data-disabled":m||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},F.createElement(ye,{elementType:`span`},F.createElement(`input`,{...c(d,x),ref:o})),F.createElement(jt.Provider,{value:{isSelected:p}},E.children))}),Lt=I({});let Rt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const zt=L(function(e,t){[e,t]=s(e,t,Lt);let{hoverProps:n,isHovered:r}=j(e),{isFocused:i,isFocusVisible:o,focusProps:c}=w({isTextInput:!0,autoFocus:e.autoFocus}),l=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,d=u({...e,values:{isHovered:r,isFocused:i,isFocusVisible:o,isDisabled:e.disabled||!1,isInvalid:l},defaultClassName:`react-aria-TextArea`});return F.createElement(a.textarea,{...C(Rt(e),c,n),...d,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":o||void 0,"data-invalid":l||void 0})}),Bt=I(null),Vt=h(function(e,t){[e,t]=s(e,t,Bt);let{validationBehavior:n}=l(bt)||{},r=e.validationBehavior??n??`native`,i=H(null);[e,i]=s(e,i,ke);let[o,c]=p(!e[`aria-label`]&&!e[`aria-labelledby`]),[d,f]=U(`input`),{labelProps:m,inputProps:h,descriptionProps:_,errorMessageProps:v,...x}=st({...y(e),inputElementType:d,label:c,validationBehavior:r},i),S=R(e=>{i.current=e,e&&f(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),C=u({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:x.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),w=b(e,{global:!0});return delete w.id,F.createElement(a.div,{...w,...C,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":x.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},F.createElement(g,{values:[[dt,{...m,ref:o}],[Et,{...h,ref:S}],[Lt,{...h,ref:S}],[Tt,{role:`presentation`,isInvalid:x.isInvalid,isDisabled:e.isDisabled||!1}],[ft,{slots:{description:_,errorMessage:v}}],[_t,x]]},C.children))}),Q=e=>e===void 0||e===``||Array.isArray(e)&&e.length===0||!Array.isArray(e)&&typeof e==`object`&&ce(e),Ht=({answer:e,defaultAnswer:t})=>{if(!Q(e)||!Q(t))return e},Ut=(e,t)=>e.type===`end`?!1:e.type!==`next`||!t,Wt=({routingLogic:e,answer:t,required:n,isLastQuestion:r})=>{if(e.type!==`always`&&Q(t)&&n)return!0;let i=e.type===`always`?e.target:Q(t)?e.default:e.cases.find(e=>ue({answer:t,condition:e}))?.target??e.default;return Ut(i,r)},Gt=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=[...e].sort((e,t)=>e.position-t.position),a=r>=0?i[r]:void 0,o=fe(i,t,{forceReachableIds:a?[a.id]:void 0}),s=i.map((e,t)=>{let i={...e},a=n[e.id];return a&&(i.error=a),{...i,visible:r===t||o.has(e.id)}}),c=s.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return c===-1&&(c=s.findLastIndex(e=>!!e.visible)),{questions:s,currentIndex:c}},$={rating:({scale:e},t)=>le({scale:e},t),"open-ended":({max:e},t)=>ie({maxLength:e},t),"single-select":({editable:e},t)=>te({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>ee({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>ne(),"bug-report":(e,t)=>oe({},t)},Kt=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=$[n];return r(e,t)}case`open-ended`:{let r=$[n];return r(e,t)}case`single-select`:{let r=$[n];return r(e,t)}case`multi-select`:{let r=$[n];return r(e,t)}case`statement`:{let r=$[n];return r(e,t)}case`bug-report`:{let r=$[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},qt=({questions:e,answers:t})=>{let n=Jt({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Jt=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Yt=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Xt={},Zt=({questions:e,answers:t,errors:n,locale:r})=>{let i={};for(let a of e){if(!a.visible||!a.required||t[a.id]!==void 0||n[a.id])continue;let e=Kt(a.properties,{required:a.required}).safeParse(void 0);e.success||(i[a.id]=be(e.error,r))}return i},Qt=e=>{let t=e.querySelector(`[data-invalid]`);if(!t)return;let n=t.getAttribute(`role`);if(n===`radiogroup`||n===`group`){t.tabIndex=-1,t.focus();return}t.querySelector(`textarea, input`)?.focus()},$t=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i,locale:a})=>{let{survey:o,submit:s}=we(),[c,l]=U({}),[u,d]=U({}),[f,p]=U(null),m=V(()=>Gt({originalQuestions:o?.questions,answers:c,errors:u,pointer:e}),[o?.questions,c,u,e]),h=e??f??m.currentIndex,g=V(()=>!!o?.isBackNavigationAllowed&&h>0&&m.questions.slice(0,h).some(e=>!!e.visible),[o?.isBackNavigationAllowed,m.questions,h]),_=R((e,t)=>{let n=m.questions.find(t=>t.id===e)?.required??!1,r=Q(t);l(i=>{if(!n&&r)return i[e]===null?i:{...i,[e]:null};if(n&&r){if(!(e in i))return i;let t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}})},[m.questions]),v=R(()=>{o?.isBackNavigationAllowed&&p(t=>{let n=t??e??m.currentIndex;for(let e=n-1;e>=0;e--)if(m.questions[e]?.visible)return e;return t})},[o?.isBackNavigationAllowed,m.questions,m.currentIndex,e]),[y,b]=U(0),x=y>0,S=H(null),[C,w]=U(!1);B(()=>{y===0||!S.current||Qt(S.current)},[y]);let T=R(({answers:e})=>{Promise.resolve(s({answers:e})).then(e=>r?.(e??void 0),()=>r?.())},[r,s]),E=R(()=>{let e=Yt({questions:m.questions,errors:u}),t=Zt({questions:m.questions,answers:c,errors:e,locale:a}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&d(e=>({...e,...t})),b(e=>e+1),!1;let i=qt({questions:m.questions,answers:c});return T({answers:i}),w(!0),n?.(),!0},[c,u,m.questions,T,n,a]),D=R(({question:r,answer:i})=>{let s=m.questions.at(r);if(!s)return{error:`Question index is invalid`};let h=Kt(s.properties,{required:s.required}).safeParse(i);if(!h.success){let e=be(h.error,a);return d(t=>{if(t[s.id]===e)return t;let n={...t};return n[s.id]=e,n}),l(e=>{if(!(s.id in e))return e;let t={...e};return delete t[s.id],t}),{error:e}}d(e=>{if(!e[s.id])return e;let t={...e};return delete t[s.id],t});let g=Q(i),_=!s.required&&g?null:i,v={...c},y=v[s.id]!==_;v[s.id]=_;let b=Gt({originalQuestions:o?.questions,answers:v,errors:u,pointer:e});y&&l(v);let x=b.questions.findIndex((e,t)=>t>r&&!!e.visible);if(f!==null&&x!==-1)return p(x),{next:x};if(p(null),b.questions.filter(({visible:e})=>!!e).every(({id:e})=>v[e]!==void 0)&&t){let e=qt({questions:b.questions,answers:v});T({answers:e}),w(!0),n?.()}return{next:b.currentIndex}},[m.questions,c,o?.questions,u,t,e,f,T,n,a]);return m.questions.length===0?G(W,{}):G(`div`,{ref:S,className:`confetti ${me}`,"data-show-errors":x||void 0,children:i({questions:m.questions,current:h,answers:c,update:D,back:v,canGoBack:g,backButtonLabel:o?.backButtonLabel??void 0,saveAnswer:_,submit:E,isSubmitted:C,errors:x?u:Xt})})},en=I(null);function tn({children:a,surveyId:o,publishableKey:s,apiBaseUrl:c,respondent:l,isSurveyVisible:u}){let f=e({surveyId:o,override:l}),p=d({publishableKey:s,apiBaseUrl:c}),{isAvailable:m,isSettled:h}=r({client:p,surveyId:o}),{state:g,isSettled:_}=t({client:p,surveyId:o,respondent:f,enabled:i(u)}),v=V(()=>({respondent:f}),[f]);return!f||!h||!_||!m||!n(g,u)?null:G(en.Provider,{value:v,children:a})}function nn(e){return z(en)?G(W,{children:e.children}):G(tn,{...e})}function rn(){let e=z(en);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const an=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3,locale:o})=>{let{surveyId:s,survey:c,dismiss:l}=we(),[u,d]=U(!1),[f,p]=U(!1),[m,h]=U(!1),[g,_]=U(!1);return Fe(()=>{c&&i?.()},f&&!(m||g)?a:null),K(`div`,{className:q(`confetti-dialog ${me}`,t?.dialog),id:`${s}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),h(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),h(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),_(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||_(!1)},children:[G(Te,{className:q(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:o,onClose:async()=>{u||(await l(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>d(!0),setIsFinished:()=>p(!0)}):e]})},on=3e4,sn=({maskAllInputs:e,initialEventsJson:t,locale:n}={})=>{let[r,i]=U(()=>t??null),[a,o]=U(!1),[s,c]=U(null),[l,u]=U(30),d=H(null),f=H(null),p=H(null),m=H([]);B(()=>{let e=new CustomEvent(pe,{detail:{isRecording:a}});document.dispatchEvent(e)},[a]);let h=R(()=>{f.current&&=(clearInterval(f.current),null),p.current&&=(clearTimeout(p.current),null),d.current=null,u(on/1e3)},[]),g=R(()=>{d.current?.(),h(),o(!1),i(JSON.stringify(m.current))},[h]);return{recordingEventsJson:r,isRecording:a,recordingError:s,remainingSeconds:l,startRecording:R(async()=>{o(!0),c(null),i(null),m.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);d.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{m.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=on/1e3;u(n),f.current=setInterval(()=>{--n,u(n)},1e3),p.current=setTimeout(()=>{g()},on)}catch{c(P(n).recordingError),o(!1),h()}},[e,g,h,n]),stopRecording:g,clear:R(()=>{h(),o(!1),i(null),c(null),m.current=[]},[h])}},cn=e=>e.replace(/\S/g,`*`),ln=e=>`*`.repeat(e.length),un=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):un(n,t)},dn=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,ln(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=ln(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=ln(t.textContent)},fn=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${de}`)){un(e,e=>{e.data=cn(e.data)}),dn(e);for(let t of e.querySelectorAll(`input, textarea, select`))dn(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))dn(e)}}}),pn=({maskAllInputs:e,initialDataUrl:t,locale:n}={})=>{let[r,i]=U(()=>t??null),[a,o]=U(!1),[s,c]=U(null);return{screenshotDataUrl:r,isCapturing:a,captureError:s,capture:R(async()=>{o(!0),c(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),n=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${me}`],excludeMode:`hide`,plugins:[fn({maskInputs:!!e})],fast:!1})).toCanvas(),r=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*r),n.width),o=Math.min(Math.round(window.innerHeight*r),n.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(n,0,0,a,o,0,0,a,o),i(s.toDataURL(`image/png`))}catch{c(P(n).captureError)}finally{o(!1)}},[e,n]),clear:R(()=>{i(null),c(null)},[])}},mn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[G(`circle`,{cx:`12`,cy:`12`,r:`10`}),G(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),hn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[G(`path`,{d:`M10 11v6`}),G(`path`,{d:`M14 11v6`}),G(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),G(`path`,{d:`M3 6h18`}),G(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function gn(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function _n(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=gn();return{userAgent:e.userAgent,screenResolution:`${t.width}x${t.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,language:e.language,timestamp:new Date().toISOString(),datadogTraceId:n?.traceId,datadogSessionId:n?.sessionId,datadogSessionReplayLink:n?.sessionReplayLink}}const vn=Pe(()=>import(`./RecordingReplayer-DNYXhses.js`)),yn=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c,defaultAnswer:l,locale:u})=>{let d=V(()=>_n(),[]),f=l&&typeof l==`object`&&`title`in l?l:void 0,[p,m]=U(()=>f?.title??``),[h,g]=U(()=>f?.description??``),{screenshotDataUrl:_,isCapturing:v,captureError:y,capture:b,clear:x}=pn({maskAllInputs:c,initialDataUrl:f?.screenshotDataUrl,locale:u}),{recordingEventsJson:S,isRecording:C,recordingError:w,remainingSeconds:T,startRecording:E,stopRecording:D,clear:k}=sn({maskAllInputs:c,initialEventsJson:f?.recordingEventsJson,locale:u}),A=V(()=>({title:p,...h?{description:h}:{},..._?{screenshotDataUrl:_}:{},...S?{recordingEventsJson:S}:{},metadata:d}),[h,d,S,_,p]);B(()=>{i(A)},[A,i]),B(()=>()=>{D()},[D]);let j=V(()=>S?JSON.parse(S):[],[S]);return G(W,{children:C?K(O,{className:q(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:D,children:[G(mn,{}),K(`span`,{children:[30-T,`s /`,` `,30,`s`]})]}):K(`div`,{className:q(`cf-bug-report`,s?.base),children:[K(Vt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:p,onChange:m,className:q(`cf-question`,s?.question),children:[K(`div`,{className:q(`cf-header`,s?.header),children:[K(X,{className:q(`cf-title`,s?.title),children:[t,!a&&K(`span`,{className:q(`cf-label-optional`,s?.optionalLabel),children:[` `,P(u).optional]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,s?.description),children:n})]}),G(Ot,{placeholder:Ee(r.placeholder,u),className:q(`cf-input`,s?.input)}),G(vt,{className:q(`cf-error`,s?.error),children:o})]}),K(Vt,{name:`${e}-description`,value:h,onChange:g,className:q(`cf-question`,s?.question),children:[G(X,{className:q(`cf-title`,s?.title),children:r.detailsLabel}),G(zt,{placeholder:Ce(r.detailsPlaceholder,u),className:q(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?K(`section`,{className:q(`cf-question`,s?.question),children:[G(X,{className:q(`cf-title`,s?.title),children:P(u).attachments}),K(`div`,{className:q(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&K(`div`,{className:q(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[_?K(`div`,{className:q(`cf-bug-report-media-preview`,s?.mediaPreview),children:[G(`img`,{src:_,alt:P(u).screenshotPreview,className:q(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),G(`div`,{className:q(`cf-bug-report-media-actions`,s?.mediaActions),children:G(O,{className:q(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:x,"aria-label":P(u).removeScreenshot,children:G(hn,{})})})]}):G(O,{className:q(`cf-bug-report-button`,s?.button),onPress:b,isDisabled:v,children:v?P(u).capturing:P(u).screenshot}),y&&G(`div`,{className:q(`cf-error`,s?.error),children:y})]}),r.enableRecording&&K(`div`,{className:q(`cf-bug-report-recording-section`,s?.recordingSection),children:[j.length>0?K(`div`,{className:q(`cf-bug-report-media-preview`,s?.mediaPreview),children:[G(je,{fallback:G(`span`,{className:q(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":P(u).loadingRecordingPreview}),children:G(vn,{events:j})}),G(`div`,{className:q(`cf-bug-report-media-actions`,s?.mediaActions),children:G(O,{className:q(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:k,"aria-label":P(u).removeRecording,children:G(hn,{})})})]}):G(O,{className:q(`cf-bug-report-button`,s?.button),onPress:E,children:P(u).record}),w&&G(`div`,{className:q(`cf-error`,s?.error),children:w})]})]})]}):null]})})},bn=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let[u,d]=U(()=>typeof c==`string`?c:``);return B(()=>{i(u)},[i,u]),K(Vt,{isRequired:o,isInvalid:!!s,name:e,className:q(`cf-question`,a?.question),value:u,onChange:e=>{d(e),i(e)},children:[K(`div`,{className:q(`cf-header`,a?.header),children:[K(X,{className:q(`cf-title`,a?.title),children:[t,!o&&K(`span`,{className:q(`cf-label-optional`,a?.optionalLabel),children:[` `,P(l).optional]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,a?.description),children:n})]}),G(zt,{className:q(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||P(l).startTyping}),G(vt,{className:q(`cf-error`,a?.error),children:s})]})},xn=({children:e,classNames:t,description:n,...r})=>G(wt,{...r,children:({isIndeterminate:r})=>K(W,{children:[K(`div`,{className:q(`cf-choice-label`,t?.label),children:[G(`div`,{className:q(`cf-checkbox-indicator`,t?.indicator),children:G(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:q(`cf-checkbox-indicator-svg`,t?.svg),children:r?G(`rect`,{x:1,y:7.5,width:16,height:3}):G(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&G(`span`,{className:q(`cf-choice-description`,t?.choiceDescription),children:n})]})}),Sn=({children:e,classNames:t,...n})=>G(wt,{...n,children:G(`div`,{className:q(`cf-tag-label`,t?.tagLabel),children:e})}),Cn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=De(n.editable?.label,l),f=n.display??`checkbox`,p=Array.isArray(c)?c:[],m=new Set(n.options.map(e=>e.value)),h=p.find(e=>!m.has(e)),[g,_]=U(()=>{let e=p.filter(e=>m.has(e));return h!==void 0&&u&&e.push(se),e}),[v,y]=U(()=>h!==void 0&&u?h:``),b=H(null),x=H(null),S=V(()=>{let e=g.indexOf(se);if(e===-1)return g;let t=[...g];return t[e]=v||`__CONFETTI_CHECKBOX_Others`,t},[v,g]),C=f===`tag`;return B(()=>{i(S)},[i,S]),G(Ct,{isRequired:o,isInvalid:!!s,name:a,value:g,onChange:_,className:q(`cf-question`,r?.question),children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(X,{className:q(`cf-title`,r?.title),children:[e,!o&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,P(l).optional]})]}),t&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:t})]}),K(`div`,{className:q(`cf-response-choices`,f===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>G(C?Sn:xn,{className:q(`cf-choice`,C&&[`cf-tag`,r?.tag],!C&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.label??e.value},t)),u&&(C?K(W,{children:[G(Sn,{inputRef:b,onChange:e=>{x.current&&e&&requestAnimationFrame(()=>{x.current&&x.current.focus()})},className:q(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:d}),G(Ot,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:v,onChange:e=>{y(e.target.value)},ref:x,className:q(`cf-input cf-tag-input`,r?.othersInput)})]}):K(`div`,{className:q(`cf-choice cf-others-choice`,r?.othersChoice),children:[G(xn,{inputRef:b,onChange:e=>{x.current&&e&&requestAnimationFrame(()=>{x.current&&x.current.focus()})},className:q(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:d}),G(Ot,{value:v,onChange:e=>{y(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:x,onFocus:()=>{b.current?.checked===!1&&b.current.click()},className:q(`cf-input`,r?.othersInput)})]}))]}),G(vt,{className:q(`cf-error`,r?.error),children:s})]})})},wn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),Tn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),En=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),Dn=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),On=e=>K(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[G(`circle`,{cx:12,cy:12,r:10}),G(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),kn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:G(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),An=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:G(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),jn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return G(`div`,{className:q(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return G(It,{className:q(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:G(o?An:kn,{})},t)})})},Mn=({properties:e,classNames:t})=>G(`div`,{className:q(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return G(It,{className:q(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),Nn=({properties:e,classNames:t,state:n})=>{let r=V(()=>[wn,En,Dn,On,Tn],[]),i=V(()=>[En,Dn,On],[]);return V(()=>e.scale===3||e.scale===5,[e.scale])?G(`div`,{className:q(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return G(It,{className:q(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&G(c,{})},a)})}):G(Mn,{properties:e,classNames:t,state:n})},Pn=e=>{switch(e.properties.display??`star`){case`emoji`:return G(Nn,{...e});case`number`:return G(Mn,{...e});case`star`:return G(jn,{...e})}},Fn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s,defaultAnswer:c,locale:l})=>{let[u,d]=U(()=>typeof c==`number`?String(c):null),f=V(()=>u?Number(u):void 0,[u]);return B(()=>{i(f)},[i,f]),G(Ft,{isRequired:s,isInvalid:!!o,name:a,className:q(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(X,{className:q(`cf-title`,r?.title),children:[t,!s&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,P(l).optional]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:n})]}),K(`div`,{className:q(`cf-rating-section`,r?.ratingSection),children:[G(Pn,{state:i,properties:e,classNames:r}),K(`div`,{className:q(`cf-rating-text`,r?.ratingText),children:[G(`span`,{className:q(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),G(`span`,{className:q(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),G(vt,{className:q(`cf-error`,r?.error),children:o})]})})},In=({classNames:e,className:t,description:n,...r})=>G(It,{...r,className:q(t,e?.radio),children:_(r.children,t=>K(W,{children:[K(`div`,{className:q(`cf-choice-label`,e?.label),children:[G(`div`,{className:q(`cf-radio-indicator`,e?.indicator)}),t]}),n&&G(`span`,{className:q(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Ln=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=De(n.editable?.label,l),f=typeof c==`string`?c:null,p=f!==null&&n.options.some(e=>e.value===f),[m,h]=U(()=>f===null?null:p?f:u?ae:null),[g,_]=U(()=>f!==null&&!p&&u?f:``),v=H(null),y=H(null),b=V(()=>m===`__CONFETTI_RADIO_Others`?g||`__CONFETTI_RADIO_Others`:m??void 0,[g,m]);return B(()=>{i(b)},[i,b]),G(Ft,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{h(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},value:m,className:q(`cf-question`,r?.question),children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(X,{className:q(`cf-title`,r?.title),children:[e,!o&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,P(l).optional]})]}),t&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:t})]}),K(`div`,{className:q(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>G(In,{classNames:{indicator:r?.indicator,radio:q(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.label??e.value},t)),u&&K(`div`,{className:q(`cf-choice cf-others-choice`,r?.othersChoice),children:[G(In,{inputRef:v,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:q(`cf-radio`,r?.radio)},description:n.editable?.description,children:d}),G(Ot,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:y,value:g,onChange:e=>_(e.target.value),onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:q(`cf-input`,r?.othersInput)})]})]}),G(vt,{className:q(`cf-error`,r?.error),children:s})]})})},Rn=({properties:e,title:t,description:n,classNames:r})=>G(`div`,{className:q(`cf-question`,r?.question),children:K(`div`,{className:q(`cf-header`,r?.header),children:[t&&G(`div`,{className:q(`cf-title`,r?.title),children:t}),n&&G(`div`,{className:q(`cf-description`,r?.description),children:n})]})}),zn=({question:e,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a})=>{switch(e.properties.type){case`rating`:return G(Fn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`open-ended`:return G(bn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`single-select`:return G(Ln,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`multi-select`:return G(Cn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`statement`:return G(Rn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return G(yn,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a},e.id)}return G(`div`,{children:P(a).unsupportedQuestionType},e.id)},Bn=({title:e,description:t,classNames:n,onClose:r,locale:i})=>{let{survey:a}=we();if(!a)return null;let o=t||a.confirmation.description;return K(W,{children:[G(`div`,{className:q(`cf-question`,n?.question),children:K(`div`,{className:q(`cf-header`,n?.header),children:[G(X,{className:q(`cf-title`,n?.title),children:e||Se(a.confirmation.title,i)}),o&&G(Z,{slot:`description`,className:q(`cf-description`,n?.description),children:o})]})}),G(O,{className:`cf-submit-button`,onPress:()=>{r?.()},children:ve(a.confirmation.buttonText,i)})]})},Vn=({onPress:e,children:t,locale:n})=>xe()?null:G(O,{className:`cf-back-button`,onPress:e,children:t===void 0?P(n).back:t}),Hn=({question:e,answer:t,isLastQuestion:n,locale:r})=>{if(e.properties.buttonLabel)return e.properties.buttonLabel;let i=P(r);return Wt({routingLogic:e.routingLogic,answer:t,required:e.required,isLastQuestion:n})?!e.required&&Q(t)?i.skip:i.next:i.submit},Un=({onPress:e,isDisabled:t,children:n,locale:r})=>xe()?null:G(O,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n===void 0?P(r).submit:n}),Wn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},Gn=e=>!Q(e),Kn=({onSubmit:e,children:t,question:n,isLastQuestion:r,defaultAnswer:i,backButton:a,saveAnswer:o,locale:s})=>{let c=xe(),[l,u]=U(i??Wn(n.properties.type)),d=V(()=>Kt(n.properties,{required:n.required}),[n.properties,n.required]),f=V(()=>{let e=d.safeParse(l);if(!e.success)return be(e.error,s)},[l,d,s]),p=V(()=>Hn({question:n,answer:l,isLastQuestion:r,locale:s}),[l,r,s,n]),m=R(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=re.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(l)}},[l,e,n.properties]),h=Gn(i),g=V(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties])&&!h,_=R(t=>{u(t),g&&Gn(t)&&d.safeParse(t).success&&e(t)},[g,d,e]),v=V(()=>{if(!a||!Ne(a))return a;let e=a;return Me(e,{onPress:()=>{let t=Ht({answer:l,defaultAnswer:i});t!==void 0&&o?.(t),e.props.onPress?.()}})},[a,l,i,o]);return K(W,{children:[t({onChange:_,question:n,error:f,defaultAnswer:i}),!c&&K(`div`,{className:`cf-button-row`,children:[v,(!g||!n.required)&&G(Un,{isDisabled:!!f,onPress:m,children:p})]})]})},qn=({onSubmit:e,children:t,locale:n})=>K(W,{children:[t,G(Un,{onPress:e,locale:n})]});export{zn as a,Fn as c,an as d,en as f,$t as h,Bn as i,Cn as l,rn as m,Kn as n,Rn as o,nn as p,Vn as r,Ln as s,qn as t,bn as u};
@@ -1,4 +1,4 @@
1
- import { r as Locale } from "./index-BgEIWUUt.js";
1
+ import { r as Locale } from "./index-DLqC_qk3.js";
2
2
 
3
3
  //#region src/components/container/ModalContainer.d.ts
4
4
  interface ModalContainerProps {
@@ -0,0 +1,5 @@
1
+ import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,I as s,J as c,K as l,M as u,O as d,P as f,S as p,T as m,U as h,W as g,_,a as v,b as ee,c as te,f as ne,g as re,h as ie,j as y,k as b,l as ae,m as oe,p as se,q as ce,s as le,t as ue,u as de,w as fe,x as pe,y as me,z as he}from"./Button-D3Wb2KZB.js";import{i as ge,n as _e,r as ve}from"./src-DG66KK2l.js";import{i as ye,r as be,t as xe}from"./internals-DKNTeE-L.js";import x,{createContext as S,forwardRef as Se,useCallback as C,useContext as w,useEffect as T,useMemo as E,useReducer as Ce,useRef as D,useState as O}from"react";import{useTimeout as we}from"usehooks-ts";import{z as k}from"zod";import{Fragment as Te,jsx as A,jsxs as Ee}from"react/jsx-runtime";import j from"clsx";import De,{flushSync as Oe}from"react-dom";const ke=S(null);S(null),S(null),S(null),S(null);const Ae=S({});S(null);const je=S(null);function Me(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function Ne(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function M(e){let t=null;return()=>(t??=e(),t)}const Pe=M(function(){return Ne(/^Mac/i)}),Fe=M(function(){return Ne(/^iPhone/i)}),Ie=M(function(){return Ne(/^iPad/i)||Pe()&&navigator.maxTouchPoints>1}),Le=M(function(){return Fe()||Ie()}),Re=M(function(){return Me(/AppleWebKit/i)&&(Le()||!ze())}),ze=M(function(){return Me(/Chrome|CriOS|CrMo/i)});String(Math.round(Math.random()*1e10));const Be=x.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement,x.useId;function Ve(){return!1}function He(){return!0}function Ue(e){return()=>{}}function We(){return typeof x.useSyncExternalStore==`function`?x.useSyncExternalStore(Ue,Ve,He):w(Be)}function Ge(){return!1}const Ke=(e=document)=>{if(!Ge())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function qe(e){if(Ge()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function Je(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}const Ye=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Xe(e){return e instanceof HTMLInputElement&&!Ye.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Ze(){let e=We(),[t,n]=O(()=>e?{width:0,height:0}:Qe());return T(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(Qe())},r,i=t=>{N&&N.scale>1||Xe(qe(t))&&(r=requestAnimationFrame(()=>{let t=Ke();(!t||!Xe(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(Qe()),Le()&&Re()&&window.addEventListener(`blur`,i,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(r),Le()&&Re()&&window.removeEventListener(`blur`,i,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function Qe(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function $e(e,t=!0){let[n,r]=O(!0),i=n&&t;return ce(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),tt(e,i,C(()=>r(!1),[])),i}function et(e,t){let[n,r]=O(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return tt(e,i,C(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function tt(e,t,n){ce(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Oe(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const nt=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function rt(e){return e instanceof HTMLInputElement&&!nt.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function it(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=oe(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}const at=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),ot=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function st(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return at.has(t.script)}let t=e.split(`-`)[0];return ot.has(t)}const ct=Symbol.for(`react-aria.i18n.locale`);function lt(){let e=typeof window<`u`&&window[ct]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:st(e)?`rtl`:`ltr`}}let ut=lt(),P=new Set;function dt(){ut=lt();for(let e of P)e(ut)}function ft(){let e=me(),[t,n]=O(ut);return T(()=>(P.size===0&&window.addEventListener(`languagechange`,dt),P.add(n),()=>{P.delete(n),P.size===0&&window.removeEventListener(`languagechange`,dt)}),[]),e?{locale:typeof window<`u`&&window[ct]||`en-US`,direction:`ltr`}:t}const pt=x.createContext(null);function mt(){let e=ft();return w(pt)||e}const ht=Symbol.for(`react-aria.i18n.locale`),gt=Symbol.for(`react-aria.i18n.strings`);let F;var _t=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=vt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[ht];if(F===void 0){let t=window[gt];if(!t)return null;F={};for(let r in t)F[r]=new e({[n]:t[r]},n)}let r=F?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function vt(e,t,n=`en-US`){if(t[e])return t[e];let r=yt(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function yt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const bt=new Map,xt=new Map;var St=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=bt.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),bt.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=xt.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),xt.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const Ct=new WeakMap;function wt(e){let t=Ct.get(e);return t||(t=new _t(e),Ct.set(e,t)),t}function Tt(e,t){return t&&_t.getGlobalDictionaryForPackage(t)||wt(e)}function Et(e,t){let{locale:n}=mt(),r=Tt(e,t);return E(()=>new St(n,r),[n,r])}var Dt=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(e){if(!i(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(a),a.currentNode=r,this._currentSetFor.add(a),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return i(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Ot(t,n,r,i){return e()?new Dt(t,n,r,i):t.createTreeWalker(n,r,i)}const kt=x.createContext(null),At=`react-aria-focus-scope-restore`;let I=null;function jt(e){let{children:t,contain:r,restoreFocus:i,autoFocus:a}=e,o=D(null),s=D(null),c=D([]),{parentNode:l}=w(kt)||{},u=E(()=>new Kt({scopeRef:c}),[c]);n(()=>{let e=l||W.root;if(W.getTreeNode(e.scopeRef)&&I&&!V(I,e.scopeRef)){let t=W.getTreeNode(I);t&&(e=t)}e.addChild(u),W.addNode(u)},[u,l]),n(()=>{let e=W.getTreeNode(c);e&&(e.contain=!!r)},[r]),n(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(At,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(At,n)}},[t]),Vt(c,i,r),Ft(c,r),Ut(c,i,r),Bt(c,a),T(()=>{let e=d(y(c.current?c.current[0]:void 0)),t=null;if(z(e,c.current)){for(let n of W.traverse())n.scopeRef&&z(e,n.scopeRef.current)&&(t=n);t===W.getTreeNode(c)&&(I=t.scopeRef)}},[c]),n(()=>()=>{let e=W.getTreeNode(c)?.parent?.scopeRef??null;(c===I||V(c,I))&&(!e||W.getTreeNode(e))&&(I=e),W.removeTreeNode(c)},[c]);let f=E(()=>Mt(c),[]),p=E(()=>({focusManager:f,parentNode:u}),[u,f]);return x.createElement(kt.Provider,{value:p},x.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,x.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function Mt(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||d(y(n[0]??void 0)),c=n[0].previousElementSibling,l=U(L(n),{tabbable:i,accept:o},n);l.currentNode=z(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&H(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||d(y(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=U(L(n),{tabbable:i,accept:o},n);l.currentNode=z(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&H(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=U(L(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&H(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=U(L(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&H(o,!0),o}}}function L(e){return e[0].parentElement}function R(e){let t=W.getTreeNode(I);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Nt(e){if(!e.form)return Array.from(y(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=u(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function Pt(e){if(e.checked)return!0;let t=Nt(e);return t.length>0&&!t.some(e=>e.checked)}function Ft(e,t){let r=D(void 0),i=D(void 0);n(()=>{let n=e.current;if(!t){i.current&&=(cancelAnimationFrame(i.current),void 0);return}let a=y(n?n[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!R(e)||t.isComposing)return;let n=d(a),r=e.current;if(!r||!z(n,r))return;let i=U(L(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&(H(o,!0),o instanceof u(o).HTMLInputElement&&o.select())},s=t=>{(!I||V(I,e))&&z(b(t),e.current)?(I=e,r.current=b(t)):R(e)&&!B(b(t),e)?r.current?r.current.focus():I&&I.current&&zt(I.current):R(e)&&(r.current=b(t))},c=t=>{i.current&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(()=>{let n=_(),i=(n===`virtual`||n===null)&&pe()&&ee(),o=d(a);if(!i&&o&&R(e)&&!B(o,e)){I=e;let n=b(t);n&&n.isConnected?(r.current=n,r.current?.focus()):I.current&&zt(I.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),n?.forEach(e=>e.addEventListener(`focusin`,s,!1)),n?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),n?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),n?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),n(()=>()=>{i.current&&cancelAnimationFrame(i.current)},[i])}function It(e){return B(e)}function z(e,t){return!e||!t?!1:t.some(t=>i(t,e))}function B(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of W.traverse(W.getTreeNode(t)))if(n&&z(e,n.current))return!0;return!1}function Lt(e){return B(e,I)}function V(e,t){let n=W.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function H(e,t=!1){if(e!=null&&!t)try{re(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Rt(e,t=!0){let n=e[0].previousElementSibling,r=L(e),i=U(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=L(e),i=U(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function zt(e,t=!0){H(Rt(e,t))}function Bt(e,t){let n=x.useRef(t);T(()=>{n.current&&(I=e,!z(d(y(e.current?e.current[0]:void 0)),I.current)&&e.current&&zt(e.current)),n.current=!1},[e])}function Vt(e,t,r){n(()=>{if(t||r)return;let n=e.current,i=y(n?n[0]:void 0),a=t=>{let n=b(t);z(n,e.current)?I=e:It(n)||(I=null)};return i.addEventListener(`focusin`,a,!1),n?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),n?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,r])}function Ht(e){let t=W.getTreeNode(I);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Ut(e,t,r){let i=D(typeof document<`u`?d(y(e.current?e.current[0]:void 0)):null);n(()=>{let n=e.current,i=y(n?n[0]:void 0);if(!t||r)return;let a=()=>{(!I||V(I,e))&&z(d(i),e.current)&&(I=e)};return i.addEventListener(`focusin`,a,!1),n?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),n?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,r]),n(()=>{let n=y(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!R(e)||t.isComposing)return;let r=n.activeElement;if(!B(r,e)||!Ht(e))return;let i=W.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=U(n.body,{tabbable:!0});o.currentNode=r;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===n.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!B(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(B(s,e));t.preventDefault(),t.stopPropagation(),s?H(s,!0):It(a)?H(a,!0):r.blur()}};return r||n.addEventListener(`keydown`,i,!0),()=>{r||n.removeEventListener(`keydown`,i,!0)}},[e,t,r]),n(()=>{let n=y(e.current?e.current[0]:void 0);if(!t)return;let r=W.getTreeNode(e);if(r)return r.nodeToRestore=i.current??void 0,()=>{let r=W.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=d(n);if(t&&i&&(a&&B(a,e)||a===n.body&&Ht(e))){let t=W.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Wt(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&W.getTreeNode(n.scopeRef)){Wt(Rt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Wt(e){e.dispatchEvent(new CustomEvent(At,{bubbles:!0,cancelable:!0}))&&H(e)}function U(e,t,n){let r=t?.tabbable?m:fe,a=y(e?.nodeType===Node.ELEMENT_NODE?e:null),o=Ot(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return i(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!Pt(e)||o.currentNode.tagName===`INPUT`&&o.currentNode.type===`radio`&&o.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||z(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(o.currentNode=t.from),o}var Gt=class e{constructor(){this.fastMap=new Map,this.root=new Kt({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Kt({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&z(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Kt=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let W=new Gt;function qt(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Jt(e,t){let n=e;for(qt(n,t)&&(n=n.parentElement);n&&!qt(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const Yt=typeof document<`u`?x.useInsertionEffect??x.useLayoutEffect:()=>{};function Xt(e,t,n){let[r,i]=O(e||t),a=D(r),o=D(e!==void 0),s=e!==void 0;T(()=>{o.current,o.current=s},[s]);let c=s?e:r;Yt(()=>{a.current=c});let[,l]=Ce(()=>({}),{});return[c,C((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}const Zt={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function Qt(e={}){let{style:t,isFocusable:n}=e,[r,i]=O(!1),{focusWithinProps:a}=v({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=E(()=>r?t:t?{...Zt,...t}:Zt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function $t(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=Qt(e);return x.createElement(n,ne(a,o),t)}const en=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function tn(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let G=new WeakMap,K=[];function nn(t,n){let r=u(t?.[0]),a=n instanceof r.Element?{root:n}:n,o=a?.root??document.body,s=a?.shouldUseInert&&en,c=new Set(t),l=new Set,d=e=>s&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{s&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},p=new Set;if(e())for(let e of t){let t=e;for(;t&&t!==o;){let e=t.getRootNode();`shadowRoot`in e&&p.add(e.shadowRoot),t=e.parentNode}}let m=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))c.add(t);let t=e=>{if(l.has(e)||c.has(e)||e.parentElement&&l.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of c)if(i(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=Ot(y(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&h(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)h(e),e=n.nextNode()}},h=e=>{let t=G.get(e)??0;d(e)&&t===0||(t===0&&f(e,!0),l.add(e),G.set(e,t+1))};K.length&&K[K.length-1].disconnect(),m(o);let g=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...c,...l].some(e=>i(e,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&tn(e)?c.add(e):e instanceof Element&&m(e);if(e()){for(let e of p)if(!e.isConnected){g.disconnect();break}}}});g.observe(o,{childList:!0,subtree:!0});let _=new Set;if(e())for(let t of p){let n=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...c,...l].some(e=>i(e,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&tn(e)?c.add(e):e instanceof Element&&m(e);if(e()){for(let e of p)if(!e.isConnected){g.disconnect();break}}}});n.observe(t,{childList:!0,subtree:!0}),_.add(n)}let v={visibleNodes:c,hiddenNodes:l,observe(){g.observe(o,{childList:!0,subtree:!0})},disconnect(){g.disconnect()}};return K.push(v),()=>{if(g.disconnect(),e())for(let e of _)e.disconnect();for(let e of l){let t=G.get(e);t!=null&&(t===1?(f(e,!1),G.delete(e)):G.set(e,t-1))}v===K[K.length-1]?(K.pop(),K.length&&K[K.length-1].observe()):K.splice(K.indexOf(v),1)}}function rn({children:e}){let t=E(()=>({register:()=>{}}),[]);return x.createElement(le.Provider,{value:t},e)}const an=S({});function on(){return w(an)??{}}const sn=x.createContext(null);function cn(e){let t=me(),{portalContainer:n=t?null:document.body,isExiting:r}=e,[i,a]=O(!1),o=E(()=>({contain:i,setContain:a}),[i,a]),{getContainer:s}=on();if(!e.portalContainer&&s&&(n=s()),!n)return null;let c=e.children;return e.disableFocusManagement||(c=x.createElement(jt,{restoreFocus:!0,contain:(e.shouldContainFocus||i)&&!r},c)),c=x.createElement(sn.Provider,{value:o},x.createElement(rn,null,c)),De.createPortal(c,n)}function ln(){let e=w(sn)?.setContain;n(()=>{e?.(!0)},[e])}function un(e,t){let{role:n=`dialog`}=e,i=se();i=e[`aria-label`]?void 0:i;let a=D(!1);return T(()=>{if(t.current&&!r(t.current)){re(t.current);let e=setTimeout(()=>{(d()===t.current||d()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),re(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),ln(),D(!1),T(()=>{}),{dialogProps:{...ae(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}function dn(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=D({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=de(e=>{n&&fn(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=de(e=>{n&&n(e)});T(()=>{let e=a.current;if(r)return;let n=t.current,i=y(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&fn(n,t)&&s(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,o,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,o,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function fn(e,t){if(e.button>0)return!1;let n=b(e);if(n){let e=n.ownerDocument;if(!e||!i(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}var pn={};pn={dismiss:`تجاهل`};var mn={};mn={dismiss:`Отхвърляне`};var hn={};hn={dismiss:`Odstranit`};var gn={};gn={dismiss:`Luk`};var _n={};_n={dismiss:`Schließen`};var vn={};vn={dismiss:`Απόρριψη`};var yn={};yn={dismiss:`Dismiss`};var bn={};bn={dismiss:`Descartar`};var xn={};xn={dismiss:`Lõpeta`};var Sn={};Sn={dismiss:`Hylkää`};var Cn={};Cn={dismiss:`Rejeter`};var wn={};wn={dismiss:`התעלם`};var Tn={};Tn={dismiss:`Odbaci`};var En={};En={dismiss:`Elutasítás`};var Dn={};Dn={dismiss:`Ignora`};var On={};On={dismiss:`閉じる`};var kn={};kn={dismiss:`무시`};var An={};An={dismiss:`Atmesti`};var jn={};jn={dismiss:`Nerādīt`};var Mn={};Mn={dismiss:`Lukk`};var Nn={};Nn={dismiss:`Negeren`};var Pn={};Pn={dismiss:`Zignoruj`};var Fn={};Fn={dismiss:`Descartar`};var In={};In={dismiss:`Dispensar`};var Ln={};Ln={dismiss:`Revocare`};var Rn={};Rn={dismiss:`Пропустить`};var zn={};zn={dismiss:`Zrušiť`};var Bn={};Bn={dismiss:`Opusti`};var Vn={};Vn={dismiss:`Odbaci`};var Hn={};Hn={dismiss:`Avvisa`};var Un={};Un={dismiss:`Kapat`};var Wn={};Wn={dismiss:`Скасувати`};var Gn={};Gn={dismiss:`取消`};var Kn={};Kn={dismiss:`關閉`};var qn={};qn={"ar-AE":pn,"bg-BG":mn,"cs-CZ":hn,"da-DK":gn,"de-DE":_n,"el-GR":vn,"en-US":yn,"es-ES":bn,"et-EE":xn,"fi-FI":Sn,"fr-FR":Cn,"he-IL":wn,"hr-HR":Tn,"hu-HU":En,"it-IT":Dn,"ja-JP":On,"ko-KR":kn,"lt-LT":An,"lv-LV":jn,"nb-NO":Mn,"nl-NL":Nn,"pl-PL":Pn,"pt-BR":Fn,"pt-PT":In,"ro-RO":Ln,"ru-RU":Rn,"sk-SK":zn,"sl-SI":Bn,"sr-SP":Vn,"sv-SE":Hn,"tr-TR":Un,"uk-UA":Wn,"zh-CN":Gn,"zh-TW":Kn};function Jn(e){return e&&e.__esModule?e.default:e}function Yn(e){let{onDismiss:t,...n}=e,r=it(n,Et(Jn(qn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return x.createElement($t,null,x.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const q=[];function Xn(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=D(void 0);T(()=>{if(i&&!q.includes(t))return q.push(t),()=>{let e=q.indexOf(t);e>=0&&q.splice(e,1)}},[i,t]);let l=()=>{q[q.length-1]===t&&n&&n()},u=e=>{let n=q[q.length-1];c.current=n,(!s||s(b(e)))&&n===t&&e.stopPropagation()},d=e=>{(!s||s(b(e)))&&(q[q.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},f=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};dn({ref:t,onInteractOutside:a&&i?d:void 0,onInteractOutsideStart:u});let{focusWithinProps:p}=v({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||Lt(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:f,...p},underlayProps:{}}}const J=typeof document<`u`&&window.visualViewport;let Y=0,Zn;function Qn(e={}){let{isDisabled:t}=e;n(()=>{if(!t)return Y++,Y===1&&(Zn=p()?er():$n()),()=>{Y--,Y===0&&Zn()}},[t])}function $n(){let e=window.innerWidth-document.documentElement.clientWidth;return ie(e>0&&(`scrollbarGutter`in document.documentElement.style?X(document.documentElement,`scrollbarGutter`,`stable`):X(document.documentElement,`paddingRight`,`${e}px`)),X(document.documentElement,`overflow`,`hidden`))}function er(){let e=X(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=b(e);t=qt(r)?r:Jt(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=te();a&&(i.nonce=a),i.textContent=`@layer {
2
+ * {
3
+ overscroll-behavior: contain;
4
+ }
5
+ }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=b(e),n=e.relatedTarget;n&&rt(n)?(n.focus({preventScroll:!0}),nr(n,rt(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=d(),n=t!=null&&rt(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&nr(this,n)};let l=ie(tr(document,`touchstart`,r,{passive:!1,capture:!0}),tr(document,`touchmove`,o,{passive:!1,capture:!0}),tr(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function X(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function tr(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function nr(e,t){t||!J?rr(e):J.addEventListener(`resize`,()=>rr(e),{once:!0})}function rr(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Jt(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;J&&(n=Math.min(n,J.offsetTop+J.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function ir(e,t,n){let{overlayProps:r,underlayProps:i}=Xn({...e,isOpen:t.isOpen,onClose:t.close},n);return Qn({isDisabled:!t.isOpen}),ln(),T(()=>{if(t.isOpen&&n.current)return nn([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:ne(r),underlayProps:i}}function ar(e){let[t,n]=Xt(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:C(()=>{n(!0)},[n]),close:C(()=>{n(!1)},[n]),toggle:C(()=>{n(!t)},[n,t])}}const or=S(null),Z=S(null),sr=Se(function(e,n){let r=e[`aria-labelledby`];[e,n]=a(e,n,or);let{dialogProps:i,titleProps:c}=un({...e,"aria-labelledby":r},n),l=w(Z);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let u=s({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:l?.close||(()=>{})}}),d=g(e,{global:!0});return x.createElement(t.section,{...o(d,u,i),render:e.render,ref:n,slot:e.slot||void 0},x.createElement(f,{values:[[Ae,{slots:{[he]:{},title:{...c,level:2}}}],[ue,{slots:{[he]:{},close:{onPress:()=>l?.close()}}}]]},u.children))}),cr=S(null),lr=S(null),ur=Se(function(e,t){if(w(lr))return x.createElement(mr,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return x.createElement(fr,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},x.createElement(mr,{...f,modalRef:t},s))});function dr(e,t){[e,t]=a(e,t,cr);let n=w(Z),r=ar(e),i=e.isOpen!=null||e.defaultOpen!=null||!n?r:n,o=h(t),s=D(null),c=et(o,i.isOpen),l=et(s,i.isOpen),u=c||l||e.isExiting||!1,d=me();return!i.isOpen&&!u||d?null:x.createElement(pr,{...e,state:i,isExiting:u,overlayRef:o,modalRef:s})}const fr=Se(dr);function pr({UNSTABLE_portalContainer:e,...n}){let r=n.modalRef,{state:i}=n,{modalProps:a,underlayProps:c}=ir(n,i,r),l=$e(n.overlayRef)||n.isEntering||!1,u=s({...n,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:l,isExiting:n.isExiting,state:i}}),d=Ze(),p;if(typeof document<`u`){let e=Je(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;p=e.scrollHeight-t}let m={...u.style,"--visual-viewport-height":d.height+`px`,"--page-height":p===void 0?void 0:p+`px`};return x.createElement(cn,{isExiting:n.isExiting,portalContainer:e},x.createElement(t.div,{...o(g(n,{global:!0}),c),...u,style:m,ref:n.overlayRef,"data-entering":l||void 0,"data-exiting":n.isExiting||void 0},x.createElement(f,{values:[[lr,{modalProps:a,modalRef:r,isExiting:n.isExiting,isDismissable:n.isDismissable}],[Z,i]]},u.children)))}function mr(e){let{modalProps:n,modalRef:r,isExiting:i,isDismissable:a}=w(lr),c=w(Z),u=h(E(()=>l(e.modalRef,r),[e.modalRef,r])),d=$e(u),f=s({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:d,isExiting:i,state:c}});return x.createElement(t.div,{...o(g(e,{global:!0}),n),...f,ref:u,"data-entering":d||void 0,"data-exiting":i||void 0},a&&x.createElement(Yn,{onDismiss:c.close}),f.children)}const hr={en:{required:`This field is required`,selectOption:`Please select an option`,fillFreeText:`Please fill out the free text field`,selectAtLeastOne:`Please select at least one option`,selectRating:`Please select a rating`,titleRequired:`Title is required`,invalidImage:`Invalid image data URL`,invalidRecording:`Invalid recording events`,invalidInput:`Invalid input`,maxLength:`Please enter less than {max} characters`,maxSelected:`Please select less than {max} options`},zh:{required:`此字段为必填项`,selectOption:`请选择一个选项`,fillFreeText:`请填写文本框`,selectAtLeastOne:`请至少选择一个选项`,selectRating:`请选择评分`,titleRequired:`标题为必填项`,invalidImage:`图片数据网址无效`,invalidRecording:`录制事件无效`,invalidInput:`输入无效`,maxLength:`请输入少于 {max} 个字符`,maxSelected:`请选择少于 {max} 个选项`},ms:{required:`Ruangan ini diperlukan`,selectOption:`Sila pilih satu pilihan`,fillFreeText:`Sila isikan ruangan teks`,selectAtLeastOne:`Sila pilih sekurang-kurangnya satu pilihan`,selectRating:`Sila pilih penilaian`,titleRequired:`Tajuk diperlukan`,invalidImage:`URL data imej tidak sah`,invalidRecording:`Acara rakaman tidak sah`,invalidInput:`Masukan tidak sah`,maxLength:`Sila masukkan kurang daripada {max} aksara`,maxSelected:`Sila pilih kurang daripada {max} pilihan`},ta:{required:`இந்தப் புலம் தேவை`,selectOption:`ஒரு விருப்பத்தைத் தேர்ந்தெடுக்கவும்`,fillFreeText:`உரைப் புலத்தில் விவரங்களை உள்ளிடவும்`,selectAtLeastOne:`குறைந்தது ஒரு விருப்பத்தையாவது தேர்ந்தெடுக்கவும்`,selectRating:`மதிப்பீட்டைத் தேர்ந்தெடுக்கவும்`,titleRequired:`தலைப்பு தேவை`,invalidImage:`படத்தின் URL தவறானது`,invalidRecording:`தவறான பதிவு நிகழ்வுகள்`,invalidInput:`தவறான உள்ளீடு`,maxLength:`{max} எழுத்துகளுக்கு மிகாமல் உள்ளிடவும்`,maxSelected:`அதிகபட்சம் {max} விருப்பங்களைத் தேர்ந்தெடுக்கவும்`}},gr=(e=`en`)=>hr[e],_r=/^Please enter less than (\d+) characters$/,vr=/^Please select less than (\d+) options$/,yr=(e,t)=>{let n=gr(t),r=e.match(_r);if(r)return n.maxLength.replace(`{max}`,r[1]??``);let i=e.match(vr);if(i)return n.maxSelected.replace(`{max}`,i[1]??``);switch(e){case`This field is required`:return n.required;case`Please select an option`:return n.selectOption;case`Please fill out the free text field`:return n.fillFreeText;case`Please select at least one option`:return n.selectAtLeastOne;case`Please select a rating`:return n.selectRating;case`Title is required`:return n.titleRequired;case`Invalid image data URL`:return n.invalidImage;case`Invalid recording events`:return n.invalidRecording;case`Invalid input`:return n.invalidInput;default:return e}};function br(e,t){let n=e.issues[0];return yr(n?.message??`Invalid input`,t)}function xr(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}const Sr=[`id`,`email`,`name`],Q=e=>k.custom(t=>typeof t==`object`&&!!t&&typeof Reflect.get(t,e)==`function`),Cr=Q(`get_distinct_id`),wr=Q(`get_session_id`),Tr=Q(`getUser`),Er=Q(`getInternalContext`),Dr=k.string(),Or=k.record(k.string(),k.unknown()),kr=k.object({session_id:k.string().optional()}),Ar=(e,t)=>{if(typeof window>`u`)return;let n=t.safeParse(Reflect.get(window,e));return n.success?n.data:void 0},jr=()=>{try{let e=Ar(`posthog`,Cr);if(!e)return;let t=Dr.safeParse(e.get_distinct_id());return t.success?t.data:void 0}catch{return}},Mr=()=>{try{let e=Ar(`posthog`,wr);if(!e)return;let t=Dr.safeParse(e.get_session_id());return t.success?t.data:void 0}catch{return}},Nr=()=>{try{let e=Ar(`DD_RUM`,Tr);if(!e)return;let t=Or.safeParse(e.getUser());return!t.success||Object.keys(t.data).length===0?void 0:t.data}catch{return}},Pr=()=>{try{let e=Ar(`DD_RUM`,Er);if(!e)return;let t=kr.safeParse(e.getInternalContext());return t.success?t.data.session_id:void 0}catch{return}},Fr=e=>{let t={...e},n=Nr(),r;if(n)try{r=JSON.stringify(n)}catch{r=void 0}let i=[[`posthog_distinct_id`,jr()],[`posthog_session_id`,Mr()],[`datadog_rum_user`,r],[`datadog_rum_session_id`,Pr()],...Sr.map(e=>[`datadog_rum_user_${e}`,xr(n?.[e])])];for(let[e,n]of i)Object.prototype.hasOwnProperty.call(t,e)||n===void 0||n.trim()===``||(t[e]=n);return t},Ir=(e,t=!1)=>t?Fr(e):e,Lr=S({}),Rr=()=>w(Lr),zr=S({}),Br=({type:e,children:t})=>{let n=E(()=>({type:e}),[e]);return A(zr.Provider,{value:n,children:t})},Vr=()=>w(zr),Hr=S(null),Ur=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},autoInjectAnalyticsMetadata:a=!1,locale:o,apiBaseUrl:s})=>{let{type:l}=Vr(),u=Rr(),d=u.version??`0.9.1`,f=u.build,p=c({publishableKey:n,apiBaseUrl:s}),m=D(void 0),[h,g]=O(),_=h?.client===p&&h.surveyId===t?h.data:void 0;T(()=>{let e=new AbortController;return(async()=>{try{let n=`api/v1/cfti/${encodeURIComponent(t)}${o?`?locale=${encodeURIComponent(o)}`:``}`,r=await p.get(n,{signal:e.signal}).json(),i=ge.safeParse(r);if(!i.success||e.signal.aborted)return;g({client:p,surveyId:t,data:i.data})}catch{}})(),()=>e.abort()},[p,o,t]);let v=C(async({answers:e})=>{let n=crypto.randomUUID(),o=ve({metadata:Ir(i,a)}),s=await p.put(`api/v1/cfti/${encodeURIComponent(t)}/response/${encodeURIComponent(n)}`,{json:{respondent:r,data:e,metadata:o.metadata,warnings:o.warnings,telemetry:{...l!==void 0&&{type:l},version:d,...f&&{build:f}}}}).json();return _e.parse({...s,createdAt:new Date(s.createdAt)})},[a,f,p,i,r,t,d,l]),ee=C(()=>{p.post(`api/v1/cfti/${encodeURIComponent(t)}/respondent/${encodeURIComponent(r)}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[p,r,t]);return T(()=>{let e=m.current;e?.client===p&&e.surveyId===t&&e.respondent===r||_&&r&&(m.current={client:p,surveyId:t,respondent:r},p.post(`api/v1/cfti/${encodeURIComponent(t)}/respondent/${encodeURIComponent(r)}/event`,{json:{type:`view`}}).catch(()=>{}))},[p,r,_,t]),_?A(Hr.Provider,{value:{submit:v,dismiss:ee,surveyId:t,survey:_,metadata:i},children:e}):null},Wr=e=>w(Hr)?A(Te,{children:e.children}):A(Ur,{...e}),Gr=()=>{let e=w(Hr);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},Kr={en:{skip:`Skip`,next:`Next`,back:`Back`,submit:`Submit`,submitAnotherResponse:`Submit another response`,other:`Other`,dismiss:`Dismiss`,close:`Close`,optional:`(optional)`,startTyping:`Start typing...`,feedbackSubmitted:`Feedback submitted!`,surveyDialog:`Survey`,unsupportedQuestionType:`Unsupported question type`,bugReportTitlePlaceholder:`Brief description of the issue`,bugReportDetailsPlaceholder:`Steps to reproduce, expected vs actual behavior, etc.`,attachments:`Attachments`,capturing:`Capturing...`,screenshot:`Screenshot`,screenshotPreview:`Screenshot preview`,removeScreenshot:`Remove screenshot`,loadingRecordingPreview:`Loading recording preview...`,removeRecording:`Remove recording`,record:`Record`,captureError:`Failed to capture screenshot. Please try again.`,recordingError:`Failed to start recording. Please try again.`},zh:{skip:`跳过`,next:`下一步`,back:`上一步`,submit:`提交`,submitAnotherResponse:`提交另一份回复`,other:`其他`,dismiss:`忽略`,close:`关闭`,optional:`(选填)`,startTyping:`开始输入…`,feedbackSubmitted:`反馈已提交!`,surveyDialog:`调查对话框`,unsupportedQuestionType:`不支持的问题类型`,bugReportTitlePlaceholder:`在此输入问题标题`,bugReportDetailsPlaceholder:`在此输入问题内容`,attachments:`附件`,capturing:`截屏中…`,screenshot:`截图`,screenshotPreview:`截图预览`,removeScreenshot:`移除截图`,loadingRecordingPreview:`录像加载中…`,removeRecording:`移除录像`,record:`录制`,captureError:`截图失败,请重试。`,recordingError:`录制启动失败,请重试。`},ms:{skip:`Langkau`,next:`Seterusnya`,back:`Kembali`,submit:`Hantar`,submitAnotherResponse:`Hantar respons lain`,other:`Lain-lain`,dismiss:`Tutup`,close:`Tutup`,optional:`(Pilihan)`,startTyping:`Mula menaip...`,feedbackSubmitted:`Maklum balas dihantar!`,surveyDialog:`Tinjauan`,unsupportedQuestionType:`Jenis soalan tidak disokong`,bugReportTitlePlaceholder:`Penerangan ringkas tentang isu`,bugReportDetailsPlaceholder:`Langkah untuk mengulang semula, tingkah laku dijangka berbanding sebenar, dll.`,attachments:`Lampiran`,capturing:`Sedang menangkap...`,screenshot:`Tangkapan skrin`,screenshotPreview:`Pratonton tangkapan skrin`,removeScreenshot:`Alih keluar tangkapan skrin`,loadingRecordingPreview:`Memuatkan pratonton rakaman...`,removeRecording:`Alih keluar rakaman`,record:`Rakam`,captureError:`Gagal menangkap tangkapan skrin. Sila cuba lagi.`,recordingError:`Gagal memulakan rakaman. Sila cuba lagi.`},ta:{skip:`தவிர்க்கவும்`,next:`அடுத்து`,back:`பின்செல்`,submit:`சமர்ப்பிக்கவும்`,submitAnotherResponse:`மற்றொரு பதிலைச் சமர்ப்பிக்கவும்`,other:`மற்றவை`,dismiss:`மூடு`,close:`மூடு`,optional:`(கட்டாயமில்லை)`,startTyping:`தட்டச்சு செய்யத் தொடங்கவும்...`,feedbackSubmitted:`கருத்து சமர்ப்பிக்கப்பட்டது!`,surveyDialog:`கருத்துக்கணிப்பு`,unsupportedQuestionType:`ஆதரிக்கப்படாத கேள்வி வகை`,bugReportTitlePlaceholder:`சிக்கலின் சுருக்கமான விளக்கம்`,bugReportDetailsPlaceholder:`சிக்கல் எப்படி ஏற்பட்டது, நீங்கள் என்ன எதிர்பார்த்தீர்கள், மேலும் என்ன நடந்தது என்பதை விவரிக்கவும்`,attachments:`இணைப்புகள்`,capturing:`ஸ்கிரீன்ஷாட் எடுக்கப்படுகிறது...`,screenshot:`ஸ்கிரீன்ஷாட்`,screenshotPreview:`ஸ்கிரீன்ஷாட் முன்னோட்டம்`,removeScreenshot:`ஸ்கிரீன்ஷாட்டை அகற்று`,loadingRecordingPreview:`பதிவு முன்னோட்டம் தயாராகிறது...`,removeRecording:`பதிவை அகற்று`,record:`பதிவுசெய்`,captureError:`ஸ்கிரீன்ஷாட் எடுக்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,recordingError:`பதிவைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`}},$=(e=`en`)=>Kr[e],qr=(e,t,n)=>e===Kr.en[t]?$(n)[t]:e,Jr=(e,t,n)=>!e||e===Kr.en[t]?$(n)[t]:e,Yr=(e,t)=>qr(e,`other`,t),Xr=(e,t)=>Jr(e,`close`,t),Zr=(e,t)=>Jr(e,`feedbackSubmitted`,t),Qr=(e,t)=>Jr(e,`bugReportTitlePlaceholder`,t),$r=(e,t)=>Jr(e,`bugReportDetailsPlaceholder`,t),ei=()=>{let[e,t]=O(!1);return T(()=>{let e=e=>{let n=ye.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(be,e),()=>{document.removeEventListener(be,e)}},[]),e},ti=({className:e,iconClassName:t,onClose:n,locale:r})=>ei()?null:A(`button`,{type:`button`,className:e,"aria-label":$(r).dismiss,onClick:n,children:A(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:A(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),ni=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s,locale:c})=>{let{survey:l,surveyId:u,dismiss:d}=Gr(),[f,p]=O(!1);return we(()=>{l&&i?.()},f?a:null),Ee(sr,{"aria-label":$(c).surveyDialog,id:`${u}-popover`,className:j(`confetti-modal-dialog ${xe}`,t?.dialog),children:[n&&A(ti,{className:j(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:c,onClose:async()=>{!o&&!f&&(await d(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>p(!0)}):e]})},ri=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3,locale:o})=>{let{dismiss:s}=Gr(),[c,l]=O(!1);return A(fr,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(c||(await s(),n?.()),r?.())},className:j(`confetti-modal-overlay ${xe}`,t?.overlay),children:A(ur,{className:j(`confetti-modal ${xe}`,t?.modal),children:A(ni,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:c,onSubmitted:()=>l(!0),locale:o,children:e})})})};export{ke as S,Xt as _,$ as a,it as b,Xr as c,Hr as d,Wr as f,$t as g,br as h,ei as i,Zr as l,Br as m,ni as n,$r as o,Gr as p,ti as r,Qr as s,ri as t,Yr as u,U as v,je as x,mt as y};
@@ -1,2 +1,2 @@
1
- import { r as ModalContent } from "./ModalContainer-BoP8D8gv.js";
1
+ import { r as ModalContent } from "./ModalContainer-DnTgSV6A.js";
2
2
  export { ModalContent as UnstableModalContent };
@@ -1 +1 @@
1
- import{n as e}from"./ModalContainer-CftztDnr.js";export{e as UnstableModalContent};
1
+ import{n as e}from"./ModalContainer-kQ-gmZ0r.js";export{e as UnstableModalContent};
@@ -1,6 +1,6 @@
1
- import { d as SingleSelectQuestionProperties, f as StatementQuestionProperties, l as MultiSelectQuestionProperties, p as TextQuestionProperties, r as Locale, u as RatingQuestionProperties } from "./index-BgEIWUUt.js";
2
- import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-BoP8D8gv.js";
3
- import { C as ConfettiState, _ as useSurvey, a as BaseFieldProps, b as Answer, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, k as Question, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-B1RcqeaN.js";
1
+ import { d as SingleSelectQuestionProperties, f as StatementQuestionProperties, l as MultiSelectQuestionProperties, p as TextQuestionProperties, r as Locale, u as RatingQuestionProperties } from "./index-DLqC_qk3.js";
2
+ import { n as ModalContainerProps, t as ModalContainer } from "./ModalContainer-DnTgSV6A.js";
3
+ import { C as ConfettiState, _ as useSurvey, a as BaseFieldProps, b as Answer, c as ConfettiProviderProps, d as RespondentVisibilityProviderProps, g as SurveyProviderProps, h as SurveyProvider, i as BugReportOptions, k as Question, l as RespondentVisibilityContext, m as SurveyContext, n as Confetti, o as Question$1, p as useRespondentVisibility, r as ConfettiProps, s as ConfettiProvider, t as BaseConfettiProps, u as RespondentVisibilityProvider, v as ConfettiController, y as ConfettiControllerProps } from "./Confetti-Ch8bCyn_.js";
4
4
  import { HTMLAttributes, JSX, PropsWithChildren, SVGProps } from "react";
5
5
 
6
6
  //#region src/components/container/PopoverContainer.d.ts
@@ -1 +1 @@
1
- import{n as e,t}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{d as n,f as r,p as i,r as a,t as o}from"./ModalContainer-CftztDnr.js";import{a as s,c,d as l,f as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./Embed-DP5SVLPA.js";import{ErrorBoundary as S}from"react-error-boundary";import{Fragment as C,jsx as w}from"react/jsx-runtime";const T=({children:e,respondent:t,isSurveyVisible:n,...i})=>{let{respondent:a}=m();return w(r,{...i,respondent:a,children:e})},E=({children:e,...t})=>w(_,{...t,children:w(T,{...t,children:e})}),D=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>w(S,{fallback:w(C,{}),children:w(E,{...r,children:w(d,{shouldAutoSubmit:n,onFinished:t,children:e})})});export{v as BackButton,a as CloseButton,D as Confetti,d as ConfettiController,E as ConfettiProvider,e as ConfettiTriggerIcon,t as DefaultConfettiTrigger,b as Embed,h as Flow,x as FreeText,o as ModalContainer,p as MultiChoice,l as PopoverContainer,c as Rating,u as RespondentVisibilityContext,_ as RespondentVisibilityProvider,y as SingleChoice,g as Statement,n as SurveyContext,r as SurveyProvider,s as SurveyQuestionFactory,f as ThankYouMessage,m as useRespondentVisibility,i as useSurvey};
1
+ import{n as e,t}from"./DefaultConfettiTrigger-iGndzjo2.js";import{d as n,f as r,p as i,r as a,t as o}from"./ModalContainer-kQ-gmZ0r.js";import{a as s,c,d as l,f as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./Embed-Ci53s3wI.js";import{ErrorBoundary as S}from"react-error-boundary";import{Fragment as C,jsx as w}from"react/jsx-runtime";const T=({children:e,respondent:t,isSurveyVisible:n,...i})=>{let{respondent:a}=m();return w(r,{...i,respondent:a,children:e})},E=({children:e,...t})=>w(_,{...t,children:w(T,{...t,children:e})}),D=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>w(S,{fallback:w(C,{}),children:w(E,{...r,children:w(d,{shouldAutoSubmit:n,onFinished:t,children:e})})});export{v as BackButton,a as CloseButton,D as Confetti,d as ConfettiController,E as ConfettiProvider,e as ConfettiTriggerIcon,t as DefaultConfettiTrigger,b as Embed,h as Flow,x as FreeText,o as ModalContainer,p as MultiChoice,l as PopoverContainer,c as Rating,u as RespondentVisibilityContext,_ as RespondentVisibilityProvider,y as SingleChoice,g as Statement,n as SurveyContext,r as SurveyProvider,s as SurveyQuestionFactory,f as ThankYouMessage,m as useRespondentVisibility,i as useSurvey};
@@ -4,6 +4,6 @@
4
4
  );--confetti-tag-border-radius: var(--confetti-input-border-radius);--confetti-background-color: #ffffff;--confetti-box-shadow:
5
5
  0 4px 6px -4px rgba(16, 24, 40, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1);--confetti-focus-shadow: 0 0 0 2px rgba(9, 9, 11, 0.3);--confetti-submit-button-color: #18181b;--confetti-submit-button-text-color: #fafafa;--confetti-rating-bg-color: white;--confetti-rating-text-color: #09090b;--confetti-rating-active-bg-color: #09090b;--confetti-rating-active-text-color: white;--confetti-indicator-active-bg-color: var(--confetti-rating-active-bg-color);--confetti-indicator-active-dot-color: var(
6
6
  --confetti-rating-active-text-color
7
- );--confetti-bug-report-button-color: #18181b;--confetti-bug-report-record-button-color: #ff2c2c;--confetti-bug-report-record-button-active-color: #dc2626;--confetti-bug-report-button-text-color: white;--confetti-bug-report-overlay-color: rgba(9, 9, 11, 0.4);--confetti-text-primary-color: #09090b;--confetti-text-subtle-color: #71717a;--confetti-error-color: #dc2626;--confetti-trigger-bg-color: #18181b;--confetti-trigger-text-color: #fafafa;--confetti-trigger-size: 40px;--confetti-widget-color: #e0a045;--confetti-widget-text-color: white;--confetti-scrollbar-thumb-color: var(--confetti-border-color);--confetti-scrollbar-track-color: var(--confetti-background-color);--confetti-outline-color: rgba(9, 9, 11, 0.8);--confetti-input-background: white;--confetti-input-text-color: #020617;--confetti-disabled-button-opacity: 0.6;}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}@keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.confetti-trigger{font-size:var(--confetti-font-scale);cursor:pointer;position:relative;display:inline-grid;grid-template-columns:0fr;align-items:center;justify-content:center;min-width:var(--confetti-trigger-size);height:var(--confetti-trigger-size);padding:0;border:none;border-radius:9999px;background:var(--confetti-trigger-bg-color);color:var(--confetti-trigger-text-color);overflow:hidden;transition:grid-template-columns 220ms ease, background 220ms ease}.confetti-trigger .confetti-trigger-icon-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;opacity:1;transition:opacity 180ms ease;pointer-events:none}.confetti-trigger .confetti-trigger-label{opacity:0;pointer-events:none;min-width:0;overflow:hidden;padding:0 20px;font-size:0.875em;font-weight:500;line-height:20px;white-space:nowrap;transition:opacity 180ms ease}.confetti-trigger:hover,.confetti-trigger:focus-visible,.confetti-trigger[data-hovered],.confetti-trigger[data-focus-visible]{grid-template-columns:1fr}.confetti-trigger:focus-visible .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:hover .confetti-trigger-icon-wrapper,.confetti-trigger[data-hovered] .confetti-trigger-icon-wrapper,.confetti-trigger[data-focus-visible] .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:focus-visible .confetti-trigger-label{opacity:1}.confetti-trigger:hover .confetti-trigger-label,.confetti-trigger[data-hovered] .confetti-trigger-label,.confetti-trigger[data-focus-visible] .confetti-trigger-label{opacity:1}.confetti-trigger:focus-visible,.confetti-trigger[data-focus-visible]{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog{width:var(--confetti-max-width);max-height:95dvh;overflow:auto;max-width:100%;background:transparent;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-dialog .confetti-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-dialog .confetti-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-dialog .confetti-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-dialog .confetti-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog .cf-header .cf-title{padding-right:20px}.confetti-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--confetti-z-index);background:rgba(0, 0, 0, 0.4);display:flex;justify-content:center;overflow-y:auto;overscroll-behavior:none;padding:10vh 0}.confetti-modal{margin:auto}.confetti-modal .confetti-modal-dialog{width:var(--confetti-max-width);max-width:100%;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-modal .confetti-modal-dialog:focus-visible{outline:none}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-modal .confetti-modal-dialog .cf-header .cf-title{padding-right:20px}.confetti{font-family:var(--confetti-font-family);display:flex;flex-direction:column;gap:16px;color:var(--confetti-text-primary-color);font-size:var(--confetti-font-scale);width:100%}.confetti .cf-button-row{display:flex;align-items:center;justify-content:space-between;gap:var(--confetti-button-row-gap)}.confetti .cf-submit-button{margin-left:auto;color:var(--confetti-submit-button-text-color);background:var(--confetti-submit-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-submit-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-submit-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-submit-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-submit-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-back-button{color:var(--confetti-text-primary-color);background:transparent;border:none;padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-back-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-back-button:hover{background:color-mix(in srgb, currentColor 8%, transparent)}.confetti .sr-only{clip:rect(0, 0, 0, 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.confetti .cf-response-choices{display:flex;flex-direction:column;gap:12px}.confetti .cf-choice{font-size:1em;cursor:pointer;padding:8px 10px;border-radius:var(--confetti-choice-border-radius);border:1px solid var(--confetti-border-color);transition:background 200ms ease-out}.confetti .cf-choice:hover{background:var( --confetti-hover-background-color, color-mix( in srgb, var(--confetti-text-primary-color) 4%, var(--confetti-background-color) ) )}.confetti .cf-choice .cf-choice-label{gap:8px;display:inline-flex;align-items:center}.confetti .cf-choice .cf-choice-description{font-size:0.875em;margin-left:26px;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-response-choices-tag{flex-direction:row;flex-wrap:wrap;gap:8px}.confetti .cf-tag-input{display:none}.confetti .cf-tag-input[data-visible='true']{display:inline}.confetti .cf-tag{border-radius:var(--confetti-tag-border-radius);padding:6px 12px;font-weight:500;font-size:0.875em;transition:background 200ms ease-out, border-color 200ms ease-out}.confetti .cf-tag[data-selected='true']{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color);color:var(--confetti-indicator-active-dot-color)}.confetti .cf-tag[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-tag:active{scale:0.96}.confetti .cf-radio,.confetti .cf-checkbox{cursor:pointer;display:flex;flex-direction:column;position:relative;align-items:start;color:var(--confetti-text-primary-color);forced-color-adjust:none}.confetti .cf-checkbox{--checkmark-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-checkbox .cf-checkbox-indicator{background:white;border:1px solid var(--confetti-border-color);width:18px;height:18px;box-sizing:border-box;border-radius:4px;transition:color 200ms ease-out;display:flex;align-items:center;justify-content:center;flex-shrink:0}.confetti .cf-checkbox svg{width:calc(100% - 8px);height:calc(100% - 8px);fill:none;stroke:var(--checkmark-color);stroke-width:3px;stroke-dasharray:22px;stroke-dashoffset:66;stroke-linecap:round;stroke-linejoin:round;transition:all 200ms}.confetti .cf-checkbox[data-focus-visible='true'] .cf-checkbox-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-checkbox[data-selected] .cf-checkbox-indicator,.confetti .cf-checkbox[data-indeterminate] .cf-checkbox-indicator{background:var(--confetti-indicator-active-bg-color);border:none}.confetti .cf-checkbox[data-selected] svg,.confetti .cf-checkbox[data-indeterminate] svg{stroke-dashoffset:44}.confetti .cf-checkbox[data-indeterminate] svg{stroke:none;fill:var(--checkmark-color)}.confetti .cf-radio{-webkit-tap-highlight-color:transparent;--dot-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-radio .cf-radio-indicator{position:relative;width:18px;height:18px;flex-shrink:0;box-sizing:border-box;border-radius:50%;transition:color 200ms ease-out;border:1px solid var(--confetti-border-color);background:white}.confetti .cf-radio .cf-radio-indicator::after{content:'';position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:inherit;background:transparent;transition:scale 200ms;scale:0}.confetti .cf-radio[data-selected] .cf-radio-indicator{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color)}.confetti .cf-radio[data-selected] .cf-radio-indicator::after{background:var(--dot-color);scale:0.4}.confetti .cf-radio[data-disabled]{color:var(--text-color-disabled);--dot-color: var(--text-color-disabled);}.confetti .cf-radio[data-focus-visible='true'] .cf-radio-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-input,.confetti .cf-textarea{background:var(--confetti-input-background);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-input-border-radius);color:var(--confetti-input-text-color);padding:10px;transition:border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out}.confetti .cf-input:focus,.confetti .cf-textarea:focus{border-color:var(--confetti-outline-color);box-shadow:var(--confetti-focus-shadow);outline:none}.confetti .cf-question{display:flex;flex-direction:column;gap:16px}.confetti .cf-question .cf-error{display:none;color:var(--confetti-error-color);font-size:0.875em;line-height:20px}.confetti .cf-question .cf-header{display:flex;flex-direction:column;gap:2px}.confetti .cf-question .cf-title{line-height:24px;font-weight:500}.confetti .cf-question .cf-label-optional{font-weight:400;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-description{font-size:0.875em;line-height:20px;font-weight:400;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-others-choice{display:flex;flex-direction:column;gap:8px}.confetti[data-show-errors] .cf-question .cf-error{display:block}.confetti .cf-bug-report{display:flex;flex-direction:column;gap:16px}.confetti .cf-bug-report .cf-bug-report-screenshot-section,.confetti .cf-bug-report .cf-bug-report-recording-section{display:flex;flex-direction:column;gap:8px}.confetti .cf-bug-report .cf-bug-report-actions{display:flex;flex-direction:column;gap:12px}.confetti .cf-bug-report .cf-bug-report-button-action{padding:8px 8px}.confetti .cf-bug-report .cf-bug-report-media-preview{position:relative;width:100%;aspect-ratio:16 / 9;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden;display:flex;align-items:center;justify-content:center}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-loading{width:1.5em;height:1.5em;border:2px solid var(--confetti-submit-button-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:confetti-spinner 1s linear infinite}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container{height:100%;width:100%;position:relative}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-player{height:100%;width:auto;overflow:hidden}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-progress-bar{position:absolute;bottom:0;left:0;height:2px;background:var(--confetti-text-primary-color);opacity:0.5;transition-property:width;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;width:0%}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-time{position:absolute;right:4px;bottom:4px;font-size:0.75em;color:color-mix( in oklab, var(--confetti-text-primary-color) 50%, transparent )}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:var(--confetti-bug-report-overlay-color);opacity:0;transition:opacity 200ms ease-out}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions:hover{opacity:1}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-screenshot-img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.confetti .cf-bug-report-button{color:var(--confetti-bug-report-button-text-color);background:var(--confetti-bug-report-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-bug-report-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-bug-report-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-bug-report-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button.cf-bug-report-record-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 8px;--pulse-color-start: var(--confetti-bug-report-record-button-color);background-color:var(--pulse-color-start);animation:confetti-record-pulse 2s ease-in-out infinite}.confetti .cf-bug-report-button.cf-bug-report-record-button:hover{--pulse-color-start: var(
7
+ );--confetti-bug-report-button-color: #18181b;--confetti-bug-report-record-button-color: #ff2c2c;--confetti-bug-report-record-button-active-color: #dc2626;--confetti-bug-report-button-text-color: white;--confetti-bug-report-overlay-color: rgba(9, 9, 11, 0.4);--confetti-text-primary-color: #09090b;--confetti-text-subtle-color: #71717a;--confetti-error-color: #dc2626;--confetti-trigger-bg-color: #18181b;--confetti-trigger-text-color: #fafafa;--confetti-trigger-size: 40px;--confetti-widget-color: #e0a045;--confetti-widget-text-color: white;--confetti-scrollbar-thumb-color: var(--confetti-border-color);--confetti-scrollbar-track-color: var(--confetti-background-color);--confetti-outline-color: rgba(9, 9, 11, 0.8);--confetti-input-background: white;--confetti-input-text-color: #020617;--confetti-disabled-button-opacity: 0.6;}@-webkit-keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}}@supports (color: color-mix(in lch, red, blue)){@-webkit-keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}}@-webkit-keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.confetti-trigger{font-size:var(--confetti-font-scale);cursor:pointer;position:relative;display:inline-grid;grid-template-columns:0fr;align-items:center;justify-content:center;min-width:var(--confetti-trigger-size);height:var(--confetti-trigger-size);padding:0;border:none;border-radius:9999px;background:var(--confetti-trigger-bg-color);color:var(--confetti-trigger-text-color);overflow:hidden;transition:grid-template-columns 220ms ease, background 220ms ease;transition:grid-template-columns 220ms ease, background 220ms ease, -ms-grid-columns 220ms ease}.confetti-trigger .confetti-trigger-icon-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;opacity:1;transition:opacity 180ms ease;pointer-events:none}.confetti-trigger .confetti-trigger-label{opacity:0;pointer-events:none;min-width:0;overflow:hidden;padding:0 20px;font-size:0.875em;font-weight:500;line-height:20px;white-space:nowrap;transition:opacity 180ms ease}.confetti-trigger:hover,.confetti-trigger:focus-visible,.confetti-trigger[data-hovered],.confetti-trigger[data-focus-visible]{grid-template-columns:1fr}.confetti-trigger:focus-visible .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:hover .confetti-trigger-icon-wrapper,.confetti-trigger[data-hovered] .confetti-trigger-icon-wrapper,.confetti-trigger[data-focus-visible] .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:focus-visible .confetti-trigger-label{opacity:1}.confetti-trigger:hover .confetti-trigger-label,.confetti-trigger[data-hovered] .confetti-trigger-label,.confetti-trigger[data-focus-visible] .confetti-trigger-label{opacity:1}.confetti-trigger:focus-visible,.confetti-trigger[data-focus-visible]{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog{width:var(--confetti-max-width);max-height:95dvh;overflow:auto;max-width:100%;background:transparent;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-dialog .confetti-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-dialog .confetti-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-dialog .confetti-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-dialog .confetti-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog .cf-header .cf-title{padding-right:20px}.confetti-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--confetti-z-index);background:rgba(0, 0, 0, 0.4);display:flex;justify-content:center;overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:none;padding:10vh 0}.confetti-modal{margin:auto}.confetti-modal .confetti-modal-dialog{width:var(--confetti-max-width);max-width:100%;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-modal .confetti-modal-dialog:focus-visible{outline:none}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-modal .confetti-modal-dialog .cf-header .cf-title{padding-right:20px}.confetti{font-family:var(--confetti-font-family);display:flex;flex-direction:column;gap:16px;color:var(--confetti-text-primary-color);font-size:var(--confetti-font-scale);width:100%}.confetti .cf-button-row{display:flex;align-items:center;justify-content:space-between;gap:var(--confetti-button-row-gap)}.confetti .cf-submit-button{margin-left:auto;color:var(--confetti-submit-button-text-color);background:var(--confetti-submit-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-submit-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-submit-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;transform:none}.confetti .cf-submit-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-submit-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-back-button{color:var(--confetti-text-primary-color);background:transparent;border:none;padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-back-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-back-button:hover{background:color-mix(in srgb, currentColor 8%, transparent)}.confetti .sr-only{clip:rect(0, 0, 0, 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.confetti .cf-response-choices{display:flex;flex-direction:column;gap:12px}.confetti .cf-choice{font-size:1em;cursor:pointer;padding:8px 10px;border-radius:var(--confetti-choice-border-radius);border:1px solid var(--confetti-border-color);transition:background 200ms ease-out}.confetti .cf-choice:hover{background:var( --confetti-hover-background-color, color-mix( in srgb, var(--confetti-text-primary-color) 4%, var(--confetti-background-color) ) )}.confetti .cf-choice .cf-choice-label{gap:8px;display:inline-flex;align-items:center}.confetti .cf-choice .cf-choice-description{font-size:0.875em;margin-left:26px;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-response-choices-tag{flex-direction:row;flex-wrap:wrap;gap:8px}.confetti .cf-tag-input{display:none}.confetti .cf-tag-input[data-visible='true']{display:inline}.confetti .cf-tag{border-radius:var(--confetti-tag-border-radius);padding:6px 12px;font-weight:500;font-size:0.875em;transition:background 200ms ease-out, border-color 200ms ease-out}.confetti .cf-tag[data-selected='true']{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color);color:var(--confetti-indicator-active-dot-color)}.confetti .cf-tag[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-tag:active{scale:0.96}.confetti .cf-radio,.confetti .cf-checkbox{cursor:pointer;display:flex;flex-direction:column;position:relative;align-items:start;color:var(--confetti-text-primary-color);forced-color-adjust:none}.confetti .cf-checkbox{--checkmark-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-checkbox .cf-checkbox-indicator{background:white;border:1px solid var(--confetti-border-color);width:18px;height:18px;box-sizing:border-box;border-radius:4px;transition:color 200ms ease-out;display:flex;align-items:center;justify-content:center;flex-shrink:0}.confetti .cf-checkbox svg{width:calc(100% - 8px);height:calc(100% - 8px);fill:none;stroke:var(--checkmark-color);stroke-width:3px;stroke-dasharray:22px;stroke-dashoffset:66;stroke-linecap:round;stroke-linejoin:round;transition:all 200ms}.confetti .cf-checkbox[data-focus-visible='true'] .cf-checkbox-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-checkbox[data-selected] .cf-checkbox-indicator,.confetti .cf-checkbox[data-indeterminate] .cf-checkbox-indicator{background:var(--confetti-indicator-active-bg-color);border:none}.confetti .cf-checkbox[data-selected] svg,.confetti .cf-checkbox[data-indeterminate] svg{stroke-dashoffset:44}.confetti .cf-checkbox[data-indeterminate] svg{stroke:none;fill:var(--checkmark-color)}.confetti .cf-radio{-webkit-tap-highlight-color:transparent;--dot-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-radio .cf-radio-indicator{position:relative;width:18px;height:18px;flex-shrink:0;box-sizing:border-box;border-radius:50%;transition:color 200ms ease-out;border:1px solid var(--confetti-border-color);background:white}.confetti .cf-radio .cf-radio-indicator::after{content:'';position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:inherit;background:transparent;transition:scale 200ms;scale:0}.confetti .cf-radio[data-selected] .cf-radio-indicator{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color)}.confetti .cf-radio[data-selected] .cf-radio-indicator::after{background:var(--dot-color);scale:0.4}.confetti .cf-radio[data-disabled]{color:var(--text-color-disabled);--dot-color: var(--text-color-disabled);}.confetti .cf-radio[data-focus-visible='true'] .cf-radio-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-input,.confetti .cf-textarea{background:var(--confetti-input-background);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-input-border-radius);color:var(--confetti-input-text-color);padding:10px;transition:border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out}.confetti .cf-input:focus,.confetti .cf-textarea:focus{border-color:var(--confetti-outline-color);box-shadow:var(--confetti-focus-shadow);outline:none}.confetti .cf-question{display:flex;flex-direction:column;gap:16px}.confetti .cf-question .cf-error{display:none;color:var(--confetti-error-color);font-size:0.875em;line-height:20px}.confetti .cf-question .cf-header{display:flex;flex-direction:column;gap:2px}.confetti .cf-question .cf-title{line-height:24px;font-weight:500}.confetti .cf-question .cf-label-optional{font-weight:400;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-description{font-size:0.875em;line-height:20px;font-weight:400;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-others-choice{display:flex;flex-direction:column;gap:8px}.confetti[data-show-errors] .cf-question .cf-error{display:block}.confetti .cf-bug-report{display:flex;flex-direction:column;gap:16px}.confetti .cf-bug-report .cf-bug-report-screenshot-section,.confetti .cf-bug-report .cf-bug-report-recording-section{display:flex;flex-direction:column;gap:8px}.confetti .cf-bug-report .cf-bug-report-actions{display:flex;flex-direction:column;gap:12px}.confetti .cf-bug-report .cf-bug-report-button-action{padding:8px 8px}.confetti .cf-bug-report .cf-bug-report-media-preview{position:relative;width:100%;aspect-ratio:16 / 9;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden;display:flex;align-items:center;justify-content:center}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-loading{width:1.5em;height:1.5em;border:2px solid var(--confetti-submit-button-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;-webkit-animation:confetti-spinner 1s linear infinite;animation:confetti-spinner 1s linear infinite}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container{height:100%;width:100%;position:relative}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-player{height:100%;width:auto;overflow:hidden}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-progress-bar{position:absolute;bottom:0;left:0;height:2px;background:var(--confetti-text-primary-color);opacity:0.5;transition-property:width;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;width:0%}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-time{position:absolute;right:4px;bottom:4px;font-size:0.75em;color:color-mix( in oklab, var(--confetti-text-primary-color) 50%, transparent )}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:var(--confetti-bug-report-overlay-color);opacity:0;transition:opacity 200ms ease-out}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions:hover{opacity:1}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-screenshot-img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.confetti .cf-bug-report-button{color:var(--confetti-bug-report-button-text-color);background:var(--confetti-bug-report-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-bug-report-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-bug-report-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;transform:none}.confetti .cf-bug-report-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button.cf-bug-report-record-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 8px;--pulse-color-start: var(--confetti-bug-report-record-button-color);background-color:var(--pulse-color-start);-webkit-animation:confetti-record-pulse 2s ease-in-out infinite;animation:confetti-record-pulse 2s ease-in-out infinite}.confetti .cf-bug-report-button.cf-bug-report-record-button:hover{--pulse-color-start: var(
8
8
  --confetti-bug-report-record-button-active-color
9
- );}.confetti .cf-rating-section{display:flex;flex-direction:column;gap:4px}.confetti .cf-rating-emoji{opacity:0.5}.confetti .cf-rating-display-star,.confetti .cf-rating-display-emoji{display:grid;grid-template-columns:repeat(auto-fit, 40px);justify-content:space-between;grid-gap:8px;gap:8px}.confetti .cf-rating-display-star .cf-rating-emoji,.confetti .cf-rating-display-emoji .cf-rating-emoji,.confetti .cf-rating-display-star .cf-rating-star,.confetti .cf-rating-display-emoji .cf-rating-star{font-size:1em;background-color:transparent;border:none;padding:0;transition:transform 0.15s ease-out;color:var(--confetti-rating-active-bg-color)}.confetti .cf-rating-display-star .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-star .cf-rating-star[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-rating-display-star .cf-rating-emoji:hover,.confetti .cf-rating-display-emoji .cf-rating-emoji:hover,.confetti .cf-rating-display-star .cf-rating-star:hover,.confetti .cf-rating-display-emoji .cf-rating-star:hover{cursor:pointer;-ms-transform:scale(1.15);transform:scale(1.15);opacity:1!important}.confetti .cf-rating-display-star .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-star .cf-rating-star[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-filled='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-selected='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji svg,.confetti .cf-rating-display-emoji .cf-rating-emoji svg,.confetti .cf-rating-display-star .cf-rating-star svg,.confetti .cf-rating-display-emoji .cf-rating-star svg{transition:fill 0.15s ease-out}.confetti .cf-rating-text{display:flex;justify-content:space-between;font-size:0.75em;color:var(--confetti-text-subtle-color);font-weight:500;line-height:1}.confetti .cf-rating-text .cf-rating-text-lower{flex:1;text-align:left}.confetti .cf-rating-text .cf-rating-text-upper{flex:1;text-align:right}.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'] ~ .cf-rating-star{opacity:0.5}.confetti .cf-rating-display-number{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden}.confetti .cf-rating-display-number .cf-rating-number{border-right:1px solid var(--confetti-border-color);text-align:center;cursor:pointer;color:var(--confetti-rating-text-color);border-left:none;border-top:none;border-bottom:none;font-weight:700;padding:8px 0;margin-top:-1px;margin-bottom:-1px}.confetti .cf-rating-display-number .cf-rating-number:first-of-type{border-top-left-radius:8px;border-bottom-left-radius:8px}.confetti .cf-rating-display-number .cf-rating-number:last-of-type{border-top-right-radius:8px;border-bottom-right-radius:8px;border-right:0}.confetti .cf-rating-display-number .cf-rating-number[data-focus-visible='true']{box-shadow:inset 0 0 0 1px var(--confetti-outline-color)}.confetti .cf-rating-display-number .cf-rating-number[data-selected='true']{background:var(--confetti-rating-active-bg-color);color:var(--confetti-rating-active-text-color)}
9
+ );}.confetti .cf-rating-section{display:flex;flex-direction:column;gap:4px}.confetti .cf-rating-emoji{opacity:0.5}.confetti .cf-rating-display-star,.confetti .cf-rating-display-emoji{display:grid;grid-template-columns:repeat(auto-fit, 40px);justify-content:space-between;grid-gap:8px;gap:8px}.confetti .cf-rating-display-star .cf-rating-emoji,.confetti .cf-rating-display-emoji .cf-rating-emoji,.confetti .cf-rating-display-star .cf-rating-star,.confetti .cf-rating-display-emoji .cf-rating-star{font-size:1em;background-color:transparent;border:none;padding:0;transition:transform 0.15s ease-out;color:var(--confetti-rating-active-bg-color)}.confetti .cf-rating-display-star .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-star .cf-rating-star[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-rating-display-star .cf-rating-emoji:hover,.confetti .cf-rating-display-emoji .cf-rating-emoji:hover,.confetti .cf-rating-display-star .cf-rating-star:hover,.confetti .cf-rating-display-emoji .cf-rating-star:hover{cursor:pointer;transform:scale(1.15);opacity:1!important}.confetti .cf-rating-display-star .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-star .cf-rating-star[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-filled='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-selected='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji svg,.confetti .cf-rating-display-emoji .cf-rating-emoji svg,.confetti .cf-rating-display-star .cf-rating-star svg,.confetti .cf-rating-display-emoji .cf-rating-star svg{transition:fill 0.15s ease-out}.confetti .cf-rating-text{display:flex;justify-content:space-between;font-size:0.75em;color:var(--confetti-text-subtle-color);font-weight:500;line-height:1}.confetti .cf-rating-text .cf-rating-text-lower{flex:1;text-align:left}.confetti .cf-rating-text .cf-rating-text-upper{flex:1;text-align:right}.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'] ~ .cf-rating-star{opacity:0.5}.confetti .cf-rating-display-number{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden}.confetti .cf-rating-display-number .cf-rating-number{border-right:1px solid var(--confetti-border-color);text-align:center;cursor:pointer;color:var(--confetti-rating-text-color);border-left:none;border-top:none;border-bottom:none;font-weight:700;padding:8px 0;margin-top:-1px;margin-bottom:-1px}.confetti .cf-rating-display-number .cf-rating-number:first-of-type{border-top-left-radius:8px;border-bottom-left-radius:8px}.confetti .cf-rating-display-number .cf-rating-number:last-of-type{border-top-right-radius:8px;border-bottom-right-radius:8px;border-right:0}.confetti .cf-rating-display-number .cf-rating-number[data-focus-visible='true']{box-shadow:inset 0 0 0 1px var(--confetti-outline-color)}.confetti .cf-rating-display-number .cf-rating-number[data-selected='true']{background:var(--confetti-rating-active-bg-color);color:var(--confetti-rating-active-text-color)}
@@ -96,7 +96,7 @@ declare const bugReportAnswerSchema: z.ZodObject<{
96
96
  referrer: z.ZodOptional<z.ZodString>;
97
97
  datadogTraceId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
98
98
  datadogSessionId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
99
- datadogSessionReplayLink: z.ZodOptional<z.ZodOptional<z.ZodString>>;
99
+ datadogSessionReplayLink: z.ZodOptional<z.ZodCatch<z.ZodOptional<z.ZodURL>>>;
100
100
  }, z.core.$catchall<z.ZodOptional<z.ZodString>>>>;
101
101
  }, z.core.$strip>;
102
102
  type BugReportAnswer = z.infer<typeof bugReportAnswerSchema>;
package/build/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { r as Locale } from "./index-BgEIWUUt.js";
2
- import { D as OptionallyDismissable, E as Finishable, O as Proxyable, S as ConfettiContainer, T as Dismissable, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-B1RcqeaN.js";
1
+ import { r as Locale } from "./index-DLqC_qk3.js";
2
+ import { D as OptionallyDismissable, E as Finishable, O as Proxyable, S as ConfettiContainer, T as Dismissable, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-Ch8bCyn_.js";
3
3
 
4
4
  //#region src/contracts/api.d.ts
5
5
  type Template = 'TriggerPopover' | 'Popover' | 'Modal' | 'Embedded' | 'Stepper';
package/build/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,o as n,r,s as i,t as a}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{G as o}from"./Button-LiaNjkvk.js";import{a as s}from"./src-D7lX72kz.js";import{useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{ErrorBoundary as p}from"react-error-boundary";import{useLocalStorage as m,useSessionStorage as h}from"usehooks-ts";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`confetti:ready`,b=`https://confetti.gov.sg`,x={promise:null,channel:null,url:null};function S(){x.promise=null,x.channel=null,x.url=null}function C(){x.promise=null}function w(e){return new URL(``,e).href}function T(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function E(e=`stable`,t=b){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(x.promise)return x.channel===e?x.url===n?x.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(x.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(x.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?x.url!==null&&x.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${x.url} to ${n} on the same page`)):j(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=O(n,e);return x.channel=e,x.url=n,x.promise=i,i}function D(e=`stable`,t=b){if(typeof window>`u`)return Promise.resolve();let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return k(n,e)}async function O(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([k(e,t),A(e,t)])]);return clearTimeout(r),C(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),S(),e}}function k(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=T(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function A(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}j(e).then(n,r)};if(window.addEventListener(y,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=T(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(y,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function j(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function M(e){let t=d(null),n=d(null),r=d(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,l(()=>{if(!e.element)return;let o=!1;return E(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),l(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function N(e){let[t,n]=f(null);return M({...e,element:t}),_(p,{fallback:_(g,{}),children:_(`div`,{ref:n,"data-confetti-mount":!0})})}function P(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.0`},onFinished:S,onClose:()=>{b(!0),C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.options,S,C]);if(!x)return null;let T=_(N,{template:`Embedded`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function F(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.0`},closeOnFinishMs:a.closeOnFinishMs,isDismissable:a.isDismissable,onFinished:S,onClose:()=>{b(!0),w?.()},onDismiss:()=>{C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.closeOnFinishMs,a.isDismissable,a.options,S,C,w]);return x?_(p,{fallback:_(g,{}),children:_(N,{template:`Modal`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function I(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.0`},closeOnFinishMs:a.closeOnFinishMs,onFinished:S,onClose:()=>{b(!0),w?.()},onDismiss:()=>{C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.closeOnFinishMs,a.options,S,C,w]);return x?_(p,{fallback:_(g,{}),children:_(N,{template:`Popover`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function L(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.0`},onFinished:S,onClose:()=>{b(!0),C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.options,S,C]);if(!x)return null;let T=_(N,{template:`Stepper`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function R(s){let m=e({surveyId:s.surveyId,override:s.respondent}),h=o({publishableKey:s.publishableKey,apiBaseUrl:s.proxyUrl}),{isAvailable:y,isSettled:b}=r({client:h,surveyId:s.surveyId}),{state:x,isSettled:S}=t({client:h,surveyId:s.surveyId,respondent:m,enabled:i(s.isSurveyVisible)}),[C,w]=f(!1),T=b&&y&&S&&C&&n(x,s.isSurveyVisible),[E,O]=f(!1),[k,A]=f(!1),{onError:j,channel:M,proxyUrl:P}=s,F=d(j);l(()=>{F.current=j},[j]),l(()=>{if(!(b&&y))return;let e=!1;return D(M,P).then(()=>{e||w(!0)}).catch(e=>F.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[b,y,M,P]);let I=T&&E,L=c(()=>O(!0),[]),R=s.onFinished,z=u(()=>({surveyId:s.surveyId,publishableKey:s.publishableKey,respondent:m,locale:s.locale,metadata:s.metadata,autoInjectAnalyticsMetadata:s.autoInjectAnalyticsMetadata,apiBaseUrl:s.proxyUrl,telemetry:{version:`0.9.0`},isOpen:E,onFinished:e=>{A(!0),R?.(e)},onClose:()=>{O(!1)},onDismiss:()=>{O(!1)},options:s.options}),[s.surveyId,s.publishableKey,m,s.locale,s.metadata,s.autoInjectAnalyticsMetadata,s.proxyUrl,s.options,E,R]);return T?v(p,{fallback:_(g,{}),children:[s.trigger?s.trigger({onClick:L,isOpen:E,isSubmitted:k}):_(a,{onClick:L,isWidgetOpen:E}),I?_(N,{template:`TriggerPopover`,channel:s.channel,scriptBaseUrl:s.proxyUrl,onError:s.onError,props:z}):null]}):null}function z(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function B(e){return e.split(`,`).map(e=>{let[t,...n]=e.split(`;`),r=n.map(e=>e.trim()).find(e=>e.startsWith(`q=`)),i=r?Number(r.slice(2)):1;return{tag:z(t??``),quality:i}}).filter(({quality:e})=>e>0).sort((e,t)=>t.quality-e.quality)}function V(e,t){for(let{tag:n}of B(e)){let e=t.find(e=>e===n);if(e)return e}}function H({preferred:e,explicit:t,available:n=s,base:r=`en`}={}){let i=t??e;return(i?V(i,n):void 0)??r}function U(){if(!(typeof navigator>`u`))return navigator.languages.length>0?navigator.languages.join(`,`):navigator.language}const W=({preferred:e,explicit:t}={})=>H({preferred:e??U(),explicit:t,available:s,base:`en`});function G({surveyId:e,publishableKey:n,respondent:i,proxyUrl:a}){let s=o({publishableKey:n,apiBaseUrl:a}),{isAvailable:c,isSettled:l}=r({client:s,surveyId:e}),{state:u,isSettled:d}=t({client:s,surveyId:e,respondent:i});if(!i)return null;if(!(!l||!d))return c?{lastRespondedAt:u.lastRespondedAt?new Date(u.lastRespondedAt):null,lastDismissedAt:u.lastDismissedAt?new Date(u.lastDismissedAt):null}:null}const K=({delay:e})=>{let[t,n]=f(!1),r=u(()=>e,[]);return l(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},q=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},J=({visits:e,respondent:t})=>{let[n,r]=h(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},Y=({threshold:e})=>{let[t,n]=f(()=>typeof window>`u`?!1:window.scrollY>=e);return l(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{P as EmbeddedConfetti,F as ModalConfetti,I as PopoverConfetti,L as StepperConfetti,R as TriggerPopoverConfetti,W as useResolveLocale,G as useRespondentState,K as useVisibleAfterDelay,q as useVisibleAfterPageVisits,Y as useVisibleAfterScroll,J as useVisibleAfterSessionPageVisits};
1
+ import{a as e,i as t,o as n,r,s as i,t as a}from"./DefaultConfettiTrigger-iGndzjo2.js";import{J as o}from"./Button-D3Wb2KZB.js";import{a as s}from"./src-DG66KK2l.js";import{useCallback as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{ErrorBoundary as p}from"react-error-boundary";import{useLocalStorage as m,useSessionStorage as h}from"usehooks-ts";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";const y=`confetti:ready`,b=`https://confetti.gov.sg`,x={promise:null,channel:null,url:null};function S(){x.promise=null,x.channel=null,x.url=null}function C(){x.promise=null}function w(e){return new URL(``,e).href}function T(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function E(e=`stable`,t=b){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(x.promise)return x.channel===e?x.url===n?x.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(x.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(x.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?x.url!==null&&x.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${x.url} to ${n} on the same page`)):j(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=O(n,e);return x.channel=e,x.url=n,x.promise=i,i}function D(e=`stable`,t=b){if(typeof window>`u`)return Promise.resolve();let n;try{n=w(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return k(n,e)}async function O(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([k(e,t),A(e,t)])]);return clearTimeout(r),C(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),S(),e}}function k(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=T(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function A(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}j(e).then(n,r)};if(window.addEventListener(y,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=T(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(y,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function j(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function M(e){let t=d(null),n=d(null),r=d(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,l(()=>{if(!e.element)return;let o=!1;return E(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),l(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function N(e){let[t,n]=f(null);return M({...e,element:t}),_(p,{fallback:_(g,{}),children:_(`div`,{ref:n,"data-confetti-mount":!0})})}function P(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.1`},onFinished:S,onClose:()=>{b(!0),C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.options,S,C]);if(!x)return null;let T=_(N,{template:`Embedded`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function F(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.1`},closeOnFinishMs:a.closeOnFinishMs,isDismissable:a.isDismissable,onFinished:S,onClose:()=>{b(!0),w?.()},onDismiss:()=>{C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.closeOnFinishMs,a.isDismissable,a.options,S,C,w]);return x?_(p,{fallback:_(g,{}),children:_(N,{template:`Modal`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function I(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onDismiss,w=a.onClose,T=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.1`},closeOnFinishMs:a.closeOnFinishMs,onFinished:S,onClose:()=>{b(!0),w?.()},onDismiss:()=>{C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.closeOnFinishMs,a.options,S,C,w]);return x?_(p,{fallback:_(g,{}),children:_(N,{template:`Popover`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:T})}):null}function L(a){let s=e({surveyId:a.surveyId,override:a.respondent}),c=o({publishableKey:a.publishableKey,apiBaseUrl:a.proxyUrl}),{isAvailable:l,isSettled:d}=r({client:c,surveyId:a.surveyId}),{state:m,isSettled:h}=t({client:c,surveyId:a.surveyId,respondent:s,enabled:i(a.isSurveyVisible)}),v=n(m,a.isSurveyVisible),[y,b]=f(!1),x=d&&l&&h&&v&&!y,S=a.onFinished,C=a.onClose,w=u(()=>({surveyId:a.surveyId,publishableKey:a.publishableKey,respondent:s,locale:a.locale,metadata:a.metadata,autoInjectAnalyticsMetadata:a.autoInjectAnalyticsMetadata,apiBaseUrl:a.proxyUrl,telemetry:{version:`0.9.1`},onFinished:S,onClose:()=>{b(!0),C?.()},options:a.options}),[a.surveyId,a.publishableKey,s,a.locale,a.metadata,a.autoInjectAnalyticsMetadata,a.proxyUrl,a.options,S,C]);if(!x)return null;let T=_(N,{template:`Stepper`,channel:a.channel,scriptBaseUrl:a.proxyUrl,onError:a.onError,props:w});return _(p,{fallback:_(g,{}),children:a.container?a.container({survey:T}):T})}function R(s){let m=e({surveyId:s.surveyId,override:s.respondent}),h=o({publishableKey:s.publishableKey,apiBaseUrl:s.proxyUrl}),{isAvailable:y,isSettled:b}=r({client:h,surveyId:s.surveyId}),{state:x,isSettled:S}=t({client:h,surveyId:s.surveyId,respondent:m,enabled:i(s.isSurveyVisible)}),[C,w]=f(!1),T=b&&y&&S&&C&&n(x,s.isSurveyVisible),[E,O]=f(!1),[k,A]=f(!1),{onError:j,channel:M,proxyUrl:P}=s,F=d(j);l(()=>{F.current=j},[j]),l(()=>{if(!(b&&y))return;let e=!1;return D(M,P).then(()=>{e||w(!0)}).catch(e=>F.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[b,y,M,P]);let I=T&&E,L=c(()=>O(!0),[]),R=s.onFinished,z=u(()=>({surveyId:s.surveyId,publishableKey:s.publishableKey,respondent:m,locale:s.locale,metadata:s.metadata,autoInjectAnalyticsMetadata:s.autoInjectAnalyticsMetadata,apiBaseUrl:s.proxyUrl,telemetry:{version:`0.9.1`},isOpen:E,onFinished:e=>{A(!0),R?.(e)},onClose:()=>{O(!1)},onDismiss:()=>{O(!1)},options:s.options}),[s.surveyId,s.publishableKey,m,s.locale,s.metadata,s.autoInjectAnalyticsMetadata,s.proxyUrl,s.options,E,R]);return T?v(p,{fallback:_(g,{}),children:[s.trigger?s.trigger({onClick:L,isOpen:E,isSubmitted:k}):_(a,{onClick:L,isWidgetOpen:E}),I?_(N,{template:`TriggerPopover`,channel:s.channel,scriptBaseUrl:s.proxyUrl,onError:s.onError,props:z}):null]}):null}function z(e){return e.trim().split(`-`)[0]?.toLowerCase()??``}function B(e){return e.split(`,`).map(e=>{let[t,...n]=e.split(`;`),r=n.map(e=>e.trim()).find(e=>e.startsWith(`q=`)),i=r?Number(r.slice(2)):1;return{tag:z(t??``),quality:i}}).filter(({quality:e})=>e>0).sort((e,t)=>t.quality-e.quality)}function V(e,t){for(let{tag:n}of B(e)){let e=t.find(e=>e===n);if(e)return e}}function H({preferred:e,explicit:t,available:n=s,base:r=`en`}={}){let i=t??e;return(i?V(i,n):void 0)??r}function U(){if(!(typeof navigator>`u`))return navigator.languages.length>0?navigator.languages.join(`,`):navigator.language}const W=({preferred:e,explicit:t}={})=>H({preferred:e??U(),explicit:t,available:s,base:`en`});function G({surveyId:e,publishableKey:n,respondent:i,proxyUrl:a}){let s=o({publishableKey:n,apiBaseUrl:a}),{isAvailable:c,isSettled:l}=r({client:s,surveyId:e}),{state:u,isSettled:d}=t({client:s,surveyId:e,respondent:i});if(!i)return null;if(!(!l||!d))return c?{lastRespondedAt:u.lastRespondedAt?new Date(u.lastRespondedAt):null,lastDismissedAt:u.lastDismissedAt?new Date(u.lastDismissedAt):null}:null}const K=({delay:e})=>{let[t,n]=f(!1),r=u(()=>e,[]);return l(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},q=({visits:e,respondent:t})=>{let[n,r]=m(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},J=({visits:e,respondent:t})=>{let[n,r]=h(`cfti:${u(()=>window.location.pathname,[])}:visits:${t??``}`,0);return l(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:c(()=>r(0),[r])}},Y=({threshold:e})=>{let[t,n]=f(!1);return l(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return t(),window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{P as EmbeddedConfetti,F as ModalConfetti,I as PopoverConfetti,L as StepperConfetti,R as TriggerPopoverConfetti,W as useResolveLocale,G as useRespondentState,K as useVisibleAfterDelay,q as useVisibleAfterPageVisits,Y as useVisibleAfterScroll,J as useVisibleAfterSessionPageVisits};
@@ -1 +1 @@
1
- import"./src-D7lX72kz.js";import{z as e}from"zod";const t=e=>e.value,n=({answer:e,condition:n})=>{let r=t(n.value);switch(n.operator){case`equal`:return e===r;case`not-equal`:return e!==r;case`greater`:return typeof e==`number`&&typeof r==`number`&&e>r;case`greater-or-equal`:return typeof e==`number`&&typeof r==`number`&&e>=r;case`less`:return typeof e==`number`&&typeof r==`number`&&e<r;case`less-or-equal`:return typeof e==`number`&&typeof r==`number`&&e<=r;case`contains`:return Array.isArray(e)&&typeof r==`string`&&e.includes(r);case`not-contains`:return Array.isArray(e)&&typeof r==`string`&&!e.includes(r)}},r=({position:e,value:t})=>{switch(t.type){case`next`:return e+1;case`jump`:return t.target;case`end`:return null}},i=e=>e==null||Array.isArray(e)&&e.length===0,a=({position:e,question:t,answer:a})=>{let o=t.routingLogic;if(o.type===`always`)return r({position:e,value:o.target});if(i(a)&&t.required)return null;let s=i(a)?void 0:o.cases.find(e=>n({answer:a,condition:e}));return r(s?{position:e,value:s.target}:{position:e,value:o.default})},o=(e,t,{forceReachableIds:n}={})=>{let r=[...e].sort((e,t)=>e.position-t.position),i=new Set,o=new Set(n);for(let e=0;e<r.length;e++){let n=r[e];if(n){if(e===0||o.has(n.id)){i.add(n.id);continue}for(let o=0;o<e;o++){let s=r[o];if(!(!s||!i.has(s.id))&&a({position:o,question:s,answer:t[s.id]})===e){i.add(n.id);break}}}}return i},s=n,c=`cfti-mask`,l=`cfti-block`,u=`__confetti_bug_report_recording_event`,d=e.object({detail:e.object({isRecording:e.boolean()})});export{s as a,d as i,c as n,o,u as r,l as t};
1
+ import"./src-DG66KK2l.js";import{z as e}from"zod";const t=e=>e.value,n=({answer:e,condition:n})=>{let r=t(n.value);switch(n.operator){case`equal`:return e===r;case`not-equal`:return e!==r;case`greater`:return typeof e==`number`&&typeof r==`number`&&e>r;case`greater-or-equal`:return typeof e==`number`&&typeof r==`number`&&e>=r;case`less`:return typeof e==`number`&&typeof r==`number`&&e<r;case`less-or-equal`:return typeof e==`number`&&typeof r==`number`&&e<=r;case`contains`:return Array.isArray(e)&&typeof r==`string`&&e.includes(r);case`not-contains`:return Array.isArray(e)&&typeof r==`string`&&!e.includes(r)}},r=({position:e,value:t})=>{switch(t.type){case`next`:return e+1;case`jump`:return t.target;case`end`:return null}},i=e=>e==null||Array.isArray(e)&&e.length===0,a=({position:e,question:t,answer:a})=>{let o=t.routingLogic;if(o.type===`always`)return r({position:e,value:o.target});if(i(a)&&t.required)return null;let s=i(a)?void 0:o.cases.find(e=>n({answer:a,condition:e}));return r(s?{position:e,value:s.target}:{position:e,value:o.default})},o=(e,t,{forceReachableIds:n}={})=>{let r=[...e].sort((e,t)=>e.position-t.position),i=new Set,o=new Set(n);for(let e=0;e<r.length;e++){let n=r[e];if(n){if(e===0||o.has(n.id)){i.add(n.id);continue}for(let o=0;o<e;o++){let s=r[o];if(!(!s||!i.has(s.id))&&a({position:o,question:s,answer:t[s.id]})===e){i.add(n.id);break}}}}return i},s=n,c=`cfti-mask`,l=`cfti-block`,u=`__confetti_bug_report_recording_event`,d=e.object({detail:e.object({isRecording:e.boolean()})});export{s as a,d as i,c as n,o,u as r,l as t};
@@ -1,4 +1,4 @@
1
- import { i as RoutableAnswer, m as BinaryOperatorCondition } from "./index-BgEIWUUt.js";
1
+ import { i as RoutableAnswer, m as BinaryOperatorCondition } from "./index-DLqC_qk3.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/core/logic/routing.d.ts
@@ -1 +1 @@
1
- import{a as e,i as t,n,r,t as i}from"./internals-C8EZCPMe.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
1
+ import{a as e,i as t,n,r,t as i}from"./internals-DKNTeE-L.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=e.object({type:e.literal(`next`)}),n=e.object({type:e.literal(`end`)}),r=e.object({type:e.literal(`jump`),target:e.number({error:`Target question is required`})}),i=e.discriminatedUnion(`type`,[t,r,n]),a=e.object({type:e.literal(`value`),value:e.union([e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),e.number({error:`Value is required`})])}),o=e.object({type:e.literal(`binary-operator`),operator:e.union([e.literal(`equal`),e.literal(`not-equal`),e.literal(`greater`),e.literal(`greater-or-equal`),e.literal(`less`),e.literal(`less-or-equal`),e.literal(`contains`),e.literal(`not-contains`)]),value:a,target:i}),s=e.object({type:e.literal(`switch`),cases:e.array(o),default:i}),c=e.object({type:e.literal(`always`),target:i}),ee=e.discriminatedUnion(`type`,[c,s]),l=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),u=e.optional(e.string().check(e.trim(),e.maxLength(50))),d=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),label:e.optional(e.string()),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),f=e.array(d).check(e.superRefine((e,t)=>{let n=new Set;for(let r of e)if(r.translationId!==void 0){if(n.has(r.translationId)){t.addIssue({code:`custom`,message:`Option translation ids must be unique within a question`});return}n.add(r.translationId)}})),p=e.nullable(e.object({label:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),max:e.number(),description:e.optional(e.string().check(e.trim()))})),m=e.optional(e.boolean()),te=e.object({type:e.literal(`rating`),buttonLabel:u,shouldAutoProgress:m,scale:e.number().check(e.gte(2),e.lte(10)),labels:e.optional(e.object({lower:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e))),upper:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e)))})),display:e.optional(e.literal([`star`,`emoji`,`number`]))}),ne=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u,max:e.number()}),re=e.object({type:e.literal(`single-select`),shouldAutoProgress:m,options:f,buttonLabel:u,editable:p}),ie=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:f,editable:p,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),ae=e.object({type:e.literal(`statement`),buttonLabel:u,buttonUrl:e.optional(l)}),oe=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,enableScreenshot:e.boolean(),enableRecording:e.boolean(),detailsLabel:e.string().check(e.trim(),e.minLength(1,{error:`Label is required`}),e.maxLength(128)),detailsPlaceholder:e.optional(e.string()),redactClasses:e.optional(e.array(e.string()))}),se=e.discriminatedUnion(`type`,[te,re,ne,ie,ae,oe]),h=e=>e.trim()===``?void 0:e,g=e.string().transform(h).optional(),_=e.string().check(e.maxLength(50)).transform(h).optional(),ce=e.string().check(e.maxLength(128)).transform(h).optional(),v=e.object({label:g,description:g}),y=e.optional(e.object({label:g,description:g})),b=e.object({type:e.literal(`rating`),buttonLabel:_,labels:e.optional(e.object({lower:g,upper:g}))}),le=e.object({type:e.literal(`open-ended`),placeholder:g,buttonLabel:_}),ue=e.object({type:e.literal(`single-select`),buttonLabel:_,options:e.optional(e.record(e.string(),v)),editable:y}),de=e.object({type:e.literal(`multi-select`),buttonLabel:_,options:e.optional(e.record(e.string(),v)),editable:y}),fe=e.object({type:e.literal(`statement`),buttonLabel:_}),pe=e.object({type:e.literal(`bug-report`),placeholder:g,buttonLabel:_,detailsLabel:ce,detailsPlaceholder:g}),me=e.discriminatedUnion(`type`,[b,le,ue,de,fe,pe]),x=`__CONFETTI_CHECKBOX_Others`,S=`__CONFETTI_RADIO_Others`,he=e.url({protocol:/^https$/,hostname:/^(?:app\.datadoghq\.(?:com|eu)|(?:app\.)?(?:us3|us5|ap1|ap2|uk1)\.datadoghq\.com|app\.ddog-gov\.com|(?:app\.)?us2\.ddog-gov\.com)$/}),ge=e.optional(e.looseObject({userAgent:e.string().check(e.trim(),e.maxLength(1e3)),screenResolution:e.string().check(e.trim(),e.maxLength(100)),viewportSize:e.string().check(e.trim(),e.maxLength(100)),pageUrl:e.string(),pageTitle:e.string().check(e.trim(),e.maxLength(1e3)),referrer:e.string(),datadogTraceId:e.optional(e.string()),datadogSessionId:e.optional(e.string()),datadogSessionReplayLink:e.catch(e.optional(he),void 0)}).partial().catchall(e.optional(e.string())));e.cuid2();const C=e.looseObject({type:e.literal([0,1,2,3,4,5,6]),data:e.unknown(),timestamp:e.number(),delay:e.optional(e.number())});e.array(C);const w=e.array(C),T=e.string().check(e.refine(e=>{try{return w.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),E=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),D=t=>e.object({title:e.string().check(e.trim(),...t?[e.minLength(1,{error:`Title is required`})]:[],e.maxLength(256)),description:e.optional(e.string().check(e.trim(),e.maxLength(4096))),screenshotDataUrl:e.optional(E),recordingEventsJson:e.optional(T),metadata:ge});D(!0);const O=D(!1),k=(e,{required:t})=>D(t),A=e=>{if(!e)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0}catch{return!1}},j=e=>!e.title.trim()&&!e.description?.trim()&&!e.screenshotDataUrl&&!A(e.recordingEventsJson),M=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),N=({scale:t},{required:n})=>{let r=M(t);return n?r:e.optional(r)},P=({maxLength:t},{required:n})=>e.string().check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),F=(t,n)=>e.string({error:`Please select an option`}).check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==S,{error:`Please fill out the free text field`})),I=({maxLength:t},{required:n})=>{let r=F(t,n);return n?r:e.optional(r)},L=({maxSelected:t,maxLength:n},{required:r})=>e.array(e.string().check(e.trim(),...r?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(n??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==x,{error:`Please fill out the free text field`}))).check(...r?[e.minLength(1,{error:`Please select at least one option`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),_e=()=>e.optional(e.string()),R=[`en`,`zh`,`ms`,`ta`],z=e.enum(R),B=e.cuid2(),ve=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),V=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:se,routingLogic:ee}),ye=e.object({title:g,description:g,backButtonLabel:_,confirmation:e.optional(e.object({title:g,description:g,buttonText:g}))});e.partialRecord(z,ye);const be=e.object({title:g,description:g,properties:e.optional(me)});e.partialRecord(z,be);const xe=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(V),confirmation:ve,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({locale:e.optional(z)}),e.object({cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const H=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),status:e.enum([`active`,`inactive`]),createdAt:e.date(),updatedAt:e.date()});e.object({data:e.array(H),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:B});const Se=V;e.object({data:e.object({...H.shape,questions:e.array(Se)})}),e.object({surveyId:B,responseId:e.union([e.cuid2(),e.uuid()])});const Ce=e.catch(e.object({type:e.enum([`embedded`,`popover`,`modal`]),version:e.string().check(e.trim(),e.minLength(1),e.maxLength(50)),build:e.string().check(e.trim(),e.minLength(1),e.maxLength(50))}).partial(),{}),U=e.record(e.string(),e.union([e.string().check(e.trim(),e.maxLength(2048)),e.number(),e.array(e.string().check(e.trim(),e.maxLength(2048))).check(e.maxLength(1024)),O])),W=1e3,G=e.string().check(e.trim(),e.maxLength(W)),we=e.record(G,G),K=e.string().trim().min(1).max(W),q=e.discriminatedUnion(`code`,[e.object({code:e.literal(`metadata_value_truncated`),key:K}).strict(),e.object({code:e.literal(`metadata_value_invalid`),key:K}).strict(),e.object({code:e.literal(`metadata_key_invalid`),position:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_key_duplicate`),key:K}).strict(),e.object({code:e.literal(`metadata_entry_limit`),droppedCount:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_container_invalid`)}).strict(),e.object({code:e.literal(`metadata_warning_details_omitted`),count:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_warning_report_invalid`)}).strict()]),Te=e.object({metadata:e.array(q).min(1).max(20)}).strict(),Ee=e.object({metadata:e.array(q).min(1)}).strict(),J=(e,t)=>Math.min(2**53-1,e+t),Y=e=>{let t=[],n=0;for(let r of e)r.code===`metadata_warning_details_omitted`?n=J(n,r.count):t.push(r);let r=n>0||t.length>20?19:20,i=t.slice(0,r);return n=J(n,t.length-i.length),n>0?[...i,{code:`metadata_warning_details_omitted`,count:n}]:i},De=e=>{let t=Y(e);return t.length>0?{metadata:t}:void 0},Oe=e=>{if(e===void 0)return[];let t=Ee.safeParse(e);return t.success?Y(t.data.metadata):[{code:`metadata_warning_report_invalid`}]},ke=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Reflect.getPrototypeOf(e);return t===Object.prototype||t===null},Ae=e=>{if(e===void 0)return{metadata:{},warnings:[]};if(!ke(e))return{metadata:{},warnings:[{code:`metadata_container_invalid`}]};let t=new Map,n=[],r=0;for(let[i,[a,o]]of Object.entries(e).entries()){let e=a.trim();if(e.length===0||e.length>1e3){n.push({code:`metadata_key_invalid`,position:i+1});continue}if(typeof o!=`string`){n.push({code:`metadata_value_invalid`,key:e});continue}if(t.has(e)){n.push({code:`metadata_key_duplicate`,key:e});continue}if(t.size>=20){r+=1;continue}let s=o.trim(),c=s.length>1e3?`${s.slice(0,W-11)}[truncated]`:s;c!==s&&n.push({code:`metadata_value_truncated`,key:e}),t.set(e,c)}return r>0&&n.push({code:`metadata_entry_limit`,droppedCount:r}),{metadata:Object.fromEntries(t),warnings:Y(n)}},X=({metadata:e,warnings:t})=>{let n=Ae(e);return{metadata:n.metadata,warnings:De([...n.warnings,...Oe(t)])}};we.check(e.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`)),e.object({respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048)),data:U,metadata:e.unknown().optional(),warnings:e.unknown().optional(),telemetry:e.optional(Ce)}).transform(e=>{let{metadata:t,warnings:n,...r}=e,{metadata:i,warnings:a}=X({metadata:t,warnings:n});return{...r,metadata:i,...a&&{warnings:a}}});const je=e.object({id:e.string(),createdAt:e.date(),warnings:e.optional(Te)});e.object({surveyId:B,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:B,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:B});const Me=e.object({lastRespondedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastViewedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastDismissedAt:e.nullable(e.union([e.iso.datetime(),e.date()]))});e.object({type:e.enum([`view`,`dismiss`])}),e.object({}),e.object({surveyId:B}),e.object({respondent:e.optional(e.string().check(e.trim(),e.minLength(1),e.maxLength(255))),after:e.optional(e.iso.datetime({offset:!0,local:!0})),before:e.optional(e.iso.datetime({offset:!0,local:!0})),cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const Z=e.object({id:e.string(),respondent:e.string(),data:U,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(Z),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})});const Q=e.number().check(e.int(),e.gte(0));e.object({data:e.object({totalViews:Q,uniqueViewers:Q,totalDismissals:Q,uniqueDismissers:Q,totalResponses:Q,uniqueResponders:Q})}),e.object({questionIds:e.array(e.string()).check(e.minLength(1)),timeRange:e.union([e.enum([`last-7-days`,`last-30-days`]),e.string().check(e.regex(/^q[1-4]-\d{4}$/)),e.string().check(e.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const $=e.record(e.string(),e.record(e.string(),e.number()));e.object({data:e.object({current:$,previousQuarter:e.nullable($)})});export{R as a,L as c,I as d,_e as f,l as h,xe as i,P as l,S as m,je as n,k as o,x as p,X as r,j as s,Me as t,N as u};
package/build/static.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { r as Locale, t as PublicPutResponseOutput } from "./index-BgEIWUUt.js";
2
- import { A as WithProxyable, D as OptionallyDismissable, S as ConfettiContainer, T as Dismissable, d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-B1RcqeaN.js";
1
+ import { r as Locale, t as PublicPutResponseOutput } from "./index-DLqC_qk3.js";
2
+ import { A as WithProxyable, D as OptionallyDismissable, S as ConfettiContainer, T as Dismissable, d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-Ch8bCyn_.js";
3
3
 
4
4
  //#region src/templates/EmbeddedConfettiContent.d.ts
5
5
  interface EmbeddedConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
package/build/static.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{f as t,m as n,t as r}from"./ModalContainer-CftztDnr.js";import{a as i,d as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f}from"./Embed-DP5SVLPA.js";import{useState as p}from"react";import{ErrorBoundary as m}from"react-error-boundary";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=({onClose:e,locale:r,...a})=>g(m,{fallback:g(h,{}),children:g(n,{type:`embedded`,children:g(t,{...a,locale:r,children:g(o,{...a,shouldAutoSubmit:!1,locale:r,children:({questions:t,update:n,submit:o,isSubmitted:c,errors:l,answers:u})=>c?g(s,{onClose:e,locale:r}):g(f,{onSubmit:o,locale:r,children:t.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:u[e.id]??void 0,error:l[e.id]||``,maskAllInputs:a.options?.bugReport?.maskAllInputs,locale:r,onChange:t=>n({question:e.position,answer:t})},e.id))})})})})}),y=e=>{let{respondent:t}=c();return g(v,{...e,respondent:t})};function b(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(y,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const x=({onDismiss:e,onClose:a,onFinished:c,closeOnFinishMs:l,isDismissable:u,locale:d,...p})=>g(m,{fallback:g(h,{}),children:g(n,{type:`modal`,children:g(t,{...p,locale:d,children:g(r,{onDismiss:e,onClose:a,closeOnFinishMs:l,isDismissable:u,locale:d,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...p,shouldAutoSubmit:!1,locale:d,onSubmitted:()=>e(),onFinished:e=>{t(),c?.(e)},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o,answers:c})=>o?g(s,{onClose:a,locale:d}):g(f,{onSubmit:r,locale:d,children:e.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:c[e.id]??void 0,error:n[e.id]||``,maskAllInputs:p.options?.bugReport?.maskAllInputs,locale:d,onChange:n=>t({question:e.position,answer:n})},e.id))})})})})})}),S=e=>{let{respondent:t}=c();return g(x,{...e,respondent:t})};function C(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(S,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const w=({onDismiss:e,onClose:r,onFinished:c,closeOnFinishMs:u,locale:f,...p})=>g(m,{fallback:g(h,{}),children:g(n,{type:`popover`,children:g(t,{...p,locale:f,children:g(a,{onDismiss:e,onClose:r,closeOnFinishMs:u,locale:f,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...p,shouldAutoSubmit:!0,locale:f,onSubmitted:()=>e(),onFinished:e=>{t(),c?.(e)},children:({current:e,questions:t,answers:n,update:a,back:o,canGoBack:c,backButtonLabel:u,saveAnswer:m,isSubmitted:_})=>{let v=e===t.length-1;if(_)return g(s,{onClose:r,locale:f});let y=t[e];return y?g(l,{isLastQuestion:v,question:y,defaultAnswer:n[y.id]??void 0,backButton:c?g(d,{onPress:o,locale:f,children:u}):void 0,locale:f,saveAnswer:e=>m(y.id,e),onSubmit:t=>a({question:e,answer:t}),children:e=>g(i,{maskAllInputs:p.options?.bugReport?.maskAllInputs,locale:f,...e})},y.id):g(h,{})}})})})})}),T=e=>{let{respondent:t}=c();return g(w,{...e,respondent:t})};function E(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(T,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const D=({onClose:e,locale:n,...r})=>g(m,{fallback:g(h,{}),children:g(t,{...r,locale:n,children:g(o,{...r,shouldAutoSubmit:!0,locale:n,children:({current:t,questions:a,answers:o,update:c,back:u,canGoBack:f,backButtonLabel:p,saveAnswer:m,isSubmitted:_})=>{let v=t===a.length-1;if(_)return g(s,{onClose:e,locale:n});let y=a[t];return y?g(l,{isLastQuestion:v,question:y,defaultAnswer:o[y.id]??void 0,backButton:f?g(d,{onPress:u,locale:n,children:p}):void 0,locale:n,saveAnswer:e=>m(y.id,e),onSubmit:e=>c({question:t,answer:e}),children:e=>g(i,{maskAllInputs:r.options?.bugReport?.maskAllInputs,locale:n,...e})},y.id):g(h,{})}})})}),O=e=>{let{respondent:t}=c();return g(D,{...e,respondent:t})};function k(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(O,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const A=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=p(!1),[o,s]=p(!1);return _(h,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:e=>{s(!0),n?.(e)},onClose:()=>a(!1)})]})},j=({trigger:t=t=>g(e,{...t}),children:n,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,proxyUrl:s,...c})=>g(m,{fallback:g(h,{}),children:g(u,{...c,apiBaseUrl:s,children:g(A,{trigger:t,surveyId:c.surveyId,publishableKey:c.publishableKey,proxyUrl:s,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,children:n})})});export{j as ConfettiTrigger,b as EmbeddedConfetti,C as ModalConfetti,E as PopoverConfetti,k as StepperConfetti};
1
+ import{t as e}from"./DefaultConfettiTrigger-iGndzjo2.js";import{f as t,m as n,t as r}from"./ModalContainer-kQ-gmZ0r.js";import{a as i,d as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f}from"./Embed-Ci53s3wI.js";import{useState as p}from"react";import{ErrorBoundary as m}from"react-error-boundary";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=({onClose:e,locale:r,...a})=>g(m,{fallback:g(h,{}),children:g(n,{type:`embedded`,children:g(t,{...a,locale:r,children:g(o,{...a,shouldAutoSubmit:!1,locale:r,children:({questions:t,update:n,submit:o,isSubmitted:c,errors:l,answers:u})=>c?g(s,{onClose:e,locale:r}):g(f,{onSubmit:o,locale:r,children:t.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:u[e.id]??void 0,error:l[e.id]||``,maskAllInputs:a.options?.bugReport?.maskAllInputs,locale:r,onChange:t=>n({question:e.position,answer:t})},e.id))})})})})}),y=e=>{let{respondent:t}=c();return g(v,{...e,respondent:t})};function b(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(y,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const x=({onDismiss:e,onClose:a,onFinished:c,closeOnFinishMs:l,isDismissable:u,locale:d,...p})=>g(m,{fallback:g(h,{}),children:g(n,{type:`modal`,children:g(t,{...p,locale:d,children:g(r,{onDismiss:e,onClose:a,closeOnFinishMs:l,isDismissable:u,locale:d,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...p,shouldAutoSubmit:!1,locale:d,onSubmitted:()=>e(),onFinished:e=>{t(),c?.(e)},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o,answers:c})=>o?g(s,{onClose:a,locale:d}):g(f,{onSubmit:r,locale:d,children:e.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,defaultAnswer:c[e.id]??void 0,error:n[e.id]||``,maskAllInputs:p.options?.bugReport?.maskAllInputs,locale:d,onChange:n=>t({question:e.position,answer:n})},e.id))})})})})})}),S=e=>{let{respondent:t}=c();return g(x,{...e,respondent:t})};function C(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(S,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const w=({onDismiss:e,onClose:r,onFinished:c,closeOnFinishMs:u,locale:f,...p})=>g(m,{fallback:g(h,{}),children:g(n,{type:`popover`,children:g(t,{...p,locale:f,children:g(a,{onDismiss:e,onClose:r,closeOnFinishMs:u,locale:f,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...p,shouldAutoSubmit:!0,locale:f,onSubmitted:()=>e(),onFinished:e=>{t(),c?.(e)},children:({current:e,questions:t,answers:n,update:a,back:o,canGoBack:c,backButtonLabel:u,saveAnswer:m,isSubmitted:_})=>{let v=e===t.length-1;if(_)return g(s,{onClose:r,locale:f});let y=t[e];return y?g(l,{isLastQuestion:v,question:y,defaultAnswer:n[y.id]??void 0,backButton:c?g(d,{onPress:o,locale:f,children:u}):void 0,locale:f,saveAnswer:e=>m(y.id,e),onSubmit:t=>a({question:e,answer:t}),children:e=>g(i,{maskAllInputs:p.options?.bugReport?.maskAllInputs,locale:f,...e})},y.id):g(h,{})}})})})})}),T=e=>{let{respondent:t}=c();return g(w,{...e,respondent:t})};function E(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(T,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const D=({onClose:e,locale:n,...r})=>g(m,{fallback:g(h,{}),children:g(t,{...r,locale:n,children:g(o,{...r,shouldAutoSubmit:!0,locale:n,children:({current:t,questions:a,answers:o,update:c,back:u,canGoBack:f,backButtonLabel:p,saveAnswer:m,isSubmitted:_})=>{let v=t===a.length-1;if(_)return g(s,{onClose:e,locale:n});let y=a[t];return y?g(l,{isLastQuestion:v,question:y,defaultAnswer:o[y.id]??void 0,backButton:f?g(d,{onPress:u,locale:n,children:p}):void 0,locale:n,saveAnswer:e=>m(y.id,e),onSubmit:e=>c({question:t,answer:e}),children:e=>g(i,{maskAllInputs:r.options?.bugReport?.maskAllInputs,locale:n,...e})},y.id):g(h,{})}})})}),O=e=>{let{respondent:t}=c();return g(D,{...e,respondent:t})};function k(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(O,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const A=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=p(!1),[o,s]=p(!1);return _(h,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:e=>{s(!0),n?.(e)},onClose:()=>a(!1)})]})},j=({trigger:t=t=>g(e,{...t}),children:n,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,proxyUrl:s,...c})=>g(m,{fallback:g(h,{}),children:g(u,{...c,apiBaseUrl:s,children:g(A,{trigger:t,surveyId:c.surveyId,publishableKey:c.publishableKey,proxyUrl:s,metadata:r,autoInjectAnalyticsMetadata:i,options:a,onFinished:o,children:n})})});export{j as ConfettiTrigger,b as EmbeddedConfetti,C as ModalConfetti,E as PopoverConfetti,k as StepperConfetti};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/confetti",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "sideEffects": false,
5
5
  "description": "Widgets for Confetti",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -83,19 +83,19 @@
83
83
  "@rrweb/types": "2.0.0-alpha.20",
84
84
  "@types/node": "24.10.8",
85
85
  "@types/react": "^19.2.18",
86
- "@types/react-dom": "^19.2.4",
87
- "@vitest/coverage-v8": "4.1.8",
86
+ "@types/react-dom": "^19.2.5",
87
+ "@vitest/coverage-v8": "4.1.11",
88
88
  "dotenv-cli": "^11.0.0",
89
89
  "esbuild": "^0.28.1",
90
- "postcss": "^8.5.25",
90
+ "postcss": "^8.5.28",
91
91
  "postcss-cli": "^11.0.1",
92
- "postcss-preset-env": "^11.2.1",
92
+ "postcss-preset-env": "^11.5.2",
93
93
  "react-aria-components": "1.16.0",
94
94
  "tsdown": "0.22.1",
95
95
  "typescript": "^7.0.2",
96
- "@confetti/common": "0.0.0",
96
+ "@confetti/tsconfig": "0.0.0",
97
97
  "@confetti/validators": "0.0.0",
98
- "@confetti/tsconfig": "0.0.0"
98
+ "@confetti/common": "0.0.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build:css": "postcss ./src/confetti.css -o ./build/confetti.css",
@@ -1,7 +0,0 @@
1
- import e,{createContext as t,forwardRef as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"ky";import u from"clsx";import"react-dom";const d=l.create({prefixUrl:`https://confetti.gov.sg`,retry:{limit:3,methods:[`get`,`head`]},timeout:6e4});function f({publishableKey:e,apiBaseUrl:t}){return o(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),d.extend(n)},[t,e])}function p(e){if(typeof window>`u`||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function m(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function h(e){let t=null;return()=>(t??=e(),t)}const g=h(function(){return m(/^Mac/i)}),_=h(function(){return m(/^iPhone/i)}),v=h(function(){return m(/^iPad/i)||g()&&navigator.maxTouchPoints>1}),y=h(function(){return _()||v()}),b=h(function(){return p(/AppleWebKit/i)&&!ee()}),ee=h(function(){return p(/Chrome/i)}),x=h(function(){return p(/Android/i)}),S=h(function(){return p(/Firefox/i)});function C(e){if(T())e.focus({preventScroll:!0});else{let t=E(e);e.focus(),D(t)}}let w=null;function T(){if(w==null){w=!1;try{document.createElement(`div`).focus({get preventScroll(){return w=!0,!0}})}catch{}}return w}function E(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function D(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function O(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;S()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(g()?r=!0:i=!0);let s=b()&&g()&&!v()?new KeyboardEvent(`keydown`,{keyIdentifier:`Enter`,metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}):new MouseEvent(`click`,{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o,detail:1,bubbles:!0,cancelable:!0});O.isOpening=n,C(e),e.dispatchEvent(s),O.isOpening=!1}O.isOpening=!1;const k=typeof document<`u`?e.useLayoutEffect:()=>{},A={prefix:String(Math.round(Math.random()*1e10)),current:0},j=e.createContext(A),te=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let M=new WeakMap;function ne(t=!1){let n=i(j),r=s(null);if(r.current===null&&!t){let t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(t){let e=M.get(t);e==null?M.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,M.delete(t))}r.current=++n.current}return r.current}function re(e){let t=i(j),n=ne(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function ie(t){let n=e.useId(),[r]=c(le()),i=r?`react-aria`:`react-aria${A.prefix}`;return t||`${i}-${n}`}const ae=typeof e.useId==`function`?ie:re;function oe(){return!1}function se(){return!0}function ce(e){return()=>{}}function le(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore(ce,oe,se):i(te)}function ue(e){let[t,n]=c(e),i=s(t),a=s(null),o=s(()=>{if(!a.current)return;let e=a.current.next();if(e.done){a.current=null;return}i.current===e.value?o.current():n(e.value)});return k(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let de=!!(typeof window<`u`&&window.document&&window.document.createElement),N=new Map,P;typeof FinalizationRegistry<`u`&&(P=new FinalizationRegistry(e=>{N.delete(e)}));function fe(e){let[t,n]=c(e),r=s(null),i=ae(t),o=s(null);if(P&&P.register(o,i),de){let e=N.get(i);e&&!e.includes(r)?e.push(r):N.set(i,[r])}return k(()=>{let e=i;return()=>{P&&P.unregister(o),N.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function pe(e,t){if(e===t)return e;let n=N.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=N.get(t);return r?(r.forEach(t=>t.current=e),e):t}function me(e=[]){let t=fe(),[n,i]=ue(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return k(a,[t,a,...e]),n}function he(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const F=e=>e?.ownerDocument??document,I=e=>e&&`window`in e&&e.window===e?e:F(e).defaultView||window;function ge(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function _e(e){return ge(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function L(){return!1}function R(e,t){if(!L())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n=n.tagName===`SLOT`&&n.assignedSlot?n.assignedSlot.parentNode:_e(n)?n.host:n.parentNode}return!1}const z=(e=document)=>{if(!L())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function B(e){if(L()&&e.target instanceof Element&&e.target.shadowRoot){if(`composedPath`in e)return e.composedPath()[0]??null;if(`composedPath`in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function ve(e){if(!e)return!1;let t=e.getRootNode(),n=I(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}function ye(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=be(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():be(e[n],null)})}}}function be(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function V(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=he(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=u(n,i):e===`id`&&n&&i?t.id=pe(n,i):e===`ref`&&n&&i?t.ref=ye(n,i):t[e]=i===void 0?n:i}}return t}const xe=new Set([`id`]),Se=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Ce=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),we=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Te=new Set(`onClick.onAuxClick.onContextMenu.onDoubleClick.onMouseDown.onMouseEnter.onMouseLeave.onMouseMove.onMouseOut.onMouseOver.onMouseUp.onTouchCancel.onTouchEnd.onTouchMove.onTouchStart.onPointerDown.onPointerMove.onPointerUp.onPointerCancel.onPointerEnter.onPointerLeave.onPointerOver.onPointerOut.onGotPointerCapture.onLostPointerCapture.onScroll.onWheel.onAnimationStart.onAnimationEnd.onAnimationIteration.onTransitionCancel.onTransitionEnd.onTransitionRun.onTransitionStart`.split(`.`)),Ee=/^(data-.*)$/;function De(e,t={}){let{labelable:n,isLink:r,global:i,events:a=i,propNames:o}=t,s={};for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(xe.has(t)||n&&Se.has(t)||r&&Ce.has(t)||i&&we.has(t)||a&&(Te.has(t)||t.endsWith(`Capture`)&&Te.has(t.slice(0,-7)))||o?.has(t)||Ee.test(t))&&(s[t]=e[t]);return s}let H=new Map,Oe=new Set;function ke(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=B(t);if(!e(t)||!r)return;let i=H.get(r);i||(i=new Set,H.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=B(t);if(!e(t)||!r)return;let i=H.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),H.delete(r)),H.size===0)){for(let e of Oe)e();Oe.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,ke):ke());function Ae(){for(let[e]of H)`isConnected`in e&&!e.isConnected&&H.delete(e)}function je(e){requestAnimationFrame(()=>{Ae(),H.size===0?e():Oe.add(e)})}function Me(){let e=s(new Map),t=r((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=r((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),i=r(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a(()=>i,[i]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:i}}function Ne(e){let t=s(null),n=s(void 0),i=r(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}else if(e)return e.current=t,()=>{e.current=null}},[e]);return o(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=i(e))}}),[i])}const Pe=e.useInsertionEffect??k;function U(e){let t=s(null);return Pe(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}function Fe(e,t){k(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Ie(e){return e.pointerType===``&&e.isTrusted?!0:x()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Le(e){return!x()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}const Re=typeof Element<`u`&&`checkVisibility`in Element.prototype;function ze(e){let t=I(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function Be(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function Ve(e,t){return Re?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&ze(e)&&Be(e,t)&&(!e.parentElement||Ve(e.parentElement,e))}const He=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]:not([contenteditable^="false"])`,`permission`],Ue=He.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;He.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const We=He.join(`:not([hidden]):not([tabindex="-1"]),`);function Ge(e,t){return e.matches(Ue)&&!qe(e)&&(t?.skipVisibilityCheck||Ve(e))}function Ke(e){return e.matches(We)&&Ve(e)&&!qe(e)}function qe(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Je(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let Ye=new WeakMap;function Xe(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Je(t);if(Ye.has(t))return Ye.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof I(n).HTMLMetaElement&&(n.nonce||n.content)||Je(t)||void 0;return r!==void 0&&Ye.set(t,r),r}const Ze=Symbol(`default`);function Qe({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function $e(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:s,values:c,render:l}=e;return o(()=>{let e,o,u;return e=typeof t==`function`?t({...c,defaultClassName:i}):t,o=typeof n==`function`?n({...c,defaultStyle:s||{}}):n,u=typeof r==`function`?r({...c,defaultChildren:a}):r??a,{className:e??i,style:o||s?{...s,...o}:void 0,children:u??a,"data-rac":``,render:l?e=>l(e,c):void 0}},[t,n,r,i,a,s,c,l])}function et(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function tt(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Ze;if(!n.slots[e]){let e=new Intl.ListFormat().format(Object.keys(n.slots).map(e=>`"${e}"`)),r=t?`Invalid slot "${t}".`:`A slot prop is required.`;throw Error(`${r} Valid slot names are ${e}.`)}return n.slots[e]}return n}function nt(e,t,n){let{ref:r,...i}=tt(n,e.slot)||{},a=Ne(o(()=>ye(t,r),[t,r])),s=V(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?s.style=t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:s.style={...i.style,...e.style}),[s,a]}function rt(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return k(()=>{i.current||n(!1)},[]),[a,t]}function it(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function at(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>ye(r,c),[r,c]);k(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const ot={},st=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=ot[t];return r||(r=n(at.bind(null,t)),ot[t]=r),r}});function ct(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function lt(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function ut(e){let t=s({isFocused:!1,observer:null});return k(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=B(n);if(r instanceof HTMLButtonElement||r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){t.current.isFocused=!0;let n=r;n.addEventListener(`focusout`,r=>{if(t.current.isFocused=!1,n.disabled){let t=ct(r);e?.(t)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)},{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&n.disabled){t.current.observer?.disconnect();let e=n===z()?null:z();n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:e})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:e}))}}),t.current.observer.observe(n,{attributes:!0,attributeFilter:[`disabled`]})}},[e])}let W=!1;function dt(e){for(;e&&!Ge(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=I(e),n=t.document.activeElement;if(!n||n===e)return;W=!0;let r=!1,i=e=>{(B(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(B(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,C(n),c()))},o=t=>{(B(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(B(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,C(n),c()))};t.addEventListener(`blur`,i,!0),t.addEventListener(`focusout`,a,!0),t.addEventListener(`focusin`,s,!0),t.addEventListener(`focus`,o,!0);let c=()=>{cancelAnimationFrame(l),t.removeEventListener(`blur`,i,!0),t.removeEventListener(`focusout`,a,!0),t.removeEventListener(`focusin`,s,!0),t.removeEventListener(`focus`,o,!0),W=!1,r=!1},l=requestAnimationFrame(c);return c}let G=`default`,ft=``,K=new WeakMap;function pt(e){if(y()){if(G==="default"){let t=F(e);ft=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}G=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;K.set(e,e.style[t]),e.style[t]=`none`}}function mt(e){if(y()){if(G!==`disabled`)return;G=`restoring`,setTimeout(()=>{je(()=>{if(G===`restoring`){let t=F(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=ft||``),ft=``,G=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&K.has(e)){let t=K.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),K.delete(e)}}const ht=e.createContext({register:()=>{}});ht.displayName=`PressResponderContext`;function gt(e){let t=i(ht);if(t){let{register:n,ref:r,...i}=t;e=V(i,e),n()}return Fe(t,e.ref),e}var q=class{#e;constructor(e,t,n,r){this.#e=!0;let i=(r?.target??n.currentTarget)?.getBoundingClientRect(),a,o=0,s,c=null;n.clientX!=null&&n.clientY!=null&&(s=n.clientX,c=n.clientY),i&&(s!=null&&c!=null?(a=s-i.left,o=c-i.top):(a=i.width/2,o=i.height/2)),this.type=e,this.pointerType=t,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.x=a,this.y=o,this.key=n.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}};const _t=Symbol(`linkClicked`),vt=`react-aria-pressable-style`,yt=`data-react-aria-pressable`;function bt(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:_,ref:v,...y}=gt(e),[b,ee]=c(!1),x=s({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:w}=Me(),T=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new q(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,ee(!0),a},[f,i,n]),E=r((e,r,i=!0)=>{let a=x.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let o=!0;if(l){let t=new q(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),ee(!1),t&&i&&!f){let n=new q(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),D=U(E),k=U(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new q(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),A=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&E(J(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,w(),_||mt(t.target);for(let e of t.disposables)e();t.disposables=[]}},[_,w,E]),j=U(A),te=r(e=>{h&&A(e)},[h,A]),M=r(e=>{f||d?.(e)},[f,d]),ne=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);lt(n,t),d(ct(n))}},[f,d]),re=o(()=>{let e=x.current,t={onKeyDown(t){if(St(t.nativeEvent,t.currentTarget)&&R(t.currentTarget,B(t))){wt(B(t),t.key)&&t.preventDefault();let r=!0;!e.isPressed&&!t.repeat&&(e.target=t.currentTarget,e.isPressed=!0,e.pointerType=`keyboard`,r=T(t,`keyboard`));let i=t.currentTarget;S(F(t.currentTarget),`keyup`,he(t=>{St(t,i)&&!t.repeat&&R(i,B(t))&&e.target&&k(J(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&g()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!R(t.currentTarget,B(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!O.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Ie(t.nativeEvent))){let e=T(t,`virtual`),r=k(t,`virtual`),i=D(t,`virtual`);M(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=k(J(t.currentTarget,t),r),a=D(J(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,M(t),j(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&St(t,e.target)){wt(B(t),t.key)&&t.preventDefault();let n=B(t),r=R(e.target,n);D(J(e.target,t),`keyboard`,r),r&&ne(t,e.target),w(),t.key!==`Enter`&&xt(e.target)&&R(e.target,n)&&!t[_t]&&(t[_t]=!0,O(e.target,t,!1)),e.isPressed=!1,e.metaKeyEvents?.delete(t.key)}else if(t.key===`Meta`&&e.metaKeyEvents?.size){let t=e.metaKeyEvents;e.metaKeyEvents=void 0;for(let n of t.values())e.target?.dispatchEvent(new KeyboardEvent(`keyup`,n))}};if(typeof PointerEvent<`u`){t.onPointerDown=t=>{if(t.button!==0||!R(t.currentTarget,B(t)))return;if(Le(t.nativeEvent)){e.pointerType=`virtual`;return}e.pointerType=t.pointerType;let i=!0;if(!e.isPressed){e.isPressed=!0,e.isOverTarget=!0,e.activePointerId=t.pointerId,e.target=t.currentTarget,_||pt(e.target),i=T(t,e.pointerType);let a=B(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(F(t.currentTarget),`pointerup`,n,!1),S(F(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(R(t.currentTarget,B(t))&&t.button===0){if(m){let n=dt(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!R(t.currentTarget,B(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&k(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,T(J(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,D(J(e.target,t),e.pointerType,!1),te(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(R(e.target,B(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?j(t):(C(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else j(t);e.isOverTarget=!1}},r=e=>{j(e)};t.onDragStart=e=>{R(e.currentTarget,B(e))&&j(e)}}return t},[S,f,m,w,_,te,T,M,ne]);return a(()=>{if(!v)return;let e=F(v.current);if(!e||!e.head||e.getElementById(vt))return;let t=e.createElement(`style`);t.id=vt;let n=Xe(e);n&&(t.nonce=n),t.textContent=`
2
- @layer {
3
- [${yt}] {
4
- touch-action: pan-x pan-y pinch-zoom;
5
- }
6
- }
7
- `.trim(),e.head.prepend(t)},[v]),a(()=>{let e=x.current;return()=>{_||mt(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[_]),{isPressed:p||b,pressProps:V(y,re,{[yt]:!0})}}function xt(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function St(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof I(i).HTMLInputElement&&!Et(i,n)||i instanceof I(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&xt(i))&&n!==`Enter`)}function J(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function Ct(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!xt(e)}function wt(e,t){return e instanceof HTMLInputElement?!Et(e,t):Ct(e)}const Tt=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Et(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Tt.has(e.type)}let Y=null;const Dt=new Set;let X=new Map,Z=!1,Ot=!1;const kt={Tab:!0,Escape:!0};function At(e,t){for(let n of Dt)n(e,t)}function jt(e){return!(e.metaKey||!g()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Mt(e){Z=!0,!O.isOpening&&jt(e)&&(Y=`keyboard`,At(`keyboard`,e))}function Q(e){Y=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(Z=!0,At(`pointer`,e))}function Nt(e){!O.isOpening&&Ie(e)&&(Z=!0,Y=`virtual`)}function Pt(e){let t=I(B(e)),n=F(B(e));B(e)===t||B(e)===n||W||!e.isTrusted||(!Z&&!Ot&&(Y=`virtual`,At(`virtual`,e)),Z=!1,Ot=!1)}function Ft(){W||(Z=!1,Ot=!0)}function It(e){if(typeof window>`u`||typeof document>`u`)return;let t=I(e),n=F(e);if(X.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){Z=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Mt,!0),n.addEventListener(`keyup`,Mt,!0),n.addEventListener(`click`,Nt,!0),t.addEventListener(`focus`,Pt,!0),t.addEventListener(`blur`,Ft,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Q,!0),n.addEventListener(`pointermove`,Q,!0),n.addEventListener(`pointerup`,Q,!0)),t.addEventListener(`beforeunload`,()=>{Lt(e)},{once:!0}),X.set(t,{focus:r})}const Lt=(e,t)=>{let n=I(e),r=F(e);t&&r.removeEventListener(`DOMContentLoaded`,t),X.has(n)&&(n.HTMLElement.prototype.focus=X.get(n).focus,r.removeEventListener(`keydown`,Mt,!0),r.removeEventListener(`keyup`,Mt,!0),r.removeEventListener(`click`,Nt,!0),n.removeEventListener(`focus`,Pt,!0),n.removeEventListener(`blur`,Ft,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Q,!0),r.removeEventListener(`pointermove`,Q,!0),r.removeEventListener(`pointerup`,Q,!0)),X.delete(n))};function Rt(e){let t=F(e),n;return t.readyState===`loading`?(n=()=>{It(e)},t.addEventListener(`DOMContentLoaded`,n)):It(e),()=>Lt(e,n)}typeof document<`u`&&Rt();function zt(){return Y!==`pointer`}function Bt(){return Y}function Vt(e){Y=e,At(e,null)}const Ht=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Ut(e,t,n){let r=n?B(n):void 0,i=F(r),a=I(r),o=a===void 0?HTMLInputElement:a.HTMLInputElement,s=a===void 0?HTMLTextAreaElement:a.HTMLTextAreaElement,c=a===void 0?HTMLElement:a.HTMLElement,l=a===void 0?KeyboardEvent:a.KeyboardEvent,u=z(i);return e=e||u instanceof o&&!Ht.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!kt[n.key])}function Wt(e,t,n){It(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Ut(!!n?.isTextInput,t,r)&&e(zt())};return Dt.add(t),()=>{Dt.delete(t)}},t)}function Gt(e){if(!e.isConnected)return;let t=F(e);if(Bt()===`virtual`){let n=z(t);je(()=>{let r=z(t);(r===n||r===t.body)&&e.isConnected&&C(e)})}else C(e)}function Kt(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(B(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=ut(o),c=r(e=>{let t=B(e),r=F(t),i=r?z(r):z();t===e.currentTarget&&t===i&&(n&&n(e),a&&a(!0),s(e))},[a,n,s]);return{focusProps:{onFocus:!t&&(n||a||i)?c:void 0,onBlur:!t&&(i||a)?o:void 0}}}function qt(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function Jt(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:qt(e.onKeyDown),onKeyUp:qt(e.onKeyUp)}}}let Yt=e.createContext(null);function Xt(e){let t=i(Yt)||{};Fe(t,e);let{ref:n,...r}=t;return r}function Zt(e,t){let{focusProps:n}=Kt(e),{keyboardProps:r}=Jt(e),i=V(n,r),o=Xt(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&Gt(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:V({...i,tabIndex:u},c)}}function Qt(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=Me(),u=r(e=>{R(e.currentTarget,B(e))&&o.current.isFocusWithin&&!R(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=ut(u),f=r(e=>{if(!R(e.currentTarget,B(e)))return;let t=B(e),n=F(t),r=z(n);if(!o.current.isFocusWithin&&r===t){i&&i(e),a&&a(!0),o.current.isFocusWithin=!0,d(e);let t=e.currentTarget;c(n,`focus`,e=>{let r=B(e);if(o.current.isFocusWithin&&!R(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});lt(e,t);let i=ct(e);u(i)}},{capture:!0})}},[i,a,d,c,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:u}}}function $t(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||zt()}),[o,l]=c(!1),[u,d]=c(()=>a.current.isFocused&&a.current.isFocusVisible),f=r(()=>d(a.current.isFocused&&a.current.isFocusVisible),[]),p=r(e=>{a.current.isFocused=e,a.current.isFocusVisible=zt(),l(e),f()},[f]);Wt(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=Kt({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=Qt({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let en=!1,tn=0;function nn(){en=!0,setTimeout(()=>{en=!1},500)}function rn(e){e.pointerType===`touch`&&nn()}function an(){let e=F(null);if(e!==void 0)return tn===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,rn),tn++,()=>{tn--,!(tn>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,rn)}}function on(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[l,u]=c(!1),d=s({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;a(an,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=Me(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!R(e.currentTarget,B(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(F(B(e)),`pointerover`,e=>{d.isHovered&&d.target&&!R(d.target,B(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:o,pointerType:r}),n&&n(!0),u(!0)},a=(e,t)=>{let i=d.target;d.pointerType=``,d.target=null,!(t===`touch`||!d.isHovered||!i)&&(d.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),u(!1))},o={};return typeof PointerEvent<`u`&&(o.onPointerEnter=t=>{en&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&R(e.currentTarget,B(e))&&a(e,e.pointerType)}),{hoverProps:o,triggerHoverEnd:a}},[t,n,r,i,d,f,p]);return a(()=>{i&&h({currentTarget:d.target},d.pointerType)},[i]),{hoverProps:m,isHovered:l}}typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const sn=t(!1);function cn(e){let t=(t,n)=>i(sn)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}function ln(e,t){let{elementType:n=`button`,isDisabled:r,onPress:i,onPressStart:a,onPressEnd:o,onPressUp:s,onPressChange:c,preventFocusOnPress:l,allowFocusWhenDisabled:u,onClick:d,href:f,target:p,rel:m,type:h=`button`}=e,g;g=n===`button`?{type:h,disabled:r,form:e.form,formAction:e.formAction,formEncType:e.formEncType,formMethod:e.formMethod,formNoValidate:e.formNoValidate,formTarget:e.formTarget,name:e.name,value:e.value}:{role:`button`,href:n===`a`&&!r?f:void 0,target:n===`a`?p:void 0,type:n===`input`?h:void 0,disabled:n===`input`?r:void 0,"aria-disabled":!r||n===`input`?void 0:r,rel:n===`a`?m:void 0};let{pressProps:_,isPressed:v}=bt({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Zt(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=V(y,_,De(e,{labelable:!0}));return{isPressed:v,buttonProps:V(g,b,{"aria-haspopup":e[`aria-haspopup`],"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-pressed":e[`aria-pressed`],"aria-current":e[`aria-current`],"aria-disabled":e[`aria-disabled`]})}}const un=t(null),dn=7e3;let $=null;function fn(e,t=`assertive`,n=dn){$?$.announce(e,t,n):($=new pn,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var pn=class{isAttached(){return this.node?.isConnected}createLog(e){let t=document.createElement(`div`);return t.setAttribute(`role`,`log`),t.setAttribute(`aria-live`,e),t.setAttribute(`aria-relevant`,`additions`),t}destroy(){this.node&&=(document.body.removeChild(this.node),null)}announce(e,t=`assertive`,n=dn){var r,i;if(!this.node)return;let a=document.createElement(`div`);typeof e==`object`?(a.setAttribute(`role`,`img`),a.setAttribute(`aria-labelledby`,e[`aria-labelledby`])):a.textContent=e,t===`assertive`?(r=this.assertiveLog)==null||r.appendChild(a):(i=this.politeLog)==null||i.appendChild(a),e!==``&&setTimeout(()=>{a.remove()},n)}clear(e){this.node&&((!e||e===`assertive`)&&this.assertiveLog&&(this.assertiveLog.innerHTML=``),(!e||e===`polite`)&&this.politeLog&&(this.politeLog.innerHTML=``))}constructor(){this.node=null,this.assertiveLog=null,this.politeLog=null,typeof document<`u`&&(this.node=document.createElement(`div`),this.node.dataset.liveAnnouncer=`true`,Object.assign(this.node.style,{border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`}),this.assertiveLog=this.createLog(`assertive`),this.node.appendChild(this.assertiveLog),this.politeLog=this.createLog(`polite`),this.node.appendChild(this.politeLog),document.body.prepend(this.node))}};const mn=t({}),hn=cn(function(t,n){[t,n]=nt(t,n,mn);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=ln(t,n);o=_n(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=$t(t),{hoverProps:f,isHovered:p}=on({...t,isDisabled:t.isDisabled||i}),m={isHovered:p,isPressed:(r.isPressed||c)&&!i,isFocused:u,isFocusVisible:d,isDisabled:t.isDisabled||!1,isPending:i??!1},h=$e({...t,values:m,defaultClassName:`react-aria-Button`}),g=fe(o.id),_=fe(),v=o[`aria-labelledby`];i&&(v?v=`${v} ${_}`:o[`aria-label`]&&(v=`${g} ${_}`));let y=s(i);a(()=>{let e={"aria-labelledby":v||g};(!y.current&&u&&i||y.current&&u&&!i)&&fn(e,`assertive`),y.current=i},[i,u,v,g]);let b=De(t,{global:!0});return delete b.onClick,e.createElement(st.button,{...V(b,h,o,l,f),type:o.type===`submit`&&i?`button`:o.type,id:g,ref:n,"aria-labelledby":v,slot:t.slot||void 0,"aria-disabled":i?`true`:o[`aria-disabled`],"data-disabled":t.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":u||void 0,"data-pending":i||void 0,"data-focus-visible":d||void 0},e.createElement(un.Provider,{value:{id:_}},h.children))}),gn=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function _n(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!gn.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{R as A,le as B,Ge as C,De as D,Ne as E,F,f as G,ee as H,I,he as L,z as M,B as N,V as O,L as P,me as R,Xe as S,U as T,x as U,k as V,y as W,et as _,$t as a,it as b,Gt as c,bt as d,ht as f,rt as g,$e as h,on as i,ve as j,ye as k,Bt as l,nt as m,hn as n,Qt as o,Qe as p,cn as r,Zt as s,mn as t,Vt as u,Ze as v,Ke as w,tt as x,st as y,fe as z};
@@ -1 +0,0 @@
1
- import{n as e}from"./Button-LiaNjkvk.js";import{t}from"./src-D7lX72kz.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l(e){return typeof e!=`boolean`}function u({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const d={lastRespondedAt:null,lastDismissedAt:null};async function f({client:e,surveyId:n,respondent:r,signal:i}){try{let a=await e.get(`api/v1/cfti/${n}/respondent/${r}`,{signal:i}).json(),o=t.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),d)}catch{return d}}function p({client:e,surveyId:t,respondent:i,enabled:a=!0}){let[o,s]=r(d),[c,l]=r(()=>!a),[u,p]=r({client:e,surveyId:t,respondent:i,enabled:a});return(u.client!==e||u.surveyId!==t||u.respondent!==i||u.enabled!==a)&&(p({client:e,surveyId:t,respondent:i,enabled:a}),s(d),l(!a)),n(()=>{if(!a||!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;f({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(s(e),l(!0))})};r();let o=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,o),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,o)}},[e,t,i,a]),{state:o,isSettled:c}}function m({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${t}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const h=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),g=({onClick:t,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(e,{onPress:t,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(h,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{u as a,p as i,h as n,c as o,m as r,l as s,g as t};
@@ -1 +0,0 @@
1
- import{a as e,i as t,o as n,r,s as i}from"./DefaultConfettiTrigger-B4MnmgtJ.js";import{D as a,E as o,G as s,I as c,N as l,O as u,R as d,T as f,V as p,_ as m,a as h,b as g,d as _,g as v,h as y,i as b,k as x,m as S,n as C,o as w,p as T,r as E,s as D,u as O,x as k,y as A,z as j}from"./Button-LiaNjkvk.js";import{c as M,d as ee,f as te,h as ne,l as re,m as ie,o as ae,p as oe,s as se,u as ce}from"./src-D7lX72kz.js";import{a as le,n as ue,o as de,r as fe,t as pe}from"./internals-C8EZCPMe.js";import{S as me,_ as he,a as N,b as ge,c as _e,g as ve,h as ye,i as be,l as xe,o as Se,p as Ce,r as we,s as Te,u as Ee,v as De,x as Oe,y as ke}from"./ModalContainer-CftztDnr.js";import P,{Suspense as Ae,cloneElement as je,createContext as F,forwardRef as I,isValidElement as Me,lazy as Ne,useCallback as L,useContext as R,useEffect as z,useMemo as B,useRef as V,useState as H}from"react";import{useTimeout as Pe}from"usehooks-ts";import{Fragment as U,jsx as W,jsxs as G}from"react/jsx-runtime";import K from"clsx";import"react-dom";function Fe(e,t,n){let r=f(e=>{n&&!e.defaultPrevented&&n(t)});z(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Ie(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=j(t);let o=j(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=ge({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Le(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Ie(e),s=d([!!t,!!n,r,i]),c=d([!!t,!!n,r,i]);return o=u(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function Re(e,t,n){let{validationBehavior:r,focus:i}=e;p(()=>{if(r===`native`&&n?.current&&!n.current.disabled){let e=t.realtimeValidation.isInvalid?t.realtimeValidation.validationErrors.join(` `)||`Invalid value.`:``;n.current.setCustomValidity(e),n.current.hasAttribute(`title`)||(n.current.title=``),t.realtimeValidation.isInvalid||t.updateValidation(Be(n.current))}});let a=V(!1),o=f(()=>{a.current||t.resetValidation()}),s=f(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Ve(r)===n.current&&(i?i():n.current?.focus(),O(`keyboard`)),e.preventDefault()}),c=f(()=>{t.commitValidation()});z(()=>{let e=n?.current;if(!e)return;let t=e.form,r=t?.reset;return t&&(t.reset=()=>{a.current=!window.event||window.event.type===`message`&&l(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,c),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,c),t?.removeEventListener(`reset`,o),t&&(t.reset=r)}},[n,r])}function ze(e){let t=e.validity;return{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing,valid:t.valid}}function Be(e){return{isInvalid:!e.validity.valid,validationDetails:ze(e),validationErrors:e.validationMessage?[e.validationMessage]:[]}}function Ve(e){for(let t=0;t<e.elements.length;t++){let n=e.elements[t];if(n.validity?.valid===!1)return n}return null}const He={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},Ue={...He,customError:!0,valid:!1},q={isInvalid:!1,validationDetails:He,validationErrors:[]},We=F({}),Ge=`__reactAriaFormValidationState`;function J(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[Ge];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ke(e)}function Ke(e){let{isInvalid:t,validationState:n,name:r,value:i,builtinValidation:a,validate:o,validationBehavior:s=`aria`}=e;n&&(t||=n===`invalid`);let c=t===void 0?null:{isInvalid:t,validationErrors:[],validationDetails:Ue},l=B(()=>!o||i==null?null:Ye(Je(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=R(We),d=B(()=>r?Array.isArray(r)?r.flatMap(e=>qe(u[e])):qe(u[r]):[],[u,r]),[f,p]=H(u),[m,h]=H(!1);u!==f&&(p(u),h(!1));let g=B(()=>Ye(m?[]:d),[m,d]),_=V(q),[v,y]=H(q),b=V(q),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Xe(e,b.current)||(b.current=e,y(e))},[S,C]=H(!1);return z(x),{realtimeValidation:c||g||l||a||q,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Xe(v,e)?y(e):_.current=e},resetValidation(){let e=q;Xe(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function qe(e){return e?Array.isArray(e)?e:[e]:[]}function Je(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return qe(n)}return[]}function Ye(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:Ue}:null}function Xe(e,t){return e===t||!!e&&!!t&&e.isInvalid===t.isInvalid&&e.validationErrors.length===t.validationErrors.length&&e.validationErrors.every((e,n)=>e===t.validationErrors[n])&&Object.entries(e.validationDetails).every(([e,n])=>t.validationDetails[e]===n)}function Ze(...e){let t=new Set,n=!1,r={...He};for(let i of e){for(let e of i.validationErrors)t.add(e);n||=i.isInvalid;for(let e in r)r[e]||=i.validationDetails[e]}return r.valid=!n,{isInvalid:n,validationErrors:[...t],validationDetails:r}}function Qe(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[d,f]=he(e.value,e.defaultValue||``,e.onChange),{focusableProps:p}=D(e,t),m=J({...e,value:d}),{isInvalid:h,validationErrors:g,validationDetails:_}=m.displayValidation,{labelProps:v,fieldProps:y,descriptionProps:b,errorMessageProps:x}=Le({...e,isInvalid:h,errorMessage:e.errorMessage||g}),S=a(e,{labelable:!0}),C={type:s,pattern:e.pattern},[w]=H(d);return Fe(t,e.defaultValue??w,f),Re(e,m,t),{labelProps:v,inputProps:u(S,n===`input`?C:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":h||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:d,onChange:e=>f(l(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,[parseInt(P.version,10)>=17?`enterKeyHint`:`enterkeyhint`]:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...p,...y}),descriptionProps:b,errorMessageProps:x,isInvalid:h,validationErrors:g,validationDetails:_}}function $e(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:d,"aria-label":f,"aria-labelledby":p,validationState:m=`valid`,isInvalid:h,onPressStart:g,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S}=e,C=e=>{e.stopPropagation(),t.setSelected(l(e).checked)},{pressProps:w,isPressed:T}=_({onPressStart:g,onPressEnd:v,onPressChange:y,onPress:b,onPressUp:x,onClick:S,isDisabled:r}),{pressProps:E,isPressed:O}=_({onPressStart:g,onPressEnd:v,onPressChange:y,onPressUp:x,onClick:S,onPress(e){b?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:k}=D(e,n),A=u(w,k),j=a(e,{labelable:!0});return Fe(n,t.defaultSelected,t.setSelected),{labelProps:u(E,{onClick:e=>e.preventDefault()}),inputProps:u(j,{"aria-invalid":h||m===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:C,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...A}),isSelected:t.isSelected,isPressed:T||O,isDisabled:r,isReadOnly:i,isInvalid:h||m===`invalid`}}function et(e,t,n){let r=J({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:d,isDisabled:f,isReadOnly:p}=$e({...e,isInvalid:i},t,n);Re(e,r,n);let{isIndeterminate:m,isRequired:h,validationBehavior:g=`aria`}=e;z(()=>{n.current&&(n.current.indeterminate=!!m)});let{pressProps:v}=_({isDisabled:f||p,onPress(){let{[Ge]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:u(s,v,B(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":h&&g===`aria`||void 0,required:h&&g===`native`},isSelected:l,isPressed:d,isDisabled:f,isReadOnly:p,isInvalid:i,validationErrors:a,validationDetails:o}}const tt=new WeakMap;function nt(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:l}=t.displayValidation,{labelProps:d,fieldProps:f,descriptionProps:p,errorMessageProps:m}=Le({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});tt.set(t,{name:r,form:i,descriptionId:p.id,errorMessageId:m.id,validationBehavior:o});let h=a(e,{labelable:!0}),{focusWithinProps:g}=w({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:u(h,{role:`group`,"aria-disabled":n||void 0,...f,...g}),labelProps:d,descriptionProps:p,errorMessageProps:m,isInvalid:s,validationErrors:c,validationDetails:l}}function rt(e={}){let{isReadOnly:t}=e,[n,r]=he(e.isSelected,e.defaultSelected||!1,e.onChange),[i]=H(n);function a(e){t||r(e)}function o(){t||r(!n)}return{isSelected:n,defaultSelected:e.defaultSelected??i,setSelected:a,toggle:o}}function it(e,t,n){let r=rt({isReadOnly:e.isReadOnly||t.isReadOnly,isSelected:t.isSelected(e.value),defaultSelected:t.defaultValue.includes(e.value),onChange(n){n?t.addValue(e.value):t.removeValue(e.value),e.onChange&&e.onChange(n)}}),{name:i,form:a,descriptionId:o,errorMessageId:s,validationBehavior:c}=tt.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=J({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=V(q),d=()=>{t.setInvalid(e.value,l.isInvalid?l:u.current)};z(d);let f=t.realtimeValidation.isInvalid?t.realtimeValidation:l,p=c===`native`?t.displayValidation:f,m=et({...e,isReadOnly:e.isReadOnly||t.isReadOnly,isDisabled:e.isDisabled||t.isDisabled,name:e.name||i,form:e.form||a,isRequired:e.isRequired??t.isRequired,validationBehavior:c,[Ge]:{realtimeValidation:f,displayValidation:p,resetValidation:t.resetValidation,commitValidation:t.commitValidation,updateValidation(e){u.current=e,d()}}},r,n);return{...m,inputProps:{...m.inputProps,"aria-describedby":[e[`aria-describedby`],t.isInvalid?s:null,o].filter(Boolean).join(` `)||void 0}}}const at=new WeakMap;function ot(e,t,n){let{value:r,children:i,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:l,onPressChange:d,onPress:f,onPressUp:p,onClick:m}=e,h=e.isDisabled||t.isDisabled,g=t.selectedValue===r,v=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:y,isPressed:b}=_({onPressStart:c,onPressEnd:l,onPressChange:d,onPress:f,onPressUp:p,onClick:m,isDisabled:h}),{pressProps:x,isPressed:S}=_({onPressStart:c,onPressEnd:l,onPressChange:d,onPressUp:p,onClick:m,isDisabled:h,onPress(e){f?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:C}=D(u(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),w=u(y,C),T=a(e,{labelable:!0}),E=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(E=0):t.selectedValue===r&&(E=0),h&&(E=void 0);let{name:O,form:k,descriptionId:A,errorMessageId:j,validationBehavior:M}=at.get(t);return Fe(n,t.defaultSelectedValue,t.setSelectedValue),Re({validationBehavior:M},t,n),{labelProps:u(x,B(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:u(T,{...w,type:`radio`,name:O,form:k,tabIndex:E,disabled:h,required:t.isRequired&&M===`native`,checked:g,value:r,onChange:v,"aria-describedby":[e[`aria-describedby`],t.isInvalid?j:null,A].filter(Boolean).join(` `)||void 0}),isDisabled:h,isSelected:g,isPressed:b||S}}function st(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:d=`vertical`,validationBehavior:f=`aria`}=e,{direction:p}=ke(),{isInvalid:m,validationErrors:h,validationDetails:g}=t.displayValidation,{labelProps:_,fieldProps:v,descriptionProps:y,errorMessageProps:b}=Le({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||h}),x=a(e,{labelable:!0}),{focusWithinProps:S}=w({onBlurWithin(n){e.onBlur?.(n),t.selectedValue||t.setLastFocusedValue(null)},onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange}),C=e=>{let n;switch(e.key){case`ArrowRight`:n=p===`rtl`&&d!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=p===`rtl`&&d!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=De(e.currentTarget,{from:l(e),accept:e=>e instanceof c(e).HTMLInputElement&&e.type===`radio`}),i;n===`next`?(i=r.nextNode(),i||=(r.currentNode=e.currentTarget,r.firstChild())):(i=r.previousNode(),i||=(r.currentNode=e.currentTarget,r.lastChild())),i&&(i.focus(),t.setSelectedValue(i.value))},T=j(n);return at.set(t,{name:T,form:r,descriptionId:y.id,errorMessageId:b.id,validationBehavior:f}),{radioGroupProps:u(x,{role:`radiogroup`,onKeyDown:C,"aria-invalid":t.isInvalid||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-readonly":i||void 0,"aria-required":o||void 0,"aria-disabled":s||void 0,"aria-orientation":d,...v,...S}),labelProps:_,descriptionProps:y,errorMessageProps:b,isInvalid:m,validationErrors:h,validationDetails:g}}const ct=F({}),Y=E(function(e,t){[e,t]=S(e,t,ct);let{elementType:n=`label`,...r}=e,i=A[n];return P.createElement(i,{className:`react-aria-Label`,...r,ref:t})}),lt=F({}),X=I(function(e,t){[e,t]=S(e,t,lt);let{elementType:n=`span`,...r}=e,i=A[n];return P.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function ut(e={}){let[t,n]=he(e.value,e.defaultValue||[],e.onChange),[r]=H(t),i=!!e.isRequired&&t.length===0,a=V(new Map),o=J({...e,value:t}),s=o.displayValidation.isInvalid;return{...o,value:t,defaultValue:e.defaultValue??r,setValue(t){e.isReadOnly||e.isDisabled||n(t)},isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isSelected(e){return t.includes(e)},addValue(t){e.isReadOnly||e.isDisabled||n(e=>e.includes(t)?e:e.concat(t))},removeValue(r){e.isReadOnly||e.isDisabled||t.includes(r)&&n(t.filter(e=>e!==r))},toggleValue(r){e.isReadOnly||e.isDisabled||(t.includes(r)?n(t.filter(e=>e!==r)):n(t.concat(r)))},setInvalid(e,t){let n=new Map(a.current);t.isInvalid?n.set(e,t):n.delete(e),a.current=n,o.updateValidation(Ze(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let dt=Math.round(Math.random()*1e10),ft=0;function pt(e){let t=B(()=>e.name||`radio-group-${dt}-${++ft}`,[e.name]),[n,r]=he(e.value,e.defaultValue??null,e.onChange),[i]=H(n),[a,o]=H(null),s=J({...e,value:n}),c=t=>{!e.isReadOnly&&!e.isDisabled&&(r(t),s.commitValidation())},l=s.displayValidation.isInvalid;return{...s,name:t,selectedValue:n,defaultSelectedValue:e.value===void 0?e.defaultValue??null:i,setSelectedValue:c,lastFocusedValue:a,setLastFocusedValue:o,isDisabled:e.isDisabled||!1,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1,validationState:e.validationState||(l?`invalid`:null),isInvalid:l}}const Z=F(null),mt=I(function(e,t){return R(Z)?.isInvalid?P.createElement(ht,{...e,ref:t}):null}),ht=I((e,t)=>{let n=R(Z),r=a(e,{global:!0}),i=y({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:P.createElement(X,{slot:`errorMessage`,...r,...i,ref:t})}),gt=F(null),_t=F(null),vt=F(null),yt=I(function(e,t){[e,t]=S(e,t,_t);let{validationBehavior:n}=k(gt)||{},r=e.validationBehavior??n??`native`,i=ut({...e,validationBehavior:r}),[o,s]=v(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:l,descriptionProps:d,errorMessageProps:f,...p}=nt({...e,label:s,validationBehavior:r},i),m=y({...e,values:{isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:e.isRequired||!1,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-CheckboxGroup`}),h=a(e,{global:!0});return P.createElement(A.div,{...u(h,m,c),ref:t,slot:e.slot||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":e.isRequired||void 0,"data-invalid":i.isInvalid||void 0,"data-disabled":e.isDisabled||void 0},P.createElement(T,{values:[[vt,i],[ct,{...l,ref:o,elementType:`span`}],[lt,{slots:{description:d,errorMessage:f}}],[Z,p]]},m.children))}),bt=I(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=S(r,t,me);let{validationBehavior:i}=k(gt)||{},s=e.validationBehavior??i??`native`,c=R(vt),l=o(B(()=>x(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:d,inputProps:f,isSelected:p,isDisabled:m,isReadOnly:_,isPressed:v,isInvalid:C}=c?it({...g(e),value:e.value,children:typeof e.children==`function`||e.children},c,l):et({...g(e),children:typeof e.children==`function`||e.children,validationBehavior:s},rt(e),l),{isFocused:w,isFocusVisible:T,focusProps:E}=h(),D=m||_,{hoverProps:O,isHovered:j}=b({...e,isDisabled:D}),M=y({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:p,isIndeterminate:e.isIndeterminate||!1,isPressed:v,isHovered:j,isFocused:w,isFocusVisible:T,isDisabled:m,isReadOnly:_,isInvalid:C,isRequired:e.isRequired||!1}}),ee=a(e,{global:!0});return delete ee.id,delete ee.onClick,P.createElement(A.label,{...u(ee,d,O,M),ref:t,slot:e.slot||void 0,"data-selected":p||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":v||void 0,"data-hovered":j||void 0,"data-focused":w||void 0,"data-focus-visible":T||void 0,"data-disabled":m||void 0,"data-readonly":_||void 0,"data-invalid":C||void 0,"data-required":e.isRequired||void 0},P.createElement(ve,{elementType:`span`},P.createElement(`input`,{...u(f,E),ref:l})),M.children)}),xt=F({}),St=F({});let Ct=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const wt=E(function(e,t){[e,t]=S(e,t,St);let{hoverProps:n,isHovered:r}=b({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=h({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=y({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return P.createElement(A.input,{...u(Ct(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),Tt=F(null);function Et(e){let t=V({});return P.createElement(Tt.Provider,{value:t},e.children)}const Dt=F({isSelected:!1}),Ot=F(null),kt=F(null),At=F(null),jt=I(function(e,t){[e,t]=S(e,t,Ot);let{validationBehavior:n}=k(gt)||{},r=e.validationBehavior??n??`native`,i=pt({...e,validationBehavior:r}),[o,s]=v(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:l,descriptionProps:d,errorMessageProps:f,...p}=st({...e,label:s,validationBehavior:r},i),m=y({...e,values:{orientation:e.orientation||`vertical`,isDisabled:i.isDisabled,isReadOnly:i.isReadOnly,isRequired:i.isRequired,isInvalid:i.isInvalid,state:i},defaultClassName:`react-aria-RadioGroup`}),h=a(e,{global:!0});return P.createElement(A.div,{...u(h,m,c),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`vertical`,"data-invalid":i.isInvalid||void 0,"data-disabled":i.isDisabled||void 0,"data-readonly":i.isReadOnly||void 0,"data-required":i.isRequired||void 0},P.createElement(T,{values:[[At,i],[ct,{...l,ref:o,elementType:`span`}],[lt,{slots:{description:d,errorMessage:f}}],[Z,p]]},P.createElement(Et,null,m.children)))}),Mt=I(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=S(r,t,kt);let i=P.useContext(At),s=o(B(()=>x(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:c,inputProps:l,isSelected:d,isDisabled:f,isPressed:p}=ot({...g(e),children:typeof e.children==`function`||e.children},i,s),{isFocused:m,isFocusVisible:_,focusProps:v}=h(),C=f||i.isReadOnly,{hoverProps:w,isHovered:T}=b({...e,isDisabled:C}),E=y({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:d,isPressed:p,isHovered:T,isFocused:m,isFocusVisible:_,isDisabled:f,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,P.createElement(A.label,{...u(D,c,w,E),ref:t,"data-selected":d||void 0,"data-pressed":p||void 0,"data-hovered":T||void 0,"data-focused":m||void 0,"data-focus-visible":_||void 0,"data-disabled":f||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},P.createElement(ve,{elementType:`span`},P.createElement(`input`,{...u(l,v),ref:s})),P.createElement(Dt.Provider,{value:{isSelected:d}},E.children))}),Nt=F({});let Pt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Ft=I(function(e,t){[e,t]=S(e,t,Nt);let{hoverProps:n,isHovered:r}=b(e),{isFocused:i,isFocusVisible:a,focusProps:o}=h({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=y({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return P.createElement(A.textarea,{...u(Pt(e),o,n),...c,ref:t,"data-focused":i||void 0,"data-disabled":e.disabled||void 0,"data-hovered":r||void 0,"data-focus-visible":a||void 0,"data-invalid":s||void 0})}),It=F(null),Lt=E(function(e,t){[e,t]=S(e,t,It);let{validationBehavior:n}=k(gt)||{},r=e.validationBehavior??n??`native`,i=V(null);[e,i]=S(e,i,Oe);let[o,s]=v(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,l]=H(`input`),{labelProps:u,inputProps:d,descriptionProps:f,errorMessageProps:p,...m}=Qe({...g(e),inputElementType:c,label:s,validationBehavior:r},i),h=L(e=>{i.current=e,e&&l(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=y({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:m.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),b=a(e,{global:!0});return delete b.id,P.createElement(A.div,{...b,..._,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":m.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},P.createElement(T,{values:[[ct,{...u,ref:o}],[St,{...d,ref:h}],[Nt,{...d,ref:h}],[xt,{role:`presentation`,isInvalid:m.isInvalid,isDisabled:e.isDisabled||!1}],[lt,{slots:{description:f,errorMessage:p}}],[Z,m]]},_.children))}),Q=e=>e===void 0||e===``||Array.isArray(e)&&e.length===0||!Array.isArray(e)&&typeof e==`object`&&se(e),Rt=({answer:e,defaultAnswer:t})=>{if(!Q(e)||!Q(t))return e},zt=(e,t)=>e.type===`end`?!1:e.type!==`next`||!t,Bt=({routingLogic:e,answer:t,required:n,isLastQuestion:r})=>{if(e.type!==`always`&&Q(t)&&n)return!0;let i=e.type===`always`?e.target:Q(t)?e.default:e.cases.find(e=>le({answer:t,condition:e}))?.target??e.default;return zt(i,r)},Vt=({originalQuestions:e,answers:t,errors:n,pointer:r=-1})=>{if(!e)return{questions:[],currentIndex:-1};let i=[...e].sort((e,t)=>e.position-t.position),a=r>=0?i[r]:void 0,o=de(i,t,{forceReachableIds:a?[a.id]:void 0}),s=i.map((e,t)=>{let i={...e},a=n[e.id];return a&&(i.error=a),{...i,visible:r===t||o.has(e.id)}}),c=s.findIndex((e,n)=>n>r&&e.visible&&t[e.id]===void 0);return c===-1&&(c=s.findLastIndex(e=>!!e.visible)),{questions:s,currentIndex:c}},$={rating:({scale:e},t)=>ce({scale:e},t),"open-ended":({max:e},t)=>re({maxLength:e},t),"single-select":({editable:e},t)=>ee({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>M({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>te(),"bug-report":(e,t)=>ae({},t)},Ht=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=$[n];return r(e,t)}case`open-ended`:{let r=$[n];return r(e,t)}case`single-select`:{let r=$[n];return r(e,t)}case`multi-select`:{let r=$[n];return r(e,t)}case`statement`:{let r=$[n];return r(e,t)}case`bug-report`:{let r=$[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Ut=({questions:e,answers:t})=>{let n=Wt({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Wt=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Gt=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Kt={},qt=({questions:e,answers:t,errors:n,locale:r})=>{let i={};for(let a of e){if(!a.visible||!a.required||t[a.id]!==void 0||n[a.id])continue;let e=Ht(a.properties,{required:a.required}).safeParse(void 0);e.success||(i[a.id]=ye(e.error,r))}return i},Jt=e=>{let t=e.querySelector(`[data-invalid]`);if(!t)return;let n=t.getAttribute(`role`);if(n===`radiogroup`||n===`group`){t.tabIndex=-1,t.focus();return}t.querySelector(`textarea, input`)?.focus()},Yt=({current:e,shouldAutoSubmit:t,onSubmitted:n,onFinished:r,children:i,locale:a})=>{let{survey:o,submit:s}=Ce(),[c,l]=H({}),[u,d]=H({}),[f,p]=H(null),m=B(()=>Vt({originalQuestions:o?.questions,answers:c,errors:u,pointer:e}),[o?.questions,c,u,e]),h=e??f??m.currentIndex,g=B(()=>!!o?.isBackNavigationAllowed&&h>0&&m.questions.slice(0,h).some(e=>!!e.visible),[o?.isBackNavigationAllowed,m.questions,h]),_=L((e,t)=>{let n=m.questions.find(t=>t.id===e)?.required??!1,r=Q(t);l(i=>{if(!n&&r)return i[e]===null?i:{...i,[e]:null};if(n&&r){if(!(e in i))return i;let t={...i};return delete t[e],t}return i[e]===t?i:{...i,[e]:t}})},[m.questions]),v=L(()=>{o?.isBackNavigationAllowed&&p(t=>{let n=t??e??m.currentIndex;for(let e=n-1;e>=0;e--)if(m.questions[e]?.visible)return e;return t})},[o?.isBackNavigationAllowed,m.questions,m.currentIndex,e]),[y,b]=H(0),x=y>0,S=V(null),[C,w]=H(!1);z(()=>{y===0||!S.current||Jt(S.current)},[y]);let T=L(({answers:e})=>{Promise.resolve(s({answers:e})).then(e=>r?.(e??void 0),()=>r?.())},[r,s]),E=L(()=>{let e=Gt({questions:m.questions,errors:u}),t=qt({questions:m.questions,answers:c,errors:e,locale:a}),r=Object.keys(t).length>0;if(Object.keys(e).length>0||r)return r&&d(e=>({...e,...t})),b(e=>e+1),!1;let i=Ut({questions:m.questions,answers:c});return T({answers:i}),w(!0),n?.(),!0},[c,u,m.questions,T,n,a]),D=L(({question:r,answer:i})=>{let s=m.questions.at(r);if(!s)return{error:`Question index is invalid`};let h=Ht(s.properties,{required:s.required}).safeParse(i);if(!h.success){let e=ye(h.error,a);return d(t=>{if(t[s.id]===e)return t;let n={...t};return n[s.id]=e,n}),l(e=>{if(!(s.id in e))return e;let t={...e};return delete t[s.id],t}),{error:e}}d(e=>{if(!e[s.id])return e;let t={...e};return delete t[s.id],t});let g=Q(i),_=!s.required&&g?null:i,v={...c},y=v[s.id]!==_;v[s.id]=_;let b=Vt({originalQuestions:o?.questions,answers:v,errors:u,pointer:e});y&&l(v);let x=b.questions.findIndex((e,t)=>t>r&&!!e.visible);if(f!==null&&x!==-1)return p(x),{next:x};if(p(null),b.questions.filter(({visible:e})=>!!e).every(({id:e})=>v[e]!==void 0)&&t){let e=Ut({questions:b.questions,answers:v});T({answers:e}),w(!0),n?.()}return{next:b.currentIndex}},[m.questions,c,o?.questions,u,t,e,f,T,n,a]);return m.questions.length===0?W(U,{}):W(`div`,{ref:S,className:`confetti ${pe}`,"data-show-errors":x||void 0,children:i({questions:m.questions,current:h,answers:c,update:D,back:v,canGoBack:g,backButtonLabel:o?.backButtonLabel??void 0,saveAnswer:_,submit:E,isSubmitted:C,errors:x?u:Kt})})},Xt=F(null);function Zt({children:a,surveyId:o,publishableKey:c,apiBaseUrl:l,respondent:u,isSurveyVisible:d}){let f=e({surveyId:o,override:u}),p=s({publishableKey:c,apiBaseUrl:l}),{isAvailable:m,isSettled:h}=r({client:p,surveyId:o}),{state:g,isSettled:_}=t({client:p,surveyId:o,respondent:f,enabled:i(d)}),v=B(()=>({respondent:f}),[f]);return!f||!h||!_||!m||!n(g,d)?null:W(Xt.Provider,{value:v,children:a})}function Qt(e){return R(Xt)?W(U,{children:e.children}):W(Zt,{...e})}function $t(){let e=R(Xt);if(!e)throw Error(`useRespondentVisibility must be used within a RespondentVisibilityProvider`);return e}const en=({children:e,classNames:t,containerProps:n,onDismiss:r,onClose:i,closeOnFinishMs:a=3e3,locale:o})=>{let{surveyId:s,survey:c,dismiss:l}=Ce(),[u,d]=H(!1),[f,p]=H(!1),[m,h]=H(!1),[g,_]=H(!1);return Pe(()=>{c&&i?.()},f&&!(m||g)?a:null),G(`div`,{className:K(`confetti-dialog ${pe}`,t?.dialog),id:`${s}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),h(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),h(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),_(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||_(!1)},children:[W(we,{className:K(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:o,onClose:async()=>{u||(await l(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>d(!0),setIsFinished:()=>p(!0)}):e]})},tn=3e4,nn=({maskAllInputs:e,initialEventsJson:t,locale:n}={})=>{let[r,i]=H(()=>t??null),[a,o]=H(!1),[s,c]=H(null),[l,u]=H(30),d=V(null),f=V(null),p=V(null),m=V([]);z(()=>{let e=new CustomEvent(fe,{detail:{isRecording:a}});document.dispatchEvent(e)},[a]);let h=L(()=>{f.current&&=(clearInterval(f.current),null),p.current&&=(clearTimeout(p.current),null),d.current=null,u(tn/1e3)},[]),g=L(()=>{d.current?.(),h(),o(!1),i(JSON.stringify(m.current))},[h]);return{recordingEventsJson:r,isRecording:a,recordingError:s,remainingSeconds:l,startRecording:L(async()=>{o(!0),c(null),i(null),m.current=[];try{let{record:t}=await import(`./record--U99gpCM.js`);d.current=t({slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0},sampling:{mousemove:50,scroll:100,input:`last`},emit:e=>{m.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=tn/1e3;u(n),f.current=setInterval(()=>{--n,u(n)},1e3),p.current=setTimeout(()=>{g()},tn)}catch{c(N(n).recordingError),o(!1),h()}},[e,g,h,n]),stopRecording:g,clear:L(()=>{h(),o(!1),i(null),c(null),m.current=[]},[h])}},rn=e=>e.replace(/\S/g,`*`),an=e=>`*`.repeat(e.length),on=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):on(n,t)},sn=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,an(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=an(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=an(t.textContent)},cn=({maskInputs:e})=>({name:`cfti-redact`,afterClone:t=>{let{clone:n}=t;if(n instanceof HTMLElement){for(let e of n.querySelectorAll(`.${ue}`)){on(e,e=>{e.data=rn(e.data)}),sn(e);for(let t of e.querySelectorAll(`input, textarea, select`))sn(t)}if(e)for(let e of n.querySelectorAll(`input, textarea, select`))sn(e)}}}),ln=({maskAllInputs:e,initialDataUrl:t,locale:n}={})=>{let[r,i]=H(()=>t??null),[a,o]=H(!1),[s,c]=H(null);return{screenshotDataUrl:r,isCapturing:a,captureError:s,capture:L(async()=>{o(!0),c(null);try{let{snapdom:t}=await import(`./snapdom-BbRa4ZYv.js`),n=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${pe}`],excludeMode:`hide`,plugins:[cn({maskInputs:!!e})],fast:!1})).toCanvas(),r=window.devicePixelRatio||1,a=Math.min(Math.round(window.innerWidth*r),n.width),o=Math.min(Math.round(window.innerHeight*r),n.height),s=document.createElement(`canvas`);s.width=a,s.height=o;let c=s.getContext(`2d`);if(!c)throw Error(`Failed to get 2D context for cropping`);c.drawImage(n,0,0,a,o,0,0,a,o),i(s.toDataURL(`image/png`))}catch{c(N(n).captureError)}finally{o(!1)}},[e,n]),clear:L(()=>{i(null),c(null)},[])}},un=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`circle`,{cx:`12`,cy:`12`,r:`10`}),W(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`})]}),dn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,...e,children:[W(`path`,{d:`M10 11v6`}),W(`path`,{d:`M14 11v6`}),W(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}),W(`path`,{d:`M3 6h18`}),W(`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]});function fn(){if(window.DD_RUM&&typeof window.DD_RUM?.getInternalContext==`function`&&typeof window.DD_RUM?.getSessionReplayLink==`function`)try{let e=window.DD_RUM?.getInternalContext?.(),t=window.DD_RUM?.getSessionReplayLink?.();return{sessionId:e?.session_id,sessionReplayLink:t}}catch{return null}return null}function pn(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=fn();return{userAgent:e.userAgent,screenResolution:`${t.width}x${t.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,language:e.language,timestamp:new Date().toISOString(),datadogTraceId:n?.traceId,datadogSessionId:n?.sessionId,datadogSessionReplayLink:n?.sessionReplayLink}}const mn=Ne(()=>import(`./RecordingReplayer-DNYXhses.js`)),hn=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c,defaultAnswer:l,locale:u})=>{let d=B(()=>pn(),[]),f=l&&typeof l==`object`&&`title`in l?l:void 0,[p,m]=H(()=>f?.title??``),[h,g]=H(()=>f?.description??``),{screenshotDataUrl:_,isCapturing:v,captureError:y,capture:b,clear:x}=ln({maskAllInputs:c,initialDataUrl:f?.screenshotDataUrl,locale:u}),{recordingEventsJson:S,isRecording:w,recordingError:T,remainingSeconds:E,startRecording:D,stopRecording:O,clear:k}=nn({maskAllInputs:c,initialEventsJson:f?.recordingEventsJson,locale:u}),A=B(()=>({title:p,...h?{description:h}:{},..._?{screenshotDataUrl:_}:{},...S?{recordingEventsJson:S}:{},metadata:d}),[h,d,S,_,p]);z(()=>{i(A)},[A,i]),z(()=>()=>{O()},[O]);let j=B(()=>S?JSON.parse(S):[],[S]);return W(U,{children:w?G(C,{className:K(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:O,children:[W(un,{}),G(`span`,{children:[30-E,`s /`,` `,30,`s`]})]}):G(`div`,{className:K(`cf-bug-report`,s?.base),children:[G(Lt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:p,onChange:m,className:K(`cf-question`,s?.question),children:[G(`div`,{className:K(`cf-header`,s?.header),children:[G(Y,{className:K(`cf-title`,s?.title),children:[t,!a&&G(`span`,{className:K(`cf-label-optional`,s?.optionalLabel),children:[` `,N(u).optional]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,s?.description),children:n})]}),W(wt,{placeholder:Te(r.placeholder,u),className:K(`cf-input`,s?.input)}),W(mt,{className:K(`cf-error`,s?.error),children:o})]}),G(Lt,{name:`${e}-description`,value:h,onChange:g,className:K(`cf-question`,s?.question),children:[W(Y,{className:K(`cf-title`,s?.title),children:r.detailsLabel}),W(Ft,{placeholder:Se(r.detailsPlaceholder,u),className:K(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?G(`section`,{className:K(`cf-question`,s?.question),children:[W(Y,{className:K(`cf-title`,s?.title),children:N(u).attachments}),G(`div`,{className:K(`cf-bug-report-actions`,s?.actions),children:[r.enableScreenshot&&G(`div`,{className:K(`cf-bug-report-screenshot-section`,s?.screenshotSection),children:[_?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(`img`,{src:_,alt:N(u).screenshotPreview,className:K(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(C,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:x,"aria-label":N(u).removeScreenshot,children:W(dn,{})})})]}):W(C,{className:K(`cf-bug-report-button`,s?.button),onPress:b,isDisabled:v,children:v?N(u).capturing:N(u).screenshot}),y&&W(`div`,{className:K(`cf-error`,s?.error),children:y})]}),r.enableRecording&&G(`div`,{className:K(`cf-bug-report-recording-section`,s?.recordingSection),children:[j.length>0?G(`div`,{className:K(`cf-bug-report-media-preview`,s?.mediaPreview),children:[W(Ae,{fallback:W(`span`,{className:K(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":N(u).loadingRecordingPreview}),children:W(mn,{events:j})}),W(`div`,{className:K(`cf-bug-report-media-actions`,s?.mediaActions),children:W(C,{className:K(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:k,"aria-label":N(u).removeRecording,children:W(dn,{})})})]}):W(C,{className:K(`cf-bug-report-button`,s?.button),onPress:D,children:N(u).record}),T&&W(`div`,{className:K(`cf-error`,s?.error),children:T})]})]})]}):null]})})},gn=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let[u,d]=H(()=>typeof c==`string`?c:``);return z(()=>{i(u)},[i,u]),G(Lt,{isRequired:o,isInvalid:!!s,name:e,className:K(`cf-question`,a?.question),value:u,onChange:e=>{d(e),i(e)},children:[G(`div`,{className:K(`cf-header`,a?.header),children:[G(Y,{className:K(`cf-title`,a?.title),children:[t,!o&&G(`span`,{className:K(`cf-label-optional`,a?.optionalLabel),children:[` `,N(l).optional]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,a?.description),children:n})]}),W(Ft,{className:K(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||N(l).startTyping}),W(mt,{className:K(`cf-error`,a?.error),children:s})]})},_n=({children:e,classNames:t,description:n,...r})=>W(bt,{...r,children:({isIndeterminate:r})=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,t?.label),children:[W(`div`,{className:K(`cf-checkbox-indicator`,t?.indicator),children:W(`svg`,{viewBox:`0 0 18 18`,"aria-hidden":`true`,className:K(`cf-checkbox-indicator-svg`,t?.svg),children:r?W(`rect`,{x:1,y:7.5,width:16,height:3}):W(`polyline`,{points:`2 9 7 14 16 4`})},r?`indeterminate`:`check`)}),e]}),n&&W(`span`,{className:K(`cf-choice-description`,t?.choiceDescription),children:n})]})}),vn=({children:e,classNames:t,...n})=>W(bt,{...n,children:W(`div`,{className:K(`cf-tag-label`,t?.tagLabel),children:e})}),yn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=Ee(n.editable?.label,l),f=n.display??`checkbox`,p=Array.isArray(c)?c:[],m=new Set(n.options.map(e=>e.value)),h=p.find(e=>!m.has(e)),[g,_]=H(()=>{let e=p.filter(e=>m.has(e));return h!==void 0&&u&&e.push(oe),e}),[v,y]=H(()=>h!==void 0&&u?h:``),b=V(null),x=V(null),S=B(()=>{let e=g.indexOf(oe);if(e===-1)return g;let t=[...g];return t[e]=v||`__CONFETTI_CHECKBOX_Others`,t},[v,g]),C=f===`tag`;return z(()=>{i(S)},[i,S]),W(yt,{isRequired:o,isInvalid:!!s,name:a,value:g,onChange:_,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(Y,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,N(l).optional]})]}),t&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,f===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>W(C?vn:_n,{className:K(`cf-choice`,C&&[`cf-tag`,r?.tag],!C&&[`cf-checkbox`,r?.checkbox]),description:e.description,value:e.value,classNames:{tag:r?.tag,tagLabel:r?.tagLabel,choiceDescription:r?.choiceDescription,label:r?.label,indicator:r?.indicator,svg:r?.svg},children:e.label??e.value},t)),u&&(C?G(U,{children:[W(vn,{inputRef:b,onChange:e=>{x.current&&e&&requestAnimationFrame(()=>{x.current&&x.current.focus()})},className:K(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:d}),W(wt,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:v,onChange:e=>{y(e.target.value)},ref:x,className:K(`cf-input cf-tag-input`,r?.othersInput)})]}):G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(_n,{inputRef:b,onChange:e=>{x.current&&e&&requestAnimationFrame(()=>{x.current&&x.current.focus()})},className:K(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:d}),W(wt,{value:v,onChange:e=>{y(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:x,onFocus:()=>{b.current?.checked===!1&&b.current.click()},className:K(`cf-input`,r?.othersInput)})]}))]}),W(mt,{className:K(`cf-error`,r?.error),children:s})]})})},bn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),xn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12ZM9 9h.01M15 9h.01`})]}),Sn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01`})]}),Cn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 15h8M9 9h.01M15 9h.01`})]}),wn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,...e,children:[W(`circle`,{cx:12,cy:12,r:10}),W(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),Tn=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:40,height:40,fill:`none`,...e,children:W(`path`,{fill:`currentColor`,d:`m6.516 14.323-1.49 6.452a.998.998 0 0 0 1.529 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082a1 1 0 0 0-.59-1.74l-5.701-.454-2.467-5.461a.998.998 0 0 0-1.822 0L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.214 4.107zm2.853-4.326a.998.998 0 0 0 .832-.586L12 5.43l1.799 3.981a.998.998 0 0 0 .832.586l3.972.315-3.271 2.944c-.284.256-.397.65-.293 1.018l1.253 4.385-3.736-2.491a.995.995 0 0 0-1.109 0l-3.904 2.603 1.05-4.546a1 1 0 0 0-.276-.94l-3.038-2.962 4.09-.326z`})}),En=e=>W(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:40,height:40,viewBox:`0 0 24 24`,...e,children:W(`path`,{fill:`currentColor`,d:`M21.947 9.179a1.001 1.001 0 0 0-.868-.676l-5.701-.453-2.467-5.461a.998.998 0 0 0-1.822-.001L8.622 8.05l-5.701.453a1 1 0 0 0-.619 1.713l4.213 4.107-1.49 6.452a1 1 0 0 0 1.53 1.057L12 18.202l5.445 3.63a1.001 1.001 0 0 0 1.517-1.106l-1.829-6.4 4.536-4.082c.297-.268.406-.686.278-1.065z`})}),Dn=({state:e,properties:t,classNames:n})=>{let r=e.selectedValue?Number(e.selectedValue):null;return W(`div`,{className:K(`cf-rating-display-star`,n?.ratingDisplayStar),children:Array.from({length:t.scale},(e,t)=>{let i=t+1,a=String(i),o=r&&i<=r;return W(Mt,{className:K(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:W(o?En:Tn,{})},t)})})},On=({properties:e,classNames:t})=>W(`div`,{className:K(`cf-rating-display-number`,t?.ratingDisplayNumber),children:Array.from({length:e.scale},(e,n)=>{let r=n+1,i=String(r);return W(Mt,{className:K(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),kn=({properties:e,classNames:t,state:n})=>{let r=B(()=>[bn,Sn,Cn,wn,xn],[]),i=B(()=>[Sn,Cn,wn],[]);return B(()=>e.scale===3||e.scale===5,[e.scale])?W(`div`,{className:K(`cf-rating-display-emoji`,t?.ratingDisplayEmoji),children:Array.from({length:e.scale},(n,a)=>{let o=a+1,s=String(o),c=e.scale===5?r[a]:i[a];return W(Mt,{className:K(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&W(c,{})},a)})}):W(On,{properties:e,classNames:t,state:n})},An=e=>{switch(e.properties.display??`star`){case`emoji`:return W(kn,{...e});case`number`:return W(On,{...e});case`star`:return W(Dn,{...e})}},jn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s,defaultAnswer:c,locale:l})=>{let[u,d]=H(()=>typeof c==`number`?String(c):null),f=B(()=>u?Number(u):void 0,[u]);return z(()=>{i(f)},[i,f]),W(jt,{isRequired:s,isInvalid:!!o,name:a,className:K(`cf-question`,r?.question),value:u,onChange:d,children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(Y,{className:K(`cf-title`,r?.title),children:[t,!s&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,N(l).optional]})]}),n&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:n})]}),G(`div`,{className:K(`cf-rating-section`,r?.ratingSection),children:[W(An,{state:i,properties:e,classNames:r}),G(`div`,{className:K(`cf-rating-text`,r?.ratingText),children:[W(`span`,{className:K(`cf-rating-text-lower`,r?.ratingTextLower),children:e.labels?.lower}),W(`span`,{className:K(`cf-rating-text-upper`,r?.ratingTextUpper),children:e.labels?.upper})]})]}),W(mt,{className:K(`cf-error`,r?.error),children:o})]})})},Mn=({classNames:e,className:t,description:n,...r})=>W(Mt,{...r,className:K(t,e?.radio),children:m(r.children,t=>G(U,{children:[G(`div`,{className:K(`cf-choice-label`,e?.label),children:[W(`div`,{className:K(`cf-radio-indicator`,e?.indicator)}),t]}),n&&W(`span`,{className:K(`cf-choice-description`,e?.choiceDescription),children:n})]}))}),Nn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s,defaultAnswer:c,locale:l})=>{let u=!!n.editable,d=Ee(n.editable?.label,l),f=typeof c==`string`?c:null,p=f!==null&&n.options.some(e=>e.value===f),[m,h]=H(()=>f===null?null:p?f:u?ie:null),[g,_]=H(()=>f!==null&&!p&&u?f:``),v=V(null),y=V(null),b=B(()=>m===`__CONFETTI_RADIO_Others`?g||`__CONFETTI_RADIO_Others`:m??void 0,[g,m]);return z(()=>{i(b)},[i,b]),W(jt,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{h(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{y.current&&y.current.focus()})},value:m,className:K(`cf-question`,r?.question),children:({state:i})=>G(U,{children:[G(`div`,{className:K(`cf-header`,r?.header),children:[G(Y,{className:K(`cf-title`,r?.title),children:[e,!o&&G(`span`,{className:K(`cf-label-optional`,r?.optionalLabel),children:[` `,N(l).optional]})]}),t&&W(X,{slot:`description`,className:K(`cf-description`,r?.description),children:t})]}),G(`div`,{className:K(`cf-response-choices`,r?.group),children:[n.options.map((e,t)=>W(Mn,{classNames:{indicator:r?.indicator,radio:K(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.label??e.value},t)),u&&G(`div`,{className:K(`cf-choice cf-others-choice`,r?.othersChoice),children:[W(Mn,{inputRef:v,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:K(`cf-radio`,r?.radio)},description:n.editable?.description,children:d}),W(wt,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:y,value:g,onChange:e=>_(e.target.value),onFocus:()=>{v.current?.checked===!1&&v.current.click()},className:K(`cf-input`,r?.othersInput)})]})]}),W(mt,{className:K(`cf-error`,r?.error),children:s})]})})},Pn=({properties:e,title:t,description:n,classNames:r})=>W(`div`,{className:K(`cf-question`,r?.question),children:G(`div`,{className:K(`cf-header`,r?.header),children:[t&&W(`div`,{className:K(`cf-title`,r?.title),children:t}),n&&W(`div`,{className:K(`cf-description`,r?.description),children:n})]})}),Fn=({question:e,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a})=>{switch(e.properties.type){case`rating`:return W(jn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`open-ended`:return W(gn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`single-select`:return W(Nn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`multi-select`:return W(yn,{...e,properties:e.properties,onChange:t,error:n,defaultAnswer:i,locale:a},e.id);case`statement`:return W(Pn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return W(hn,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r,defaultAnswer:i,locale:a},e.id)}return W(`div`,{children:N(a).unsupportedQuestionType},e.id)},In=({title:e,description:t,classNames:n,onClose:r,locale:i})=>{let{survey:a}=Ce();if(!a)return null;let o=t||a.confirmation.description;return G(U,{children:[W(`div`,{className:K(`cf-question`,n?.question),children:G(`div`,{className:K(`cf-header`,n?.header),children:[W(Y,{className:K(`cf-title`,n?.title),children:e||xe(a.confirmation.title,i)}),o&&W(X,{slot:`description`,className:K(`cf-description`,n?.description),children:o})]})}),W(C,{className:`cf-submit-button`,onPress:()=>{r?.()},children:_e(a.confirmation.buttonText,i)})]})},Ln=({onPress:e,children:t,locale:n})=>be()?null:W(C,{className:`cf-back-button`,onPress:e,children:t===void 0?N(n).back:t}),Rn=({question:e,answer:t,isLastQuestion:n,locale:r})=>{if(e.properties.buttonLabel)return e.properties.buttonLabel;let i=N(r);return Bt({routingLogic:e.routingLogic,answer:t,required:e.required,isLastQuestion:n})?!e.required&&Q(t)?i.skip:i.next:i.submit},zn=({onPress:e,isDisabled:t,children:n,locale:r})=>be()?null:W(C,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n===void 0?N(r).submit:n}),Bn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},Vn=e=>!Q(e),Hn=({onSubmit:e,children:t,question:n,isLastQuestion:r,defaultAnswer:i,backButton:a,saveAnswer:o,locale:s})=>{let c=be(),[l,u]=H(i??Bn(n.properties.type)),d=B(()=>Ht(n.properties,{required:n.required}),[n.properties,n.required]),f=B(()=>{let e=d.safeParse(l);if(!e.success)return ye(e.error,s)},[l,d,s]),p=B(()=>Rn({question:n,answer:l,isLastQuestion:r,locale:s}),[l,r,s,n]),m=L(()=>{switch(n.properties.type){case`statement`:if(n.properties.buttonUrl&&typeof window<`u`){let e=ne.safeParse(n.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return e(void 0);default:return e(l)}},[l,e,n.properties]),h=Vn(i),g=B(()=>{switch(n.properties.type){case`rating`:case`single-select`:return!!n.properties.shouldAutoProgress;default:return!1}},[n.properties])&&!h,_=L(t=>{u(t),g&&Vn(t)&&d.safeParse(t).success&&e(t)},[g,d,e]),v=B(()=>{if(!a||!Me(a))return a;let e=a;return je(e,{onPress:()=>{let t=Rt({answer:l,defaultAnswer:i});t!==void 0&&o?.(t),e.props.onPress?.()}})},[a,l,i,o]);return G(U,{children:[t({onChange:_,question:n,error:f,defaultAnswer:i}),!c&&G(`div`,{className:`cf-button-row`,children:[v,(!g||!n.required)&&W(zn,{isDisabled:!!f,onPress:m,children:p})]})]})},Un=({onSubmit:e,children:t,locale:n})=>G(U,{children:[t,W(zn,{onPress:e,locale:n})]});export{Fn as a,jn as c,en as d,Xt as f,Yt as h,In as i,yn as l,$t as m,Hn as n,Pn as o,Qt as p,Ln as r,Nn as s,Un as t,gn as u};
@@ -1,5 +0,0 @@
1
- import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,L as l,M as u,N as d,O as f,P as p,R as m,S as h,T as g,U as _,V as v,W as y,c as ee,f as te,h as ne,j as re,k as ie,l as ae,m as oe,o as se,p as ce,t as le,v as ue,w as de,y as fe,z as pe}from"./Button-LiaNjkvk.js";import{i as me,n as he,r as ge}from"./src-D7lX72kz.js";import{i as _e,r as ve,t as ye}from"./internals-C8EZCPMe.js";import b,{createContext as x,forwardRef as be,useCallback as S,useContext as C,useEffect as w,useMemo as T,useReducer as xe,useRef as E,useState as D}from"react";import{useTimeout as Se}from"usehooks-ts";import{z as O}from"zod";import{Fragment as Ce,jsx as k,jsxs as we}from"react/jsx-runtime";import A from"clsx";import Te,{flushSync as Ee}from"react-dom";const De=x(null);x(null),x(null),x(null),x(null);const Oe=x({});x(null);const ke=x(null);var Ae=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}else if(typeof this.filter==`function`)return this.filter(e);else if(this.filter?.acceptNode)return this.filter.acceptNode(e);else if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(t){if(!e(this.root,t))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let n=[],r=t,i=t;for(this._currentNode=t;r&&r!==this.root;)if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=r,t=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});n.push(t),t.currentNode=i,this._currentSetFor.add(t),r=i=e.host}else r=r.parentNode;let a=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});n.push(a),a.currentNode=i,this._currentSetFor.add(a),this._walkerStack=n}get doc(){return this._doc}firstChild(){let t=this.currentNode,n=this.nextNode();return e(t,n)?(n&&(this.currentNode=n),n):(this.currentNode=t,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}else return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e))if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null;return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}else if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}else return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function je(e,t,n,r){return p()?new Ae(e,t,n,r):e.createTreeWalker(t,n,r)}function Me(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=pe(n),i&&r?i=[...new Set([n,...i.trim().split(/\s+/)])].join(` `):i&&=i.trim().split(/\s+/).join(` `),!r&&!i&&t&&(r=t),{id:n,"aria-label":r,"aria-labelledby":i}}function j(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function Ne(e,t){let n=e;for(j(n,t)&&(n=n.parentElement);n&&!j(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const Pe=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function M(e){return e instanceof HTMLInputElement&&!Pe.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let N=typeof document<`u`&&window.visualViewport;function Fe(){let e=t(),[n,r]=D(()=>e?{width:0,height:0}:Ie());return w(()=>{let e=e=>{r(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{N&&N.scale>1||e(Ie())},n,i=t=>{N&&N.scale>1||M(d(t))&&(n=requestAnimationFrame(()=>{let t=u();(!t||!M(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(Ie()),y()&&window.addEventListener(`blur`,i,!0),N?N.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(n),y()&&window.removeEventListener(`blur`,i,!0),N?N.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),n}function Ie(){return{width:N?Math.min(N.width*N.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:N?N.height*N.scale:document.documentElement.clientHeight}}function Le(e,t=!0){let[n,r]=D(!0),i=n&&t;return v(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),ze(e,i,S(()=>r(!1),[])),i}function Re(e,t){let[n,r]=D(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return ze(e,i,S(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function ze(e,t,n){v(()=>{if(t&&e.current){if(!(`getAnimations`in e.current)){n();return}let t=e.current.getAnimations();if(t.length===0){n();return}let r=!1;return Promise.allSettled(t.map(e=>e.finished)).then(()=>{r||Ee(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const Be=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Ve(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let P=new WeakMap,F=[];function He(t,n){let r=c(t?.[0]),i=n instanceof r.Element?{root:n}:n,o=i?.root??document.body,s=i?.shouldUseInert&&Be,l=new Set(t),u=new Set,d=e=>s&&e instanceof r.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,f=(e,t)=>{s&&e instanceof r.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof r.HTMLElement&&(e.inert=!1))},m=new Set;if(p())for(let e of t){let t=e;for(;t&&t!==o;){let e=t.getRootNode();`shadowRoot`in e&&m.add(e.shadowRoot),t=e.parentNode}}let h=t=>{for(let e of t.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))l.add(e);let n=t=>{if(u.has(t)||l.has(t)||t.parentElement&&u.has(t.parentElement)&&t.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let n of l)if(e(t,n))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},r=je(a(t),t,NodeFilter.SHOW_ELEMENT,{acceptNode:n}),i=n(t);if(i===NodeFilter.FILTER_ACCEPT&&g(t),i!==NodeFilter.FILTER_REJECT){let e=r.nextNode();for(;e!=null;)g(e),e=r.nextNode()}},g=e=>{let t=P.get(e)??0;d(e)&&t===0||(t===0&&f(e,!0),u.add(e),P.set(e,t+1))};F.length&&F[F.length-1].disconnect(),h(o);let _=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Ve(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});_.observe(o,{childList:!0,subtree:!0});let v=new Set;if(p())for(let t of m){let n=new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){if(n.target.isConnected&&![...l,...u].some(t=>e(t,n.target)))for(let e of n.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Ve(e)?l.add(e):e instanceof Element&&h(e);if(p()){for(let e of m)if(!e.isConnected){_.disconnect();break}}}});n.observe(t,{childList:!0,subtree:!0}),v.add(n)}let y={visibleNodes:l,hiddenNodes:u,observe(){_.observe(o,{childList:!0,subtree:!0})},disconnect(){_.disconnect()}};return F.push(y),()=>{if(_.disconnect(),p())for(let e of v)e.disconnect();for(let e of u){let t=P.get(e);t!=null&&(t===1?(f(e,!1),P.delete(e)):P.set(e,t-1))}y===F[F.length-1]?(F.pop(),F.length&&F[F.length-1].observe()):F.splice(F.indexOf(y),1)}}const Ue=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),We=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Ge(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),n=typeof t.getTextInfo==`function`?t.getTextInfo():t.textInfo;if(n)return n.direction===`rtl`;if(t.script)return Ue.has(t.script)}let t=e.split(`-`)[0];return We.has(t)}const Ke=Symbol.for(`react-aria.i18n.locale`);function qe(){let e=typeof window<`u`&&window[Ke]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Ge(e)?`rtl`:`ltr`}}let Je=qe(),I=new Set;function Ye(){Je=qe();for(let e of I)e(Je)}function Xe(){let e=t(),[n,r]=D(Je);return w(()=>(I.size===0&&window.addEventListener(`languagechange`,Ye),I.add(r),()=>{I.delete(r),I.size===0&&window.removeEventListener(`languagechange`,Ye)}),[]),e?{locale:typeof window<`u`&&window[Ke]||`en-US`,direction:`ltr`}:n}const Ze=b.createContext(null);function Qe(){let e=Xe();return C(Ze)||e}const $e=Symbol.for(`react-aria.i18n.locale`),et=Symbol.for(`react-aria.i18n.strings`);let L;var tt=class e{constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=nt(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[$e];if(L===void 0){let t=window[et];if(!t)return null;L={};for(let r in t)L[r]=new e({[n]:t[r]},n)}let r=L?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}};function nt(e,t,n=`en-US`){if(t[e])return t[e];let r=rt(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function rt(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const it=new Map,at=new Map;var ot=class{constructor(e,t){this.locale=e,this.strings=t}format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=it.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),it.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=at.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),at.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const st=new WeakMap;function ct(e){let t=st.get(e);return t||(t=new tt(e),st.set(e,t)),t}function lt(e,t){return t&&tt.getGlobalDictionaryForPackage(t)||ct(e)}function ut(e,t){let{locale:n}=Qe(),r=lt(e,t);return T(()=>new ot(n,r),[n,r])}const dt=b.createContext(null),ft=`react-aria-focus-scope-restore`;let R=null;function pt(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=E(null),s=E(null),c=E([]),{parentNode:l}=C(dt)||{},d=T(()=>new Ot({scopeRef:c}),[c]);v(()=>{let e=l||K.root;if(K.getTreeNode(e.scopeRef)&&R&&!U(R,e.scopeRef)){let t=K.getTreeNode(R);t&&(e=t)}e.addChild(d),K.addNode(d)},[d,l]),v(()=>{let e=K.getTreeNode(c);e&&(e.contain=!!n)},[n]),v(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(ft,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(ft,n)}},[t]),Ct(c,r,n),_t(c,n),Tt(c,r,n),St(c,i),w(()=>{let e=u(a(c.current?c.current[0]:void 0)),t=null;if(V(e,c.current)){for(let n of K.traverse())n.scopeRef&&V(e,n.scopeRef.current)&&(t=n);t===K.getTreeNode(c)&&(R=t.scopeRef)}},[c]),v(()=>()=>{let e=K.getTreeNode(c)?.parent?.scopeRef??null;(c===R||U(c,R))&&(!e||K.getTreeNode(e))&&(R=e),K.removeTreeNode(c)},[c]);let f=T(()=>mt(c),[]),p=T(()=>({focusManager:f,parentNode:d}),[d,f]);return b.createElement(dt.Provider,{value:p},b.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,b.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function mt(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[0].previousElementSibling,d=G(z(n),{tabbable:i,accept:s},n);d.currentNode=V(c,n)?c:l;let f=d.nextNode();return!f&&o&&(d.currentNode=l,f=d.nextNode()),f&&W(f,!0),f},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||u(a(n[0]??void 0)),l=n[n.length-1].nextElementSibling,d=G(z(n),{tabbable:i,accept:s},n);d.currentNode=V(c,n)?c:l;let f=d.previousNode();return!f&&o&&(d.currentNode=l,f=d.previousNode()),f&&W(f,!0),f},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=G(z(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&W(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=G(z(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&W(o,!0),o}}}function z(e){return e[0].parentElement}function B(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function ht(e){if(!e.form)return Array.from(a(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=c(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function gt(e){if(e.checked)return!0;let t=ht(e);return t.length>0&&!t.some(e=>e.checked)}function _t(e,t){let n=E(void 0),r=E(void 0);v(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let o=a(i?i[0]:void 0),l=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=u(o),r=e.current;if(!r||!V(n,r))return;let i=G(z(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let a=t.shiftKey?i.previousNode():i.nextNode();a||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),a&&(W(a,!0),a instanceof c(a).HTMLInputElement&&a.select())},f=t=>{(!R||U(R,e))&&V(d(t),e.current)?(R=e,n.current=d(t)):B(e)&&!H(d(t),e)?n.current?n.current.focus():R&&R.current&&xt(R.current):B(e)&&(n.current=d(t))},p=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=ae(),i=(r===`virtual`||r===null)&&_()&&s(),a=u(o);if(!i&&a&&B(e)&&!H(a,e)){R=e;let r=d(t);r&&r.isConnected?(n.current=r,n.current?.focus()):R.current&&xt(R.current)}})};return o.addEventListener(`keydown`,l,!1),o.addEventListener(`focusin`,f,!1),i?.forEach(e=>e.addEventListener(`focusin`,f,!1)),i?.forEach(e=>e.addEventListener(`focusout`,p,!1)),()=>{o.removeEventListener(`keydown`,l,!1),o.removeEventListener(`focusin`,f,!1),i?.forEach(e=>e.removeEventListener(`focusin`,f,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,p,!1))}},[e,t]),v(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function vt(e){return H(e)}function V(t,n){return!t||!n?!1:n.some(n=>e(n,t))}function H(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of K.traverse(K.getTreeNode(t)))if(n&&V(e,n.current))return!0;return!1}function yt(e){return H(e,R)}function U(e,t){let n=K.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function W(e,t=!1){if(e!=null&&!t)try{ee(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function bt(e,t=!0){let n=e[0].previousElementSibling,r=z(e),i=G(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=z(e),i=G(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function xt(e,t=!0){W(bt(e,t))}function St(e,t){let n=b.useRef(t);w(()=>{n.current&&(R=e,!V(u(a(e.current?e.current[0]:void 0)),R.current)&&e.current&&xt(e.current)),n.current=!1},[e])}function Ct(e,t,n){v(()=>{if(t||n)return;let r=e.current,i=a(r?r[0]:void 0),o=t=>{let n=d(t);V(n,e.current)?R=e:vt(n)||(R=null)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,t,n])}function wt(e){let t=K.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Tt(e,t,n){let r=E(typeof document<`u`?u(a(e.current?e.current[0]:void 0)):null);v(()=>{let r=e.current,i=a(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!R||U(R,e))&&V(u(i),e.current)&&(R=e)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),v(()=>{let r=a(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=r.activeElement;if(!H(n,e)||!wt(e))return;let i=K.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=G(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!H(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(H(s,e));t.preventDefault(),t.stopPropagation(),s?W(s,!0):vt(a)?W(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),v(()=>{let n=a(e.current?e.current[0]:void 0);if(!t)return;let i=K.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=K.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=u(n);if(t&&i&&(a&&H(a,e)||a===n.body&&wt(e))){let t=K.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Et(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&K.getTreeNode(n.scopeRef)){Et(bt(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Et(e){e.dispatchEvent(new CustomEvent(ft,{bubbles:!0,cancelable:!0}))&&W(e)}function G(t,r,i){let o=r?.tabbable?de:n,s=a(t?.nodeType===Node.ELEMENT_NODE?t:null),c=je(s,t||s,NodeFilter.SHOW_ELEMENT,{acceptNode(t){return e(r?.from,t)||r?.tabbable&&t.tagName===`INPUT`&&t.getAttribute(`type`)===`radio`&&(!gt(t)||c.currentNode.tagName===`INPUT`&&c.currentNode.type===`radio`&&c.currentNode.name===t.name)?NodeFilter.FILTER_REJECT:o(t)&&(!i||V(t,i))&&(!r?.accept||r.accept(t))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return r?.from&&(c.currentNode=r.from),c}var Dt=class e{constructor(){this.fastMap=new Map,this.root=new Ot({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Ot({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&V(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Ot=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}};let K=new Dt;const kt=typeof document<`u`?b.useInsertionEffect??b.useLayoutEffect:()=>{};function At(e,t,n){let[r,i]=D(e||t),a=E(r),o=E(e!==void 0),s=e!==void 0;w(()=>{o.current,o.current=s},[s]);let c=s?e:r;kt(()=>{a.current=c});let[,l]=xe(()=>({}),{});return[c,S((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),l(),n?.(r,...t))},[n])]}function jt({children:e}){let t=T(()=>({register:()=>{}}),[]);return b.createElement(te.Provider,{value:t},e)}function Mt(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,o=E({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),s=g(e=>{n&&Nt(e,t)&&(i&&i(e),o.current.isPointerDown=!0)}),c=g(e=>{n&&n(e)});w(()=>{let e=o.current;if(r)return;let n=t.current,i=a(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Nt(n,t)&&c(n),e.isPointerDown=!1};return i.addEventListener(`pointerdown`,s,!0),i.addEventListener(`click`,n,!0),()=>{i.removeEventListener(`pointerdown`,s,!0),i.removeEventListener(`click`,n,!0)}}},[t,r])}function Nt(t,n){if(t.button>0)return!1;let r=d(t);if(r){let t=r.ownerDocument;if(!t||!e(t.documentElement,r)||r.closest(`[data-react-aria-top-layer]`))return!1}return n.current?!t.composedPath().includes(n.current):!1}const Pt={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function Ft(e={}){let{style:t,isFocusable:n}=e,[r,i]=D(!1),{focusWithinProps:a}=se({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=T(()=>r?t:t?{...Pt,...t}:Pt,[r]);return{visuallyHiddenProps:{...a,style:o}}}function It(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=Ft(e);return b.createElement(n,f(a,o),t)}const Lt=x({});function Rt(){return C(Lt)??{}}const zt=b.createContext(null);function Bt(e){let n=t(),{portalContainer:r=n?null:document.body,isExiting:i}=e,[a,o]=D(!1),s=T(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Rt();if(!e.portalContainer&&c&&(r=c()),!r)return null;let l=e.children;return e.disableFocusManagement||(l=b.createElement(pt,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},l)),l=b.createElement(zt.Provider,{value:s},b.createElement(jt,null,l)),Te.createPortal(l,r)}function Vt(){let e=C(zt)?.setContain;v(()=>{e?.(!0)},[e])}function Ht(e,t){let{role:n=`dialog`}=e,i=m();i=e[`aria-label`]?void 0:i;let a=E(!1);return w(()=>{if(t.current&&!re(t.current)){ee(t.current);let e=setTimeout(()=>{(u()===t.current||u()===document.body)&&(a.current=!0,t.current&&(t.current.blur(),ee(t.current)),a.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Vt(),E(!1),w(()=>{}),{dialogProps:{...r(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||i,onBlur:e=>{a.current&&e.stopPropagation()}},titleProps:{id:i}}}var Ut={};Ut={dismiss:`تجاهل`};var Wt={};Wt={dismiss:`Отхвърляне`};var Gt={};Gt={dismiss:`Odstranit`};var Kt={};Kt={dismiss:`Luk`};var qt={};qt={dismiss:`Schließen`};var Jt={};Jt={dismiss:`Απόρριψη`};var Yt={};Yt={dismiss:`Dismiss`};var Xt={};Xt={dismiss:`Descartar`};var Zt={};Zt={dismiss:`Lõpeta`};var Qt={};Qt={dismiss:`Hylkää`};var $t={};$t={dismiss:`Rejeter`};var en={};en={dismiss:`התעלם`};var tn={};tn={dismiss:`Odbaci`};var nn={};nn={dismiss:`Elutasítás`};var rn={};rn={dismiss:`Ignora`};var an={};an={dismiss:`閉じる`};var on={};on={dismiss:`무시`};var sn={};sn={dismiss:`Atmesti`};var cn={};cn={dismiss:`Nerādīt`};var ln={};ln={dismiss:`Lukk`};var un={};un={dismiss:`Negeren`};var dn={};dn={dismiss:`Zignoruj`};var fn={};fn={dismiss:`Descartar`};var pn={};pn={dismiss:`Dispensar`};var mn={};mn={dismiss:`Revocare`};var hn={};hn={dismiss:`Пропустить`};var gn={};gn={dismiss:`Zrušiť`};var _n={};_n={dismiss:`Opusti`};var vn={};vn={dismiss:`Odbaci`};var yn={};yn={dismiss:`Avvisa`};var bn={};bn={dismiss:`Kapat`};var xn={};xn={dismiss:`Скасувати`};var Sn={};Sn={dismiss:`取消`};var Cn={};Cn={dismiss:`關閉`};var wn={};wn={"ar-AE":Ut,"bg-BG":Wt,"cs-CZ":Gt,"da-DK":Kt,"de-DE":qt,"el-GR":Jt,"en-US":Yt,"es-ES":Xt,"et-EE":Zt,"fi-FI":Qt,"fr-FR":$t,"he-IL":en,"hr-HR":tn,"hu-HU":nn,"it-IT":rn,"ja-JP":an,"ko-KR":on,"lt-LT":sn,"lv-LV":cn,"nb-NO":ln,"nl-NL":un,"pl-PL":dn,"pt-BR":fn,"pt-PT":pn,"ro-RO":mn,"ru-RU":hn,"sk-SK":gn,"sl-SI":_n,"sr-SP":vn,"sv-SE":yn,"tr-TR":bn,"uk-UA":xn,"zh-CN":Sn,"zh-TW":Cn};function Tn(e){return e&&e.__esModule?e.default:e}function En(e){let{onDismiss:t,...n}=e,r=Me(n,ut(Tn(wn),`@react-aria/overlays`).format(`dismiss`)),i=()=>{t&&t()};return b.createElement(It,null,b.createElement(`button`,{...r,tabIndex:-1,onClick:i,style:{width:1,height:1}}))}const q=[];function Dn(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,c=E(void 0);w(()=>{if(i&&!q.includes(t))return q.push(t),()=>{let e=q.indexOf(t);e>=0&&q.splice(e,1)}},[i,t]);let l=()=>{q[q.length-1]===t&&n&&n()},u=e=>{let n=q[q.length-1];c.current=n,(!s||s(d(e)))&&n===t&&e.stopPropagation()},f=e=>{(!s||s(d(e)))&&(q[q.length-1]===t&&e.stopPropagation(),c.current===t&&l()),c.current=void 0},p=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),l())};Mt({ref:t,onInteractOutside:a&&i?f:void 0,onInteractOutsideStart:u});let{focusWithinProps:m}=se({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||yt(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:p,...m},underlayProps:{}}}const J=typeof document<`u`&&window.visualViewport;let Y=0,On;function kn(e={}){let{isDisabled:t}=e;v(()=>{if(!t)return Y++,Y===1&&(On=y()?jn():An()),()=>{Y--,Y===0&&On()}},[t])}function An(){let e=window.innerWidth-document.documentElement.clientWidth;return l(e>0&&(`scrollbarGutter`in document.documentElement.style?X(document.documentElement,`scrollbarGutter`,`stable`):X(document.documentElement,`paddingRight`,`${e}px`)),X(document.documentElement,`overflow`,`hidden`))}function jn(){let e=X(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=d(e);t=j(r)?r:Ne(r,!0),n=!1;let i=r.ownerDocument.defaultView.getSelection();i&&!i.isCollapsed&&i.containsNode(r,!0)&&(n=!0),e.composedPath().some(e=>e instanceof HTMLInputElement&&e.type===`range`)&&(n=!0),`selectionStart`in r&&`selectionEnd`in r&&r.selectionStart<r.selectionEnd&&r.ownerDocument.activeElement===r&&(n=!0)},i=document.createElement(`style`),a=h();a&&(i.nonce=a),i.textContent=`@layer {
2
- * {
3
- overscroll-behavior: contain;
4
- }
5
- }`,document.head.prepend(i);let o=e=>{if(!(e.touches.length===2||n)){if(!t||t===document.documentElement||t===document.body){e.preventDefault();return}t.scrollHeight===t.clientHeight&&t.scrollWidth===t.clientWidth&&e.preventDefault()}},s=e=>{let t=d(e),n=e.relatedTarget;n&&M(n)?(n.focus({preventScroll:!0}),Nn(n,M(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=u(),n=t!=null&&M(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Nn(this,n)};let f=l(Mn(document,`touchstart`,r,{passive:!1,capture:!0}),Mn(document,`touchmove`,o,{passive:!1,capture:!0}),Mn(document,`blur`,s,!0));return()=>{e(),f(),i.remove(),HTMLElement.prototype.focus=c}}function X(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Mn(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Nn(e,t){t||!J?Pn(e):J.addEventListener(`resize`,()=>Pn(e),{once:!0})}function Pn(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=Ne(n);if(e!==document.documentElement&&e!==document.body&&e!==n){let t=e.getBoundingClientRect(),r=n.getBoundingClientRect();if(r.top<t.top||r.bottom>t.top+n.clientHeight){let n=t.bottom;J&&(n=Math.min(n,J.offsetTop+J.height));let i=r.top-t.top-((n-t.top)/2-r.height/2);e.scrollTo({top:Math.max(0,Math.min(e.scrollHeight-e.clientHeight,e.scrollTop+i)),behavior:`smooth`})}}n=e.parentElement}}function Fn(e,t,n){let{overlayProps:r,underlayProps:i}=Dn({...e,isOpen:t.isOpen,onClose:t.close},n);return kn({isDisabled:!t.isOpen}),Vt(),w(()=>{if(t.isOpen&&n.current)return He([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:f(r),underlayProps:i}}function In(e){let[t,n]=At(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:S(()=>{n(!0)},[n]),close:S(()=>{n(!1)},[n]),toggle:S(()=>{n(!t)},[n,t])}}const Ln=x(null),Z=x(null),Rn=be(function(e,t){let n=e[`aria-labelledby`];[e,t]=oe(e,t,Ln);let{dialogProps:i,titleProps:a}=Ht({...e,"aria-labelledby":n},t),o=C(Z);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let s=ne({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),c=r(e,{global:!0});return b.createElement(fe.section,{...f(c,s,i),render:e.render,ref:t,slot:e.slot||void 0},b.createElement(ce,{values:[[Oe,{slots:{[ue]:{},title:{...a,level:2}}}],[le,{slots:{[ue]:{},close:{onPress:()=>o?.close()}}}]]},s.children))}),zn=x(null),Bn=x(null),Vn=be(function(e,t){if(C(Bn))return b.createElement(Gn,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,children:s,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d,...f}=e;return b.createElement(Un,{isDismissable:n,isKeyboardDismissDisabled:r,isOpen:i,defaultOpen:a,onOpenChange:o,isEntering:c,isExiting:l,UNSTABLE_portalContainer:u,shouldCloseOnInteractOutside:d},b.createElement(Gn,{...f,modalRef:t},s))});function Hn(e,n){[e,n]=oe(e,n,zn);let r=C(Z),a=In(e),o=e.isOpen!=null||e.defaultOpen!=null||!r?a:r,s=i(n),c=E(null),l=Re(s,o.isOpen),u=Re(c,o.isOpen),d=l||u||e.isExiting||!1,f=t();return!o.isOpen&&!d||f?null:b.createElement(Wn,{...e,state:o,isExiting:d,overlayRef:s,modalRef:c})}const Un=be(Hn);function Wn({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Fn(t,i,n),s=Le(t.overlayRef)||t.isEntering||!1,c=ne({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=Fe(),u;if(typeof document<`u`){let e=j(document.body)?document.body:document.scrollingElement||document.documentElement,t=e.getBoundingClientRect().height%1;u=e.scrollHeight-t}let d={...c.style,"--visual-viewport-height":l.height+`px`,"--page-height":u===void 0?void 0:u+`px`};return b.createElement(Bt,{isExiting:t.isExiting,portalContainer:e},b.createElement(fe.div,{...f(r(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},b.createElement(ce,{values:[[Bn,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[Z,i]]},c.children)))}function Gn(e){let{modalProps:t,modalRef:n,isExiting:a,isDismissable:o}=C(Bn),s=C(Z),c=i(T(()=>ie(e.modalRef,n),[e.modalRef,n])),l=Le(c),u=ne({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:l,isExiting:a,state:s}});return b.createElement(fe.div,{...f(r(e,{global:!0}),t),...u,ref:c,"data-entering":l||void 0,"data-exiting":a||void 0},o&&b.createElement(En,{onDismiss:s.close}),u.children)}const Kn={en:{required:`This field is required`,selectOption:`Please select an option`,fillFreeText:`Please fill out the free text field`,selectAtLeastOne:`Please select at least one option`,selectRating:`Please select a rating`,titleRequired:`Title is required`,invalidImage:`Invalid image data URL`,invalidRecording:`Invalid recording events`,invalidInput:`Invalid input`,maxLength:`Please enter less than {max} characters`,maxSelected:`Please select less than {max} options`},zh:{required:`此字段为必填项`,selectOption:`请选择一个选项`,fillFreeText:`请填写文本框`,selectAtLeastOne:`请至少选择一个选项`,selectRating:`请选择评分`,titleRequired:`标题为必填项`,invalidImage:`图片数据网址无效`,invalidRecording:`录制事件无效`,invalidInput:`输入无效`,maxLength:`请输入少于 {max} 个字符`,maxSelected:`请选择少于 {max} 个选项`},ms:{required:`Ruangan ini diperlukan`,selectOption:`Sila pilih satu pilihan`,fillFreeText:`Sila isikan ruangan teks`,selectAtLeastOne:`Sila pilih sekurang-kurangnya satu pilihan`,selectRating:`Sila pilih penilaian`,titleRequired:`Tajuk diperlukan`,invalidImage:`URL data imej tidak sah`,invalidRecording:`Acara rakaman tidak sah`,invalidInput:`Masukan tidak sah`,maxLength:`Sila masukkan kurang daripada {max} aksara`,maxSelected:`Sila pilih kurang daripada {max} pilihan`},ta:{required:`இந்தப் புலம் தேவை`,selectOption:`ஒரு விருப்பத்தைத் தேர்ந்தெடுக்கவும்`,fillFreeText:`உரைப் புலத்தில் விவரங்களை உள்ளிடவும்`,selectAtLeastOne:`குறைந்தது ஒரு விருப்பத்தையாவது தேர்ந்தெடுக்கவும்`,selectRating:`மதிப்பீட்டைத் தேர்ந்தெடுக்கவும்`,titleRequired:`தலைப்பு தேவை`,invalidImage:`படத்தின் URL தவறானது`,invalidRecording:`தவறான பதிவு நிகழ்வுகள்`,invalidInput:`தவறான உள்ளீடு`,maxLength:`{max} எழுத்துகளுக்கு மிகாமல் உள்ளிடவும்`,maxSelected:`அதிகபட்சம் {max} விருப்பங்களைத் தேர்ந்தெடுக்கவும்`}},qn=(e=`en`)=>Kn[e],Jn=/^Please enter less than (\d+) characters$/,Yn=/^Please select less than (\d+) options$/,Xn=(e,t)=>{let n=qn(t),r=e.match(Jn);if(r)return n.maxLength.replace(`{max}`,r[1]??``);let i=e.match(Yn);if(i)return n.maxSelected.replace(`{max}`,i[1]??``);switch(e){case`This field is required`:return n.required;case`Please select an option`:return n.selectOption;case`Please fill out the free text field`:return n.fillFreeText;case`Please select at least one option`:return n.selectAtLeastOne;case`Please select a rating`:return n.selectRating;case`Title is required`:return n.titleRequired;case`Invalid image data URL`:return n.invalidImage;case`Invalid recording events`:return n.invalidRecording;case`Invalid input`:return n.invalidInput;default:return e}};function Zn(e,t){let n=e.issues[0];return Xn(n?.message??`Invalid input`,t)}function Qn(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e)}const $n=[`id`,`email`,`name`],er=e=>O.custom(t=>typeof t==`object`&&!!t&&typeof Reflect.get(t,e)==`function`),tr=er(`get_distinct_id`),nr=er(`get_session_id`),rr=er(`getUser`),ir=er(`getInternalContext`),ar=O.string(),or=O.record(O.string(),O.unknown()),sr=O.object({session_id:O.string().optional()}),cr=(e,t)=>{if(typeof window>`u`)return;let n=t.safeParse(Reflect.get(window,e));return n.success?n.data:void 0},lr=()=>{try{let e=cr(`posthog`,tr);if(!e)return;let t=ar.safeParse(e.get_distinct_id());return t.success?t.data:void 0}catch{return}},ur=()=>{try{let e=cr(`posthog`,nr);if(!e)return;let t=ar.safeParse(e.get_session_id());return t.success?t.data:void 0}catch{return}},dr=()=>{try{let e=cr(`DD_RUM`,rr);if(!e)return;let t=or.safeParse(e.getUser());return!t.success||Object.keys(t.data).length===0?void 0:t.data}catch{return}},fr=()=>{try{let e=cr(`DD_RUM`,ir);if(!e)return;let t=sr.safeParse(e.getInternalContext());return t.success?t.data.session_id:void 0}catch{return}},pr=e=>{let t={...e},n=dr(),r;if(n)try{r=JSON.stringify(n)}catch{r=void 0}let i=[[`posthog_distinct_id`,lr()],[`posthog_session_id`,ur()],[`datadog_rum_user`,r],[`datadog_rum_session_id`,fr()],...$n.map(e=>[`datadog_rum_user_${e}`,Qn(n?.[e])])];for(let[e,n]of i)Object.prototype.hasOwnProperty.call(t,e)||n===void 0||n.trim()===``||(t[e]=n);return t},mr=(e,t=!1)=>t?pr(e):e,hr=x({}),gr=()=>C(hr),_r=x({}),vr=({type:e,children:t})=>{let n=T(()=>({type:e}),[e]);return k(_r.Provider,{value:n,children:t})},yr=()=>C(_r),br=x(null),xr=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},autoInjectAnalyticsMetadata:a=!1,locale:s,apiBaseUrl:c})=>{let{type:l}=yr(),u=gr(),d=u.version??`0.9.0`,f=u.build,p=o({publishableKey:n,apiBaseUrl:c}),m=E(void 0),[h,g]=D(),_=h?.client===p&&h.surveyId===t?h.data:void 0;w(()=>{let e=new AbortController;return(async()=>{try{let n=`api/v1/cfti/${t}${s?`?locale=${s}`:``}`,r=await p.get(n,{signal:e.signal}).json(),i=me.safeParse(r);if(!i.success||e.signal.aborted)return;g({client:p,surveyId:t,data:i.data})}catch{}})(),()=>e.abort()},[p,s,t]);let v=S(async({answers:e})=>{let n=crypto.randomUUID(),o=ge({metadata:mr(i,a)}),s=await p.put(`api/v1/cfti/${t}/response/${n}`,{json:{respondent:r,data:e,metadata:o.metadata,warnings:o.warnings,telemetry:{...l!==void 0&&{type:l},version:d,...f&&{build:f}}}}).json();return he.parse({...s,createdAt:new Date(s.createdAt)})},[a,f,p,i,r,t,d,l]),y=S(()=>{p.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[p,r,t]);return w(()=>{let e=m.current;e?.client===p&&e.surveyId===t&&e.respondent===r||_&&r&&(m.current={client:p,surveyId:t,respondent:r},p.post(`api/v1/cfti/${t}/respondent/${r}/event`,{json:{type:`view`}}).catch(()=>{}))},[p,r,_,t]),_?k(br.Provider,{value:{submit:v,dismiss:y,surveyId:t,survey:_,metadata:i},children:e}):null},Sr=e=>C(br)?k(Ce,{children:e.children}):k(xr,{...e}),Cr=()=>{let e=C(br);if(!e)throw Error(`useSurvey must be used within a SurveyProvider`);return e},wr={en:{skip:`Skip`,next:`Next`,back:`Back`,submit:`Submit`,submitAnotherResponse:`Submit another response`,other:`Other`,dismiss:`Dismiss`,close:`Close`,optional:`(optional)`,startTyping:`Start typing...`,feedbackSubmitted:`Feedback submitted!`,surveyDialog:`Survey`,unsupportedQuestionType:`Unsupported question type`,bugReportTitlePlaceholder:`Brief description of the issue`,bugReportDetailsPlaceholder:`Steps to reproduce, expected vs actual behavior, etc.`,attachments:`Attachments`,capturing:`Capturing...`,screenshot:`Screenshot`,screenshotPreview:`Screenshot preview`,removeScreenshot:`Remove screenshot`,loadingRecordingPreview:`Loading recording preview...`,removeRecording:`Remove recording`,record:`Record`,captureError:`Failed to capture screenshot. Please try again.`,recordingError:`Failed to start recording. Please try again.`},zh:{skip:`跳过`,next:`下一步`,back:`上一步`,submit:`提交`,submitAnotherResponse:`提交另一份回复`,other:`其他`,dismiss:`忽略`,close:`关闭`,optional:`(选填)`,startTyping:`开始输入…`,feedbackSubmitted:`反馈已提交!`,surveyDialog:`调查对话框`,unsupportedQuestionType:`不支持的问题类型`,bugReportTitlePlaceholder:`在此输入问题标题`,bugReportDetailsPlaceholder:`在此输入问题内容`,attachments:`附件`,capturing:`截屏中…`,screenshot:`截图`,screenshotPreview:`截图预览`,removeScreenshot:`移除截图`,loadingRecordingPreview:`录像加载中…`,removeRecording:`移除录像`,record:`录制`,captureError:`截图失败,请重试。`,recordingError:`录制启动失败,请重试。`},ms:{skip:`Langkau`,next:`Seterusnya`,back:`Kembali`,submit:`Hantar`,submitAnotherResponse:`Hantar respons lain`,other:`Lain-lain`,dismiss:`Tutup`,close:`Tutup`,optional:`(Pilihan)`,startTyping:`Mula menaip...`,feedbackSubmitted:`Maklum balas dihantar!`,surveyDialog:`Tinjauan`,unsupportedQuestionType:`Jenis soalan tidak disokong`,bugReportTitlePlaceholder:`Penerangan ringkas tentang isu`,bugReportDetailsPlaceholder:`Langkah untuk mengulang semula, tingkah laku dijangka berbanding sebenar, dll.`,attachments:`Lampiran`,capturing:`Sedang menangkap...`,screenshot:`Tangkapan skrin`,screenshotPreview:`Pratonton tangkapan skrin`,removeScreenshot:`Alih keluar tangkapan skrin`,loadingRecordingPreview:`Memuatkan pratonton rakaman...`,removeRecording:`Alih keluar rakaman`,record:`Rakam`,captureError:`Gagal menangkap tangkapan skrin. Sila cuba lagi.`,recordingError:`Gagal memulakan rakaman. Sila cuba lagi.`},ta:{skip:`தவிர்க்கவும்`,next:`அடுத்து`,back:`பின்செல்`,submit:`சமர்ப்பிக்கவும்`,submitAnotherResponse:`மற்றொரு பதிலைச் சமர்ப்பிக்கவும்`,other:`மற்றவை`,dismiss:`மூடு`,close:`மூடு`,optional:`(கட்டாயமில்லை)`,startTyping:`தட்டச்சு செய்யத் தொடங்கவும்...`,feedbackSubmitted:`கருத்து சமர்ப்பிக்கப்பட்டது!`,surveyDialog:`கருத்துக்கணிப்பு`,unsupportedQuestionType:`ஆதரிக்கப்படாத கேள்வி வகை`,bugReportTitlePlaceholder:`சிக்கலின் சுருக்கமான விளக்கம்`,bugReportDetailsPlaceholder:`சிக்கல் எப்படி ஏற்பட்டது, நீங்கள் என்ன எதிர்பார்த்தீர்கள், மேலும் என்ன நடந்தது என்பதை விவரிக்கவும்`,attachments:`இணைப்புகள்`,capturing:`ஸ்கிரீன்ஷாட் எடுக்கப்படுகிறது...`,screenshot:`ஸ்கிரீன்ஷாட்`,screenshotPreview:`ஸ்கிரீன்ஷாட் முன்னோட்டம்`,removeScreenshot:`ஸ்கிரீன்ஷாட்டை அகற்று`,loadingRecordingPreview:`பதிவு முன்னோட்டம் தயாராகிறது...`,removeRecording:`பதிவை அகற்று`,record:`பதிவுசெய்`,captureError:`ஸ்கிரீன்ஷாட் எடுக்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`,recordingError:`பதிவைத் தொடங்க முடியவில்லை. மீண்டும் முயற்சிக்கவும்.`}},Q=(e=`en`)=>wr[e],Tr=(e,t,n)=>e===wr.en[t]?Q(n)[t]:e,$=(e,t,n)=>!e||e===wr.en[t]?Q(n)[t]:e,Er=(e,t)=>Tr(e,`other`,t),Dr=(e,t)=>$(e,`close`,t),Or=(e,t)=>$(e,`feedbackSubmitted`,t),kr=(e,t)=>$(e,`bugReportTitlePlaceholder`,t),Ar=(e,t)=>$(e,`bugReportDetailsPlaceholder`,t),jr=()=>{let[e,t]=D(!1);return w(()=>{let e=e=>{let n=_e.safeParse(e);n.error||t(n.data.detail.isRecording)};return document.addEventListener(ve,e),()=>{document.removeEventListener(ve,e)}},[]),e},Mr=({className:e,iconClassName:t,onClose:n,locale:r})=>jr()?null:k(`button`,{type:`button`,className:e,"aria-label":Q(r).dismiss,onClick:n,children:k(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:k(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M3.53 3.529c.26-.26.682-.26.942 0l3.529 3.528 3.528-3.528a.667.667 0 0 1 .943.942L8.943 8l3.53 3.528a.667.667 0 0 1-.944.943L8.001 8.943 4.472 12.47a.667.667 0 1 1-.943-.943L7.058 8 3.529 4.47a.667.667 0 0 1 0-.942Z`,clipRule:`evenodd`})})}),Nr=({children:e,classNames:t,isDismissable:n,onDismiss:r,onClose:i,closeOnFinishMs:a,isSubmitted:o,onSubmitted:s,locale:c})=>{let{survey:l,surveyId:u,dismiss:d}=Cr(),[f,p]=D(!1);return Se(()=>{l&&i?.()},f?a:null),we(Rn,{"aria-label":Q(c).surveyDialog,id:`${u}-popover`,className:A(`confetti-modal-dialog ${ye}`,t?.dialog),children:[n&&k(Mr,{className:A(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,locale:c,onClose:async()=>{!o&&!f&&(await d(),r?.()),i?.()}}),typeof e==`function`?e({setIsSubmitted:()=>s?.(),setIsFinished:()=>p(!0)}):e]})},Pr=({children:e,classNames:t,onDismiss:n,onClose:r,isDismissable:i=!0,closeOnFinishMs:a=3e3,locale:o})=>{let{dismiss:s}=Cr(),[c,l]=D(!1);return k(Un,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(c||(await s(),n?.()),r?.())},className:A(`confetti-modal-overlay ${ye}`,t?.overlay),children:k(Vn,{className:A(`confetti-modal ${ye}`,t?.modal),children:k(Nr,{classNames:t,isDismissable:i,onDismiss:n,onClose:r,closeOnFinishMs:a,isSubmitted:c,onSubmitted:()=>l(!0),locale:o,children:e})})})};export{De as S,At as _,Q as a,Me as b,Dr as c,br as d,Sr as f,It as g,Zn as h,jr as i,Or as l,vr as m,Nr as n,Ar as o,Cr as p,Mr as r,kr as s,Pr as t,Er as u,G as v,ke as x,Qe as y};
@@ -1 +0,0 @@
1
- import{z as e}from"zod";const t=e.object({type:e.literal(`next`)}),n=e.object({type:e.literal(`end`)}),r=e.object({type:e.literal(`jump`),target:e.number({error:`Target question is required`})}),i=e.discriminatedUnion(`type`,[t,r,n]),a=e.object({type:e.literal(`value`),value:e.union([e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),e.number({error:`Value is required`})])}),o=e.object({type:e.literal(`binary-operator`),operator:e.union([e.literal(`equal`),e.literal(`not-equal`),e.literal(`greater`),e.literal(`greater-or-equal`),e.literal(`less`),e.literal(`less-or-equal`),e.literal(`contains`),e.literal(`not-contains`)]),value:a,target:i}),s=e.object({type:e.literal(`switch`),cases:e.array(o),default:i}),c=e.object({type:e.literal(`always`),target:i}),ee=e.discriminatedUnion(`type`,[c,s]),l=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),u=e.optional(e.string().check(e.trim(),e.maxLength(50))),te=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),label:e.optional(e.string()),description:e.optional(e.string().check(e.trim())),translationId:e.optional(e.cuid2())}),d=e.array(te).check(e.superRefine((e,t)=>{let n=new Set;for(let r of e)if(r.translationId!==void 0){if(n.has(r.translationId)){t.addIssue({code:`custom`,message:`Option translation ids must be unique within a question`});return}n.add(r.translationId)}})),f=e.nullable(e.object({label:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),max:e.number(),description:e.optional(e.string().check(e.trim()))})),p=e.optional(e.boolean()),ne=e.object({type:e.literal(`rating`),buttonLabel:u,shouldAutoProgress:p,scale:e.number().check(e.gte(2),e.lte(10)),labels:e.optional(e.object({lower:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e))),upper:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e)))})),display:e.optional(e.literal([`star`,`emoji`,`number`]))}),re=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:u,max:e.number()}),ie=e.object({type:e.literal(`single-select`),shouldAutoProgress:p,options:d,buttonLabel:u,editable:f}),ae=e.object({type:e.literal(`multi-select`),buttonLabel:u,options:d,editable:f,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),oe=e.object({type:e.literal(`statement`),buttonLabel:u,buttonUrl:e.optional(l)}),se=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:u,enableScreenshot:e.boolean(),enableRecording:e.boolean(),detailsLabel:e.string().check(e.trim(),e.minLength(1,{error:`Label is required`}),e.maxLength(128)),detailsPlaceholder:e.optional(e.string()),redactClasses:e.optional(e.array(e.string()))}),ce=e.discriminatedUnion(`type`,[ne,ie,re,ae,oe,se]),m=e=>e.trim()===``?void 0:e,h=e.string().transform(m).optional(),g=e.string().check(e.maxLength(50)).transform(m).optional(),le=e.string().check(e.maxLength(128)).transform(m).optional(),_=e.object({label:h,description:h}),v=e.optional(e.object({label:h,description:h})),y=e.object({type:e.literal(`rating`),buttonLabel:g,labels:e.optional(e.object({lower:h,upper:h}))}),ue=e.object({type:e.literal(`open-ended`),placeholder:h,buttonLabel:g}),de=e.object({type:e.literal(`single-select`),buttonLabel:g,options:e.optional(e.record(e.string(),_)),editable:v}),fe=e.object({type:e.literal(`multi-select`),buttonLabel:g,options:e.optional(e.record(e.string(),_)),editable:v}),pe=e.object({type:e.literal(`statement`),buttonLabel:g}),me=e.object({type:e.literal(`bug-report`),placeholder:h,buttonLabel:g,detailsLabel:le,detailsPlaceholder:h}),he=e.discriminatedUnion(`type`,[y,ue,de,fe,pe,me]),b=`__CONFETTI_CHECKBOX_Others`,x=`__CONFETTI_RADIO_Others`,ge=e.optional(e.looseObject({userAgent:e.string().check(e.trim(),e.maxLength(1e3)),screenResolution:e.string().check(e.trim(),e.maxLength(100)),viewportSize:e.string().check(e.trim(),e.maxLength(100)),pageUrl:e.string(),pageTitle:e.string().check(e.trim(),e.maxLength(1e3)),referrer:e.string(),datadogTraceId:e.optional(e.string()),datadogSessionId:e.optional(e.string()),datadogSessionReplayLink:e.optional(e.string())}).partial().catchall(e.optional(e.string())));e.cuid2();const S=e.looseObject({type:e.literal([0,1,2,3,4,5,6]),data:e.unknown(),timestamp:e.number(),delay:e.optional(e.number())});e.array(S);const C=e.array(S),w=e.string().check(e.refine(e=>{try{return C.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),T=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),E=t=>e.object({title:e.string().check(e.trim(),...t?[e.minLength(1,{error:`Title is required`})]:[],e.maxLength(256)),description:e.optional(e.string().check(e.trim(),e.maxLength(4096))),screenshotDataUrl:e.optional(T),recordingEventsJson:e.optional(w),metadata:ge});E(!0);const D=E(!1),O=(e,{required:t})=>E(t),k=e=>{if(!e)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0}catch{return!1}},A=e=>!e.title.trim()&&!e.description?.trim()&&!e.screenshotDataUrl&&!k(e.recordingEventsJson),j=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),M=({scale:t},{required:n})=>{let r=j(t);return n?r:e.optional(r)},N=({maxLength:t},{required:n})=>e.string().check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),P=(t,n)=>e.string({error:`Please select an option`}).check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==x,{error:`Please fill out the free text field`})),F=({maxLength:t},{required:n})=>{let r=P(t,n);return n?r:e.optional(r)},I=({maxSelected:t,maxLength:n},{required:r})=>e.array(e.string().check(e.trim(),...r?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(n??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==b,{error:`Please fill out the free text field`}))).check(...r?[e.minLength(1,{error:`Please select at least one option`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),L=()=>e.optional(e.string()),R=[`en`,`zh`,`ms`,`ta`],z=e.enum(R),B=e.cuid2(),_e=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),V=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:ce,routingLogic:ee}),H=e.object({title:h,description:h,backButtonLabel:g,confirmation:e.optional(e.object({title:h,description:h,buttonText:h}))});e.partialRecord(z,H);const ve=e.object({title:h,description:h,properties:e.optional(he)});e.partialRecord(z,ve);const ye=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(V),confirmation:_e,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({locale:e.optional(z)}),e.object({cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const U=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),status:e.enum([`active`,`inactive`]),createdAt:e.date(),updatedAt:e.date()});e.object({data:e.array(U),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:B});const be=V;e.object({data:e.object({...U.shape,questions:e.array(be)})}),e.object({surveyId:B,responseId:e.union([e.cuid2(),e.uuid()])});const xe=e.catch(e.object({type:e.enum([`embedded`,`popover`,`modal`]),version:e.string().check(e.trim(),e.minLength(1),e.maxLength(50)),build:e.string().check(e.trim(),e.minLength(1),e.maxLength(50))}).partial(),{}),W=e.record(e.string(),e.union([e.string().check(e.trim(),e.maxLength(2048)),e.number(),e.array(e.string().check(e.trim(),e.maxLength(2048))).check(e.maxLength(1024)),D])),G=1e3,K=e.string().check(e.trim(),e.maxLength(G)),Se=e.record(K,K),q=e.string().trim().min(1).max(G),J=e.discriminatedUnion(`code`,[e.object({code:e.literal(`metadata_value_truncated`),key:q}).strict(),e.object({code:e.literal(`metadata_value_invalid`),key:q}).strict(),e.object({code:e.literal(`metadata_key_invalid`),position:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_key_duplicate`),key:q}).strict(),e.object({code:e.literal(`metadata_entry_limit`),droppedCount:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_container_invalid`)}).strict(),e.object({code:e.literal(`metadata_warning_details_omitted`),count:e.number().int().positive().max(2**53-1)}).strict(),e.object({code:e.literal(`metadata_warning_report_invalid`)}).strict()]),Ce=e.object({metadata:e.array(J).min(1).max(20)}).strict(),we=e.object({metadata:e.array(J).min(1)}).strict(),Y=(e,t)=>Math.min(2**53-1,e+t),X=e=>{let t=[],n=0;for(let r of e)r.code===`metadata_warning_details_omitted`?n=Y(n,r.count):t.push(r);let r=n>0||t.length>20?19:20,i=t.slice(0,r);return n=Y(n,t.length-i.length),n>0?[...i,{code:`metadata_warning_details_omitted`,count:n}]:i},Te=e=>{let t=X(e);return t.length>0?{metadata:t}:void 0},Ee=e=>{if(e===void 0)return[];let t=we.safeParse(e);return t.success?X(t.data.metadata):[{code:`metadata_warning_report_invalid`}]},De=e=>{if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Reflect.getPrototypeOf(e);return t===Object.prototype||t===null},Oe=e=>{if(e===void 0)return{metadata:{},warnings:[]};if(!De(e))return{metadata:{},warnings:[{code:`metadata_container_invalid`}]};let t=new Map,n=[],r=0;for(let[i,[a,o]]of Object.entries(e).entries()){let e=a.trim();if(e.length===0||e.length>1e3){n.push({code:`metadata_key_invalid`,position:i+1});continue}if(typeof o!=`string`){n.push({code:`metadata_value_invalid`,key:e});continue}if(t.has(e)){n.push({code:`metadata_key_duplicate`,key:e});continue}if(t.size>=20){r+=1;continue}let s=o.trim(),c=s.length>1e3?`${s.slice(0,G-11)}[truncated]`:s;c!==s&&n.push({code:`metadata_value_truncated`,key:e}),t.set(e,c)}return r>0&&n.push({code:`metadata_entry_limit`,droppedCount:r}),{metadata:Object.fromEntries(t),warnings:X(n)}},Z=({metadata:e,warnings:t})=>{let n=Oe(e);return{metadata:n.metadata,warnings:Te([...n.warnings,...Ee(t)])}};Se.check(e.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`)),e.object({respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048)),data:W,metadata:e.unknown().optional(),warnings:e.unknown().optional(),telemetry:e.optional(xe)}).transform(e=>{let{metadata:t,warnings:n,...r}=e,{metadata:i,warnings:a}=Z({metadata:t,warnings:n});return{...r,metadata:i,...a&&{warnings:a}}});const ke=e.object({id:e.string(),createdAt:e.date(),warnings:e.optional(Ce)});e.object({surveyId:B,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:B,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:B});const Ae=e.object({lastRespondedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastViewedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastDismissedAt:e.nullable(e.union([e.iso.datetime(),e.date()]))});e.object({type:e.enum([`view`,`dismiss`])}),e.object({}),e.object({surveyId:B}),e.object({respondent:e.optional(e.string().check(e.trim(),e.minLength(1),e.maxLength(255))),after:e.optional(e.iso.datetime({offset:!0,local:!0})),before:e.optional(e.iso.datetime({offset:!0,local:!0})),cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const je=e.object({id:e.string(),respondent:e.string(),data:W,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(je),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})});const Q=e.number().check(e.int(),e.gte(0));e.object({data:e.object({totalViews:Q,uniqueViewers:Q,totalDismissals:Q,uniqueDismissers:Q,totalResponses:Q,uniqueResponders:Q})}),e.object({questionIds:e.array(e.string()).check(e.minLength(1)),timeRange:e.union([e.enum([`last-7-days`,`last-30-days`]),e.string().check(e.regex(/^q[1-4]-\d{4}$/)),e.string().check(e.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const $=e.record(e.string(),e.record(e.string(),e.number()));e.object({data:e.object({current:$,previousQuarter:e.nullable($)})});export{R as a,I as c,F as d,L as f,l as h,ye as i,N as l,x as m,ke as n,O as o,b as p,Z as r,A as s,Ae as t,M as u};