@opengovsg/confetti 0.3.3 → 0.4.0
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.
- package/README.md +42 -5
- package/build/Confetti-X1LYIVnH.d.ts +86 -0
- package/build/DefaultConfettiTrigger-JDSIZWbW.js +1 -0
- package/build/ModalContainer-B3QLAjgy.js +11 -0
- package/build/{ModalContainer-BT1Bys9H.d.ts → ModalContainer-CPX4GCql.d.ts} +2 -2
- package/build/client-internals.d.ts +1 -1
- package/build/client-internals.js +1 -1
- package/build/components.d.ts +261 -0
- package/build/components.js +1 -0
- package/build/index.d.ts +31 -370
- package/build/index.js +1 -1
- package/package.json +23 -4
- package/build/ModalContainer-DiVIAVi2.js +0 -11
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./internals-B5GhpjgM.js";import{A as a,B as o,C as s,D as c,E as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,N as v,O as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as E,W as D,X as ee,Y as te,_ as O,a as k,b as A,c as ne,d as re,f as ie,g as ae,h as oe,i as se,j,k as ce,l as le,m as ue,o as de,p as fe,q as pe,r as me,s as M,t as he,u as ge,v as _e,w as N,x as P,y as ve,z as ye}from"./ModalContainer-DiVIAVi2.js";import{ErrorBoundary as F}from"react-error-boundary";import I,{Suspense as be,createContext as L,forwardRef as R,lazy as xe,useCallback as z,useContext as Se,useEffect as B,useMemo as V,useRef as H,useState as U}from"react";import{useLocalStorage as Ce,useSessionStorage as we,useTimeout as Te}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 Ee(e){return e.issues[0]?.message??`Invalid input`}const J={rating:({scale:e},t)=>pe({scale:e},t),"open-ended":({max:e},t)=>h({maxLength:e},t),"single-select":({editable:e},t)=>m({maxLength:e?.max},t),"multi-select":({editable:e,max:t},n)=>d({maxLength:e?.max,maxSelected:t},n),statement:(e,t)=>te(),"bug-report":(e,t)=>D({},t)},De=(e,t)=>{let n=e.type;switch(n){case`rating`:{let r=J[n];return r(e,t)}case`open-ended`:{let r=J[n];return r(e,t)}case`single-select`:{let r=J[n];return r(e,t)}case`multi-select`:{let r=J[n];return r(e,t)}case`statement`:{let r=J[n];return r(e,t)}case`bug-report`:{let r=J[n];return r(e,t)}default:throw Error(`Unsupported question type`)}},Oe=({originalQuestions:e,answers:t,errors:r,pointer:i=-1})=>{if(!e)return{questions:[],currentIndex:-1};let a=e.sort((e,t)=>e.position-t.position).map(e=>{let t={...e},n=r[e.id];return n&&(t.error=n),{...t,visible:!1}});for(let e=0;e<a.length;e++){let r=a[e];if(!r)continue;let o=n({index:e,questions:a,answers:t});r.visible=i===e||o}let o=a.findIndex((e,n)=>n>i&&e.visible&&t[e.id]===void 0);return o===-1&&(o=a.findLastIndex(e=>!!e.visible)),{questions:a,currentIndex:o}},ke=({questions:e,answers:t})=>{let n=Ae({questions:e,answers:t});return Object.fromEntries(Object.entries(n).filter(([,e])=>e!==null))},Ae=({questions:e,answers:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),je=({questions:e,errors:t})=>Object.fromEntries(Object.entries(t).filter(([t])=>!!e.find(e=>e.id===t)?.visible)),Me=({current:e,shouldAutoSubmit:t,onFinished:n,children:r})=>{let{survey:a,submit:o}=f(),[s,c]=U({}),[l,u]=U({}),d=V(()=>Oe({originalQuestions:a?.questions,answers:s,errors:l,pointer:e}),[a?.questions,s,l,e]),p=V(()=>!!d.questions.filter(({required:e,visible:t})=>!!e&&!!t).every(({id:e})=>s[e]!==void 0),[s,d.questions]),[m,h]=U(!1),g=z(({answers:e})=>{o({answers:e}).finally(()=>{n?.()})},[n,o]),_=z(()=>{g({answers:ke({questions:d.questions,answers:s})}),h(!0)},[s,d.questions,g]),v=z(({question:n,answer:r})=>{let i=d.questions.at(n);if(!i)return{error:`Question index is invalid`};let o=De(i.properties,{required:i.required}).safeParse(r);if(!o.success){let e=Ee(o.error);return u(t=>{if(t[i.id]===e)return t;let n={...t};return n[i.id]=e,n}),c(e=>{if(!(i.id in e))return e;let t={...e};return delete t[i.id],t}),{error:e}}u(e=>{if(!e[i.id])return e;let t={...e};return delete t[i.id],t});let f=!i.required&&!r?null:r,p={...s};if(p[i.id]===f)return{next:Oe({originalQuestions:a?.questions,answers:p,errors:l,pointer:e}).currentIndex};p[i.id]=f;let m=Oe({originalQuestions:a?.questions,answers:p,errors:l,pointer:e});return p=Ae({questions:m.questions,answers:p}),c(p),u(je({questions:m.questions,errors:l})),m.questions.filter(({visible:e})=>!!e).every(({id:e})=>p[e]!==void 0)&&t&&(g({answers:ke({questions:m.questions,answers:p})}),h(!0)),{next:m.currentIndex}},[d.questions,s,a?.questions,l,t,e,g]);return d.questions.length===0?G(W,{}):G(`div`,{className:`confetti ${i}`,children:r({questions:d.questions,current:e??d.currentIndex,update:v,isCompleted:p,submit:_,isSubmitted:m,errors:l})})},Ne=({children:e,onFinished:t,shouldAutoSubmit:n,...r})=>G(F,{fallback:G(W,{}),children:G(E,{...r,children:G(Me,{shouldAutoSubmit:n,onFinished:t,children:e})})});function Pe(e,t,n){let r=c(e=>{n&&!e.defaultPrevented&&n(t)});B(()=>{let t=e?.current?.form;return t?.addEventListener(`reset`,r),()=>{t?.removeEventListener(`reset`,r)}},[e])}function Fe(e){let{id:t,label:n,"aria-labelledby":r,"aria-label":i,labelElementType:a=`label`}=e;t=p(t);let o=p(),s={};n&&(r=r?`${o} ${r}`:o,s={id:o,htmlFor:a===`label`?t:void 0});let c=ce({id:t,"aria-label":i,"aria-labelledby":r});return{labelProps:s,fieldProps:c}}function Ie(e){let{description:t,errorMessage:n,isInvalid:r,validationState:i}=e,{labelProps:a,fieldProps:o}=Fe(e),s=u([!!t,!!n,r,i]),c=u([!!t,!!n,r,i]);return o=j(o,{"aria-describedby":[s,c,e[`aria-describedby`]].filter(Boolean).join(` `)||void 0}),{labelProps:a,fieldProps:o,descriptionProps:{id:s},errorMessageProps:{id:c}}}function Le(e,t,n){let{validationBehavior:r,focus:i}=e;g(()=>{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(ze(n.current))}});let a=H(!1),o=c(()=>{a.current||t.resetValidation()}),s=c(e=>{t.displayValidation.isInvalid||t.commitValidation();let r=n?.current?.form;!e.defaultPrevented&&n&&r&&Be(r)===n.current&&(i?i():n.current?.focus(),ae(`keyboard`)),e.preventDefault()}),l=c(()=>{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`&&v(window.event)instanceof MessagePort,r?.call(t),a.current=!1}),e.addEventListener(`invalid`,s),e.addEventListener(`change`,l),t?.addEventListener(`reset`,o),()=>{e.removeEventListener(`invalid`,s),e.removeEventListener(`change`,l),t?.removeEventListener(`reset`,o),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}const Ve={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},He={...Ve,customError:!0,valid:!1},Y={isInvalid:!1,validationDetails:Ve,validationErrors:[]},Ue=L({}),We=`__reactAriaFormValidationState`;function X(e){if(e.__reactAriaFormValidationState){let{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}=e[We];return{realtimeValidation:t,displayValidation:n,updateValidation:r,resetValidation:i,commitValidation:a}}return Ge(e)}function Ge(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:He},l=V(()=>!o||i==null?null:Je(qe(o,i)),[o,i]);a?.validationDetails.valid&&(a=void 0);let u=Se(Ue),d=V(()=>r?Array.isArray(r)?r.flatMap(e=>Ke(u[e])):Ke(u[r]):[],[u,r]),[f,p]=U(u),[m,h]=U(!1);u!==f&&(p(u),h(!1));let g=V(()=>Je(m?[]:d),[m,d]),_=H(Y),[v,y]=U(Y),b=H(Y),x=()=>{if(!S)return;C(!1);let e=l||a||_.current;Ye(e,b.current)||(b.current=e,y(e))},[S,C]=U(!1);return B(x),{realtimeValidation:c||g||l||a||Y,displayValidation:s===`native`?c||g||v:c||g||l||a||v,updateValidation(e){s===`aria`&&!Ye(v,e)?y(e):_.current=e},resetValidation(){let e=Y;Ye(e,b.current)||(b.current=e,y(e)),s===`native`&&C(!1),h(!0)},commitValidation(){s===`native`&&C(!0),h(!0)}}}function Ke(e){return e?Array.isArray(e)?e:[e]:[]}function qe(e,t){if(typeof e==`function`){let n=e(t);if(n&&typeof n!=`boolean`)return Ke(n)}return[]}function Je(e){return e.length?{isInvalid:!0,validationErrors:e,validationDetails:He}:null}function Ye(e,t){return e===t?!0:!!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 Xe(...e){let t=new Set,n=!1,r={...Ve};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 Ze(e,t){let{inputElementType:n=`input`,isDisabled:r=!1,isRequired:i=!1,isReadOnly:o=!1,type:s=`text`,validationBehavior:c=`aria`}=e,[l,u]=fe(e.value,e.defaultValue||``,e.onChange),{focusableProps:d}=ue(e,t),f=X({...e,value:l}),{isInvalid:p,validationErrors:m,validationDetails:h}=f.displayValidation,{labelProps:g,fieldProps:_,descriptionProps:y,errorMessageProps:b}=Ie({...e,isInvalid:p,errorMessage:e.errorMessage||m}),x=a(e,{labelable:!0}),S={type:s,pattern:e.pattern},[C]=U(l);return Pe(t,e.defaultValue??C,u),Le(e,f,t),{labelProps:g,inputProps:j(x,n===`input`?S:void 0,{disabled:r,readOnly:o,required:i&&c===`native`,"aria-required":i&&c===`aria`||void 0,"aria-invalid":p||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:l,onChange:e=>u(v(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(I.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,...d,..._}),descriptionProps:y,errorMessageProps:b,isInvalid:p,validationErrors:m,validationDetails:h}}function Qe(e,t,n){let{isDisabled:r=!1,isReadOnly:i=!1,value:o,name:s,form:c,children:l,"aria-label":u,"aria-labelledby":d,validationState:f=`valid`,isInvalid:p,onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:y,onClick:b}=e,x=e=>{e.stopPropagation(),t.setSelected(v(e).checked)},{pressProps:S,isPressed:C}=O({onPressStart:m,onPressEnd:h,onPressChange:g,onPress:_,onPressUp:y,onClick:b,isDisabled:r}),{pressProps:w,isPressed:T}=O({onPressStart:m,onPressEnd:h,onPressChange:g,onPressUp:y,onClick:b,onPress(e){_?.(e),t.toggle(),n.current?.focus()},isDisabled:r||i}),{focusableProps:E}=ue(e,n),D=j(S,E),ee=a(e,{labelable:!0});return Pe(n,t.defaultSelected,t.setSelected),{labelProps:j(w,{onClick:e=>e.preventDefault()}),inputProps:j(ee,{"aria-invalid":p||f===`invalid`||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-controls":e[`aria-controls`],"aria-readonly":i||void 0,onChange:x,disabled:r,...o==null?{}:{value:o},name:s,form:c,type:`checkbox`,...D}),isSelected:t.isSelected,isPressed:C||T,isDisabled:r,isReadOnly:i,isInvalid:p||f===`invalid`}}function $e(e,t,n){let r=X({...e,value:t.isSelected}),{isInvalid:i,validationErrors:a,validationDetails:o}=r.displayValidation,{labelProps:s,inputProps:c,isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f}=Qe({...e,isInvalid:i},t,n);Le(e,r,n);let{isIndeterminate:p,isRequired:m,validationBehavior:h=`aria`}=e;B(()=>{n.current&&(n.current.indeterminate=!!p)});let{pressProps:g}=O({isDisabled:d||f,onPress(){let{[We]:t}=e,{commitValidation:n}=t||r;n()}});return{labelProps:j(s,g,V(()=>({onMouseDown:e=>e.preventDefault()}),[])),inputProps:{...c,checked:l,"aria-required":m&&h===`aria`||void 0,required:m&&h===`native`},isSelected:l,isPressed:u,isDisabled:d,isReadOnly:f,isInvalid:i,validationErrors:a,validationDetails:o}}const et=new WeakMap;function tt(e,t){let{isDisabled:n,name:r,form:i,validationBehavior:o=`aria`}=e,{isInvalid:s,validationErrors:c,validationDetails:l}=t.displayValidation,{labelProps:u,fieldProps:d,descriptionProps:f,errorMessageProps:p}=Ie({...e,labelElementType:`span`,isInvalid:s,errorMessage:e.errorMessage||c});et.set(t,{name:r,form:i,descriptionId:f.id,errorMessageId:p.id,validationBehavior:o});let m=a(e,{labelable:!0}),{focusWithinProps:h}=ie({onBlurWithin:e.onBlur,onFocusWithin:e.onFocus,onFocusWithinChange:e.onFocusChange});return{groupProps:j(m,{role:`group`,"aria-disabled":n||void 0,...d,...h}),labelProps:u,descriptionProps:f,errorMessageProps:p,isInvalid:s,validationErrors:c,validationDetails:l}}function nt(e={}){let{isReadOnly:t}=e,[n,r]=fe(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 rt(e,t,n){let r=nt({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}=et.get(t);c=e.validationBehavior??c;let{realtimeValidation:l}=X({...e,value:r.isSelected,name:void 0,validationBehavior:`aria`}),u=H(Y),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=$e({...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,[We]:{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 it=new WeakMap;function at(e,t,n){let{value:r,children:i,"aria-label":o,"aria-labelledby":s,onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p}=e,m=e.isDisabled||t.isDisabled,h=t.selectedValue===r,g=e=>{e.stopPropagation(),t.setSelectedValue(r)},{pressProps:_,isPressed:v}=O({onPressStart:c,onPressEnd:l,onPressChange:u,onPress:d,onPressUp:f,onClick:p,isDisabled:m}),{pressProps:y,isPressed:b}=O({onPressStart:c,onPressEnd:l,onPressChange:u,onPressUp:f,onClick:p,isDisabled:m,onPress(e){d?.(e),t.setSelectedValue(r),n.current?.focus()}}),{focusableProps:x}=ue(j(e,{onFocus:()=>t.setLastFocusedValue(r)}),n),S=j(_,x),C=a(e,{labelable:!0}),w=-1;t.selectedValue==null?(t.lastFocusedValue===r||t.lastFocusedValue==null)&&(w=0):t.selectedValue===r&&(w=0),m&&(w=void 0);let{name:T,form:E,descriptionId:D,errorMessageId:ee,validationBehavior:te}=it.get(t);return Pe(n,t.defaultSelectedValue,t.setSelectedValue),Le({validationBehavior:te},t,n),{labelProps:j(y,V(()=>({onClick:e=>e.preventDefault(),onMouseDown:e=>e.preventDefault()}),[])),inputProps:j(C,{...S,type:`radio`,name:T,form:E,tabIndex:w,disabled:m,required:t.isRequired&&te===`native`,checked:h,value:r,onChange:g,"aria-describedby":[e[`aria-describedby`],t.isInvalid?ee:null,D].filter(Boolean).join(` `)||void 0}),isDisabled:m,isSelected:h,isPressed:v||b}}function ot(e,t){let{name:n,form:r,isReadOnly:i,isRequired:o,isDisabled:s,orientation:c=`vertical`,validationBehavior:l=`aria`}=e,{direction:u}=_e(),{isInvalid:d,validationErrors:f,validationDetails:m}=t.displayValidation,{labelProps:h,fieldProps:g,descriptionProps:_,errorMessageProps:y}=Ie({...e,labelElementType:`span`,isInvalid:t.isInvalid,errorMessage:e.errorMessage||f}),x=a(e,{labelable:!0}),{focusWithinProps:S}=ie({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=u===`rtl`&&c!==`vertical`?`prev`:`next`;break;case`ArrowLeft`:n=u===`rtl`&&c!==`vertical`?`next`:`prev`;break;case`ArrowDown`:n=`next`;break;case`ArrowUp`:n=`prev`;break;default:return}e.preventDefault();let r=oe(e.currentTarget,{from:v(e),accept:e=>e instanceof b(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))},w=p(n);return it.set(t,{name:w,form:r,descriptionId:_.id,errorMessageId:y.id,validationBehavior:l}),{radioGroupProps:j(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":c,...g,...S}),labelProps:h,descriptionProps:_,errorMessageProps:y,isInvalid:d,validationErrors:f,validationDetails:m}}const st=L({}),Z=R(function(e,t){[e,t]=A(e,t,st);let{elementType:n=`span`,...r}=e,i=N[n];return I.createElement(i,{className:`react-aria-Text`,...r,ref:t})});function ct(e={}){let[t,n]=fe(e.value,e.defaultValue||[],e.onChange),[r]=U(t),i=!!e.isRequired&&t.length===0,a=H(new Map),o=X({...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(Xe(...n.values()))},validationState:e.validationState??(s?`invalid`:null),isInvalid:s,isRequired:i}}let lt=Math.round(Math.random()*1e10),ut=0;function dt(e){let t=V(()=>e.name||`radio-group-${lt}-${++ut}`,[e.name]),[n,r]=fe(e.value,e.defaultValue??null,e.onChange),[i]=U(n),[a,o]=U(null),s=X({...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 Q=L(null),$=R(function(e,t){return Se(Q)?.isInvalid?I.createElement(ft,{...e,ref:t}):null}),ft=R((e,t)=>{let n=Se(Q),r=a(e,{global:!0}),i=P({...e,defaultClassName:`react-aria-FieldError`,defaultChildren:n.validationErrors.length===0?void 0:n.validationErrors.join(` `),values:n});return i.children==null?null:I.createElement(Z,{slot:`errorMessage`,...r,...i,ref:t})}),pt=L(null),mt=L(null),ht=L(null),gt=R(function(e,t){[e,t]=A(e,t,mt);let{validationBehavior:n}=l(pt)||{},r=e.validationBehavior??n??`native`,i=ct({...e,validationBehavior:r}),[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),{groupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=tt({...e,label:s,validationBehavior:r},i),m=P({...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 I.createElement(N.div,{...j(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},I.createElement(ve,{values:[[ht,i],[de,{...u,ref:o,elementType:`span`}],[st,{slots:{description:d,errorMessage:f}}],[Q,p]]},m.children))}),_t=R(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=A(r,t,ye);let{validationBehavior:i}=l(pt)||{},o=e.validationBehavior??i??`native`,s=Se(ht),c=y(V(()=>_(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:u,inputProps:d,isSelected:f,isDisabled:p,isReadOnly:m,isPressed:h,isInvalid:g}=s?rt({...w(e),value:e.value,children:typeof e.children==`function`?!0:e.children},s,c):$e({...w(e),children:typeof e.children==`function`?!0:e.children,validationBehavior:o},nt(e),c),{isFocused:v,isFocusVisible:b,focusProps:x}=re(),S=p||m,{hoverProps:C,isHovered:T}=ge({...e,isDisabled:S}),E=P({...e,defaultClassName:`react-aria-Checkbox`,values:{isSelected:f,isIndeterminate:e.isIndeterminate||!1,isPressed:h,isHovered:T,isFocused:v,isFocusVisible:b,isDisabled:p,isReadOnly:m,isInvalid:g,isRequired:e.isRequired||!1}}),D=a(e,{global:!0});return delete D.id,delete D.onClick,I.createElement(N.label,{...j(D,u,C,E),ref:t,slot:e.slot||void 0,"data-selected":f||void 0,"data-indeterminate":e.isIndeterminate||void 0,"data-pressed":h||void 0,"data-hovered":T||void 0,"data-focused":v||void 0,"data-focus-visible":b||void 0,"data-disabled":p||void 0,"data-readonly":m||void 0,"data-invalid":g||void 0,"data-required":e.isRequired||void 0},I.createElement(ne,{elementType:`span`},I.createElement(`input`,{...j(d,x),ref:c})),E.children)}),vt=L({}),yt=L({});let bt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const xt=le(function(e,t){[e,t]=A(e,t,yt);let{hoverProps:n,isHovered:r}=ge({...e,isDisabled:e.disabled}),{isFocused:i,isFocusVisible:a,focusProps:o}=re({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=P({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-Input`});return I.createElement(N.input,{...j(bt(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})}),St=L(null);function Ct(e){let t=H({});return I.createElement(St.Provider,{value:t},e.children)}const wt=L({isSelected:!1}),Tt=L(null),Et=L(null),Dt=L(null),Ot=R(function(e,t){[e,t]=A(e,t,Tt);let{validationBehavior:n}=l(pt)||{},r=e.validationBehavior??n??`native`,i=dt({...e,validationBehavior:r}),[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),{radioGroupProps:c,labelProps:u,descriptionProps:d,errorMessageProps:f,...p}=ot({...e,label:s,validationBehavior:r},i),m=P({...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 I.createElement(N.div,{...j(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},I.createElement(ve,{values:[[Dt,i],[de,{...u,ref:o,elementType:`span`}],[st,{slots:{description:d,errorMessage:f}}],[Q,p]]},I.createElement(Ct,null,m.children)))}),kt=R(function(e,t){let{inputRef:n=null,...r}=e;[e,t]=A(r,t,Et);let i=I.useContext(Dt),o=y(V(()=>_(n,e.inputRef===void 0?null:e.inputRef),[n,e.inputRef])),{labelProps:s,inputProps:c,isSelected:l,isDisabled:u,isPressed:d}=at({...w(e),children:typeof e.children==`function`?!0:e.children},i,o),{isFocused:f,isFocusVisible:p,focusProps:m}=re(),h=u||i.isReadOnly,{hoverProps:g,isHovered:v}=ge({...e,isDisabled:h}),b=P({...e,defaultClassName:`react-aria-Radio`,values:{isSelected:l,isPressed:d,isHovered:v,isFocused:f,isFocusVisible:p,isDisabled:u,isReadOnly:i.isReadOnly,isInvalid:i.isInvalid,isRequired:i.isRequired}}),x=a(e,{global:!0});return delete x.id,delete x.onClick,I.createElement(N.label,{...j(x,s,g,b),ref:t,"data-selected":l||void 0,"data-pressed":d||void 0,"data-hovered":v||void 0,"data-focused":f||void 0,"data-focus-visible":p||void 0,"data-disabled":u||void 0,"data-readonly":i.isReadOnly||void 0,"data-invalid":i.isInvalid||void 0,"data-required":i.isRequired||void 0},I.createElement(ne,{elementType:`span`},I.createElement(`input`,{...j(c,m),ref:o})),I.createElement(wt.Provider,{value:{isSelected:l}},b.children))}),At=L({});let jt=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i};const Mt=R(function(e,t){[e,t]=A(e,t,At);let{hoverProps:n,isHovered:r}=ge(e),{isFocused:i,isFocusVisible:a,focusProps:o}=re({isTextInput:!0,autoFocus:e.autoFocus}),s=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,c=P({...e,values:{isHovered:r,isFocused:i,isFocusVisible:a,isDisabled:e.disabled||!1,isInvalid:s},defaultClassName:`react-aria-TextArea`});return I.createElement(N.textarea,{...j(jt(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})}),Nt=L(null),Pt=le(function(e,t){[e,t]=A(e,t,Nt);let{validationBehavior:n}=l(pt)||{},r=e.validationBehavior??n??`native`,i=H(null);[e,i]=A(e,i,S);let[o,s]=C(!e[`aria-label`]&&!e[`aria-labelledby`]),[c,u]=U(`input`),{labelProps:d,inputProps:f,descriptionProps:p,errorMessageProps:m,...h}=Ze({...w(e),inputElementType:c,label:s,validationBehavior:r},i),g=z(e=>{i.current=e,e&&u(e instanceof HTMLTextAreaElement?`textarea`:`input`)},[i]),_=P({...e,values:{isDisabled:e.isDisabled||!1,isInvalid:h.isInvalid,isReadOnly:e.isReadOnly||!1,isRequired:e.isRequired||!1},defaultClassName:`react-aria-TextField`}),v=a(e,{global:!0});return delete v.id,I.createElement(N.div,{...v,..._,ref:t,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":h.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0},I.createElement(ve,{values:[[de,{...d,ref:o}],[yt,{...f,ref:g}],[At,{...f,ref:g}],[vt,{role:`presentation`,isInvalid:h.isInvalid,isDisabled:e.isDisabled||!1}],[st,{slots:{description:p,errorMessage:m}}],[Q,h]]},_.children))}),Ft=({title:e,description:t,classNames:n})=>{let{survey:r,dismiss:i}=f();if(!r)return null;let a=t||r.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(M,{className:q(`cf-title`,n?.title),children:e||r.confirmation.title||`Feedback submitted!`}),a&&G(Z,{slot:`description`,className:q(`cf-description`,n?.description),children:a})]})}),G(k,{className:`cf-submit-button`,onPress:i,children:r.confirmation.buttonText||`Close`})]})},It=({children:e,classNames:t,containerProps:n,onDismiss:r,closeOnFinishMs:a=3e3})=>{let{surveyId:o,survey:s,dismiss:c}=f(),[l,u]=U(!1),[d,p]=U(!1),[m,h]=U(!1);return Te(()=>{s&&c()},l&&!(d||m)?a:null),K(`div`,{className:q(`confetti-dialog ${i}`,t?.dialog),id:`${o}-popover`,...n,onMouseEnter:e=>{n?.onMouseEnter?.(e),p(!0)},onMouseLeave:e=>{n?.onMouseLeave?.(e),p(!1)},onFocusCapture:e=>{n?.onFocusCapture?.(e),h(!0)},onBlurCapture:e=>{n?.onBlurCapture?.(e),e.currentTarget.contains(e.relatedTarget)||h(!1)},children:[G(me,{className:q(`confetti-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),r?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},Lt=3e4,Rt=({maskAllInputs:e}={})=>{let[t,n]=U(null),[i,a]=U(!1),[o,s]=U(null),[c,l]=U(30),u=H(null),d=H(null),f=H(null),p=H([]);B(()=>{let e=new CustomEvent(r,{detail:{isRecording:i}});document.dispatchEvent(e)},[i]);let m=z(()=>{d.current&&=(clearInterval(d.current),null),f.current&&=(clearTimeout(f.current),null),u.current=null,l(Lt/1e3)},[]),h=z(()=>{u.current?.(),m(),a(!1),n(JSON.stringify(p.current))},[m]);return{recordingEventsJson:t,isRecording:i,recordingError:o,remainingSeconds:c,startRecording:z(async()=>{a(!0),s(null),n(null),p.current=[];try{let{record:t}=await import(`./record-BZwNFiEW.js`);u.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=>{p.current.push(e)},blockClass:`cfti-block`,maskTextClass:`cfti-mask`,maskAllInputs:e})??null;let n=Lt/1e3;l(n),d.current=setInterval(()=>{--n,l(n)},1e3),f.current=setTimeout(()=>{h()},Lt)}catch{s(`Failed to start recording. Please try again.`),a(!1),m()}},[e,h,m]),stopRecording:h,clear:z(()=>{m(),a(!1),n(null),s(null),p.current=[]},[m])}},zt=e=>e.replace(/\S/g,`*`),Bt=e=>`*`.repeat(e.length),Vt=(e,t)=>{for(let n of Array.from(e.childNodes))n.nodeType===Node.TEXT_NODE?t(n):Vt(n,t)},Ht=e=>{if(e instanceof HTMLInputElement)e.setAttribute(`value`,Bt(e.getAttribute(`value`)??``));else if(e instanceof HTMLTextAreaElement)e.textContent=Bt(e.textContent);else if(e instanceof HTMLSelectElement)for(let t of e.querySelectorAll(`option`))t.textContent=Bt(t.textContent)},Ut=({maskInputs:e})=>({name:`cfti-redact`,afterClone:n=>{let{clone:r}=n;if(r instanceof HTMLElement){for(let e of r.querySelectorAll(`.${t}`)){Vt(e,e=>{e.data=zt(e.data)}),Ht(e);for(let t of e.querySelectorAll(`input, textarea, select`))Ht(t)}if(e)for(let e of r.querySelectorAll(`input, textarea, select`))Ht(e)}}}),Wt=({maskAllInputs:e}={})=>{let[t,n]=U(null),[r,a]=U(!1),[o,s]=U(null);return{screenshotDataUrl:t,isCapturing:r,captureError:o,capture:z(async()=>{a(!0),s(null);try{let{snapdom:t}=await import(`./snapdom-BQZEILL6.js`),r=await(await t(document.documentElement,{embedFonts:!0,exclude:[`.${i}`],excludeMode:`hide`,plugins:[Ut({maskInputs:!!e})],fast:!1})).toCanvas(),a=window.devicePixelRatio||1,o=Math.min(Math.round(window.innerWidth*a),r.width),s=Math.min(Math.round(window.innerHeight*a),r.height),c=document.createElement(`canvas`);c.width=o,c.height=s;let l=c.getContext(`2d`);if(!l)throw Error(`Failed to get 2D context for cropping`);l.drawImage(r,0,0,o,s,0,0,o,s),n(c.toDataURL(`image/png`))}catch{s(`Failed to capture screenshot. Please try again.`)}finally{a(!1)}},[e]),clear:z(()=>{n(null),s(null)},[])}},Gt=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`})]}),Kt=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 qt(){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 Jt(){if(typeof window>`u`||typeof navigator>`u`)return;let e=navigator,t=window.screen,n=qt();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 Yt=xe(()=>import(`./RecordingReplayer-BvU_CHwb.js`)),Xt=({id:e,title:t,description:n,properties:r,onChange:i,required:a,error:o,classNames:s,maskAllInputs:c})=>{let l=V(()=>Jt(),[]),[u,d]=U(``),[f,p]=U(``),{screenshotDataUrl:m,isCapturing:h,captureError:g,capture:_,clear:v}=Wt({maskAllInputs:c}),{recordingEventsJson:y,isRecording:b,recordingError:x,remainingSeconds:S,startRecording:C,stopRecording:w,clear:T}=Rt({maskAllInputs:c}),E=V(()=>({title:u,...f?{description:f}:{},...m?{screenshotDataUrl:m}:{},...y?{recordingEventsJson:y}:{},metadata:l}),[f,l,y,m,u]);B(()=>{i(E)},[E,i]),B(()=>()=>{w()},[w]);let D=V(()=>y?JSON.parse(y):[],[y]);return G(W,{children:b?K(k,{className:q(`cf-bug-report-button`,`cf-bug-report-record-button`,s?.button,s?.recordButton),onPress:w,children:[G(Gt,{}),K(`span`,{children:[30-S,`s /`,` `,30,`s`]})]}):K(`div`,{className:q(`cf-bug-report`,s?.base),children:[K(Pt,{isRequired:a,isInvalid:!!o,name:`${e}-title`,value:u,onChange:d,className:q(`cf-question`,s?.question),children:[K(`div`,{className:q(`cf-header`,s?.header),children:[K(M,{className:q(`cf-title`,s?.title),children:[t,!a&&K(`span`,{className:q(`cf-label-optional`,s?.optionalLabel),children:[` `,`(optional)`]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,s?.description),children:n})]}),G(xt,{placeholder:r.placeholder||`Brief description of the issue`,className:q(`cf-input`,s?.input)})]}),K(Pt,{name:`${e}-description`,value:f,onChange:p,className:q(`cf-question`,s?.question),children:[G(M,{className:q(`cf-title`,s?.title),children:r.detailsLabel}),G(Mt,{placeholder:r.detailsPlaceholder||`Steps to reproduce, expected vs actual behavior, etc.`,className:q(`cf-textarea`,s?.textArea),rows:4})]}),r.enableScreenshot||r.enableRecording?K(`section`,{className:q(`cf-question`,s?.question),children:[G(M,{className:q(`cf-title`,s?.title),children:`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:[m?K(`div`,{className:q(`cf-bug-report-media-preview`,s?.mediaPreview),children:[G(`img`,{src:m,alt:`Screenshot preview`,className:q(`cf-bug-report-screenshot-img`,s?.screenshotImg)}),G(`div`,{className:q(`cf-bug-report-media-actions`,s?.mediaActions),children:G(k,{className:q(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:v,"aria-label":`Remove screenshot`,children:G(Kt,{})})})]}):G(k,{className:q(`cf-bug-report-button`,s?.button),onPress:_,isDisabled:h,children:h?`Capturing...`:`Screenshot`}),g&&G(`div`,{className:q(`cf-error`,s?.error),children:g})]}),r.enableRecording&&K(`div`,{className:q(`cf-bug-report-recording-section`,s?.recordingSection),children:[D.length>0?K(`div`,{className:q(`cf-bug-report-media-preview`,s?.mediaPreview),children:[G(be,{fallback:G(`span`,{className:q(`cf-bug-report-player-loading`,s?.playerLoading),"aria-label":`Loading recording preview...`}),children:G(Yt,{events:D})}),G(`div`,{className:q(`cf-bug-report-media-actions`,s?.mediaActions),children:G(k,{className:q(`cf-bug-report-button`,`cf-bug-report-button-action`,s?.button,s?.buttonAction),onPress:T,"aria-label":`Remove recording`,children:G(Kt,{})})})]}):G(k,{className:q(`cf-bug-report-button`,s?.button),onPress:C,children:`Record`}),x&&G(`div`,{className:q(`cf-error`,s?.error),children:x})]})]})]}):null,G($,{className:q(`cf-error`,s?.error),children:o})]})})},Zt=({id:e,title:t,description:n,properties:r,onChange:i,classNames:a,required:o,error:s})=>{let[c,l]=U(``);return B(()=>{i(c)},[i,c]),K(Pt,{isRequired:o,isInvalid:!!s,name:e,className:q(`cf-question`,a?.question),value:c,onChange:e=>{l(e),i(e)},children:[K(`div`,{className:q(`cf-header`,a?.header),children:[K(M,{className:q(`cf-title`,a?.title),children:[t,!o&&K(`span`,{className:q(`cf-label-optional`,a?.optionalLabel),children:[` `,`(optional)`]})]}),n&&G(Z,{slot:`description`,className:q(`cf-description`,a?.description),children:n})]}),G(Mt,{className:q(`cf-textarea`,a?.textarea),maxLength:r.max,rows:4,placeholder:r.placeholder||`Start typing...`}),G($,{className:q(`cf-error`,a?.error),children:s})]})},Qt=({children:e,classNames:t,description:n,...r})=>G(_t,{...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})]})}),$t=({children:e,classNames:t,...n})=>G(_t,{...n,children:G(`div`,{className:q(`cf-tag-label`,t?.tagLabel),children:e})}),en=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let c=!!n.editable,l=n.display??`checkbox`,[u,d]=U([]),[f,p]=U(``),m=H(null),h=H(null),g=V(()=>{let e=u.indexOf(ee);if(e===-1)return u;let t=[...u];return t[e]=f||`__CONFETTI_CHECKBOX_Others`,t},[f,u]),_=l===`tag`;return B(()=>{i(g)},[i,g]),G(gt,{isRequired:o,isInvalid:!!s,name:a,value:u,onChange:d,className:q(`cf-question`,r?.question),children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(M,{className:q(`cf-title`,r?.title),children:[e,!o&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,`(optional)`]})]}),t&&G(Z,{slot:`description`,className:q(`cf-description`,r?.description),children:t})]}),K(`div`,{className:q(`cf-response-choices`,l===`tag`&&`cf-response-choices-tag`,r?.group),children:[n.options.map((e,t)=>G(_?$t:Qt,{className:q(`cf-choice`,_&&[`cf-tag`,r?.tag],!_&&[`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.value},t)),c&&(_?K(W,{children:[G($t,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:q(`cf-choice cf-tag`,r?.tag),value:`__CONFETTI_CHECKBOX_Others`,children:n.editable?.label}),G(xt,{"data-visible":i.value.includes(`__CONFETTI_CHECKBOX_Others`)||void 0,value:f,onChange:e=>{p(e.target.value)},ref:h,className:q(`cf-input cf-tag-input`,r?.othersInput)})]}):K(`div`,{className:q(`cf-choice cf-others-choice`,r?.othersChoice),children:[G(Qt,{inputRef:m,onChange:e=>{h.current&&e&&requestAnimationFrame(()=>{h.current&&h.current.focus()})},className:q(`cf-checkbox`,r?.checkbox),value:`__CONFETTI_CHECKBOX_Others`,classNames:{indicator:r?.indicator,svg:r?.svg},description:n.editable?.description,children:n.editable?.label}),G(xt,{value:f,onChange:e=>{p(e.target.value)},tabIndex:i.value.includes(`__CONFETTI_CHECKBOX_Others`)?0:-1,ref:h,onFocus:()=>{m.current?.checked===!1&&m.current.click()},className:q(`cf-input`,r?.othersInput)})]}))]}),G($,{className:q(`cf-error`,r?.error),children:s})]})})},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:`M16 16s-1.5-2-4-2-4 2-4 2M7.5 8 10 9M14 9l2.5-1M9 10h.01M15 10h.01`})]}),nn=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`})]}),rn=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`})]}),an=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`})]}),sn=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`})}),cn=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`})}),ln=({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(kt,{className:q(`cf-rating-star`,n?.ratingStar),value:a,"data-filled":o?`true`:void 0,children:G(o?cn:sn,{})},t)})})},un=({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(kt,{className:q(`cf-rating-number`,t?.ratingNumber),value:i,children:r},n)})}),dn=({properties:e,classNames:t,state:n})=>{let r=V(()=>[tn,rn,an,on,nn],[]),i=V(()=>[rn,an,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(kt,{className:q(`cf-rating-emoji`,t?.ratingEmoji),value:s,children:c&&G(c,{})},a)})}):G(un,{properties:e,classNames:t,state:n})},fn=e=>{switch(e.properties.display??`star`){case`emoji`:return G(dn,{...e});case`number`:return G(un,{...e});case`star`:return G(ln,{...e})}},pn=({properties:e,title:t,description:n,classNames:r,onChange:i,id:a,error:o,required:s})=>{let[c,l]=U(null),u=V(()=>c?Number(c):void 0,[c]);return B(()=>{i(u)},[i,u]),G(Ot,{isRequired:s,isInvalid:!!o,name:a,className:q(`cf-question`,r?.question),value:c,onChange:l,children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(M,{className:q(`cf-title`,r?.title),children:[t,!s&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,`(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(fn,{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($,{className:q(`cf-error`,r?.error),children:o})]})})},mn=({classNames:e,className:t,description:n,...r})=>G(kt,{...r,className:q(t,e?.radio),children:s(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})]}))}),hn=({title:e,description:t,properties:n,classNames:r,onChange:i,id:a,required:o,error:s})=>{let[c,l]=U(null),[u,d]=U(``),f=!!n.editable,p=H(null),m=H(null),h=V(()=>c===`__CONFETTI_RADIO_Others`?u||`__CONFETTI_RADIO_Others`:c??void 0,[u,c]);return B(()=>{i(h)},[i,h]),G(Ot,{isRequired:o,isInvalid:!!s,name:a,onChange:e=>{l(e),e===`__CONFETTI_RADIO_Others`&&requestAnimationFrame(()=>{m.current&&m.current.focus()})},value:c,className:q(`cf-question`,r?.question),children:({state:i})=>K(W,{children:[K(`div`,{className:q(`cf-header`,r?.header),children:[K(M,{className:q(`cf-title`,r?.title),children:[e,!o&&K(`span`,{className:q(`cf-label-optional`,r?.optionalLabel),children:[` `,`(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(mn,{classNames:{indicator:r?.indicator,radio:q(`cf-choice cf-radio`,r?.radio)},value:e.value,description:e.description,children:e.value},t)),f&&K(`div`,{className:q(`cf-choice cf-others-choice`,r?.othersChoice),children:[G(mn,{inputRef:p,value:`__CONFETTI_RADIO_Others`,classNames:{indicator:r?.indicator,radio:q(`cf-radio`,r?.radio)},description:n.editable?.description,children:n.editable?.label}),G(xt,{tabIndex:i.selectedValue===`__CONFETTI_RADIO_Others`?0:-1,ref:m,value:u,onChange:e=>d(e.target.value),onFocus:()=>{p.current?.checked===!1&&p.current.click()},className:q(`cf-input`,r?.othersInput)})]})]}),G($,{className:q(`cf-error`,r?.error),children:s})]})})},gn=({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})]})}),_n=({question:e,onChange:t,error:n,maskAllInputs:r})=>{switch(e.properties.type){case`rating`:return G(pn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`open-ended`:return G(Zt,{...e,properties:e.properties,onChange:t,error:n},e.id);case`single-select`:return G(hn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`multi-select`:return G(en,{...e,properties:e.properties,onChange:t,error:n},e.id);case`statement`:return G(gn,{...e,properties:e.properties,onChange:t,error:n},e.id);case`bug-report`:return G(Xt,{...e,properties:e.properties,onChange:t,error:n,maskAllInputs:r},e.id)}return G(`div`,{children:`Unsupported question type`},e.id)},vn=({onPress:e,isDisabled:t,children:n=`Submit`})=>se()?null:G(k,{isDisabled:t,className:`cf-submit-button`,onPress:e,children:n}),yn=e=>{switch(e){case`multi-select`:return[];case`bug-report`:return{title:``};case`statement`:return;default:return``}},bn=e=>e!==void 0&&e!==``&&!(Array.isArray(e)&&e.length===0),xn=({onSubmit:t,children:n,question:r,isLastQuestion:i})=>{let[a,o]=U(yn(r.properties.type)),s=V(()=>De(r.properties,{required:r.required}),[r.properties,r.required]),c=V(()=>{let e=s.safeParse(a);if(!e.success)return Ee(e.error)},[a,s]),l=V(()=>{let t=r.routingLogic;if(t.type!==`always`&&!bn(a)&&r.required)return!0;let n=t.type===`always`?t.target:t.cases.find(t=>e({answer:a,condition:t}))?.target??t.default;return n.type===`end`?!1:n.type===`next`?!i:!0},[a,i,r.required,r.routingLogic]),u=V(()=>r.properties.buttonLabel?r.properties.buttonLabel:l?!r.required&&!bn(a)?`Skip`:`Next`:`Submit`,[a,l,r.properties.buttonLabel,r.required]),d=z(()=>{switch(r.properties.type){case`statement`:if(r.properties.buttonUrl&&typeof window<`u`){let e=x.safeParse(r.properties.buttonUrl).data;e&&window.open(e,`_blank`)}return t(void 0);default:return t(a)}},[a,t,r.properties]),f=V(()=>{switch(r.properties.type){case`rating`:case`single-select`:return!!r.properties.shouldAutoProgress;default:return!1}},[r.properties]);return K(W,{children:[n({onChange:z(e=>{o(e),f&&bn(e)&&s.safeParse(e).success&&t(e)},[f,s,t]),question:r,error:c}),(!f||!r.required)&&G(vn,{isDisabled:!!c,onPress:d,children:u})]})},Sn=({isCompleted:e,onSubmit:t,children:n})=>K(W,{children:[n,e&&G(vn,{onPress:t})]}),Cn=e=>G(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:K(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[G(`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`}),G(`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`}),G(`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`}),G(`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`})]})}),wn=({onClick:e,isWidgetOpen:t,classNames:n,label:r=`Help us improve`})=>t?null:K(k,{onPress:e,className:q(`confetti-trigger`,n?.trigger),children:[G(`span`,{className:q(`confetti-trigger-icon-wrapper`,n?.iconWrapper),"aria-hidden":!0,children:G(Cn,{className:q(`confetti-trigger-icon`,n?.icon),width:24})}),G(`span`,{className:q(`confetti-trigger-label`,n?.label),children:r})]}),Tn=({trigger:e,children:t,publishableKey:n,surveyId:r})=>{let i=f(),[a,s]=U(!1),[c,l]=U(!1);if(!i.isVisible)return null;let u=()=>{s(!1)};return K(W,{children:[e({onClick:()=>s(!0),isWidgetOpen:a,hasSubmitted:c}),a&&G(o.Provider,{value:{...i,dismiss:()=>{i.dismiss(),u()},submit:async e=>{let t=await i.submit(e);return l(!0),t}},children:t({onDismiss:u,surveyId:r,publishableKey:n})})]})},En=({trigger:e=e=>G(wn,{...e}),children:t,...n})=>G(F,{fallback:G(W,{}),children:G(E,{...n,alwaysRenderChildren:!0,children:G(Tn,{trigger:e,surveyId:n.surveyId,publishableKey:n.publishableKey,children:t})})}),Dn=e=>G(F,{fallback:G(W,{}),children:G(T,{type:`embedded`,children:G(Ne,{...e,shouldAutoSubmit:!1,children:({questions:t,update:n,isCompleted:r,submit:i,isSubmitted:a,errors:o})=>a?G(Ft,{}):G(Sn,{onSubmit:i,isCompleted:r,children:t.filter(({visible:e})=>!!e).map(t=>G(_n,{question:t,error:o[t.id]||``,maskAllInputs:e.options?.bugReport?.maskAllInputs,onChange:e=>n({question:t.position,answer:e})},t.position))})})})}),On=({onDismiss:e,closeOnFinishMs:t,isDismissable:n,...r})=>G(F,{fallback:G(W,{}),children:G(T,{type:`modal`,children:G(E,{...r,children:G(he,{onDismiss:e,closeOnFinishMs:t,isDismissable:n,children:({setIsFinished:e})=>G(Me,{...r,shouldAutoSubmit:!1,onFinished:()=>{e(),r.onFinished?.()},children:({questions:e,update:t,isCompleted:n,errors:i,submit:a,isSubmitted:o})=>o?G(Ft,{}):G(Sn,{onSubmit:a,isCompleted:n,children:e.filter(({visible:e})=>!!e).map(e=>G(_n,{question:e,error:i[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),kn=({onDismiss:e,closeOnFinishMs:t,...n})=>G(F,{fallback:G(W,{}),children:G(T,{type:`popover`,children:G(E,{...n,children:G(It,{onDismiss:e,closeOnFinishMs:t,children:({setIsFinished:e})=>G(Me,{shouldAutoSubmit:!0,...n,onFinished:()=>{e(),n.onFinished?.()},children:({current:e,questions:t,update:r,isSubmitted:i})=>{let a=e===t.length-1;if(i)return G(Ft,{});let o=t[e];return o?G(xn,{isLastQuestion:a,question:o,onSubmit:t=>r({question:e,answer:t}),children:e=>G(_n,{maskAllInputs:n.options?.bugReport?.maskAllInputs,...e})},o.id):G(W,{})}})})})})}),An=e=>G(Ne,{...e,shouldAutoSubmit:!0,children:({current:t,questions:n,update:r,isSubmitted:i})=>{let a=t===n.length-1;if(i)return G(Ft,{});let o=n[t];return o?G(xn,{isLastQuestion:a,question:o,onSubmit:e=>r({question:t,answer:e}),children:t=>G(_n,{maskAllInputs:e.options?.bugReport?.maskAllInputs,...t})},o.id):G(W,{})}}),jn=({delay:e})=>{let[t,n]=U(!1),r=V(()=>e,[]);return B(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},Mn=({visits:e,respondent:t})=>{let[n,r]=Ce(`cfti:${V(()=>window.location.pathname,[])}:visits:${t??``}`,0);return B(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:z(()=>r(0),[r])}},Nn=({visits:e,respondent:t})=>{let[n,r]=we(`cfti:${V(()=>window.location.pathname,[])}:visits:${t??``}`,0);return B(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:z(()=>r(0),[r])}},Pn=({threshold:e})=>{let[t,n]=U(()=>typeof window>`u`?!1:window.scrollY>=e);return B(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{me as CloseButton,Ne as Confetti,o as ConfettiContext,Me as ConfettiController,E as ConfettiProvider,En as ConfettiTrigger,Cn as ConfettiTriggerIcon,wn as DefaultConfettiTrigger,Sn as Embed,Dn as EmbeddedConfetti,xn as Flow,Zt as FreeText,On as ModalConfetti,he as ModalContainer,en as MultiChoice,kn as PopoverConfetti,It as PopoverContainer,pn as Rating,hn as SingleChoice,gn as Statement,An as StepperConfetti,_n as SurveyQuestionFactory,Ft as ThankYouMessage,f as useConfetti,jn as useVisibleAfterDelay,Mn as useVisibleAfterPageVisits,Pn as useVisibleAfterScroll,Nn as useVisibleAfterSessionPageVisits};
|
|
1
|
+
import{a as e,d as t,f as n,i as r,m as i,p as a,r as o,t as s}from"./DefaultConfettiTrigger-JDSIZWbW.js";import{B as c,H as l,U as u,V as d,t as f}from"./ModalContainer-B3QLAjgy.js";import{ErrorBoundary as p}from"react-error-boundary";import{useCallback as m,useEffect as h,useMemo as g,useState as _}from"react";import{useLocalStorage as v,useSessionStorage as y}from"usehooks-ts";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";const C=n=>x(p,{fallback:x(b,{}),children:x(u,{type:`embedded`,children:x(a,{...n,shouldAutoSubmit:!1,children:({questions:i,update:a,isCompleted:o,submit:s,isSubmitted:c,errors:l})=>c?x(r,{}):x(t,{onSubmit:s,isCompleted:o,children:i.filter(({visible:e})=>!!e).map(t=>x(e,{question:t,error:l[t.id]||``,maskAllInputs:n.options?.bugReport?.maskAllInputs,onChange:e=>a({question:t.position,answer:e})},t.position))})})})}),w=({onDismiss:n,closeOnFinishMs:a,isDismissable:o,...s})=>x(p,{fallback:x(b,{}),children:x(u,{type:`modal`,children:x(d,{...s,children:x(f,{onDismiss:n,closeOnFinishMs:a,isDismissable:o,children:({setIsFinished:n})=>x(i,{...s,shouldAutoSubmit:!1,onFinished:()=>{n(),s.onFinished?.()},children:({questions:n,update:i,isCompleted:a,errors:o,submit:c,isSubmitted:l})=>l?x(r,{}):x(t,{onSubmit:c,isCompleted:a,children:n.filter(({visible:e})=>!!e).map(t=>x(e,{question:t,error:o[t.id]||``,maskAllInputs:s.options?.bugReport?.maskAllInputs,onChange:e=>i({question:t.position,answer:e})},t.position))})})})})})}),T=({onDismiss:t,closeOnFinishMs:a,...s})=>x(p,{fallback:x(b,{}),children:x(u,{type:`popover`,children:x(d,{...s,children:x(o,{onDismiss:t,closeOnFinishMs:a,children:({setIsFinished:t})=>x(i,{shouldAutoSubmit:!0,...s,onFinished:()=>{t(),s.onFinished?.()},children:({current:t,questions:i,update:a,isSubmitted:o})=>{let c=t===i.length-1;if(o)return x(r,{});let l=i[t];return l?x(n,{isLastQuestion:c,question:l,onSubmit:e=>a({question:t,answer:e}),children:t=>x(e,{maskAllInputs:s.options?.bugReport?.maskAllInputs,...t})},l.id):x(b,{})}})})})})}),E=t=>x(a,{...t,shouldAutoSubmit:!0,children:({current:i,questions:a,update:o,isSubmitted:s})=>{let c=i===a.length-1;if(s)return x(r,{});let l=a[i];return l?x(n,{isLastQuestion:c,question:l,onSubmit:e=>o({question:i,answer:e}),children:n=>x(e,{maskAllInputs:t.options?.bugReport?.maskAllInputs,...n})},l.id):x(b,{})}}),D=({delay:e})=>{let[t,n]=_(!1),r=g(()=>e,[]);return h(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},O=({visits:e,respondent:t})=>{let[n,r]=v(`cfti:${g(()=>window.location.pathname,[])}:visits:${t??``}`,0);return h(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:m(()=>r(0),[r])}},k=({visits:e,respondent:t})=>{let[n,r]=y(`cfti:${g(()=>window.location.pathname,[])}:visits:${t??``}`,0);return h(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:m(()=>r(0),[r])}},A=({threshold:e})=>{let[t,n]=_(()=>typeof window>`u`?!1:window.scrollY>=e);return h(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}},j=({trigger:e,children:t,publishableKey:n,surveyId:r})=>{let i=l(),[a,o]=_(!1),[s,u]=_(!1);if(!i.isVisible)return null;let d=()=>{o(!1)};return S(b,{children:[e({onClick:()=>o(!0),isWidgetOpen:a,hasSubmitted:s}),a&&x(c.Provider,{value:{...i,dismiss:()=>{i.dismiss(),d()},submit:async e=>{let t=await i.submit(e);return u(!0),t}},children:t({onDismiss:d,surveyId:r,publishableKey:n})})]})},M=({trigger:e=e=>x(s,{...e}),children:t,...n})=>x(p,{fallback:x(b,{}),children:x(d,{...n,alwaysRenderChildren:!0,children:x(j,{trigger:e,surveyId:n.surveyId,publishableKey:n.publishableKey,children:t})})});export{M as ConfettiTrigger,C as EmbeddedConfetti,w as ModalConfetti,T as PopoverConfetti,E as StepperConfetti,D as useVisibleAfterDelay,O as useVisibleAfterPageVisits,A as useVisibleAfterScroll,k as useVisibleAfterSessionPageVisits};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengovsg/confetti",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Widgets for Confetti",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"default": "./build/index.js",
|
|
16
16
|
"types": "./build/index.d.ts"
|
|
17
17
|
},
|
|
18
|
+
"./components": {
|
|
19
|
+
"import": "./build/components.js",
|
|
20
|
+
"default": "./build/components.js",
|
|
21
|
+
"types": "./build/components.d.ts"
|
|
22
|
+
},
|
|
18
23
|
"./internals": {
|
|
19
24
|
"import": "./build/internals.js",
|
|
20
25
|
"default": "./build/internals.js",
|
|
@@ -27,6 +32,19 @@
|
|
|
27
32
|
},
|
|
28
33
|
"./confetti.css": "./build/confetti.css"
|
|
29
34
|
},
|
|
35
|
+
"typesVersions": {
|
|
36
|
+
"*": {
|
|
37
|
+
"components": [
|
|
38
|
+
"./build/components.d.ts"
|
|
39
|
+
],
|
|
40
|
+
"internals": [
|
|
41
|
+
"./build/internals.d.ts"
|
|
42
|
+
],
|
|
43
|
+
"client-internals": [
|
|
44
|
+
"./build/client-internals.d.ts"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
},
|
|
30
48
|
"files": [
|
|
31
49
|
"./build/**/*.d.ts",
|
|
32
50
|
"./build/**/*.js",
|
|
@@ -56,7 +74,8 @@
|
|
|
56
74
|
"@csstools/postcss-minify": "^3.0.0",
|
|
57
75
|
"@rrweb/types": "2.0.0-alpha.20",
|
|
58
76
|
"@types/node": "24.10.8",
|
|
59
|
-
"@types/react": "^19.2.
|
|
77
|
+
"@types/react": "^19.2.16",
|
|
78
|
+
"@types/react-dom": "^19.2.3",
|
|
60
79
|
"dotenv-cli": "^11.0.0",
|
|
61
80
|
"esbuild": "^0.27.2",
|
|
62
81
|
"eslint": "^9.39.2",
|
|
@@ -68,9 +87,9 @@
|
|
|
68
87
|
"tsdown": "0.22.1",
|
|
69
88
|
"typescript": "^5.9.3",
|
|
70
89
|
"@confetti/eslint-config": "0.0.0",
|
|
90
|
+
"@confetti/prettier-config": "0.0.0",
|
|
71
91
|
"@confetti/tsconfig": "0.0.0",
|
|
72
|
-
"@confetti/validators": "0.0.0"
|
|
73
|
-
"@confetti/prettier-config": "0.0.0"
|
|
92
|
+
"@confetti/validators": "0.0.0"
|
|
74
93
|
},
|
|
75
94
|
"prettier": "@confetti/prettier-config",
|
|
76
95
|
"scripts": {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./internals-B5GhpjgM.js";import r,{createContext as i,forwardRef as a,useCallback as o,useContext as s,useEffect as c,useMemo as l,useReducer as u,useRef as d,useState as f}from"react";import{z as p}from"zod/v4/mini";import{useLocalStorage as m,useTimeout as h}from"usehooks-ts";import g from"ky";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import b from"clsx";import x,{flushSync as S}from"react-dom";const C=p.object({type:p.literal(`next`)}),w=p.object({type:p.literal(`end`)}),ee=p.object({type:p.literal(`jump`),target:p.number({error:`Target question is required`})}),T=p.discriminatedUnion(`type`,[C,ee,w]),E=p.object({type:p.literal(`value`),value:p.union([p.string().check(p.trim(),p.minLength(1,{error:`Value is required`})),p.number({error:`Value is required`})])}),te=p.object({type:p.literal(`binary-operator`),operator:p.union([p.literal(`equal`),p.literal(`not-equal`),p.literal(`greater`),p.literal(`greater-or-equal`),p.literal(`less`),p.literal(`less-or-equal`),p.literal(`contains`),p.literal(`not-contains`)]),value:E,target:T}),ne=p.object({type:p.literal(`switch`),cases:p.array(te),default:T}),re=p.object({type:p.literal(`always`),target:T}),ie=p.discriminatedUnion(`type`,[re,ne]),ae=p.string().check(p.trim(),p.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),D=p.optional(p.string().check(p.trim(),p.maxLength(50))),oe=p.object({value:p.string().check(p.trim(),p.minLength(1,{error:`Value is required`})),description:p.optional(p.string().check(p.trim()))}),se=p.nullable(p.object({label:p.string().check(p.trim(),p.minLength(1,{error:`Value is required`})),max:p.number(),description:p.optional(p.string().check(p.trim()))})),ce=p.optional(p.boolean()),le=p.object({type:p.literal(`rating`),buttonLabel:D,shouldAutoProgress:ce,scale:p.number().check(p.minimum(2),p.maximum(10)),labels:p.optional(p.object({lower:p.optional(p.pipe(p.string().check(p.trim()),p.transform(e=>e===``?void 0:e))),upper:p.optional(p.pipe(p.string().check(p.trim()),p.transform(e=>e===``?void 0:e)))})),display:p.optional(p.literal([`star`,`emoji`,`number`]))}),ue=p.object({type:p.literal(`open-ended`),placeholder:p.optional(p.string()),buttonLabel:D,max:p.number()}),de=p.object({type:p.literal(`single-select`),shouldAutoProgress:ce,options:p.array(oe),buttonLabel:D,editable:se}),fe=p.object({type:p.literal(`multi-select`),buttonLabel:D,options:p.array(oe),editable:se,max:p.optional(p.number()),display:p.optional(p.literal([`checkbox`,`tag`]))}),pe=p.object({type:p.literal(`statement`),buttonLabel:D,buttonUrl:p.optional(ae)}),me=p.object({type:p.literal(`bug-report`),placeholder:p.optional(p.string()),buttonLabel:D,enableScreenshot:p.boolean(),enableRecording:p.boolean(),detailsLabel:p.string().check(p.trim(),p.minLength(1,{error:`Label is required`}),p.maxLength(128)),detailsPlaceholder:p.optional(p.string()),redactClasses:p.optional(p.array(p.string()))}),he=p.discriminatedUnion(`type`,[le,de,ue,fe,pe,me]),ge=`__CONFETTI_CHECKBOX_Others`,_e=`__CONFETTI_RADIO_Others`,ve=p.optional(p.catchall(p.partial(p.looseObject({userAgent:p.string().check(p.trim(),p.maxLength(1e3)),screenResolution:p.string().check(p.trim(),p.maxLength(100)),viewportSize:p.string().check(p.trim(),p.maxLength(100)),pageUrl:p.string(),pageTitle:p.string().check(p.trim(),p.maxLength(1e3)),referrer:p.string(),datadogTraceId:p.optional(p.string()),datadogSessionId:p.optional(p.string()),datadogSessionReplayLink:p.optional(p.string())})),p.optional(p.string())));p.cuid2();const ye=p.looseObject({type:p.literal([0,1,2,3,4,5,6]),data:p.unknown(),timestamp:p.number(),delay:p.optional(p.number())});p.array(ye);const be=p.array(ye),xe=p.string().check(p.refine(e=>{try{return be.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),Se=p.string().check(p.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),Ce=e=>p.object({title:p.string().check(p.trim(),...e?[p.minLength(1,{error:`Title is required`})]:[],p.maxLength(256)),description:p.optional(p.string().check(p.trim(),p.maxLength(4096))),screenshotDataUrl:p.optional(Se),recordingEventsJson:p.optional(xe),metadata:ve}),we=Ce(!0),Te=(e,{required:t})=>Ce(t),Ee=e=>p.number().check(p.int(),p.minimum(1),p.maximum(e)),De=({scale:e},{required:t})=>{let n=Ee(e);return t?n:p.optional(n)},Oe=({maxLength:e},{required:t})=>p.string().check(p.trim(),...t?[p.minLength(1,{error:`This field is required`})]:[],p.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ke=(e,t)=>p.string().check(p.trim(),...t?[p.minLength(1,{error:`This field is required`})]:[],p.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),p.refine(e=>e!==_e,{error:`Please fill out the free text field`})),Ae=({maxLength:e},{required:t})=>{let n=ke(e,t);return t?n:p.optional(n)},je=({maxSelected:e,maxLength:t},{required:n})=>p.array(p.string().check(p.trim(),...n?[p.minLength(1,{error:`This field is required`})]:[],p.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),p.refine(e=>e!==ge,{error:`Please fill out the free text field`}))).check(...n?[p.minLength(1,{error:`Please select at least one option`})]:[],p.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Me=()=>p.optional(p.string()),Ne=p.cuid2(),Pe=p.object({title:p.string().check(p.trim()),description:p.string().check(p.trim()),buttonText:p.string().check(p.trim())}),Fe=p.object({title:p.string(),description:p.nullable(p.string()),questions:p.array(p.object({id:p.string(),title:p.string(),description:p.nullable(p.string()),position:p.number(),required:p.boolean(),properties:he,routingLogic:ie})),confirmation:Pe});p.object({surveyId:Ne,responseId:p.union([p.cuid2(),p.uuid()])});const Ie=p.catch(p.partial(p.object({type:p.enum([`embedded`,`popover`,`modal`]),version:p.string().check(p.trim(),p.minLength(1),p.maxLength(50))})),{});p.object({respondent:p.string().check(p.trim(),p.minLength(1),p.maxLength(2048)),data:p.record(p.string(),p.union([p.string().check(p.trim(),p.maxLength(2048)),p.number(),p.array(p.string().check(p.trim(),p.maxLength(2048))).check(p.maxLength(1024)),we])),metadata:p.record(p.string().check(p.trim(),p.maxLength(1e3)),p.string().check(p.trim(),p.maxLength(1e3))),telemetry:p.optional(Ie)}),p.object({surveyId:Ne,respondent:p.string().check(p.trim(),p.minLength(1),p.maxLength(2048))}),p.object({surveyId:Ne,respondent:p.string().check(p.trim(),p.minLength(1),p.maxLength(2048))}),p.object({surveyId:Ne});const Le=p.object({lastRespondedAt:p.nullable(p.union([p.iso.datetime(),p.date()])),lastViewedAt:p.nullable(p.union([p.iso.datetime(),p.date()])),lastDismissedAt:p.nullable(p.union([p.iso.datetime(),p.date()]))});p.object({type:p.enum([`view`,`dismiss`])});function Re({surveyId:e,override:t}){let[n,r]=m(`cfti:${e}:respondent`,``);return c(()=>{n||r(crypto.randomUUID())},[n,r]),t||n}const ze={lastRespondedAt:null,lastDismissedAt:null};async function Be({client:e,surveyId:t,respondent:n,signal:r}){try{let i=await e.get(`v1/cfti/${t}/respondent/${n}`,{signal:r}).json(),a=Le.safeParse(i);return a.success?{lastRespondedAt:a.data.lastRespondedAt?new Date(a.data.lastRespondedAt):null,lastDismissedAt:a.data.lastDismissedAt?new Date(a.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,a.error),ze)}catch{return ze}}function Ve({client:e,surveyId:t,respondent:n}){let[r,i]=f(ze),[a,o]=f(!1),[s,l]=f({client:e,surveyId:t,respondent:n});return(s.client!==e||s.surveyId!==t||s.respondent!==n)&&(l({client:e,surveyId:t,respondent:n}),i(ze),o(!1)),c(()=>{if(!n||typeof window>`u`||typeof document>`u`)return;let r=null,a=()=>{r?.abort(),r=new AbortController;let a=r;Be({client:e,surveyId:t,respondent:n,signal:a.signal}).then(e=>{a.signal.aborted||(i(e),o(!0))})};a();let s=()=>{document.visibilityState===`visible`&&a()};return document.addEventListener(`visibilitychange`,s),()=>{r?.abort(),document.removeEventListener(`visibilitychange`,s)}},[e,t,n]),{state:r,isSettled:a}}const He=g.create({prefixUrl:`https://confetti.gov.sg/api`,retry:{limit:3,methods:[`get`]},timeout:6e4});function Ue(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}const We=i(null),Ge=({type:e,children:t})=>{let n=l(()=>({type:e}),[e]);return v(We.Provider,{value:n,children:t})},Ke=()=>s(We),qe=i(null),Je=({children:e,surveyId:t,publishableKey:n,respondent:r,metadata:i={},isSurveyVisible:a,apiBaseUrl:s,alwaysRenderChildren:u})=>{let p=Ke(),m=d(!1),[h,g]=f(),[_,y]=f(!1),b=Re({surveyId:t,override:r}),x=l(()=>{let e={headers:{"x-cfti-pk":n}};return s&&(e.prefixUrl=s),He.extend(e)},[s,n]),{state:S,isSettled:C}=Ve({client:x,surveyId:t,respondent:b});c(()=>{(async()=>{m.current=!1,y(!1),g(void 0);try{let e=await x.get(`v1/cfti/${t}`).json(),n=Fe.safeParse(e);if(!n.success)return;g(n.data)}catch{}finally{y(!0)}})()},[x,t]);let w=o(async({answers:e})=>{let n=crypto.randomUUID();await x.put(`v1/cfti/${t}/response/${n}`,{json:{respondent:b,data:e,metadata:i,telemetry:{...p!==null&&{type:p.type},version:`0.3.3`}}})},[x,i,b,t,p]),ee=o(()=>{u||g(void 0),x.post(`v1/cfti/${t}/respondent/${b}/event`,{json:{type:`dismiss`}}).catch(()=>{})},[u,x,b,t]),T=l(()=>!_||!C?!1:Ue(S,a),[_,C,a,S]);c(()=>{m.current||T&&h&&b&&(m.current=!0,x.post(`v1/cfti/${t}/respondent/${b}/event`,{json:{type:`view`}}).catch(()=>{}))},[x,T,b,h,t]);let E=T&&!!h;return!u&&!E?null:v(qe.Provider,{value:{submit:w,dismiss:ee,surveyId:t,survey:h,metadata:i,isVisible:E},children:e})},Ye=e=>s(qe)?v(_,{children:e.children}):v(Je,{...e,surveyId:e.surveyId,publishableKey:e.publishableKey}),Xe=()=>{let e=s(qe);if(!e)throw Error(`useConfetti must be used within a ConfettiProvider`);return e},Ze=i(null);i(null),i(null),i(null),i(null);const Qe=i({});i(null);const $e=i(null);function et(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 tt(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function O(e){let t=null;return()=>(t??=e(),t)}const nt=O(function(){return tt(/^Mac/i)}),rt=O(function(){return tt(/^iPhone/i)}),it=O(function(){return tt(/^iPad/i)||nt()&&navigator.maxTouchPoints>1}),at=O(function(){return rt()||it()}),ot=O(function(){return et(/AppleWebKit/i)&&!st()}),st=O(function(){return et(/Chrome/i)}),ct=O(function(){return et(/Android/i)}),lt=O(function(){return et(/Firefox/i)});function ut(e){if(ft())e.focus({preventScroll:!0});else{let t=pt(e);e.focus(),mt(t)}}let dt=null;function ft(){if(dt==null){dt=!1;try{document.createElement(`div`).focus({get preventScroll(){return dt=!0,!0}})}catch{}}return dt}function pt(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 mt(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function k(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;lt()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(nt()?r=!0:i=!0);let s=ot()&&nt()&&!it()?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});k.isOpening=n,ut(e),e.dispatchEvent(s),k.isOpening=!1}k.isOpening=!1;const A=typeof document<`u`?r.useLayoutEffect:()=>{},ht={prefix:String(Math.round(Math.random()*1e10)),current:0},gt=r.createContext(ht),_t=r.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let vt=new WeakMap;function yt(e=!1){let t=s(gt),n=d(null);if(n.current===null&&!e){let e=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(e){let n=vt.get(e);n==null?vt.set(e,{id:t.current,state:e.memoizedState}):e.memoizedState!==n.state&&(t.current=n.id,vt.delete(e))}n.current=++t.current}return n.current}function bt(e){let t=s(gt),n=yt(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function xt(e){let t=r.useId(),[n]=f(Et()),i=n?`react-aria`:`react-aria${ht.prefix}`;return e||`${i}-${t}`}const St=typeof r.useId==`function`?xt:bt;function Ct(){return!1}function wt(){return!0}function Tt(e){return()=>{}}function Et(){return typeof r.useSyncExternalStore==`function`?r.useSyncExternalStore(Tt,Ct,wt):s(_t)}function Dt(e){let[t,n]=f(e),r=d(t),i=d(null),a=d(()=>{if(!i.current)return;let e=i.current.next();if(e.done){i.current=null;return}r.current===e.value?a.current():n(e.value)});return A(()=>{r.current=t,i.current&&a.current()}),[t,o(e=>{i.current=e(r.current),a.current()},[a])]}let Ot=!!(typeof window<`u`&&window.document&&window.document.createElement),kt=new Map,At;typeof FinalizationRegistry<`u`&&(At=new FinalizationRegistry(e=>{kt.delete(e)}));function jt(e){let[t,n]=f(e),r=d(null),i=St(t),a=d(null);if(At&&At.register(a,i),Ot){let e=kt.get(i);e&&!e.includes(r)?e.push(r):kt.set(i,[r])}return A(()=>{let e=i;return()=>{At&&At.unregister(a),kt.delete(e)}},[i]),c(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function Mt(e,t){if(e===t)return e;let n=kt.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=kt.get(t);return r?(r.forEach(t=>t.current=e),e):t}function Nt(e=[]){let t=jt(),[n,r]=Dt(t),i=o(()=>{r(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,r]);return A(i,[t,i,...e]),n}function Pt(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const j=e=>e?.ownerDocument??document,M=e=>e&&`window`in e&&e.window===e?e:j(e).defaultView||window;function Ft(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function It(e){return Ft(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function N(){return!1}function P(e,t){if(!N())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:It(n)?n.host:n.parentNode}return!1}const F=(e=document)=>{if(!N())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function I(e){if(N()&&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 Lt(e){if(!e)return!1;let t=e.getRootNode(),n=M(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}var Rt=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(!P(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 i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return P(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 zt(e,t,n,r){return N()?new Rt(e,t,n,r):e.createTreeWalker(t,n,r)}function Bt(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=Vt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():Vt(e[n],null)})}}}function Vt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function L(...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]=Pt(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=b(n,i):e===`id`&&n&&i?t.id=Mt(n,i):e===`ref`&&n&&i?t.ref=Bt(n,i):t[e]=i===void 0?n:i}}return t}const Ht=new Set([`id`]),Ut=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),Wt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),Gt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),Kt=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(`.`)),qt=/^(data-.*)$/;function R(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)&&(Ht.has(t)||n&&Ut.has(t)||r&&Wt.has(t)||i&&Gt.has(t)||a&&(Kt.has(t)||t.endsWith(`Capture`)&&Kt.has(t.slice(0,-7)))||o?.has(t)||qt.test(t))&&(s[t]=e[t]);return s}let z=new Map,Jt=new Set;function Yt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=I(t);if(!e(t)||!r)return;let i=z.get(r);i||(i=new Set,z.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=I(t);if(!e(t)||!r)return;let i=z.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),z.delete(r)),z.size===0)){for(let e of Jt)e();Jt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Yt):Yt());function Xt(){for(let[e]of z)`isConnected`in e&&!e.isConnected&&z.delete(e)}function Zt(e){requestAnimationFrame(()=>{Xt(),z.size===0?e():Jt.add(e)})}function Qt(){let e=d(new Map),t=o((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=o((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=o(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return c(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function $t(e,t){let{id:n,"aria-label":r,"aria-labelledby":i}=e;return n=jt(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 en(e){let t=d(null),n=d(void 0),r=o(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 l(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=r(e))}}),[r])}const tn=r.useInsertionEffect??A;function B(e){let t=d(null);return tn(()=>{t.current=e},[e]),o((...e)=>{let n=t.current;return n?.(...e)},[])}function nn(e,t){A(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function rn(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 an(e,t){let n=e;for(rn(n,t)&&(n=n.parentElement);n&&!rn(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}const on=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function sn(e){return e instanceof HTMLInputElement&&!on.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}let V=typeof document<`u`&&window.visualViewport;function cn(){let e=Et(),[t,n]=f(()=>e?{width:0,height:0}:ln());return c(()=>{let e=e=>{n(t=>e.width===t.width&&e.height===t.height?t:e)},t=()=>{V&&V.scale>1||e(ln())},r,i=t=>{V&&V.scale>1||sn(I(t))&&(r=requestAnimationFrame(()=>{let t=F();(!t||!sn(t))&&e({width:document.documentElement.clientWidth,height:document.documentElement.clientHeight})}))};return e(ln()),at()&&window.addEventListener(`blur`,i,!0),V?V.addEventListener(`resize`,t):window.addEventListener(`resize`,t),()=>{cancelAnimationFrame(r),at()&&window.removeEventListener(`blur`,i,!0),V?V.removeEventListener(`resize`,t):window.removeEventListener(`resize`,t)}},[]),t}function ln(){return{width:V?Math.min(V.width*V.scale,document.documentElement.clientWidth):document.documentElement.clientWidth,height:V?V.height*V.scale:document.documentElement.clientHeight}}function un(e){return e.pointerType===``&&e.isTrusted?!0:ct()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function dn(e){return!ct()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}function fn(e,t=!0){let[n,r]=f(!0),i=n&&t;return A(()=>{if(i&&e.current&&`getAnimations`in e.current)for(let t of e.current.getAnimations())t instanceof CSSTransition&&t.cancel()},[e,i]),mn(e,i,o(()=>r(!1),[])),i}function pn(e,t){let[n,r]=f(t?`open`:`closed`);switch(n){case`open`:t||r(`exiting`);break;case`closed`:case`exiting`:t&&r(`open`);break}let i=n===`exiting`;return mn(e,i,o(()=>{r(e=>e===`exiting`?`closed`:e)},[])),i}function mn(e,t,n){A(()=>{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||S(()=>{n()})}),()=>{r=!0}}},[e,t,n])}const hn=typeof Element<`u`&&`checkVisibility`in Element.prototype;function gn(e){let t=M(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 _n(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 vn(e,t){return hn?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&gn(e)&&_n(e,t)&&(!e.parentElement||vn(e.parentElement,e))}const yn=[`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`],bn=yn.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;yn.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const xn=yn.join(`:not([hidden]):not([tabindex="-1"]),`);function Sn(e,t){return e.matches(bn)&&!wn(e)&&(t?.skipVisibilityCheck||vn(e))}function Cn(e){return e.matches(xn)&&vn(e)&&!wn(e)}function wn(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Tn(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let En=new WeakMap;function Dn(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Tn(t);if(En.has(t))return En.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof M(n).HTMLMetaElement&&(n.nonce||n.content)||Tn(t)||void 0;return r!==void 0&&En.set(t,r),r}const On=Symbol(`default`);function kn({values:e,children:t}){for(let[n,i]of e)t=r.createElement(n.Provider,{value:i},t);return t}function An(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:o,values:s,render:c}=e;return l(()=>{let e,l,u;return e=typeof t==`function`?t({...s,defaultClassName:i}):t,l=typeof n==`function`?n({...s,defaultStyle:o||{}}):n,u=typeof r==`function`?r({...s,defaultChildren:a}):r??a,{className:e??i,style:l||o?{...o,...l}:void 0,children:u??a,"data-rac":``,render:c?e=>c(e,s):void 0}},[t,n,r,i,a,o,s,c])}function jn(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function Mn(e,t){let n=s(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||On;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 Nn(e,t,n){let{ref:r,...i}=Mn(n,e.slot)||{},a=en(l(()=>Bt(t,r),[t,r])),o=L(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?o.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}}:o.style={...i.style,...e.style}),[o,a]}function Pn(e=!0){let[t,n]=f(e),r=d(!1),i=o(e=>{r.current=!0,n(!!e)},[]);return A(()=>{r.current||n(!1)},[]),[i,t]}function Fn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function In(e,t,n){let{render:i,...a}=t,o=d(null),s=l(()=>Bt(n,o),[n,o]);A(()=>{},[e,i]);let c={...a,ref:s};return i?i(c,void 0):r.createElement(e,c)}const Ln={},Rn=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let n=Ln[t];return n||(n=a(In.bind(null,t)),Ln[t]=n),n}}),zn=typeof HTMLElement<`u`&&`inert`in HTMLElement.prototype;function Bn(e){return e.dataset.liveAnnouncer===`true`||e.dataset.reactAriaTopLayer!==void 0}let Vn=new WeakMap,H=[];function Hn(e,t){let n=M(e?.[0]),r=t instanceof n.Element?{root:t}:t,i=r?.root??document.body,a=r?.shouldUseInert&&zn,o=new Set(e),s=new Set,c=e=>a&&e instanceof n.HTMLElement?e.inert:e.getAttribute(`aria-hidden`)===`true`,l=(e,t)=>{a&&e instanceof n.HTMLElement?e.inert=t:t?e.setAttribute(`aria-hidden`,`true`):(e.removeAttribute(`aria-hidden`),e instanceof n.HTMLElement&&(e.inert=!1))},u=new Set;if(N())for(let t of e){let e=t;for(;e&&e!==i;){let t=e.getRootNode();`shadowRoot`in t&&u.add(t.shadowRoot),e=t.parentNode}}let d=e=>{for(let t of e.querySelectorAll(`[data-live-announcer], [data-react-aria-top-layer]`))o.add(t);let t=e=>{if(s.has(e)||o.has(e)||e.parentElement&&s.has(e.parentElement)&&e.parentElement.getAttribute(`role`)!==`row`)return NodeFilter.FILTER_REJECT;for(let t of o)if(P(e,t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},n=zt(j(e),e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),r=t(e);if(r===NodeFilter.FILTER_ACCEPT&&f(e),r!==NodeFilter.FILTER_REJECT){let e=n.nextNode();for(;e!=null;)f(e),e=n.nextNode()}},f=e=>{let t=Vn.get(e)??0;c(e)&&t===0||(t===0&&l(e,!0),s.add(e),Vn.set(e,t+1))};H.length&&H[H.length-1].disconnect(),d(i);let p=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...s].some(e=>P(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Bn(e)?o.add(e):e instanceof Element&&d(e);if(N()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});p.observe(i,{childList:!0,subtree:!0});let m=new Set;if(N())for(let e of u){let t=new MutationObserver(e=>{for(let t of e)if(t.type===`childList`){if(t.target.isConnected&&![...o,...s].some(e=>P(e,t.target)))for(let e of t.addedNodes)(e instanceof HTMLElement||e instanceof SVGElement)&&Bn(e)?o.add(e):e instanceof Element&&d(e);if(N()){for(let e of u)if(!e.isConnected){p.disconnect();break}}}});t.observe(e,{childList:!0,subtree:!0}),m.add(t)}let h={visibleNodes:o,hiddenNodes:s,observe(){p.observe(i,{childList:!0,subtree:!0})},disconnect(){p.disconnect()}};return H.push(h),()=>{if(p.disconnect(),N())for(let e of m)e.disconnect();for(let e of s){let t=Vn.get(e);t!=null&&(t===1?(l(e,!1),Vn.delete(e)):Vn.set(e,t-1))}h===H[H.length-1]?(H.pop(),H.length&&H[H.length-1].observe()):H.splice(H.indexOf(h),1)}}const Un=new Set([`Arab`,`Syrc`,`Samr`,`Mand`,`Thaa`,`Mend`,`Nkoo`,`Adlm`,`Rohg`,`Hebr`]),Wn=new Set([`ae`,`ar`,`arc`,`bcc`,`bqi`,`ckb`,`dv`,`fa`,`glk`,`he`,`ku`,`mzn`,`nqo`,`pnb`,`ps`,`sd`,`ug`,`ur`,`yi`]);function Gn(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 Un.has(t.script)}let t=e.split(`-`)[0];return Wn.has(t)}const Kn=Symbol.for(`react-aria.i18n.locale`);function qn(){let e=typeof window<`u`&&window[Kn]||typeof navigator<`u`&&(navigator.language||navigator.userLanguage)||`en-US`;try{Intl.DateTimeFormat.supportedLocalesOf([e])}catch{e=`en-US`}return{locale:e,direction:Gn(e)?`rtl`:`ltr`}}let Jn=qn(),Yn=new Set;function Xn(){Jn=qn();for(let e of Yn)e(Jn)}function Zn(){let e=Et(),[t,n]=f(Jn);return c(()=>(Yn.size===0&&window.addEventListener(`languagechange`,Xn),Yn.add(n),()=>{Yn.delete(n),Yn.size===0&&window.removeEventListener(`languagechange`,Xn)}),[]),e?{locale:typeof window<`u`&&window[Kn]||`en-US`,direction:`ltr`}:t}const Qn=r.createContext(null);function $n(){let e=Zn();return s(Qn)||e}const er=Symbol.for(`react-aria.i18n.locale`),tr=Symbol.for(`react-aria.i18n.strings`);let nr;var rr=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=ir(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[er];if(nr===void 0){let t=window[tr];if(!t)return null;nr={};for(let r in t)nr[r]=new e({[n]:t[r]},n)}let r=nr?.[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 ir(e,t,n=`en-US`){if(t[e])return t[e];let r=ar(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function ar(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}const or=new Map,sr=new Map;var cr=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=or.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),or.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=sr.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),sr.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}};const lr=new WeakMap;function ur(e){let t=lr.get(e);return t||(t=new rr(e),lr.set(e,t)),t}function dr(e,t){return t&&rr.getGlobalDictionaryForPackage(t)||ur(e)}function fr(e,t){let{locale:n}=$n(),r=dr(e,t);return l(()=>new cr(n,r),[n,r])}function pr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function mr(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function hr(e){let t=d({isFocused:!1,observer:null});return A(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),o(n=>{let r=I(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=pr(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===F()?null:F();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 gr=!1;function _r(e){for(;e&&!Sn(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=M(e),n=t.document.activeElement;if(!n||n===e)return;gr=!0;let r=!1,i=e=>{(I(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(I(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,ut(n),c()))},o=t=>{(I(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(I(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,ut(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),gr=!1,r=!1},l=requestAnimationFrame(c);return c}let vr=`default`,yr=``,br=new WeakMap;function xr(e){if(at()){if(vr==="default"){let t=j(e);yr=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}vr=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;br.set(e,e.style[t]),e.style[t]=`none`}}function Sr(e){if(at()){if(vr!==`disabled`)return;vr=`restoring`,setTimeout(()=>{Zt(()=>{if(vr===`restoring`){let t=j(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=yr||``),yr=``,vr=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&br.has(e)){let t=br.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),br.delete(e)}}const Cr=r.createContext({register:()=>{}});Cr.displayName=`PressResponderContext`;function wr(e){let t=s(Cr);if(t){let{register:n,ref:r,...i}=t;e=L(i,e),n()}return nn(t,e.ref),e}var Tr=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 Er=Symbol(`linkClicked`),Dr=`react-aria-pressable-style`,Or=`data-react-aria-pressable`;function kr(e){let{onPress:t,onPressChange:n,onPressStart:r,onPressEnd:i,onPressUp:a,onClick:s,isDisabled:u,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=wr(e),[y,b]=f(!1),x=d({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=Qt(),w=o((e,t)=>{let i=x.current;if(u||i.didFirePressStart)return!1;let a=!0;if(i.isTriggeringEvent=!0,r){let n=new Tr(`pressstart`,t,e);r(n),a=n.shouldStopPropagation}return n&&n(!0),i.isTriggeringEvent=!1,i.didFirePressStart=!0,b(!0),a},[u,r,n]),ee=o((e,r,a=!0)=>{let o=x.current;if(!o.didFirePressStart)return!1;o.didFirePressStart=!1,o.isTriggeringEvent=!0;let s=!0;if(i){let t=new Tr(`pressend`,r,e);i(t),s=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&a&&!u){let n=new Tr(`press`,r,e);t(n),s&&=n.shouldStopPropagation}return o.isTriggeringEvent=!1,s},[u,i,n,t]),T=B(ee),E=B(o((e,t)=>{let n=x.current;if(u)return!1;if(a){n.isTriggeringEvent=!0;let r=new Tr(`pressup`,t,e);return a(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[u,a])),te=o(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&ee(U(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||Sr(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,ee]),ne=B(te),re=o(e=>{h&&te(e)},[h,te]),ie=o(e=>{u||s?.(e)},[u,s]),ae=o((e,t)=>{if(!u&&s){let n=new MouseEvent(`click`,e);mr(n,t),s(pr(n))}},[u,s]),D=l(()=>{let e=x.current,t={onKeyDown(t){if(jr(t.nativeEvent,t.currentTarget)&&P(t.currentTarget,I(t))){Nr(I(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(j(t.currentTarget),`keyup`,Pt(t=>{jr(t,i)&&!t.repeat&&P(i,I(t))&&e.target&&E(U(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&nt()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!P(t.currentTarget,I(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!k.isOpening){let n=!0;if(u&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||un(t.nativeEvent))){let e=w(t,`virtual`),r=E(t,`virtual`),i=T(t,`virtual`);ie(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=E(U(t.currentTarget,t),r),a=T(U(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,ie(t),ne(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&jr(t,e.target)){Nr(I(t),t.key)&&t.preventDefault();let n=I(t),r=P(e.target,n);T(U(e.target,t),`keyboard`,r),r&&ae(t,e.target),C(),t.key!==`Enter`&&Ar(e.target)&&P(e.target,n)&&!t[Er]&&(t[Er]=!0,k(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||!P(t.currentTarget,I(t)))return;if(dn(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||xr(e.target),i=w(t,e.pointerType);let a=I(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(j(t.currentTarget),`pointerup`,n,!1),S(j(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(P(t.currentTarget,I(t))&&t.button===0){if(m){let n=_r(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!P(t.currentTarget,I(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&E(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(U(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,T(U(e.target,t),e.pointerType,!1),re(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(P(e.target,I(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?ne(t):(ut(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else ne(t);e.isOverTarget=!1}},r=e=>{ne(e)};t.onDragStart=e=>{P(e.currentTarget,I(e))&&ne(e)}}return t},[S,u,m,C,g,re,w,ie,ae]);return c(()=>{if(!_)return;let e=j(_.current);if(!e||!e.head||e.getElementById(Dr))return;let t=e.createElement(`style`);t.id=Dr;let n=Dn(e);n&&(t.nonce=n),t.textContent=`
|
|
2
|
-
@layer {
|
|
3
|
-
[${Or}] {
|
|
4
|
-
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
`.trim(),e.head.prepend(t)},[_]),c(()=>{let e=x.current;return()=>{g||Sr(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:L(v,D,{[Or]:!0})}}function Ar(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function jr(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof M(i).HTMLInputElement&&!Fr(i,n)||i instanceof M(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Ar(i))&&n!==`Enter`)}function U(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 Mr(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Ar(e)}function Nr(e,t){return e instanceof HTMLInputElement?!Fr(e,t):Mr(e)}const Pr=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Fr(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:Pr.has(e.type)}let W=null;const Ir=new Set;let Lr=new Map,G=!1,Rr=!1;const zr={Tab:!0,Escape:!0};function Br(e,t){for(let n of Ir)n(e,t)}function Vr(e){return!(e.metaKey||!nt()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Hr(e){G=!0,!k.isOpening&&Vr(e)&&(W=`keyboard`,Br(`keyboard`,e))}function Ur(e){W=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(G=!0,Br(`pointer`,e))}function Wr(e){!k.isOpening&&un(e)&&(G=!0,W=`virtual`)}function Gr(e){let t=M(I(e)),n=j(I(e));I(e)===t||I(e)===n||gr||!e.isTrusted||(!G&&!Rr&&(W=`virtual`,Br(`virtual`,e)),G=!1,Rr=!1)}function Kr(){gr||(G=!1,Rr=!0)}function qr(e){if(typeof window>`u`||typeof document>`u`)return;let t=M(e),n=j(e);if(Lr.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){G=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Hr,!0),n.addEventListener(`keyup`,Hr,!0),n.addEventListener(`click`,Wr,!0),t.addEventListener(`focus`,Gr,!0),t.addEventListener(`blur`,Kr,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Ur,!0),n.addEventListener(`pointermove`,Ur,!0),n.addEventListener(`pointerup`,Ur,!0)),t.addEventListener(`beforeunload`,()=>{Jr(e)},{once:!0}),Lr.set(t,{focus:r})}const Jr=(e,t)=>{let n=M(e),r=j(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Lr.has(n)&&(n.HTMLElement.prototype.focus=Lr.get(n).focus,r.removeEventListener(`keydown`,Hr,!0),r.removeEventListener(`keyup`,Hr,!0),r.removeEventListener(`click`,Wr,!0),n.removeEventListener(`focus`,Gr,!0),n.removeEventListener(`blur`,Kr,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Ur,!0),r.removeEventListener(`pointermove`,Ur,!0),r.removeEventListener(`pointerup`,Ur,!0)),Lr.delete(n))};function Yr(e){let t=j(e),n;return t.readyState===`loading`?(n=()=>{qr(e)},t.addEventListener(`DOMContentLoaded`,n)):qr(e),()=>Jr(e,n)}typeof document<`u`&&Yr();function Xr(){return W!==`pointer`}function Zr(){return W}function Qr(e){W=e,Br(e,null)}const $r=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ei(e,t,n){let r=n?I(n):void 0,i=j(r),a=M(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=F(i);return e=e||u instanceof o&&!$r.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!zr[n.key])}function ti(e,t,n){qr(),c(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{ei(!!n?.isTextInput,t,r)&&e(Xr())};return Ir.add(t),()=>{Ir.delete(t)}},t)}function ni(e){if(!e.isConnected)return;let t=j(e);if(Zr()===`virtual`){let n=F(t);Zt(()=>{let r=F(t);(r===n||r===t.body)&&e.isConnected&&ut(e)})}else ut(e)}const ri=r.createContext(null),ii=`react-aria-focus-scope-restore`;let K=null;function ai(e){let{children:t,contain:n,restoreFocus:i,autoFocus:a}=e,o=d(null),u=d(null),f=d([]),{parentNode:p}=s(ri)||{},m=l(()=>new Si({scopeRef:f}),[f]);A(()=>{let e=p||Q.root;if(Q.getTreeNode(e.scopeRef)&&K&&!pi(K,e.scopeRef)){let t=Q.getTreeNode(K);t&&(e=t)}e.addChild(m),Q.addNode(m)},[m,p]),A(()=>{let e=Q.getTreeNode(f);e&&(e.contain=!!n)},[n]),A(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==u.current;)t.push(e),e.addEventListener(ii,n),e=e.nextSibling;return f.current=t,()=>{for(let e of t)e.removeEventListener(ii,n)}},[t]),_i(f,i,n),ui(f,n),yi(f,i,n),gi(f,a),c(()=>{let e=F(j(f.current?f.current[0]:void 0)),t=null;if(J(e,f.current)){for(let n of Q.traverse())n.scopeRef&&J(e,n.scopeRef.current)&&(t=n);t===Q.getTreeNode(f)&&(K=t.scopeRef)}},[f]),A(()=>()=>{let e=Q.getTreeNode(f)?.parent?.scopeRef??null;(f===K||pi(f,K))&&(!e||Q.getTreeNode(e))&&(K=e),Q.removeTreeNode(f)},[f]);let h=l(()=>oi(f),[]),g=l(()=>({focusManager:h,parentNode:m}),[m,h]);return r.createElement(ri.Provider,{value:g},r.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,r.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:u}))}function oi(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(j(n[0]??void 0)),c=n[0].previousElementSibling,l=Z(q(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&X(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||F(j(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=Z(q(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&X(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Z(q(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&X(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Z(q(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&X(o,!0),o}}}function q(e){return e[0].parentElement}function si(e){let t=Q.getTreeNode(K);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function ci(e){if(!e.form)return Array.from(j(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=M(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function li(e){if(e.checked)return!0;let t=ci(e);return t.length>0&&!t.some(e=>e.checked)}function ui(e,t){let n=d(void 0),r=d(void 0);A(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=j(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!si(e)||t.isComposing)return;let n=F(a),r=e.current;if(!r||!J(n,r))return;let i=Z(q(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&&(X(o,!0),o instanceof M(o).HTMLInputElement&&o.select())},s=t=>{(!K||pi(K,e))&&J(I(t),e.current)?(K=e,n.current=I(t)):si(e)&&!Y(I(t),e)?n.current?n.current.focus():K&&K.current&&hi(K.current):si(e)&&(n.current=I(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=Zr(),i=(r===`virtual`||r===null)&&ct()&&st(),o=F(a);if(!i&&o&&si(e)&&!Y(o,e)){K=e;let r=I(t);r&&r.isConnected?(n.current=r,n.current?.focus()):K.current&&hi(K.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),A(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function di(e){return Y(e)}function J(e,t){return!e||!t?!1:t.some(t=>P(t,e))}function Y(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of Q.traverse(Q.getTreeNode(t)))if(n&&J(e,n.current))return!0;return!1}function fi(e){return Y(e,K)}function pi(e,t){let n=Q.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function X(e,t=!1){if(e!=null&&!t)try{ni(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function mi(e,t=!0){let n=e[0].previousElementSibling,r=q(e),i=Z(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=q(e),i=Z(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function hi(e,t=!0){X(mi(e,t))}function gi(e,t){let n=r.useRef(t);c(()=>{n.current&&(K=e,!J(F(j(e.current?e.current[0]:void 0)),K.current)&&e.current&&hi(e.current)),n.current=!1},[e])}function _i(e,t,n){A(()=>{if(t||n)return;let r=e.current,i=j(r?r[0]:void 0),a=t=>{let n=I(t);J(n,e.current)?K=e:di(n)||(K=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function vi(e){let t=Q.getTreeNode(K);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function yi(e,t,n){let r=d(typeof document<`u`?F(j(e.current?e.current[0]:void 0)):null);A(()=>{let r=e.current,i=j(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!K||pi(K,e))&&J(F(i),e.current)&&(K=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),A(()=>{let r=j(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!si(e)||t.isComposing)return;let n=r.activeElement;if(!Y(n,e)||!vi(e))return;let i=Q.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=Z(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||!Y(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(Y(s,e));t.preventDefault(),t.stopPropagation(),s?X(s,!0):di(a)?X(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),A(()=>{let n=j(e.current?e.current[0]:void 0);if(!t)return;let i=Q.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=Q.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=F(n);if(t&&i&&(a&&Y(a,e)||a===n.body&&vi(e))){let t=Q.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){bi(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&Q.getTreeNode(n.scopeRef)){bi(mi(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function bi(e){e.dispatchEvent(new CustomEvent(ii,{bubbles:!0,cancelable:!0}))&&X(e)}function Z(e,t,n){let r=t?.tabbable?Cn:Sn,i=j(e?.nodeType===Node.ELEMENT_NODE?e:null),a=zt(i,e||i,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return P(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!li(e)||a.currentNode.tagName===`INPUT`&&a.currentNode.type===`radio`&&a.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||J(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(a.currentNode=t.from),a}var xi=class e{constructor(){this.fastMap=new Map,this.root=new Si({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 Si({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&&J(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}},Si=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 Q=new xi;function Ci(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:i}=e,a=o(e=>{if(I(e)===e.currentTarget)return r&&r(e),i&&i(!1),!0},[r,i]),s=hr(a),c=o(e=>{let t=I(e),r=j(t),a=r?F(r):F();t===e.currentTarget&&t===a&&(n&&n(e),i&&i(!0),s(e))},[i,n,s]);return{focusProps:{onFocus:!t&&(n||i||r)?c:void 0,onBlur:!t&&(r||i)?a:void 0}}}function wi(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 Ti(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:wi(e.onKeyDown),onKeyUp:wi(e.onKeyUp)}}}let Ei=r.createContext(null);function Di(e){let t=s(Ei)||{};nn(t,e);let{ref:n,...r}=t;return r}function Oi(e,t){let{focusProps:n}=Ci(e),{keyboardProps:r}=Ti(e),i=L(n,r),a=Di(t),o=e.isDisabled?{}:a,s=d(e.autoFocus);c(()=>{s.current&&t.current&&ni(t.current),s.current=!1},[t]);let l=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(l=void 0),{focusableProps:L({...i,tabIndex:l},o)}}const ki=typeof document<`u`?r.useInsertionEffect??r.useLayoutEffect:()=>{};function Ai(e,t,n){let[r,i]=f(e||t),a=d(r),s=d(e!==void 0),l=e!==void 0;c(()=>{s.current,s.current=l},[l]);let p=l?e:r;ki(()=>{a.current=p});let[,m]=u(()=>({}),{});return[p,o((e,...t)=>{let r=typeof e==`function`?e(a.current):e;Object.is(a.current,r)||(a.current=r,i(r),m(),n?.(r,...t))},[n])]}function ji(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=e,a=d({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:c}=Qt(),l=o(e=>{P(e.currentTarget,I(e))&&a.current.isFocusWithin&&!P(e.currentTarget,e.relatedTarget)&&(a.current.isFocusWithin=!1,c(),n&&n(e),i&&i(!1))},[n,i,a,c]),u=hr(l),f=o(e=>{if(!P(e.currentTarget,I(e)))return;let t=I(e),n=j(t),o=F(n);if(!a.current.isFocusWithin&&o===t){r&&r(e),i&&i(!0),a.current.isFocusWithin=!0,u(e);let t=e.currentTarget;s(n,`focus`,e=>{let r=I(e);if(a.current.isFocusWithin&&!P(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});mr(e,t),l(pr(e))}},{capture:!0})}},[r,i,u,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:l}}}function Mi(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,i=d({isFocused:!1,isFocusVisible:t||Xr()}),[a,s]=f(!1),[c,l]=f(()=>i.current.isFocused&&i.current.isFocusVisible),u=o(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),p=o(e=>{i.current.isFocused=e,i.current.isFocusVisible=Xr(),s(e),u()},[u]);ti(e=>{i.current.isFocusVisible=e,u()},[n,a],{enabled:a,isTextInput:n});let{focusProps:m}=Ci({isDisabled:r,onFocusChange:p}),{focusWithinProps:h}=ji({isDisabled:!r,onFocusWithinChange:p});return{isFocused:a,isFocusVisible:c,focusProps:r?h:m}}function Ni({children:e}){let t=l(()=>({register:()=>{}}),[]);return r.createElement(Cr.Provider,{value:t},e)}let Pi=!1,Fi=0;function Ii(){Pi=!0,setTimeout(()=>{Pi=!1},500)}function Li(e){e.pointerType===`touch`&&Ii()}function Ri(){let e=j(null);if(e!==void 0)return Fi===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,Li),Fi++,()=>{Fi--,!(Fi>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,Li)}}function zi(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[a,o]=f(!1),s=d({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;c(Ri,[]);let{addGlobalListener:u,removeAllGlobalListeners:p}=Qt(),{hoverProps:m,triggerHoverEnd:h}=l(()=>{let e=(e,r)=>{if(s.pointerType=r,i||r===`touch`||s.isHovered||!P(e.currentTarget,I(e)))return;s.isHovered=!0;let c=e.currentTarget;s.target=c,u(j(I(e)),`pointerover`,e=>{s.isHovered&&s.target&&!P(s.target,I(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:c,pointerType:r}),n&&n(!0),o(!0)},a=(e,t)=>{let i=s.target;s.pointerType=``,s.target=null,!(t===`touch`||!s.isHovered||!i)&&(s.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),o(!1))},c={};return typeof PointerEvent<`u`&&(c.onPointerEnter=t=>{Pi&&t.pointerType===`mouse`||e(t,t.pointerType)},c.onPointerLeave=e=>{!i&&P(e.currentTarget,I(e))&&a(e,e.pointerType)}),{hoverProps:c,triggerHoverEnd:a}},[t,n,r,i,s,u,p]);return c(()=>{i&&h({currentTarget:s.target},s.pointerType)},[i]),{hoverProps:m,isHovered:a}}function Bi(e){let{ref:t,onInteractOutside:n,isDisabled:r,onInteractOutsideStart:i}=e,a=d({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}),o=B(e=>{n&&Vi(e,t)&&(i&&i(e),a.current.isPointerDown=!0)}),s=B(e=>{n&&n(e)});c(()=>{let e=a.current;if(r)return;let n=t.current,i=j(n);if(typeof PointerEvent<`u`){let n=n=>{e.isPointerDown&&Vi(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 Vi(e,t){if(e.button>0)return!1;let n=I(e);if(n){let e=n.ownerDocument;if(!e||!P(e.documentElement,n)||n.closest(`[data-react-aria-top-layer]`))return!1}return t.current?!e.composedPath().includes(t.current):!1}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 Hi=i(!1);function Ui(e){let t=(t,n)=>s(Hi)?null:e(t,n);return t.displayName=e.displayName||e.name,a(t)}function Wi(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}=kr({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Oi(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=L(y,_,R(e,{labelable:!0}));return{isPressed:v,buttonProps:L(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 Gi={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 Ki(e={}){let{style:t,isFocusable:n}=e,[r,i]=f(!1),{focusWithinProps:a}=ji({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=l(()=>r?t:t?{...Gi,...t}:Gi,[r]);return{visuallyHiddenProps:{...a,style:o}}}function qi(e){let{children:t,elementType:n=`div`,isFocusable:i,style:a,...o}=e,{visuallyHiddenProps:s}=Ki(e);return r.createElement(n,L(o,s),t)}const Ji=i({});function Yi(){return s(Ji)??{}}const Xi=r.createContext(null);function Zi(e){let t=Et(),{portalContainer:n=t?null:document.body,isExiting:i}=e,[a,o]=f(!1),s=l(()=>({contain:a,setContain:o}),[a,o]),{getContainer:c}=Yi();if(!e.portalContainer&&c&&(n=c()),!n)return null;let u=e.children;return e.disableFocusManagement||(u=r.createElement(ai,{restoreFocus:!0,contain:(e.shouldContainFocus||a)&&!i},u)),u=r.createElement(Xi.Provider,{value:s},r.createElement(Ni,null,u)),x.createPortal(u,n)}function Qi(){let e=s(Xi)?.setContain;A(()=>{e?.(!0)},[e])}function $i(e,t){let{role:n=`dialog`}=e,r=Nt();r=e[`aria-label`]?void 0:r;let i=d(!1);return c(()=>{if(t.current&&!Lt(t.current)){ni(t.current);let e=setTimeout(()=>{(F()===t.current||F()===document.body)&&(i.current=!0,t.current&&(t.current.blur(),ni(t.current)),i.current=!1)},500);return()=>{clearTimeout(e)}}},[t]),Qi(),d(!1),c(()=>{}),{dialogProps:{...R(e,{labelable:!0}),role:n,tabIndex:-1,"aria-labelledby":e[`aria-labelledby`]||r,onBlur:e=>{i.current&&e.stopPropagation()}},titleProps:{id:r}}}var ea={};ea={dismiss:`تجاهل`};var ta={};ta={dismiss:`Отхвърляне`};var na={};na={dismiss:`Odstranit`};var ra={};ra={dismiss:`Luk`};var ia={};ia={dismiss:`Schließen`};var aa={};aa={dismiss:`Απόρριψη`};var oa={};oa={dismiss:`Dismiss`};var sa={};sa={dismiss:`Descartar`};var ca={};ca={dismiss:`Lõpeta`};var la={};la={dismiss:`Hylkää`};var ua={};ua={dismiss:`Rejeter`};var da={};da={dismiss:`התעלם`};var fa={};fa={dismiss:`Odbaci`};var pa={};pa={dismiss:`Elutasítás`};var ma={};ma={dismiss:`Ignora`};var ha={};ha={dismiss:`閉じる`};var ga={};ga={dismiss:`무시`};var _a={};_a={dismiss:`Atmesti`};var va={};va={dismiss:`Nerādīt`};var ya={};ya={dismiss:`Lukk`};var ba={};ba={dismiss:`Negeren`};var xa={};xa={dismiss:`Zignoruj`};var Sa={};Sa={dismiss:`Descartar`};var Ca={};Ca={dismiss:`Dispensar`};var wa={};wa={dismiss:`Revocare`};var Ta={};Ta={dismiss:`Пропустить`};var Ea={};Ea={dismiss:`Zrušiť`};var Da={};Da={dismiss:`Opusti`};var Oa={};Oa={dismiss:`Odbaci`};var ka={};ka={dismiss:`Avvisa`};var Aa={};Aa={dismiss:`Kapat`};var ja={};ja={dismiss:`Скасувати`};var Ma={};Ma={dismiss:`取消`};var Na={};Na={dismiss:`關閉`};var Pa={};Pa={"ar-AE":ea,"bg-BG":ta,"cs-CZ":na,"da-DK":ra,"de-DE":ia,"el-GR":aa,"en-US":oa,"es-ES":sa,"et-EE":ca,"fi-FI":la,"fr-FR":ua,"he-IL":da,"hr-HR":fa,"hu-HU":pa,"it-IT":ma,"ja-JP":ha,"ko-KR":ga,"lt-LT":_a,"lv-LV":va,"nb-NO":ya,"nl-NL":ba,"pl-PL":xa,"pt-BR":Sa,"pt-PT":Ca,"ro-RO":wa,"ru-RU":Ta,"sk-SK":Ea,"sl-SI":Da,"sr-SP":Oa,"sv-SE":ka,"tr-TR":Aa,"uk-UA":ja,"zh-CN":Ma,"zh-TW":Na};function Fa(e){return e&&e.__esModule?e.default:e}function Ia(e){let{onDismiss:t,...n}=e,i=$t(n,fr(Fa(Pa),`@react-aria/overlays`).format(`dismiss`)),a=()=>{t&&t()};return r.createElement(qi,null,r.createElement(`button`,{...i,tabIndex:-1,onClick:a,style:{width:1,height:1}}))}const $=[];function La(e,t){let{onClose:n,shouldCloseOnBlur:r,isOpen:i,isDismissable:a=!1,isKeyboardDismissDisabled:o=!1,shouldCloseOnInteractOutside:s}=e,l=d(void 0);c(()=>{if(i&&!$.includes(t))return $.push(t),()=>{let e=$.indexOf(t);e>=0&&$.splice(e,1)}},[i,t]);let u=()=>{$[$.length-1]===t&&n&&n()},f=e=>{let n=$[$.length-1];l.current=n,(!s||s(I(e)))&&n===t&&e.stopPropagation()},p=e=>{(!s||s(I(e)))&&($[$.length-1]===t&&e.stopPropagation(),l.current===t&&u()),l.current=void 0},m=e=>{e.key===`Escape`&&!o&&!e.nativeEvent.isComposing&&(e.stopPropagation(),e.preventDefault(),u())};Bi({ref:t,onInteractOutside:a&&i?p:void 0,onInteractOutsideStart:f});let{focusWithinProps:h}=ji({isDisabled:!r,onBlurWithin:e=>{!e.relatedTarget||fi(e.relatedTarget)||(!s||s(e.relatedTarget))&&n?.()}});return{overlayProps:{onKeyDown:m,...h},underlayProps:{}}}const Ra=typeof document<`u`&&window.visualViewport;let za=0,Ba;function Va(e={}){let{isDisabled:t}=e;A(()=>{if(!t)return za++,za===1&&(Ba=at()?Ua():Ha()),()=>{za--,za===0&&Ba()}},[t])}function Ha(){let e=window.innerWidth-document.documentElement.clientWidth;return Pt(e>0&&(`scrollbarGutter`in document.documentElement.style?Wa(document.documentElement,`scrollbarGutter`,`stable`):Wa(document.documentElement,`paddingRight`,`${e}px`)),Wa(document.documentElement,`overflow`,`hidden`))}function Ua(){let e=Wa(document.documentElement,`overflow`,`hidden`),t,n=!1,r=e=>{let r=I(e);t=rn(r)?r:an(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=Dn();a&&(i.nonce=a),i.textContent=`@layer {
|
|
8
|
-
* {
|
|
9
|
-
overscroll-behavior: contain;
|
|
10
|
-
}
|
|
11
|
-
}`,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=I(e),n=e.relatedTarget;n&&sn(n)?(n.focus({preventScroll:!0}),Ka(n,sn(t))):n||(t.parentElement?.closest(`[tabindex]`))?.focus({preventScroll:!0})},c=HTMLElement.prototype.focus;HTMLElement.prototype.focus=function(e){let t=F(),n=t!=null&&sn(t);c.call(this,{...e,preventScroll:!0}),(!e||!e.preventScroll)&&Ka(this,n)};let l=Pt(Ga(document,`touchstart`,r,{passive:!1,capture:!0}),Ga(document,`touchmove`,o,{passive:!1,capture:!0}),Ga(document,`blur`,s,!0));return()=>{e(),l(),i.remove(),HTMLElement.prototype.focus=c}}function Wa(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function Ga(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Ka(e,t){t||!Ra?qa(e):Ra.addEventListener(`resize`,()=>qa(e),{once:!0})}function qa(e){let t=document.scrollingElement||document.documentElement,n=e;for(;n&&n!==t;){let e=an(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;Ra&&(n=Math.min(n,Ra.offsetTop+Ra.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 Ja(e,t,n){let{overlayProps:r,underlayProps:i}=La({...e,isOpen:t.isOpen,onClose:t.close},n);return Va({isDisabled:!t.isOpen}),Qi(),c(()=>{if(t.isOpen&&n.current)return Hn([n.current],{shouldUseInert:!0})},[t.isOpen,n]),{modalProps:L(r),underlayProps:i}}const Ya=i({}),Xa=Ui(function(e,t){[e,t]=Nn(e,t,Ya);let{elementType:n=`label`,...i}=e,a=Rn[n];return r.createElement(a,{className:`react-aria-Label`,...i,ref:t})}),Za=i(null),Qa=7e3;let $a=null;function eo(e,t=`assertive`,n=Qa){$a?$a.announce(e,t,n):($a=new to,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$a.announce(e,t,n):setTimeout(()=>{$a?.isAttached()&&$a?.announce(e,t,n)},100))}var to=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=Qa){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 no=i({}),ro=Ui(function(e,t){[e,t]=Nn(e,t,no);let n=e,{isPending:i}=n,{buttonProps:a,isPressed:o}=Wi(e,t);a=ao(a,i);let{focusProps:s,isFocused:l,isFocusVisible:u}=Mi(e),{hoverProps:f,isHovered:p}=zi({...e,isDisabled:e.isDisabled||i}),m={isHovered:p,isPressed:(n.isPressed||o)&&!i,isFocused:l,isFocusVisible:u,isDisabled:e.isDisabled||!1,isPending:i??!1},h=An({...e,values:m,defaultClassName:`react-aria-Button`}),g=jt(a.id),_=jt(),v=a[`aria-labelledby`];i&&(v?v=`${v} ${_}`:a[`aria-label`]&&(v=`${g} ${_}`));let y=d(i);c(()=>{let e={"aria-labelledby":v||g};(!y.current&&l&&i||y.current&&l&&!i)&&eo(e,`assertive`),y.current=i},[i,l,v,g]);let b=R(e,{global:!0});return delete b.onClick,r.createElement(Rn.button,{...L(b,h,a,s,f),type:a.type===`submit`&&i?`button`:a.type,id:g,ref:t,"aria-labelledby":v,slot:e.slot||void 0,"aria-disabled":i?`true`:a[`aria-disabled`],"data-disabled":e.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":l||void 0,"data-pending":i||void 0,"data-focus-visible":u||void 0},r.createElement(Za.Provider,{value:{id:_}},h.children))}),io=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function ao(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!io.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}function oo(e){let[t,n]=Ai(e.isOpen,e.defaultOpen||!1,e.onOpenChange);return{isOpen:t,setOpen:n,open:o(()=>{n(!0)},[n]),close:o(()=>{n(!1)},[n]),toggle:o(()=>{n(!t)},[n,t])}}const so=i(null),co=i(null),lo=a(function(e,t){let n=e[`aria-labelledby`];[e,t]=Nn(e,t,so);let{dialogProps:i,titleProps:a}=$i({...e,"aria-labelledby":n},t),o=s(co);!i[`aria-label`]&&!i[`aria-labelledby`]&&e[`aria-labelledby`]&&(i[`aria-labelledby`]=e[`aria-labelledby`]);let c=An({defaultClassName:`react-aria-Dialog`,className:e.className,style:e.style,children:e.children,values:{close:o?.close||(()=>{})}}),l=R(e,{global:!0});return r.createElement(Rn.section,{...L(l,c,i),render:e.render,ref:t,slot:e.slot||void 0},r.createElement(kn,{values:[[Qe,{slots:{[On]:{},title:{...a,level:2}}}],[no,{slots:{[On]:{},close:{onPress:()=>o?.close()}}}]]},c.children))}),uo=i(null),fo=i(null),po=a(function(e,t){if(s(fo))return r.createElement(_o,{...e,modalRef:t},e.children);let{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,children:l,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p,...m}=e;return r.createElement(ho,{isDismissable:n,isKeyboardDismissDisabled:i,isOpen:a,defaultOpen:o,onOpenChange:c,isEntering:u,isExiting:d,UNSTABLE_portalContainer:f,shouldCloseOnInteractOutside:p},r.createElement(_o,{...m,modalRef:t},l))});function mo(e,t){[e,t]=Nn(e,t,uo);let n=s(co),i=oo(e),a=e.isOpen!=null||e.defaultOpen!=null||!n?i:n,o=en(t),c=d(null),l=pn(o,a.isOpen),u=pn(c,a.isOpen),f=l||u||e.isExiting||!1,p=Et();return!a.isOpen&&!f||p?null:r.createElement(go,{...e,state:a,isExiting:f,overlayRef:o,modalRef:c})}const ho=a(mo);function go({UNSTABLE_portalContainer:e,...t}){let n=t.modalRef,{state:i}=t,{modalProps:a,underlayProps:o}=Ja(t,i,n),s=fn(t.overlayRef)||t.isEntering||!1,c=An({...t,defaultClassName:`react-aria-ModalOverlay`,values:{isEntering:s,isExiting:t.isExiting,state:i}}),l=cn(),u;if(typeof document<`u`){let e=rn(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 r.createElement(Zi,{isExiting:t.isExiting,portalContainer:e},r.createElement(Rn.div,{...L(R(t,{global:!0}),o),...c,style:d,ref:t.overlayRef,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},r.createElement(kn,{values:[[fo,{modalProps:a,modalRef:n,isExiting:t.isExiting,isDismissable:t.isDismissable}],[co,i]]},c.children)))}function _o(e){let{modalProps:t,modalRef:n,isExiting:i,isDismissable:a}=s(fo),o=s(co),c=en(l(()=>Bt(e.modalRef,n),[e.modalRef,n])),u=fn(c),d=An({...e,defaultClassName:`react-aria-Modal`,values:{isEntering:u,isExiting:i,state:o}});return r.createElement(Rn.div,{...L(R(e,{global:!0}),t),...d,ref:c,"data-entering":u||void 0,"data-exiting":i||void 0},a&&r.createElement(Ia,{onDismiss:o.close}),d.children)}const vo=()=>{let[n,r]=f(!1);return c(()=>{let n=t=>{let n=e.safeParse(t);n.error||r(n.data.detail.isRecording)};return document.addEventListener(t,n),()=>{document.removeEventListener(t,n)}},[]),n},yo=({className:e,iconClassName:t,onClose:n})=>vo()?null:v(`button`,{type:`button`,className:e,"aria-label":`Dismiss`,onClick:n,children:v(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`none`,className:t,children:v(`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`})})}),bo=({children:e,classNames:t,isDismissable:r,onDismiss:i,closeOnFinishMs:a})=>{let{survey:o,surveyId:s,dismiss:c}=Xe(),[l,u]=f(!1);return h(()=>{o&&c()},l?a:null),y(lo,{"aria-label":`Survey`,id:`${s}-popover`,className:b(`confetti-modal-dialog ${n}`,t?.dialog),children:[r&&v(yo,{className:b(`confetti-modal-dialog-close`,t?.closeButton),iconClassName:t?.icon,onClose:async()=>{await c(),i?.()}}),typeof e==`function`?e({setIsFinished:()=>u(!0)}):e]})},xo=({children:e,classNames:t,onDismiss:r,isDismissable:i=!0,closeOnFinishMs:a=3e3})=>{let{dismiss:o}=Xe();return v(ho,{isOpen:!0,isDismissable:i,isKeyboardDismissDisabled:!i,onOpenChange:async e=>{e||(await o(),r?.())},className:b(`confetti-modal-overlay ${n}`,t?.overlay),children:v(po,{className:b(`confetti-modal ${n}`,t?.modal),children:v(bo,{classNames:t,isDismissable:i,onDismiss:r,closeOnFinishMs:a,children:e})})})};export{R as A,qe as B,jn as C,B as D,Mn as E,Nt as F,je as G,Xe as H,jt as I,Ae as J,Oe as K,A as L,Bt as M,I as N,en as O,M as P,ae as Q,$e as R,Pn as S,Fn as T,Ge as U,Ye as V,Te as W,ge as X,Me as Y,_e as Z,kr as _,ro as a,Nn as b,qi as c,Mi as d,ji as f,Qr as g,Z as h,vo as i,L as j,$t as k,Ui as l,Oi as m,bo as n,Ya as o,Ai as p,De as q,yo as r,Xa as s,xo as t,zi as u,$n as v,Rn as w,An as x,kn as y,Ze as z};
|