@opengovsg/confetti 0.6.0 → 0.7.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.
@@ -1,9 +1,9 @@
1
- :root{--confetti-font-scale: 16px;--confetti-box-padding: 24px;--confetti-max-width: 300px;--confetti-z-index: 2147483647;--confetti-border-color: #e4e4e7;--confetti-border-bottom: 1.5px solid var(--confetti-border-color);--confetti-border-radius: 12px;--confetti-input-border-radius: 8px;--confetti-choice-border-radius: max(
1
+ :root{--confetti-font-scale: 16px;--confetti-box-padding: 24px;--confetti-button-row-gap: 16px;--confetti-max-width: 300px;--confetti-z-index: 2147483647;--confetti-border-color: #e4e4e7;--confetti-border-bottom: 1.5px solid var(--confetti-border-color);--confetti-border-radius: 12px;--confetti-input-border-radius: 8px;--confetti-choice-border-radius: max(
2
2
  var(--confetti-input-border-radius) - 2px,
3
3
  0px
4
4
  );--confetti-tag-border-radius: var(--confetti-input-border-radius);--confetti-background-color: #ffffff;--confetti-box-shadow:
5
5
  0 4px 6px -4px rgba(16, 24, 40, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1);--confetti-focus-shadow: 0 0 0 2px rgba(9, 9, 11, 0.3);--confetti-submit-button-color: #18181b;--confetti-submit-button-text-color: #fafafa;--confetti-rating-bg-color: white;--confetti-rating-text-color: #09090b;--confetti-rating-active-bg-color: #09090b;--confetti-rating-active-text-color: white;--confetti-indicator-active-bg-color: var(--confetti-rating-active-bg-color);--confetti-indicator-active-dot-color: var(
6
6
  --confetti-rating-active-text-color
7
- );--confetti-bug-report-button-color: #18181b;--confetti-bug-report-record-button-color: #ff2c2c;--confetti-bug-report-record-button-active-color: #dc2626;--confetti-bug-report-button-text-color: white;--confetti-bug-report-overlay-color: rgba(9, 9, 11, 0.4);--confetti-text-primary-color: #09090b;--confetti-text-subtle-color: #71717a;--confetti-error-color: #dc2626;--confetti-trigger-bg-color: #18181b;--confetti-trigger-text-color: #fafafa;--confetti-trigger-size: 40px;--confetti-widget-color: #e0a045;--confetti-widget-text-color: white;--confetti-scrollbar-thumb-color: var(--confetti-border-color);--confetti-scrollbar-track-color: var(--confetti-background-color);--confetti-outline-color: rgba(9, 9, 11, 0.8);--confetti-input-background: white;--confetti-input-text-color: #020617;--confetti-disabled-button-opacity: 0.6;}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}@keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.confetti-trigger{font-size:var(--confetti-font-scale);cursor:pointer;position:relative;display:inline-grid;grid-template-columns:0fr;align-items:center;justify-content:center;min-width:var(--confetti-trigger-size);height:var(--confetti-trigger-size);padding:0;border:none;border-radius:9999px;background:var(--confetti-trigger-bg-color);color:var(--confetti-trigger-text-color);overflow:hidden;transition:grid-template-columns 220ms ease, background 220ms ease}.confetti-trigger .confetti-trigger-icon-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;opacity:1;transition:opacity 180ms ease;pointer-events:none}.confetti-trigger .confetti-trigger-label{opacity:0;pointer-events:none;min-width:0;overflow:hidden;padding:0 20px;font-size:0.875em;font-weight:500;line-height:20px;white-space:nowrap;transition:opacity 180ms ease}.confetti-trigger:hover,.confetti-trigger:focus-visible,.confetti-trigger[data-hovered],.confetti-trigger[data-focus-visible]{grid-template-columns:1fr}.confetti-trigger:focus-visible .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:hover .confetti-trigger-icon-wrapper,.confetti-trigger[data-hovered] .confetti-trigger-icon-wrapper,.confetti-trigger[data-focus-visible] .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:focus-visible .confetti-trigger-label{opacity:1}.confetti-trigger:hover .confetti-trigger-label,.confetti-trigger[data-hovered] .confetti-trigger-label,.confetti-trigger[data-focus-visible] .confetti-trigger-label{opacity:1}.confetti-trigger:focus-visible,.confetti-trigger[data-focus-visible]{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog{width:var(--confetti-max-width);max-height:95dvh;overflow:auto;max-width:100%;background:transparent;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-dialog .confetti-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-dialog .confetti-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-dialog .confetti-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-dialog .confetti-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog .cf-header .cf-title{padding-right:20px}.confetti-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--confetti-z-index);background:rgba(0, 0, 0, 0.4);display:flex;justify-content:center;overflow-y:auto;overscroll-behavior:none;padding:10vh 0}.confetti-modal{margin:auto}.confetti-modal .confetti-modal-dialog{width:var(--confetti-max-width);max-width:100%;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-modal .confetti-modal-dialog:focus-visible{outline:none}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-modal .confetti-modal-dialog .cf-header .cf-title{padding-right:20px}.confetti{font-family:var(--confetti-font-family);display:flex;flex-direction:column;gap:16px;color:var(--confetti-text-primary-color);font-size:var(--confetti-font-scale);width:100%}.confetti .cf-submit-button{align-self:end;color:var(--confetti-submit-button-text-color);background:var(--confetti-submit-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-submit-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-submit-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-submit-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-submit-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .sr-only{clip:rect(0, 0, 0, 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.confetti .cf-response-choices{display:flex;flex-direction:column;gap:12px}.confetti .cf-choice{font-size:1em;cursor:pointer;padding:8px 10px;border-radius:var(--confetti-choice-border-radius);border:1px solid var(--confetti-border-color);transition:background 200ms ease-out}.confetti .cf-choice:hover{background:var( --confetti-hover-background-color, color-mix( in srgb, var(--confetti-text-primary-color) 4%, var(--confetti-background-color) ) )}.confetti .cf-choice .cf-choice-label{gap:8px;display:inline-flex;align-items:center}.confetti .cf-choice .cf-choice-description{font-size:0.875em;margin-left:26px;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-response-choices-tag{flex-direction:row;flex-wrap:wrap;gap:8px}.confetti .cf-tag-input{display:none}.confetti .cf-tag-input[data-visible='true']{display:inline}.confetti .cf-tag{border-radius:var(--confetti-tag-border-radius);padding:6px 12px;font-weight:500;font-size:0.875em;transition:background 200ms ease-out, border-color 200ms ease-out}.confetti .cf-tag[data-selected='true']{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color);color:var(--confetti-indicator-active-dot-color)}.confetti .cf-tag[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-tag:active{scale:0.96}.confetti .cf-radio,.confetti .cf-checkbox{cursor:pointer;display:flex;flex-direction:column;position:relative;align-items:start;color:var(--confetti-text-primary-color);forced-color-adjust:none}.confetti .cf-checkbox{--checkmark-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-checkbox .cf-checkbox-indicator{background:white;border:1px solid var(--confetti-border-color);width:18px;height:18px;box-sizing:border-box;border-radius:4px;transition:color 200ms ease-out;display:flex;align-items:center;justify-content:center;flex-shrink:0}.confetti .cf-checkbox svg{width:calc(100% - 8px);height:calc(100% - 8px);fill:none;stroke:var(--checkmark-color);stroke-width:3px;stroke-dasharray:22px;stroke-dashoffset:66;stroke-linecap:round;stroke-linejoin:round;transition:all 200ms}.confetti .cf-checkbox[data-focus-visible='true'] .cf-checkbox-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-checkbox[data-selected] .cf-checkbox-indicator,.confetti .cf-checkbox[data-indeterminate] .cf-checkbox-indicator{background:var(--confetti-indicator-active-bg-color);border:none}.confetti .cf-checkbox[data-selected] svg,.confetti .cf-checkbox[data-indeterminate] svg{stroke-dashoffset:44}.confetti .cf-checkbox[data-indeterminate] svg{stroke:none;fill:var(--checkmark-color)}.confetti .cf-radio{-webkit-tap-highlight-color:transparent;--dot-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-radio .cf-radio-indicator{position:relative;width:18px;height:18px;flex-shrink:0;box-sizing:border-box;border-radius:50%;transition:color 200ms ease-out;border:1px solid var(--confetti-border-color);background:white}.confetti .cf-radio .cf-radio-indicator::after{content:'';position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:inherit;background:transparent;transition:scale 200ms;scale:0}.confetti .cf-radio[data-selected] .cf-radio-indicator{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color)}.confetti .cf-radio[data-selected] .cf-radio-indicator::after{background:var(--dot-color);scale:0.4}.confetti .cf-radio[data-disabled]{color:var(--text-color-disabled);--dot-color: var(--text-color-disabled);}.confetti .cf-radio[data-focus-visible='true'] .cf-radio-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-input,.confetti .cf-textarea{background:var(--confetti-input-background);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-input-border-radius);color:var(--confetti-input-text-color);padding:10px;transition:border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out}.confetti .cf-input:focus,.confetti .cf-textarea:focus{border-color:var(--confetti-outline-color);box-shadow:var(--confetti-focus-shadow);outline:none}.confetti .cf-question{display:flex;flex-direction:column;gap:16px}.confetti .cf-question .cf-error{display:none;color:var(--confetti-error-color);font-size:0.875em;line-height:20px}.confetti .cf-question .cf-header{display:flex;flex-direction:column;gap:2px}.confetti .cf-question .cf-title{line-height:24px;font-weight:500}.confetti .cf-question .cf-label-optional{font-weight:400;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-description{font-size:0.875em;line-height:20px;font-weight:400;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-others-choice{display:flex;flex-direction:column;gap:8px}.confetti[data-show-errors] .cf-question .cf-error{display:block}.confetti .cf-bug-report{display:flex;flex-direction:column;gap:16px}.confetti .cf-bug-report .cf-bug-report-screenshot-section,.confetti .cf-bug-report .cf-bug-report-recording-section{display:flex;flex-direction:column;gap:8px}.confetti .cf-bug-report .cf-bug-report-actions{display:flex;flex-direction:column;gap:12px}.confetti .cf-bug-report .cf-bug-report-button-action{padding:8px 8px}.confetti .cf-bug-report .cf-bug-report-media-preview{position:relative;width:100%;aspect-ratio:16 / 9;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden;display:flex;align-items:center;justify-content:center}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-loading{width:1.5em;height:1.5em;border:2px solid var(--confetti-submit-button-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:confetti-spinner 1s linear infinite}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container{height:100%;width:100%;position:relative}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-player{height:100%;width:auto;overflow:hidden}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-progress-bar{position:absolute;bottom:0;left:0;height:2px;background:var(--confetti-text-primary-color);opacity:0.5;transition-property:width;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;width:0%}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-time{position:absolute;right:4px;bottom:4px;font-size:0.75em;color:color-mix( in oklab, var(--confetti-text-primary-color) 50%, transparent )}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:var(--confetti-bug-report-overlay-color);opacity:0;transition:opacity 200ms ease-out}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions:hover{opacity:1}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-screenshot-img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.confetti .cf-bug-report-button{color:var(--confetti-bug-report-button-text-color);background:var(--confetti-bug-report-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-bug-report-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-bug-report-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-bug-report-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button.cf-bug-report-record-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 8px;--pulse-color-start: var(--confetti-bug-report-record-button-color);background-color:var(--pulse-color-start);animation:confetti-record-pulse 2s ease-in-out infinite}.confetti .cf-bug-report-button.cf-bug-report-record-button:hover{--pulse-color-start: var(
7
+ );--confetti-bug-report-button-color: #18181b;--confetti-bug-report-record-button-color: #ff2c2c;--confetti-bug-report-record-button-active-color: #dc2626;--confetti-bug-report-button-text-color: white;--confetti-bug-report-overlay-color: rgba(9, 9, 11, 0.4);--confetti-text-primary-color: #09090b;--confetti-text-subtle-color: #71717a;--confetti-error-color: #dc2626;--confetti-trigger-bg-color: #18181b;--confetti-trigger-text-color: #fafafa;--confetti-trigger-size: 40px;--confetti-widget-color: #e0a045;--confetti-widget-text-color: white;--confetti-scrollbar-thumb-color: var(--confetti-border-color);--confetti-scrollbar-track-color: var(--confetti-background-color);--confetti-outline-color: rgba(9, 9, 11, 0.8);--confetti-input-background: white;--confetti-input-text-color: #020617;--confetti-disabled-button-opacity: 0.6;}@keyframes confetti-record-pulse{0%, 100%{background-color:var(--pulse-color-start)}50%{background-color:color-mix( in srgb, var(--pulse-color-start), rgb(70, 70, 70) 20% )}}@keyframes confetti-spinner{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.confetti-trigger{font-size:var(--confetti-font-scale);cursor:pointer;position:relative;display:inline-grid;grid-template-columns:0fr;align-items:center;justify-content:center;min-width:var(--confetti-trigger-size);height:var(--confetti-trigger-size);padding:0;border:none;border-radius:9999px;background:var(--confetti-trigger-bg-color);color:var(--confetti-trigger-text-color);overflow:hidden;transition:grid-template-columns 220ms ease, background 220ms ease}.confetti-trigger .confetti-trigger-icon-wrapper{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;opacity:1;transition:opacity 180ms ease;pointer-events:none}.confetti-trigger .confetti-trigger-label{opacity:0;pointer-events:none;min-width:0;overflow:hidden;padding:0 20px;font-size:0.875em;font-weight:500;line-height:20px;white-space:nowrap;transition:opacity 180ms ease}.confetti-trigger:hover,.confetti-trigger:focus-visible,.confetti-trigger[data-hovered],.confetti-trigger[data-focus-visible]{grid-template-columns:1fr}.confetti-trigger:focus-visible .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:hover .confetti-trigger-icon-wrapper,.confetti-trigger[data-hovered] .confetti-trigger-icon-wrapper,.confetti-trigger[data-focus-visible] .confetti-trigger-icon-wrapper{opacity:0}.confetti-trigger:focus-visible .confetti-trigger-label{opacity:1}.confetti-trigger:hover .confetti-trigger-label,.confetti-trigger[data-hovered] .confetti-trigger-label,.confetti-trigger[data-focus-visible] .confetti-trigger-label{opacity:1}.confetti-trigger:focus-visible,.confetti-trigger[data-focus-visible]{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog{width:var(--confetti-max-width);max-height:95dvh;overflow:auto;max-width:100%;background:transparent;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-dialog .confetti-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-dialog .confetti-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-dialog .confetti-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-dialog .confetti-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-dialog .cf-header .cf-title{padding-right:20px}.confetti-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--confetti-z-index);background:rgba(0, 0, 0, 0.4);display:flex;justify-content:center;overflow-y:auto;overscroll-behavior:none;padding:10vh 0}.confetti-modal{margin:auto}.confetti-modal .confetti-modal-dialog{width:var(--confetti-max-width);max-width:100%;position:relative;box-shadow:var(--confetti-box-shadow);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-border-radius);background:var(--confetti-background-color);padding:var(--confetti-box-padding)}.confetti-modal .confetti-modal-dialog:focus-visible{outline:none}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close{position:absolute;top:8px;right:8px;background:transparent;border:none;cursor:pointer;padding:8px;border-radius:8px;transition:background 200ms}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close svg{width:16px;height:16px;color:var(--confetti-text-subtle-color)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:hover{background:rgba(0, 0, 0, 0.05)}.confetti-modal .confetti-modal-dialog .confetti-modal-dialog-close:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti-modal .confetti-modal-dialog .cf-header .cf-title{padding-right:20px}.confetti{font-family:var(--confetti-font-family);display:flex;flex-direction:column;gap:16px;color:var(--confetti-text-primary-color);font-size:var(--confetti-font-scale);width:100%}.confetti .cf-button-row{display:flex;align-items:center;justify-content:space-between;gap:var(--confetti-button-row-gap)}.confetti .cf-submit-button{margin-left:auto;color:var(--confetti-submit-button-text-color);background:var(--confetti-submit-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-submit-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-submit-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-submit-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-submit-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-back-button{color:var(--confetti-text-primary-color);background:transparent;border:none;padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-back-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-back-button:hover{background:color-mix(in srgb, currentColor 8%, transparent)}.confetti .sr-only{clip:rect(0, 0, 0, 0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.confetti .cf-response-choices{display:flex;flex-direction:column;gap:12px}.confetti .cf-choice{font-size:1em;cursor:pointer;padding:8px 10px;border-radius:var(--confetti-choice-border-radius);border:1px solid var(--confetti-border-color);transition:background 200ms ease-out}.confetti .cf-choice:hover{background:var( --confetti-hover-background-color, color-mix( in srgb, var(--confetti-text-primary-color) 4%, var(--confetti-background-color) ) )}.confetti .cf-choice .cf-choice-label{gap:8px;display:inline-flex;align-items:center}.confetti .cf-choice .cf-choice-description{font-size:0.875em;margin-left:26px;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-response-choices-tag{flex-direction:row;flex-wrap:wrap;gap:8px}.confetti .cf-tag-input{display:none}.confetti .cf-tag-input[data-visible='true']{display:inline}.confetti .cf-tag{border-radius:var(--confetti-tag-border-radius);padding:6px 12px;font-weight:500;font-size:0.875em;transition:background 200ms ease-out, border-color 200ms ease-out}.confetti .cf-tag[data-selected='true']{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color);color:var(--confetti-indicator-active-dot-color)}.confetti .cf-tag[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-tag:active{scale:0.96}.confetti .cf-radio,.confetti .cf-checkbox{cursor:pointer;display:flex;flex-direction:column;position:relative;align-items:start;color:var(--confetti-text-primary-color);forced-color-adjust:none}.confetti .cf-checkbox{--checkmark-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-checkbox .cf-checkbox-indicator{background:white;border:1px solid var(--confetti-border-color);width:18px;height:18px;box-sizing:border-box;border-radius:4px;transition:color 200ms ease-out;display:flex;align-items:center;justify-content:center;flex-shrink:0}.confetti .cf-checkbox svg{width:calc(100% - 8px);height:calc(100% - 8px);fill:none;stroke:var(--checkmark-color);stroke-width:3px;stroke-dasharray:22px;stroke-dashoffset:66;stroke-linecap:round;stroke-linejoin:round;transition:all 200ms}.confetti .cf-checkbox[data-focus-visible='true'] .cf-checkbox-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-checkbox[data-selected] .cf-checkbox-indicator,.confetti .cf-checkbox[data-indeterminate] .cf-checkbox-indicator{background:var(--confetti-indicator-active-bg-color);border:none}.confetti .cf-checkbox[data-selected] svg,.confetti .cf-checkbox[data-indeterminate] svg{stroke-dashoffset:44}.confetti .cf-checkbox[data-indeterminate] svg{stroke:none;fill:var(--checkmark-color)}.confetti .cf-radio{-webkit-tap-highlight-color:transparent;--dot-color: var(--confetti-indicator-active-dot-color);}.confetti .cf-radio .cf-radio-indicator{position:relative;width:18px;height:18px;flex-shrink:0;box-sizing:border-box;border-radius:50%;transition:color 200ms ease-out;border:1px solid var(--confetti-border-color);background:white}.confetti .cf-radio .cf-radio-indicator::after{content:'';position:absolute;top:1px;right:1px;bottom:1px;left:1px;border-radius:inherit;background:transparent;transition:scale 200ms;scale:0}.confetti .cf-radio[data-selected] .cf-radio-indicator{background:var(--confetti-indicator-active-bg-color);border-color:var(--confetti-indicator-active-bg-color)}.confetti .cf-radio[data-selected] .cf-radio-indicator::after{background:var(--dot-color);scale:0.4}.confetti .cf-radio[data-disabled]{color:var(--text-color-disabled);--dot-color: var(--text-color-disabled);}.confetti .cf-radio[data-focus-visible='true'] .cf-radio-indicator{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-input,.confetti .cf-textarea{background:var(--confetti-input-background);border:1px solid var(--confetti-border-color);border-radius:var(--confetti-input-border-radius);color:var(--confetti-input-text-color);padding:10px;transition:border-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.15s ease-out}.confetti .cf-input:focus,.confetti .cf-textarea:focus{border-color:var(--confetti-outline-color);box-shadow:var(--confetti-focus-shadow);outline:none}.confetti .cf-question{display:flex;flex-direction:column;gap:16px}.confetti .cf-question .cf-error{display:none;color:var(--confetti-error-color);font-size:0.875em;line-height:20px}.confetti .cf-question .cf-header{display:flex;flex-direction:column;gap:2px}.confetti .cf-question .cf-title{line-height:24px;font-weight:500}.confetti .cf-question .cf-label-optional{font-weight:400;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-description{font-size:0.875em;line-height:20px;font-weight:400;white-space:pre-wrap;word-wrap:anywhere;color:var(--confetti-text-subtle-color)}.confetti .cf-question .cf-others-choice{display:flex;flex-direction:column;gap:8px}.confetti[data-show-errors] .cf-question .cf-error{display:block}.confetti .cf-bug-report{display:flex;flex-direction:column;gap:16px}.confetti .cf-bug-report .cf-bug-report-screenshot-section,.confetti .cf-bug-report .cf-bug-report-recording-section{display:flex;flex-direction:column;gap:8px}.confetti .cf-bug-report .cf-bug-report-actions{display:flex;flex-direction:column;gap:12px}.confetti .cf-bug-report .cf-bug-report-button-action{padding:8px 8px}.confetti .cf-bug-report .cf-bug-report-media-preview{position:relative;width:100%;aspect-ratio:16 / 9;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden;display:flex;align-items:center;justify-content:center}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-loading{width:1.5em;height:1.5em;border:2px solid var(--confetti-submit-button-color);border-bottom-color:transparent;border-radius:50%;display:inline-block;box-sizing:border-box;animation:confetti-spinner 1s linear infinite}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container{height:100%;width:100%;position:relative}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-player{height:100%;width:auto;overflow:hidden}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-progress-bar{position:absolute;bottom:0;left:0;height:2px;background:var(--confetti-text-primary-color);opacity:0.5;transition-property:width;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;width:0%}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-player-container .cf-bug-report-time{position:absolute;right:4px;bottom:4px;font-size:0.75em;color:color-mix( in oklab, var(--confetti-text-primary-color) 50%, transparent )}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:var(--confetti-bug-report-overlay-color);opacity:0;transition:opacity 200ms ease-out}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-media-actions:hover{opacity:1}.confetti .cf-bug-report .cf-bug-report-media-preview .cf-bug-report-screenshot-img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.confetti .cf-bug-report-button{color:var(--confetti-bug-report-button-text-color);background:var(--confetti-bug-report-button-color);padding:8px 16px;border-radius:var(--confetti-input-border-radius);cursor:pointer;transition:transform 200ms;font-size:0.875em;font-weight:500;line-height:20px;transition:background 200ms ease-out}.confetti .cf-bug-report-button:focus-visible{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-bug-report-button[data-disabled]{opacity:var(--confetti-disabled-button-opacity);cursor:not-allowed;-ms-transform:none;transform:none}.confetti .cf-bug-report-button:hover{background:color-mix( in srgb, white 10%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button:active{background:color-mix( in srgb, white 5%, var(--confetti-submit-button-color) )}.confetti .cf-bug-report-button.cf-bug-report-record-button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 8px;--pulse-color-start: var(--confetti-bug-report-record-button-color);background-color:var(--pulse-color-start);animation:confetti-record-pulse 2s ease-in-out infinite}.confetti .cf-bug-report-button.cf-bug-report-record-button:hover{--pulse-color-start: var(
8
8
  --confetti-bug-report-record-button-active-color
9
9
  );}.confetti .cf-rating-section{display:flex;flex-direction:column;gap:4px}.confetti .cf-rating-emoji{opacity:0.5}.confetti .cf-rating-display-star,.confetti .cf-rating-display-emoji{display:grid;grid-template-columns:repeat(auto-fit, 40px);justify-content:space-between;grid-gap:8px;gap:8px}.confetti .cf-rating-display-star .cf-rating-emoji,.confetti .cf-rating-display-emoji .cf-rating-emoji,.confetti .cf-rating-display-star .cf-rating-star,.confetti .cf-rating-display-emoji .cf-rating-star{font-size:1em;background-color:transparent;border:none;padding:0;transition:transform 0.15s ease-out;color:var(--confetti-rating-active-bg-color)}.confetti .cf-rating-display-star .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-focus-visible='true'],.confetti .cf-rating-display-star .cf-rating-star[data-focus-visible='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-focus-visible='true']{outline:2px solid var(--confetti-outline-color);outline-offset:2px}.confetti .cf-rating-display-star .cf-rating-emoji:hover,.confetti .cf-rating-display-emoji .cf-rating-emoji:hover,.confetti .cf-rating-display-star .cf-rating-star:hover,.confetti .cf-rating-display-emoji .cf-rating-star:hover{cursor:pointer;-ms-transform:scale(1.15);transform:scale(1.15);opacity:1!important}.confetti .cf-rating-display-star .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-filled='true'],.confetti .cf-rating-display-star .cf-rating-star[data-filled='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-filled='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-emoji[data-selected='true'],.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'],.confetti .cf-rating-display-emoji .cf-rating-star[data-selected='true']{opacity:1}.confetti .cf-rating-display-star .cf-rating-emoji svg,.confetti .cf-rating-display-emoji .cf-rating-emoji svg,.confetti .cf-rating-display-star .cf-rating-star svg,.confetti .cf-rating-display-emoji .cf-rating-star svg{transition:fill 0.15s ease-out}.confetti .cf-rating-text{display:flex;justify-content:space-between;font-size:0.75em;color:var(--confetti-text-subtle-color);font-weight:500;line-height:1}.confetti .cf-rating-text .cf-rating-text-lower{flex:1;text-align:left}.confetti .cf-rating-text .cf-rating-text-upper{flex:1;text-align:right}.confetti .cf-rating-display-star .cf-rating-star[data-selected='true'] ~ .cf-rating-star{opacity:0.5}.confetti .cf-rating-display-number{display:grid;grid-auto-columns:1fr;grid-auto-flow:column;border:1px solid var(--confetti-border-color);border-radius:8px;overflow:hidden}.confetti .cf-rating-display-number .cf-rating-number{border-right:1px solid var(--confetti-border-color);text-align:center;cursor:pointer;color:var(--confetti-rating-text-color);border-left:none;border-top:none;border-bottom:none;font-weight:700;padding:8px 0;margin-top:-1px;margin-bottom:-1px}.confetti .cf-rating-display-number .cf-rating-number:first-of-type{border-top-left-radius:8px;border-bottom-left-radius:8px}.confetti .cf-rating-display-number .cf-rating-number:last-of-type{border-top-right-radius:8px;border-bottom-right-radius:8px;border-right:0}.confetti .cf-rating-display-number .cf-rating-number[data-focus-visible='true']{box-shadow:inset 0 0 0 1px var(--confetti-outline-color)}.confetti .cf-rating-display-number .cf-rating-number[data-selected='true']{background:var(--confetti-rating-active-bg-color);color:var(--confetti-rating-active-text-color)}
@@ -1,4 +1,3 @@
1
- import { ReactNode } from "react";
2
1
  import { z } from "zod";
3
2
 
4
3
  //#region ../validators/dist/questions/routing.d.ts
@@ -130,6 +129,14 @@ declare const multiSelectAnswerSchemaFactory: ({
130
129
  }) => z.ZodArray<z.ZodString>;
131
130
  type MultiSelectAnswer = z.infer<ReturnType<typeof multiSelectAnswerSchemaFactory>>;
132
131
  //#endregion
132
+ //#region ../validators/dist/questions/reachability.d.ts
133
+ /**
134
+ * Answer shape the routing engine can evaluate. Mirrors the widget's `Answer`
135
+ * union. Condition evaluation only meaningfully inspects string / number /
136
+ * string[] answers; any other shape never satisfies a condition.
137
+ */
138
+ type RoutableAnswer = BugReportAnswer | RatingAnswer | MultiSelectAnswer | SingleSelectAnswer;
139
+ //#endregion
133
140
  //#region ../validators/dist/survey.d.ts
134
141
  declare const publicGetSurveyOutputSchema: z.ZodObject<{
135
142
  title: z.ZodString;
@@ -239,107 +246,9 @@ declare const publicGetSurveyOutputSchema: z.ZodObject<{
239
246
  description: z.ZodString;
240
247
  buttonText: z.ZodString;
241
248
  }, z.core.$strip>;
249
+ isBackNavigationAllowed: z.ZodBoolean;
250
+ backButtonLabel: z.ZodNullable<z.ZodString>;
242
251
  }, z.core.$strip>;
243
252
  type PublicGetSurveyOutput = z.infer<typeof publicGetSurveyOutputSchema>;
244
253
  //#endregion
245
- //#region src/core/types.d.ts
246
- type Question = {
247
- visible: boolean;
248
- error?: string;
249
- } & PublicGetSurveyOutput['questions'][number];
250
- type Answer = BugReportAnswer | RatingAnswer | MultiSelectAnswer | SingleSelectAnswer;
251
- interface ConfettiState {
252
- questions: Question[];
253
- current: number;
254
- update: ({
255
- question,
256
- answer
257
- }: {
258
- question: number;
259
- answer: Answer;
260
- }) => {
261
- next?: number;
262
- error?: string;
263
- };
264
- /**
265
- * Submits the survey, or, when a visible question is unanswered or invalid,
266
- * refuses and reveals the blocking errors through `errors`. Render an
267
- * always-enabled submit control and let this decide.
268
- *
269
- * Returns whether the submission was accepted. Anything that should only
270
- * happen on a real submission — navigation, analytics — must be gated on
271
- * this rather than assuming the press went through.
272
- */
273
- submit: () => boolean;
274
- isSubmitted: boolean;
275
- /**
276
- * Blocking errors keyed by question id. Empty until the first submit
277
- * attempt, then updated live as answers change.
278
- */
279
- errors: Record<Question['id'], string>;
280
- }
281
- interface Proxyable {
282
- /**
283
- * Origin of the proxy that forwards Confetti API requests. The hosted
284
- * templates also load the widget bundle and stylesheet from it.
285
- */
286
- proxyUrl?: string;
287
- }
288
- type WithProxyable<T> = Omit<T, 'apiBaseUrl'> & Proxyable;
289
- interface Finishable {
290
- /**
291
- * Callback is invoked after the survey response is submitted and the
292
- * submission network call settles.
293
- */
294
- onFinished?: () => void;
295
- }
296
- interface Closable {
297
- /**
298
- * Callback is invoked whenever the survey closes, regardless of how it was closed.
299
- */
300
- onClose?: () => void;
301
- }
302
- /**
303
- * Wraps the rendered survey in a consumer-provided container. Receives an
304
- * object holding the survey node and returns the wrapped tree. The object
305
- * shape leaves room to pass extra render data in the future.
306
- */
307
- type ConfettiContainer = (props: {
308
- survey: ReactNode;
309
- }) => ReactNode;
310
- interface Containable {
311
- /**
312
- * Wraps the rendered survey in a consumer-provided container for theming.
313
- * Only invoked once the survey passes its visibility gates, so the container
314
- * never renders while the survey is hidden, and unmounts when the survey
315
- * closes.
316
- *
317
- * Prefer an inline function. To carry state or animation, render your own
318
- * component inside it: `container={({ survey }) => <BrandShell>{survey}</BrandShell>}`.
319
- */
320
- container?: ConfettiContainer;
321
- }
322
- interface Dismissable extends Closable {
323
- /**
324
- * The widget will automatically close this many milliseconds
325
- * after the survey is finished.
326
- * Set to `null` to disable automatic closing.
327
- * @default 3000
328
- */
329
- closeOnFinishMs?: number | null;
330
- /**
331
- * Callback is invoked when the user dismisses the survey before submitting.
332
- * Closing after submission is not a dismissal and does not invoke this.
333
- */
334
- onDismiss?: () => void;
335
- }
336
- interface OptionallyDismissable extends Dismissable {
337
- /**
338
- * Allows the user to dismiss the modal via the close button and the
339
- * overlay.
340
- * @default true
341
- */
342
- isDismissable?: boolean;
343
- }
344
- //#endregion
345
- export { TextQuestionProperties as _, Containable as a, OptionallyDismissable as c, WithProxyable as d, PublicGetSurveyOutput as f, StatementQuestionProperties as g, SingleSelectQuestionProperties as h, ConfettiState as i, Proxyable as l, RatingQuestionProperties as m, Closable as n, Dismissable as o, MultiSelectQuestionProperties as p, ConfettiContainer as r, Finishable as s, Answer as t, Question as u, BinaryOperatorCondition as v };
254
+ export { RatingAnswer as a, RatingQuestionProperties as c, TextQuestionProperties as d, BinaryOperatorCondition as f, MultiSelectAnswer as i, SingleSelectQuestionProperties as l, RoutableAnswer as n, SingleSelectAnswer as o, BugReportAnswer as r, MultiSelectQuestionProperties as s, PublicGetSurveyOutput as t, StatementQuestionProperties as u };
package/build/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as Containable, c as OptionallyDismissable, l as Proxyable, n as Closable, o as Dismissable, r as ConfettiContainer, s as Finishable } from "./types-NMQZur7D.js";
2
- import { t as BaseConfettiProps } from "./Confetti-fis-IO5o.js";
1
+ import { D as OptionallyDismissable, E as Finishable, O as Proxyable, S as ConfettiContainer, T as Dismissable, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-d1r1QIP2.js";
3
2
 
4
3
  //#region src/contracts/api.d.ts
5
4
  type Template = 'TriggerPopover' | 'Popover' | 'Modal' | 'Embedded' | 'Stepper';
package/build/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,o as n,r,t as i}from"./DefaultConfettiTrigger-CxIyRNHv.js";import{nt as a}from"./Button-uM2fAs2N.js";import{useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{ErrorBoundary as d}from"react-error-boundary";import{useLocalStorage as f,useSessionStorage as p}from"usehooks-ts";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=`confetti:ready`,v=`https://confetti.gov.sg`,y={promise:null,channel:null,url:null};function b(){y.promise=null,y.channel=null,y.url=null}function x(){y.promise=null}function S(e){return new URL(``,e).href}function C(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function w(e=`stable`,t=v){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(y.promise)return y.channel===e?y.url===n?y.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(y.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(y.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?y.url!==null&&y.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${y.url} to ${n} on the same page`)):k(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=E(n,e);return y.channel=e,y.url=n,y.promise=i,i}function T(e=`stable`,t=v){if(typeof window>`u`)return Promise.resolve();let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return D(n,e)}async function E(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([D(e,t),O(e,t)])]);return clearTimeout(r),x(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),b(),e}}function D(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=C(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function O(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}k(e).then(n,r)};if(window.addEventListener(_,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=C(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(_,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function k(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function A(e){let t=l(null),n=l(null),r=l(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,s(()=>{if(!e.element)return;let o=!1;return w(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),s(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function j(e){let[t,n]=u(null);return A({...e,element:t}),h(d,{fallback:h(m,{}),children:h(`div`,{ref:n,"data-confetti-mount":!0})})}function M(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.0`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Embedded`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function N(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.0`},closeOnFinishMs:i.closeOnFinishMs,isDismissable:i.isDismissable,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.isDismissable,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Modal`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function P(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.0`},closeOnFinishMs:i.closeOnFinishMs,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Popover`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function F(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.6.0`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Stepper`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function I(f){let p=e({surveyId:f.surveyId,override:f.respondent}),_=a({publishableKey:f.publishableKey,apiBaseUrl:f.proxyUrl}),{isAvailable:v,isSettled:y}=r({client:_,surveyId:f.surveyId}),{state:b,isSettled:x}=t({client:_,surveyId:f.surveyId,respondent:p}),[S,C]=u(!1),w=y&&v&&x&&S&&n(b,f.isSurveyVisible),[E,D]=u(!1),[O,k]=u(!1),{onError:A,channel:M,proxyUrl:N}=f,P=l(A);s(()=>{P.current=A},[A]),s(()=>{if(!(y&&v))return;let e=!1;return T(M,N).then(()=>{e||C(!0)}).catch(e=>P.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[y,v,M,N]);let F=w&&E,I=o(()=>D(!0),[]),L=f.onFinished,R=c(()=>({surveyId:f.surveyId,publishableKey:f.publishableKey,respondent:p,metadata:f.metadata,apiBaseUrl:f.proxyUrl,telemetry:{version:`0.6.0`},isOpen:E,onFinished:()=>{k(!0),L?.()},onClose:()=>{D(!1)},onDismiss:()=>{D(!1)},options:f.options}),[f.surveyId,f.publishableKey,p,f.metadata,f.proxyUrl,f.options,E,L]);return w?g(d,{fallback:h(m,{}),children:[f.trigger?f.trigger({onClick:I,isOpen:E,isSubmitted:O}):h(i,{onClick:I,isWidgetOpen:E}),F?h(j,{template:`TriggerPopover`,channel:f.channel,scriptBaseUrl:f.proxyUrl,onError:f.onError,props:R}):null]}):null}const L=({delay:e})=>{let[t,n]=u(!1),r=c(()=>e,[]);return s(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},R=({visits:e,respondent:t})=>{let[n,r]=f(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},z=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},B=({threshold:e})=>{let[t,n]=u(()=>typeof window>`u`?!1:window.scrollY>=e);return s(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{M as EmbeddedConfetti,N as ModalConfetti,P as PopoverConfetti,F as StepperConfetti,I as TriggerPopoverConfetti,L as useVisibleAfterDelay,R as useVisibleAfterPageVisits,B as useVisibleAfterScroll,z as useVisibleAfterSessionPageVisits};
1
+ import{a as e,i as t,o as n,r,t as i}from"./DefaultConfettiTrigger-C-E0FHJD.js";import{G as a}from"./Button-LiaNjkvk.js";import{useCallback as o,useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{ErrorBoundary as d}from"react-error-boundary";import{useLocalStorage as f,useSessionStorage as p}from"usehooks-ts";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=`confetti:ready`,v=`https://confetti.gov.sg`,y={promise:null,channel:null,url:null};function b(){y.promise=null,y.channel=null,y.url=null}function x(){y.promise=null}function S(e){return new URL(``,e).href}function C(e,t,n){let r=new URL(e);return r.pathname.endsWith(`/`)||(r.pathname+=`/`),new URL(`widget/v1/${t}.${n}`,r).href}function w(e=`stable`,t=v){if(typeof window>`u`)return Promise.reject(Error(`[confetti] No window found, SSR environments are not supported`));let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}if(y.promise)return y.channel===e?y.url===n?y.promise:Promise.reject(Error(`[confetti] Cannot switch baseUrl from ${String(y.url)} to ${n} on the same page`)):Promise.reject(Error(`[confetti] Cannot switch channel from ${String(y.channel)} to ${e} on the same page`));let r=window.__confetti;if(r){let t=String(r.channel);return t===e?y.url!==null&&y.url!==n?Promise.reject(Error(`[confetti] Cannot switch URL from ${y.url} to ${n} on the same page`)):k(r):Promise.reject(Error(`[confetti] Cannot switch channel from ${t} to ${e} on the same page`))}let i=E(n,e);return y.channel=e,y.url=n,y.promise=i,i}function T(e=`stable`,t=v){if(typeof window>`u`)return Promise.resolve();let n;try{n=S(t)}catch{return Promise.reject(Error(`[confetti] Invalid URL: ${t}`))}return D(n,e)}async function E(e,t){let n=!!document.querySelector(`link[data-confetti-loader]`),r,i=new Promise((e,t)=>{r=setTimeout(()=>t(Error(`[confetti] Script load timeout`)),1e4)});try{let[,n]=await Promise.race([i,Promise.all([D(e,t),O(e,t)])]);return clearTimeout(r),x(),n}catch(e){throw clearTimeout(r),n||document.querySelector(`link[data-confetti-loader]`)?.remove(),document.querySelector(`script[data-confetti-loader]`)?.remove(),b(),e}}function D(e,t){return new Promise((n,r)=>{if(document.querySelector(`link[data-confetti-loader]`)){n();return}let i=document.createElement(`link`);i.rel=`stylesheet`,i.href=C(e,t,`css`),i.crossOrigin=`anonymous`,i.dataset.confettiLoader=``,i.onload=()=>n(),i.onerror=e=>{i.remove(),console.error(`[confetti] Stylesheet load failed. If your site uses a Content-Security-Policy, ensure style-src includes https://confetti.gov.sg (and script-src for the bundle).`),r(Error(`[confetti] Stylesheet load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(i)})}function O(e,t){return new Promise((n,r)=>{let i=()=>{let e=window.__confetti;if(!e){r(Error(`[confetti] Ready event fired but global state is missing`));return}k(e).then(n,r)};if(window.addEventListener(_,i,{once:!0}),document.querySelector(`script[data-confetti-loader]`))return;let a=document.createElement(`script`);a.src=C(e,t,`js`),a.async=!0,a.crossOrigin=`anonymous`,a.dataset.confettiLoader=``,a.onerror=e=>{window.removeEventListener(_,i),console.error(`[confetti] Script load failed. If your site uses a Content-Security-Policy, ensure script-src includes https://confetti.gov.sg (and style-src for the CSS).`),r(Error(`[confetti] Script load failed (check CSP allowlist for confetti.gov.sg)`,{cause:e}))},document.head.appendChild(a)})}function k(e){let t=Number(e.protocolVersion);return Number.isFinite(t)?t===1?Promise.resolve(e):Promise.reject(Error(`[confetti] Wire protocol v${t} does not match expected v1`)):Promise.reject(Error(`[confetti] Wire protocol value is not a number (got ${typeof e.protocolVersion})`))}function A(e){let t=l(null),n=l(null),r=l(e.props),i=e.channel??`stable`,a=e.scriptBaseUrl??`https://confetti.gov.sg`;r.current=e.props,s(()=>{if(!e.element)return;let o=!1;return w(i,a).then(i=>{o||!e.element||(n.current=i,t.current=i.mount({template:e.template,element:e.element,props:r.current}))}).catch(t=>e.onError?.(t instanceof Error?t:Error(String(t)))),()=>{o=!0,t.current&&n.current&&n.current.unmount(t.current),t.current=null,n.current=null}},[i,a,e.element,e.template]),s(()=>{t.current&&n.current&&n.current.update(t.current,e.props)},[e.props])}function j(e){let[t,n]=u(null);return A({...e,element:t}),h(d,{fallback:h(m,{}),children:h(`div`,{ref:n,"data-confetti-mount":!0})})}function M(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.0`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Embedded`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function N(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.0`},closeOnFinishMs:i.closeOnFinishMs,isDismissable:i.isDismissable,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.isDismissable,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Modal`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function P(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onDismiss,C=i.onClose,w=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.0`},closeOnFinishMs:i.closeOnFinishMs,onFinished:x,onClose:()=>{y(!0),C?.()},onDismiss:()=>{S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.closeOnFinishMs,i.options,x,S,C]);return b?h(d,{fallback:h(m,{}),children:h(j,{template:`Popover`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:w})}):null}function F(i){let o=e({surveyId:i.surveyId,override:i.respondent}),s=a({publishableKey:i.publishableKey,apiBaseUrl:i.proxyUrl}),{isAvailable:l,isSettled:f}=r({client:s,surveyId:i.surveyId}),{state:p,isSettled:g}=t({client:s,surveyId:i.surveyId,respondent:o}),_=n(p,i.isSurveyVisible),[v,y]=u(!1),b=f&&l&&g&&_&&!v,x=i.onFinished,S=i.onClose,C=c(()=>({surveyId:i.surveyId,publishableKey:i.publishableKey,respondent:o,metadata:i.metadata,apiBaseUrl:i.proxyUrl,telemetry:{version:`0.7.0`},onFinished:x,onClose:()=>{y(!0),S?.()},options:i.options}),[i.surveyId,i.publishableKey,o,i.metadata,i.proxyUrl,i.options,x,S]);if(!b)return null;let w=h(j,{template:`Stepper`,channel:i.channel,scriptBaseUrl:i.proxyUrl,onError:i.onError,props:C});return h(d,{fallback:h(m,{}),children:i.container?i.container({survey:w}):w})}function I(f){let p=e({surveyId:f.surveyId,override:f.respondent}),_=a({publishableKey:f.publishableKey,apiBaseUrl:f.proxyUrl}),{isAvailable:v,isSettled:y}=r({client:_,surveyId:f.surveyId}),{state:b,isSettled:x}=t({client:_,surveyId:f.surveyId,respondent:p}),[S,C]=u(!1),w=y&&v&&x&&S&&n(b,f.isSurveyVisible),[E,D]=u(!1),[O,k]=u(!1),{onError:A,channel:M,proxyUrl:N}=f,P=l(A);s(()=>{P.current=A},[A]),s(()=>{if(!(y&&v))return;let e=!1;return T(M,N).then(()=>{e||C(!0)}).catch(e=>P.current?.(e instanceof Error?e:Error(String(e)))),()=>{e=!0}},[y,v,M,N]);let F=w&&E,I=o(()=>D(!0),[]),L=f.onFinished,R=c(()=>({surveyId:f.surveyId,publishableKey:f.publishableKey,respondent:p,metadata:f.metadata,apiBaseUrl:f.proxyUrl,telemetry:{version:`0.7.0`},isOpen:E,onFinished:()=>{k(!0),L?.()},onClose:()=>{D(!1)},onDismiss:()=>{D(!1)},options:f.options}),[f.surveyId,f.publishableKey,p,f.metadata,f.proxyUrl,f.options,E,L]);return w?g(d,{fallback:h(m,{}),children:[f.trigger?f.trigger({onClick:I,isOpen:E,isSubmitted:O}):h(i,{onClick:I,isWidgetOpen:E}),F?h(j,{template:`TriggerPopover`,channel:f.channel,scriptBaseUrl:f.proxyUrl,onError:f.onError,props:R}):null]}):null}const L=({delay:e})=>{let[t,n]=u(!1),r=c(()=>e,[]);return s(()=>{let e=setTimeout(()=>{n(!0)},r);return()=>clearTimeout(e)},[]),{isVisible:t}},R=({visits:e,respondent:t})=>{let[n,r]=f(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},z=({visits:e,respondent:t})=>{let[n,r]=p(`cfti:${c(()=>window.location.pathname,[])}:visits:${t??``}`,0);return s(()=>{r(e=>e+1)},[r]),{isVisible:n>=e,reset:o(()=>r(0),[r])}},B=({threshold:e})=>{let[t,n]=u(()=>typeof window>`u`?!1:window.scrollY>=e);return s(()=>{let t=()=>{window.scrollY>=e&&n(!0)};return window.addEventListener(`scroll`,t,{passive:!0}),()=>window.removeEventListener(`scroll`,t)},[e]),{isVisible:t}};export{M as EmbeddedConfetti,N as ModalConfetti,P as PopoverConfetti,F as StepperConfetti,I as TriggerPopoverConfetti,L as useVisibleAfterDelay,R as useVisibleAfterPageVisits,B as useVisibleAfterScroll,z as useVisibleAfterSessionPageVisits};
@@ -0,0 +1 @@
1
+ import"./src-DAnW22YG.js";import{z as e}from"zod";const t=e=>e.value,n=({answer:e,condition:n})=>{let r=t(n.value);switch(n.operator){case`equal`:return e===r;case`not-equal`:return e!==r;case`greater`:return typeof e==`number`&&typeof r==`number`&&e>r;case`greater-or-equal`:return typeof e==`number`&&typeof r==`number`&&e>=r;case`less`:return typeof e==`number`&&typeof r==`number`&&e<r;case`less-or-equal`:return typeof e==`number`&&typeof r==`number`&&e<=r;case`contains`:return Array.isArray(e)&&typeof r==`string`&&e.includes(r);case`not-contains`:return Array.isArray(e)&&typeof r==`string`&&!e.includes(r)}},r=({position:e,value:t})=>{switch(t.type){case`next`:return e+1;case`jump`:return t.target;case`end`:return null}},i=({position:e,question:t,answer:i})=>{let a=t.routingLogic;if(a.type===`always`)return r({position:e,value:a.target});if(i==null&&t.required)return null;let o=i==null?void 0:a.cases.find(e=>n({answer:i,condition:e}));return r(o?{position:e,value:o.target}:{position:e,value:a.default})},a=(e,t,{forceReachableIds:n}={})=>{let r=[...e].sort((e,t)=>e.position-t.position),a=new Set,o=new Set(n);for(let e=0;e<r.length;e++){let n=r[e];if(n){if(e===0||o.has(n.id)){a.add(n.id);continue}for(let o=0;o<e;o++){let s=r[o];if(!(!s||!a.has(s.id))&&i({position:o,question:s,answer:t[s.id]})===e){a.add(n.id);break}}}}return a},o=n,s=`cfti-mask`,c=`cfti-block`,l=`__confetti_bug_report_recording_event`,u=e.object({detail:e.object({isRecording:e.boolean()})});export{o as a,u as i,s as n,a as o,l as r,c as t};
@@ -1,4 +1,4 @@
1
- import { t as Answer, v as BinaryOperatorCondition } from "./types-NMQZur7D.js";
1
+ import { f as BinaryOperatorCondition, n as RoutableAnswer } from "./index-rGiNABlG.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/core/logic/routing.d.ts
@@ -6,7 +6,7 @@ declare const evaluateCondition: ({
6
6
  answer,
7
7
  condition
8
8
  }: {
9
- answer: Answer;
9
+ answer: RoutableAnswer;
10
10
  condition: BinaryOperatorCondition;
11
11
  }) => boolean;
12
12
  //#endregion
@@ -1 +1 @@
1
- import{a as e,i as t,n,r,t as i}from"./internals-Cc32ucML.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
1
+ import{a as e,i as t,n,r,t as i}from"./internals-DMTYF5K8.js";export{i as BUG_REPORT_BLOCK_CLASS,n as BUG_REPORT_MASK_CLASS,r as __INTERNAL_BUG_REPORT_RECORDING_EVENT,t as internalBugReportRecordingEventSchema,e as unstableInternalConfettiEvaluateCondition};
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=e.object({type:e.literal(`next`)}),n=e.object({type:e.literal(`end`)}),r=e.object({type:e.literal(`jump`),target:e.number({error:`Target question is required`})}),i=e.discriminatedUnion(`type`,[t,r,n]),a=e.object({type:e.literal(`value`),value:e.union([e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),e.number({error:`Value is required`})])}),o=e.object({type:e.literal(`binary-operator`),operator:e.union([e.literal(`equal`),e.literal(`not-equal`),e.literal(`greater`),e.literal(`greater-or-equal`),e.literal(`less`),e.literal(`less-or-equal`),e.literal(`contains`),e.literal(`not-contains`)]),value:a,target:i}),s=e.object({type:e.literal(`switch`),cases:e.array(o),default:i}),c=e.object({type:e.literal(`always`),target:i}),l=e.discriminatedUnion(`type`,[c,s]),u=e.string().check(e.trim(),e.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),d=e.optional(e.string().check(e.trim(),e.maxLength(50))),f=e.object({value:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),description:e.optional(e.string().check(e.trim()))}),p=e.nullable(e.object({label:e.string().check(e.trim(),e.minLength(1,{error:`Value is required`})),max:e.number(),description:e.optional(e.string().check(e.trim()))})),m=e.optional(e.boolean()),h=e.object({type:e.literal(`rating`),buttonLabel:d,shouldAutoProgress:m,scale:e.number().check(e.gte(2),e.lte(10)),labels:e.optional(e.object({lower:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e))),upper:e.optional(e.pipe(e.string().check(e.trim()),e.transform(e=>e===``?void 0:e)))})),display:e.optional(e.literal([`star`,`emoji`,`number`]))}),g=e.object({type:e.literal(`open-ended`),placeholder:e.optional(e.string()),buttonLabel:d,max:e.number()}),_=e.object({type:e.literal(`single-select`),shouldAutoProgress:m,options:e.array(f),buttonLabel:d,editable:p}),v=e.object({type:e.literal(`multi-select`),buttonLabel:d,options:e.array(f),editable:p,max:e.optional(e.number()),display:e.optional(e.literal([`checkbox`,`tag`]))}),y=e.object({type:e.literal(`statement`),buttonLabel:d,buttonUrl:e.optional(u)}),b=e.object({type:e.literal(`bug-report`),placeholder:e.optional(e.string()),buttonLabel:d,enableScreenshot:e.boolean(),enableRecording:e.boolean(),detailsLabel:e.string().check(e.trim(),e.minLength(1,{error:`Label is required`}),e.maxLength(128)),detailsPlaceholder:e.optional(e.string()),redactClasses:e.optional(e.array(e.string()))}),x=e.discriminatedUnion(`type`,[h,_,g,v,y,b]),S=`__CONFETTI_CHECKBOX_Others`,C=`__CONFETTI_RADIO_Others`,w=e.optional(e.looseObject({userAgent:e.string().check(e.trim(),e.maxLength(1e3)),screenResolution:e.string().check(e.trim(),e.maxLength(100)),viewportSize:e.string().check(e.trim(),e.maxLength(100)),pageUrl:e.string(),pageTitle:e.string().check(e.trim(),e.maxLength(1e3)),referrer:e.string(),datadogTraceId:e.optional(e.string()),datadogSessionId:e.optional(e.string()),datadogSessionReplayLink:e.optional(e.string())}).partial().catchall(e.optional(e.string())));e.cuid2();const T=e.looseObject({type:e.literal([0,1,2,3,4,5,6]),data:e.unknown(),timestamp:e.number(),delay:e.optional(e.number())});e.array(T);const E=e.array(T),D=e.string().check(e.refine(e=>{try{return E.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),O=e.string().check(e.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),k=t=>e.object({title:e.string().check(e.trim(),...t?[e.minLength(1,{error:`Title is required`})]:[],e.maxLength(256)),description:e.optional(e.string().check(e.trim(),e.maxLength(4096))),screenshotDataUrl:e.optional(O),recordingEventsJson:e.optional(D),metadata:w}),A=k(!0),j=(e,{required:t})=>k(t),M=t=>e.number({error:`Please select a rating`}).check(e.int(),e.gte(1),e.lte(t)),N=({scale:t},{required:n})=>{let r=M(t);return n?r:e.optional(r)},P=({maxLength:t},{required:n})=>e.string().check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),F=(t,n)=>e.string({error:`Please select an option`}).check(e.trim(),...n?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==C,{error:`Please fill out the free text field`})),I=({maxLength:t},{required:n})=>{let r=F(t,n);return n?r:e.optional(r)},L=({maxSelected:t,maxLength:n},{required:r})=>e.array(e.string().check(e.trim(),...r?[e.minLength(1,{error:`This field is required`})]:[],e.maxLength(n??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),e.refine(e=>e!==S,{error:`Please fill out the free text field`}))).check(...r?[e.minLength(1,{error:`Please select at least one option`})]:[],e.maxLength(t??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),R=()=>e.optional(e.string()),z=e.cuid2(),B=e.object({title:e.string().check(e.trim()),description:e.string().check(e.trim()),buttonText:e.string().check(e.trim())}),V=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),position:e.number(),required:e.boolean(),properties:x,routingLogic:l}),H=e.object({title:e.string(),description:e.nullable(e.string()),questions:e.array(V),confirmation:B,isBackNavigationAllowed:e.boolean(),backButtonLabel:e.nullable(e.string().check(e.trim(),e.maxLength(50)))});e.object({cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const U=e.object({id:e.string(),title:e.string(),description:e.nullable(e.string()),status:e.enum([`active`,`inactive`]),createdAt:e.date(),updatedAt:e.date()});e.object({data:e.array(U),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})}),e.object({surveyId:z});const W=V;e.object({data:e.object({...U.shape,questions:e.array(W)})}),e.object({surveyId:z,responseId:e.union([e.cuid2(),e.uuid()])});const G=e.catch(e.object({type:e.enum([`embedded`,`popover`,`modal`]),version:e.string().check(e.trim(),e.minLength(1),e.maxLength(50)),build:e.string().check(e.trim(),e.minLength(1),e.maxLength(50))}).partial(),{}),K=e.record(e.string(),e.union([e.string().check(e.trim(),e.maxLength(2048)),e.number(),e.array(e.string().check(e.trim(),e.maxLength(2048))).check(e.maxLength(1024)),A])),q=e.string().check(e.trim(),e.maxLength(1e3)),J=e.record(q,q).check(e.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`));e.object({respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048)),data:K,metadata:J,telemetry:e.optional(G)}),e.object({id:e.string(),createdAt:e.date()}),e.object({surveyId:z,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:z,respondent:e.string().check(e.trim(),e.minLength(1),e.maxLength(2048))}),e.object({surveyId:z});const Y=e.object({lastRespondedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastViewedAt:e.nullable(e.union([e.iso.datetime(),e.date()])),lastDismissedAt:e.nullable(e.union([e.iso.datetime(),e.date()]))});e.object({type:e.enum([`view`,`dismiss`])}),e.object({}),e.object({surveyId:z}),e.object({respondent:e.optional(e.string().check(e.trim(),e.minLength(1),e.maxLength(255))),after:e.optional(e.iso.datetime({offset:!0,local:!0})),before:e.optional(e.iso.datetime({offset:!0,local:!0})),cursor:e.optional(e.string().check(e.minLength(1),e.maxLength(100))),limit:e.optional(e.number().check(e.int(),e.gte(1),e.lte(100)))});const X=e.object({id:e.string(),respondent:e.string(),data:K,clientMetadata:e.record(e.string(),e.string()),createdAt:e.date()});e.object({data:e.array(X),nextCursor:e.nullable(e.string()),limit:e.number(),links:e.object({self:e.string(),next:e.nullable(e.string())})});const Z=e.number().check(e.int(),e.gte(0));e.object({data:e.object({totalViews:Z,uniqueViewers:Z,totalDismissals:Z,uniqueDismissers:Z,totalResponses:Z,uniqueResponders:Z})}),e.object({questionIds:e.array(e.string()).check(e.minLength(1)),timeRange:e.union([e.enum([`last-7-days`,`last-30-days`]),e.string().check(e.regex(/^q[1-4]-\d{4}$/)),e.string().check(e.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const Q=e.record(e.string(),e.record(e.string(),e.number()));e.object({data:e.object({current:Q,previousQuarter:e.nullable(Q)})});export{P as a,R as c,u as d,L as i,S as l,H as n,N as o,j as r,I as s,Y as t,C as u};
package/build/static.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as Containable, c as OptionallyDismissable, d as WithProxyable, n as Closable, o as Dismissable, r as ConfettiContainer } from "./types-NMQZur7D.js";
2
- import { d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps } from "./Confetti-fis-IO5o.js";
1
+ import { A as WithProxyable, D as OptionallyDismissable, S as ConfettiContainer, T as Dismissable, d as RespondentVisibilityProviderProps, f as WithVisibilityControl, t as BaseConfettiProps, w as Containable, x as Closable } from "./Confetti-d1r1QIP2.js";
3
2
 
4
3
  //#region src/templates/EmbeddedConfettiContent.d.ts
5
4
  interface EmbeddedConfettiContentProps extends Omit<BaseConfettiProps, 'isSurveyVisible'>, Closable {
package/build/static.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./DefaultConfettiTrigger-CxIyRNHv.js";import{c as t,o as n,t as r}from"./ModalContainer-jzFfmvRQ.js";import{f as i,i as a,m as o,n as s,p as c,r as l,t as u,u as d}from"./Embed-CtGEGKcw.js";import{useState as f}from"react";import{ErrorBoundary as p}from"react-error-boundary";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";const _=({onClose:e,...r})=>h(p,{fallback:h(m,{}),children:h(t,{type:`embedded`,children:h(n,{...r,children:h(o,{...r,shouldAutoSubmit:!1,children:({questions:t,update:n,submit:i,isSubmitted:o,errors:s})=>o?h(l,{onClose:e}):h(u,{onSubmit:i,children:t.filter(({visible:e})=>!!e).map(e=>h(a,{question:e,error:s[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:t=>n({question:e.position,answer:t})},e.position))})})})})}),v=e=>{let{respondent:t}=c();return h(_,{...e,respondent:t})};function y(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,container:s,...c}=e;if(t)return null;let l=h(v,{...c,apiBaseUrl:o,onClose:()=>{n(!0),c.onClose?.()}});return h(i,{surveyId:c.surveyId,publishableKey:c.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:s?s({survey:l}):l})}const b=({onDismiss:e,onClose:i,onFinished:s,closeOnFinishMs:c,isDismissable:d,...f})=>h(p,{fallback:h(m,{}),children:h(t,{type:`modal`,children:h(n,{...f,children:h(r,{onDismiss:e,onClose:i,closeOnFinishMs:c,isDismissable:d,children:({setIsSubmitted:e,setIsFinished:t})=>h(o,{...f,shouldAutoSubmit:!1,onSubmitted:()=>e(),onFinished:()=>{t(),s?.()},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o})=>o?h(l,{onClose:i}):h(u,{onSubmit:r,children:e.filter(({visible:e})=>!!e).map(e=>h(a,{question:e,error:n[e.id]||``,maskAllInputs:f.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),x=e=>{let{respondent:t}=c();return h(b,{...e,respondent:t})};function S(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,...s}=e;return t?null:h(i,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:h(x,{...s,apiBaseUrl:o,onClose:()=>{n(!0),s.onClose?.()}})})}const C=({onDismiss:e,onClose:r,onFinished:i,closeOnFinishMs:c,...u})=>h(p,{fallback:h(m,{}),children:h(t,{type:`popover`,children:h(n,{...u,children:h(d,{onDismiss:e,onClose:r,closeOnFinishMs:c,children:({setIsSubmitted:e,setIsFinished:t})=>h(o,{...u,shouldAutoSubmit:!0,onSubmitted:()=>e(),onFinished:()=>{t(),i?.()},children:({current:e,questions:t,update:n,isSubmitted:i})=>{let o=e===t.length-1;if(i)return h(l,{onClose:r});let c=t[e];return c?h(s,{isLastQuestion:o,question:c,onSubmit:t=>n({question:e,answer:t}),children:e=>h(a,{maskAllInputs:u.options?.bugReport?.maskAllInputs,...e})},c.id):h(m,{})}})})})})}),w=e=>{let{respondent:t}=c();return h(C,{...e,respondent:t})};function T(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,...s}=e;return t?null:h(i,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:h(w,{...s,apiBaseUrl:o,onClose:()=>{n(!0),s.onClose?.()}})})}const E=({onClose:e,...t})=>h(p,{fallback:h(m,{}),children:h(n,{...t,children:h(o,{...t,shouldAutoSubmit:!0,children:({current:n,questions:r,update:i,isSubmitted:o})=>{let c=n===r.length-1;if(o)return h(l,{onClose:e});let u=r[n];return u?h(s,{isLastQuestion:c,question:u,onSubmit:e=>i({question:n,answer:e}),children:e=>h(a,{maskAllInputs:t.options?.bugReport?.maskAllInputs,...e})},u.id):h(m,{})}})})}),D=e=>{let{respondent:t}=c();return h(E,{...e,respondent:t})};function O(e){let[t,n]=f(!1),{respondent:r,isSurveyVisible:a,proxyUrl:o,container:s,...c}=e;if(t)return null;let l=h(D,{...c,apiBaseUrl:o,onClose:()=>{n(!0),c.onClose?.()}});return h(i,{surveyId:c.surveyId,publishableKey:c.publishableKey,apiBaseUrl:o,respondent:r,isSurveyVisible:a,children:s?s({survey:l}):l})}const k=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=f(!1),[o,s]=f(!1);return g(m,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:()=>{s(!0),n?.()},onClose:()=>a(!1)})]})},A=({trigger:t=t=>h(e,{...t}),children:n,metadata:r,options:a,onFinished:o,proxyUrl:s,...c})=>h(p,{fallback:h(m,{}),children:h(i,{...c,apiBaseUrl:s,children:h(k,{trigger:t,surveyId:c.surveyId,publishableKey:c.publishableKey,proxyUrl:s,metadata:r,options:a,onFinished:o,children:n})})});export{A as ConfettiTrigger,y as EmbeddedConfetti,S as ModalConfetti,T as PopoverConfetti,O as StepperConfetti};
1
+ import{t as e}from"./DefaultConfettiTrigger-C-E0FHJD.js";import{c as t,o as n,t as r}from"./ModalContainer-BiysurqW.js";import{a as i,d as a,h as o,i as s,m as c,n as l,p as u,r as d,t as f}from"./Embed-ByNzZH0P.js";import{useState as p}from"react";import{ErrorBoundary as m}from"react-error-boundary";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=({onClose:e,...r})=>g(m,{fallback:g(h,{}),children:g(t,{type:`embedded`,children:g(n,{...r,children:g(o,{...r,shouldAutoSubmit:!1,children:({questions:t,update:n,submit:a,isSubmitted:o,errors:c})=>o?g(s,{onClose:e}):g(f,{onSubmit:a,children:t.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,error:c[e.id]||``,maskAllInputs:r.options?.bugReport?.maskAllInputs,onChange:t=>n({question:e.position,answer:t})},e.position))})})})})}),y=e=>{let{respondent:t}=c();return g(v,{...e,respondent:t})};function b(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(y,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const x=({onDismiss:e,onClose:a,onFinished:c,closeOnFinishMs:l,isDismissable:u,...d})=>g(m,{fallback:g(h,{}),children:g(t,{type:`modal`,children:g(n,{...d,children:g(r,{onDismiss:e,onClose:a,closeOnFinishMs:l,isDismissable:u,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...d,shouldAutoSubmit:!1,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({questions:e,update:t,errors:n,submit:r,isSubmitted:o})=>o?g(s,{onClose:a}):g(f,{onSubmit:r,children:e.filter(({visible:e})=>!!e).map(e=>g(i,{question:e,error:n[e.id]||``,maskAllInputs:d.options?.bugReport?.maskAllInputs,onChange:n=>t({question:e.position,answer:n})},e.position))})})})})})}),S=e=>{let{respondent:t}=c();return g(x,{...e,respondent:t})};function C(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(S,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const w=({onDismiss:e,onClose:r,onFinished:c,closeOnFinishMs:u,...f})=>g(m,{fallback:g(h,{}),children:g(t,{type:`popover`,children:g(n,{...f,children:g(a,{onDismiss:e,onClose:r,closeOnFinishMs:u,children:({setIsSubmitted:e,setIsFinished:t})=>g(o,{...f,shouldAutoSubmit:!0,onSubmitted:()=>e(),onFinished:()=>{t(),c?.()},children:({current:e,questions:t,answers:n,update:a,back:o,canGoBack:c,backButtonLabel:u,saveAnswer:p,isSubmitted:m})=>{let _=e===t.length-1;if(m)return g(s,{onClose:r});let v=t[e];return v?g(l,{isLastQuestion:_,question:v,defaultAnswer:n[v.id]??void 0,backButton:c?g(d,{onPress:o,children:u}):void 0,saveAnswer:e=>p(v.id,e),onSubmit:t=>a({question:e,answer:t}),children:e=>g(i,{maskAllInputs:f.options?.bugReport?.maskAllInputs,...e})},v.id):g(h,{})}})})})})}),T=e=>{let{respondent:t}=c();return g(w,{...e,respondent:t})};function E(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,...o}=e;return t?null:g(u,{surveyId:o.surveyId,publishableKey:o.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:g(T,{...o,apiBaseUrl:a,onClose:()=>{n(!0),o.onClose?.()}})})}const D=({onClose:e,...t})=>g(m,{fallback:g(h,{}),children:g(n,{...t,children:g(o,{...t,shouldAutoSubmit:!0,children:({current:n,questions:r,answers:a,update:o,back:c,canGoBack:u,backButtonLabel:f,saveAnswer:p,isSubmitted:m})=>{let _=n===r.length-1;if(m)return g(s,{onClose:e});let v=r[n];return v?g(l,{isLastQuestion:_,question:v,defaultAnswer:a[v.id]??void 0,backButton:u?g(d,{onPress:c,children:f}):void 0,saveAnswer:e=>p(v.id,e),onSubmit:e=>o({question:n,answer:e}),children:e=>g(i,{maskAllInputs:t.options?.bugReport?.maskAllInputs,...e})},v.id):g(h,{})}})})}),O=e=>{let{respondent:t}=c();return g(D,{...e,respondent:t})};function k(e){let[t,n]=p(!1),{respondent:r,isSurveyVisible:i,proxyUrl:a,container:o,...s}=e;if(t)return null;let c=g(O,{...s,apiBaseUrl:a,onClose:()=>{n(!0),s.onClose?.()}});return g(u,{surveyId:s.surveyId,publishableKey:s.publishableKey,apiBaseUrl:a,respondent:r,isSurveyVisible:i,children:o?o({survey:c}):c})}const A=({trigger:e,children:t,onFinished:n,...r})=>{let[i,a]=p(!1),[o,s]=p(!1);return _(h,{children:[e({onClick:()=>a(!0),isWidgetOpen:i,hasSubmitted:o}),i&&t({...r,onDismiss:()=>a(!1),onFinished:()=>{s(!0),n?.()},onClose:()=>a(!1)})]})},j=({trigger:t=t=>g(e,{...t}),children:n,metadata:r,options:i,onFinished:a,proxyUrl:o,...s})=>g(m,{fallback:g(h,{}),children:g(u,{...s,apiBaseUrl:o,children:g(A,{trigger:t,surveyId:s.surveyId,publishableKey:s.publishableKey,proxyUrl:o,metadata:r,options:i,onFinished:a,children:n})})});export{j as ConfettiTrigger,b as EmbeddedConfetti,C as ModalConfetti,E as PopoverConfetti,k as StepperConfetti};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/confetti",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "sideEffects": false,
5
5
  "description": "Widgets for Confetti",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -88,7 +88,7 @@
88
88
  "@vitest/coverage-v8": "4.1.8",
89
89
  "dotenv-cli": "^11.0.0",
90
90
  "esbuild": "^0.28.1",
91
- "postcss": "^8.5.10",
91
+ "postcss": "^8.5.25",
92
92
  "postcss-cli": "^11.0.1",
93
93
  "postcss-preset-env": "^11.2.1",
94
94
  "react-aria-components": "1.16.0",
@@ -1,7 +0,0 @@
1
- import e,{createContext as t,forwardRef as n,useCallback as r,useContext as i,useEffect as a,useMemo as o,useRef as s,useState as c}from"react";import l from"ky";import{z as u}from"zod";import d from"clsx";import"react-dom";const f=l.create({prefixUrl:`https://confetti.gov.sg`,retry:{limit:3,methods:[`get`,`head`]},timeout:6e4});function p({publishableKey:e,apiBaseUrl:t}){return o(()=>{let n={headers:{"x-cfti-pk":e}};return t&&(n.prefixUrl=t),f.extend(n)},[t,e])}const m=u.object({type:u.literal(`next`)}),h=u.object({type:u.literal(`end`)}),g=u.object({type:u.literal(`jump`),target:u.number({error:`Target question is required`})}),_=u.discriminatedUnion(`type`,[m,g,h]),v=u.object({type:u.literal(`value`),value:u.union([u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),u.number({error:`Value is required`})])}),y=u.object({type:u.literal(`binary-operator`),operator:u.union([u.literal(`equal`),u.literal(`not-equal`),u.literal(`greater`),u.literal(`greater-or-equal`),u.literal(`less`),u.literal(`less-or-equal`),u.literal(`contains`),u.literal(`not-contains`)]),value:v,target:_}),b=u.object({type:u.literal(`switch`),cases:u.array(y),default:_}),x=u.object({type:u.literal(`always`),target:_}),S=u.discriminatedUnion(`type`,[x,b]),C=u.string().check(u.trim(),u.url({protocol:/^(https|mailto)/,error:`Link must start with https:// or mailto:`})),w=u.optional(u.string().check(u.trim(),u.maxLength(50))),T=u.object({value:u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),description:u.optional(u.string().check(u.trim()))}),E=u.nullable(u.object({label:u.string().check(u.trim(),u.minLength(1,{error:`Value is required`})),max:u.number(),description:u.optional(u.string().check(u.trim()))})),D=u.optional(u.boolean()),ee=u.object({type:u.literal(`rating`),buttonLabel:w,shouldAutoProgress:D,scale:u.number().check(u.gte(2),u.lte(10)),labels:u.optional(u.object({lower:u.optional(u.pipe(u.string().check(u.trim()),u.transform(e=>e===``?void 0:e))),upper:u.optional(u.pipe(u.string().check(u.trim()),u.transform(e=>e===``?void 0:e)))})),display:u.optional(u.literal([`star`,`emoji`,`number`]))}),O=u.object({type:u.literal(`open-ended`),placeholder:u.optional(u.string()),buttonLabel:w,max:u.number()}),te=u.object({type:u.literal(`single-select`),shouldAutoProgress:D,options:u.array(T),buttonLabel:w,editable:E}),ne=u.object({type:u.literal(`multi-select`),buttonLabel:w,options:u.array(T),editable:E,max:u.optional(u.number()),display:u.optional(u.literal([`checkbox`,`tag`]))}),re=u.object({type:u.literal(`statement`),buttonLabel:w,buttonUrl:u.optional(C)}),ie=u.object({type:u.literal(`bug-report`),placeholder:u.optional(u.string()),buttonLabel:w,enableScreenshot:u.boolean(),enableRecording:u.boolean(),detailsLabel:u.string().check(u.trim(),u.minLength(1,{error:`Label is required`}),u.maxLength(128)),detailsPlaceholder:u.optional(u.string()),redactClasses:u.optional(u.array(u.string()))}),ae=u.discriminatedUnion(`type`,[ee,te,O,ne,re,ie]),oe=`__CONFETTI_CHECKBOX_Others`,se=`__CONFETTI_RADIO_Others`,ce=u.optional(u.looseObject({userAgent:u.string().check(u.trim(),u.maxLength(1e3)),screenResolution:u.string().check(u.trim(),u.maxLength(100)),viewportSize:u.string().check(u.trim(),u.maxLength(100)),pageUrl:u.string(),pageTitle:u.string().check(u.trim(),u.maxLength(1e3)),referrer:u.string(),datadogTraceId:u.optional(u.string()),datadogSessionId:u.optional(u.string()),datadogSessionReplayLink:u.optional(u.string())}).partial().catchall(u.optional(u.string())));u.cuid2();const le=u.looseObject({type:u.literal([0,1,2,3,4,5,6]),data:u.unknown(),timestamp:u.number(),delay:u.optional(u.number())});u.array(le);const ue=u.array(le),de=u.string().check(u.refine(e=>{try{return ue.safeParse(JSON.parse(e)).success}catch{return!1}},{error:`Invalid recording events`})),fe=u.string().check(u.regex(/^data:image\/(png|jpeg|jpg|webp|gif);base64,[A-Za-z0-9+/]+=*$/,{error:`Invalid image data URL`})),pe=e=>u.object({title:u.string().check(u.trim(),...e?[u.minLength(1,{error:`Title is required`})]:[],u.maxLength(256)),description:u.optional(u.string().check(u.trim(),u.maxLength(4096))),screenshotDataUrl:u.optional(fe),recordingEventsJson:u.optional(de),metadata:ce}),me=pe(!0),he=(e,{required:t})=>pe(t),ge=e=>u.number({error:`Please select a rating`}).check(u.int(),u.gte(1),u.lte(e)),_e=({scale:e},{required:t})=>{let n=ge(e);return t?n:u.optional(n)},ve=({maxLength:e},{required:t})=>u.string().check(u.trim(),...t?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(e??2048,{error:({maximum:e})=>`Please enter less than ${e} characters`})),ye=(e,t)=>u.string({error:`Please select an option`}).check(u.trim(),...t?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(e??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),u.refine(e=>e!==se,{error:`Please fill out the free text field`})),be=({maxLength:e},{required:t})=>{let n=ye(e,t);return t?n:u.optional(n)},xe=({maxSelected:e,maxLength:t},{required:n})=>u.array(u.string().check(u.trim(),...n?[u.minLength(1,{error:`This field is required`})]:[],u.maxLength(t??1024,{error:({maximum:e})=>`Please enter less than ${e} characters`}),u.refine(e=>e!==oe,{error:`Please fill out the free text field`}))).check(...n?[u.minLength(1,{error:`Please select at least one option`})]:[],u.maxLength(e??1024,{error:({maximum:e})=>`Please select less than ${e} options`})),Se=()=>u.optional(u.string()),k=u.cuid2(),Ce=u.object({title:u.string().check(u.trim()),description:u.string().check(u.trim()),buttonText:u.string().check(u.trim())}),we=u.object({id:u.string(),title:u.string(),description:u.nullable(u.string()),position:u.number(),required:u.boolean(),properties:ae,routingLogic:S}),Te=u.object({title:u.string(),description:u.nullable(u.string()),questions:u.array(we),confirmation:Ce});u.object({cursor:u.optional(u.string().check(u.minLength(1),u.maxLength(100))),limit:u.optional(u.number().check(u.int(),u.gte(1),u.lte(100)))});const Ee=u.object({id:u.string(),title:u.string(),description:u.nullable(u.string()),status:u.enum([`active`,`inactive`]),createdAt:u.date(),updatedAt:u.date()});u.object({data:u.array(Ee),nextCursor:u.nullable(u.string()),limit:u.number(),links:u.object({self:u.string(),next:u.nullable(u.string())})}),u.object({surveyId:k});const De=we;u.object({data:u.object({...Ee.shape,questions:u.array(De)})}),u.object({surveyId:k,responseId:u.union([u.cuid2(),u.uuid()])});const Oe=u.catch(u.object({type:u.enum([`embedded`,`popover`,`modal`]),version:u.string().check(u.trim(),u.minLength(1),u.maxLength(50)),build:u.string().check(u.trim(),u.minLength(1),u.maxLength(50))}).partial(),{}),ke=u.record(u.string(),u.union([u.string().check(u.trim(),u.maxLength(2048)),u.number(),u.array(u.string().check(u.trim(),u.maxLength(2048))).check(u.maxLength(1024)),me])),Ae=u.string().check(u.trim(),u.maxLength(1e3)),je=u.record(Ae,Ae).check(u.refine(e=>Object.keys(e).length<=20,`At most 20 metadata entries are allowed.`));u.object({respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048)),data:ke,metadata:je,telemetry:u.optional(Oe)}),u.object({id:u.string(),createdAt:u.date()}),u.object({surveyId:k,respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048))}),u.object({surveyId:k,respondent:u.string().check(u.trim(),u.minLength(1),u.maxLength(2048))}),u.object({surveyId:k});const Me=u.object({lastRespondedAt:u.nullable(u.union([u.iso.datetime(),u.date()])),lastViewedAt:u.nullable(u.union([u.iso.datetime(),u.date()])),lastDismissedAt:u.nullable(u.union([u.iso.datetime(),u.date()]))});u.object({type:u.enum([`view`,`dismiss`])}),u.object({}),u.object({surveyId:k}),u.object({respondent:u.optional(u.string().check(u.trim(),u.minLength(1),u.maxLength(255))),after:u.optional(u.iso.datetime({offset:!0,local:!0})),before:u.optional(u.iso.datetime({offset:!0,local:!0})),cursor:u.optional(u.string().check(u.minLength(1),u.maxLength(100))),limit:u.optional(u.number().check(u.int(),u.gte(1),u.lte(100)))});const Ne=u.object({id:u.string(),respondent:u.string(),data:ke,clientMetadata:u.record(u.string(),u.string()),createdAt:u.date()});u.object({data:u.array(Ne),nextCursor:u.nullable(u.string()),limit:u.number(),links:u.object({self:u.string(),next:u.nullable(u.string())})});const A=u.number().check(u.int(),u.gte(0));u.object({data:u.object({totalViews:A,uniqueViewers:A,totalDismissals:A,uniqueDismissers:A,totalResponses:A,uniqueResponders:A})}),u.object({questionIds:u.array(u.string()).check(u.minLength(1)),timeRange:u.union([u.enum([`last-7-days`,`last-30-days`]),u.string().check(u.regex(/^q[1-4]-\d{4}$/)),u.string().check(u.regex(/^custom_\d{4}-\d{2}-\d{2}_\d{4}-\d{2}-\d{2}$/))])});const Pe=u.record(u.string(),u.record(u.string(),u.number()));u.object({data:u.object({current:Pe,previousQuarter:u.nullable(Pe)})});function Fe(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 Ie(e){return typeof window<`u`&&window.navigator!=null&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function j(e){let t=null;return()=>(t??=e(),t)}const M=j(function(){return Ie(/^Mac/i)}),Le=j(function(){return Ie(/^iPhone/i)}),Re=j(function(){return Ie(/^iPad/i)||M()&&navigator.maxTouchPoints>1}),ze=j(function(){return Le()||Re()}),Be=j(function(){return Fe(/AppleWebKit/i)&&!Ve()}),Ve=j(function(){return Fe(/Chrome/i)}),He=j(function(){return Fe(/Android/i)}),Ue=j(function(){return Fe(/Firefox/i)});function N(e){if(We())e.focus({preventScroll:!0});else{let t=Ge(e);e.focus(),Ke(t)}}let P=null;function We(){if(P==null){P=!1;try{document.createElement(`div`).focus({get preventScroll(){return P=!0,!0}})}catch{}}return P}function Ge(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 Ke(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function F(e,t,n=!0){let{metaKey:r,ctrlKey:i,altKey:a,shiftKey:o}=t;Ue()&&window.event?.type?.startsWith(`key`)&&e.target===`_blank`&&(M()?r=!0:i=!0);let s=Be()&&M()&&!Re()?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});F.isOpening=n,N(e),e.dispatchEvent(s),F.isOpening=!1}F.isOpening=!1;const I=typeof document<`u`?e.useLayoutEffect:()=>{},qe={prefix:String(Math.round(Math.random()*1e10)),current:0},Je=e.createContext(qe),Ye=e.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement;let Xe=new WeakMap;function Ze(t=!1){let n=i(Je),r=s(null);if(r.current===null&&!t){let t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(t){let e=Xe.get(t);e==null?Xe.set(t,{id:n.current,state:t.memoizedState}):t.memoizedState!==e.state&&(n.current=e.id,Xe.delete(t))}r.current=++n.current}return r.current}function Qe(e){let t=i(Je),n=Ze(!!e),r=`react-aria${t.prefix}`;return e||`${r}-${n}`}function $e(t){let n=e.useId(),[r]=c(it()),i=r?`react-aria`:`react-aria${qe.prefix}`;return t||`${i}-${n}`}const et=typeof e.useId==`function`?$e:Qe;function tt(){return!1}function nt(){return!0}function rt(e){return()=>{}}function it(){return typeof e.useSyncExternalStore==`function`?e.useSyncExternalStore(rt,tt,nt):i(Ye)}function at(e){let[t,n]=c(e),i=s(t),a=s(null),o=s(()=>{if(!a.current)return;let e=a.current.next();if(e.done){a.current=null;return}i.current===e.value?o.current():n(e.value)});return I(()=>{i.current=t,a.current&&o.current()}),[t,r(e=>{a.current=e(i.current),o.current()},[o])]}let ot=!!(typeof window<`u`&&window.document&&window.document.createElement),L=new Map,R;typeof FinalizationRegistry<`u`&&(R=new FinalizationRegistry(e=>{L.delete(e)}));function st(e){let[t,n]=c(e),r=s(null),i=et(t),o=s(null);if(R&&R.register(o,i),ot){let e=L.get(i);e&&!e.includes(r)?e.push(r):L.set(i,[r])}return I(()=>{let e=i;return()=>{R&&R.unregister(o),L.delete(e)}},[i]),a(()=>{let e=r.current;return e&&n(e),()=>{e&&(r.current=null)}}),i}function ct(e,t){if(e===t)return e;let n=L.get(e);if(n)return n.forEach(e=>e.current=t),t;let r=L.get(t);return r?(r.forEach(t=>t.current=e),e):t}function lt(e=[]){let t=st(),[n,i]=at(t),a=r(()=>{i(function*(){yield t,yield document.getElementById(t)?t:void 0})},[t,i]);return I(a,[t,a,...e]),n}function ut(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}const z=e=>e?.ownerDocument??document,B=e=>e&&`window`in e&&e.window===e?e:z(e).defaultView||window;function dt(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function ft(e){return dt(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function pt(){return!1}function V(e,t){if(!pt())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:ft(n)?n.host:n.parentNode}return!1}const H=(e=document)=>{if(!pt())return e.activeElement;let t=e.activeElement;for(;t&&`shadowRoot`in t&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t};function U(e){if(pt()&&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 mt(e){if(!e)return!1;let t=e.getRootNode(),n=B(e);if(!(t instanceof n.Document||t instanceof n.ShadowRoot))return!1;let r=t.activeElement;return r!=null&&e.contains(r)}function ht(...e){return e.length===1&&e[0]?e[0]:t=>{let n=!1,r=e.map(e=>{let r=gt(e,t);return n||=typeof r==`function`,r});if(n)return()=>{r.forEach((t,n)=>{typeof t==`function`?t():gt(e[n],null)})}}}function gt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function W(...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]=ut(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=d(n,i):e===`id`&&n&&i?t.id=ct(n,i):e===`ref`&&n&&i?t.ref=ht(n,i):t[e]=i===void 0?n:i}}return t}const _t=new Set([`id`]),vt=new Set([`aria-label`,`aria-labelledby`,`aria-describedby`,`aria-details`]),yt=new Set([`href`,`hrefLang`,`target`,`rel`,`download`,`ping`,`referrerPolicy`]),bt=new Set([`dir`,`lang`,`hidden`,`inert`,`translate`]),xt=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(`.`)),St=/^(data-.*)$/;function Ct(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)&&(_t.has(t)||n&&vt.has(t)||r&&yt.has(t)||i&&bt.has(t)||a&&(xt.has(t)||t.endsWith(`Capture`)&&xt.has(t.slice(0,-7)))||o?.has(t)||St.test(t))&&(s[t]=e[t]);return s}let G=new Map,wt=new Set;function Tt(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{let r=U(t);if(!e(t)||!r)return;let i=G.get(r);i||(i=new Set,G.set(r,i),r.addEventListener(`transitioncancel`,n,{once:!0})),i.add(t.propertyName)},n=t=>{let r=U(t);if(!e(t)||!r)return;let i=G.get(r);if(i&&(i.delete(t.propertyName),i.size===0&&(r.removeEventListener(`transitioncancel`,n),G.delete(r)),G.size===0)){for(let e of wt)e();wt.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,Tt):Tt());function Et(){for(let[e]of G)`isConnected`in e&&!e.isConnected&&G.delete(e)}function Dt(e){requestAnimationFrame(()=>{Et(),G.size===0?e():wt.add(e)})}function Ot(){let e=s(new Map),t=r((t,n,r,i)=>{let a=i?.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,a,i)},[]),n=r((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),i=r(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return a(()=>i,[i]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:i}}function kt(e){let t=s(null),n=s(void 0),i=r(t=>{if(typeof e==`function`){let n=e,r=n(t);return()=>{typeof r==`function`?r():n(null)}}else if(e)return e.current=t,()=>{e.current=null}},[e]);return o(()=>({get current(){return t.current},set current(e){t.current=e,n.current&&=(n.current(),void 0),e!=null&&(n.current=i(e))}}),[i])}const At=e.useInsertionEffect??I;function jt(e){let t=s(null);return At(()=>{t.current=e},[e]),r((...e)=>{let n=t.current;return n?.(...e)},[])}function Mt(e,t){I(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function Nt(e){return e.pointerType===``&&e.isTrusted?!0:He()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Pt(e){return!He()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`}const Ft=typeof Element<`u`&&`checkVisibility`in Element.prototype;function It(e){let t=B(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 Lt(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 Rt(e,t){return Ft?e.checkVisibility({visibilityProperty:!0})&&!e.closest(`[data-react-aria-prevent-focus]`):e.nodeName!==`#comment`&&It(e)&&Lt(e,t)&&(!e.parentElement||Rt(e.parentElement,e))}const zt=[`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`],Bt=zt.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;zt.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);const Vt=zt.join(`:not([hidden]):not([tabindex="-1"]),`);function Ht(e,t){return e.matches(Bt)&&!Wt(e)&&(t?.skipVisibilityCheck||Rt(e))}function Ut(e){return e.matches(Vt)&&Rt(e)&&!Wt(e)}function Wt(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Gt(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let Kt=new WeakMap;function qt(e){let t=e??(typeof document<`u`?document:void 0);if(!t)return Gt(t);if(Kt.has(t))return Kt.get(t);let n=t.querySelector(`meta[property="csp-nonce"]`),r=n&&n instanceof B(n).HTMLMetaElement&&(n.nonce||n.content)||Gt(t)||void 0;return r!==void 0&&Kt.set(t,r),r}const Jt=Symbol(`default`);function Yt({values:t,children:n}){for(let[r,i]of t)n=e.createElement(r.Provider,{value:i},n);return n}function Xt(e){let{className:t,style:n,children:r,defaultClassName:i,defaultChildren:a,defaultStyle:s,values:c,render:l}=e;return o(()=>{let e,o,u;return e=typeof t==`function`?t({...c,defaultClassName:i}):t,o=typeof n==`function`?n({...c,defaultStyle:s||{}}):n,u=typeof r==`function`?r({...c,defaultChildren:a}):r??a,{className:e??i,style:o||s?{...s,...o}:void 0,children:u??a,"data-rac":``,render:l?e=>l(e,c):void 0}},[t,n,r,i,a,s,c,l])}function Zt(e,t){return n=>t(typeof e==`function`?e(n):e,n)}function Qt(e,t){let n=i(e);if(t===null)return null;if(n&&typeof n==`object`&&`slots`in n&&n.slots){let e=t||Jt;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 $t(e,t,n){let{ref:r,...i}=Qt(n,e.slot)||{},a=kt(o(()=>ht(t,r),[t,r])),s=W(i,e);return`style`in i&&i.style&&`style`in e&&e.style&&(typeof i.style==`function`||typeof e.style==`function`?s.style=t=>{let n=typeof i.style==`function`?i.style(t):i.style,r={...t.defaultStyle,...n},a=typeof e.style==`function`?e.style({...t,defaultStyle:r}):e.style;return{...r,...a}}:s.style={...i.style,...e.style}),[s,a]}function en(e=!0){let[t,n]=c(e),i=s(!1),a=r(e=>{i.current=!0,n(!!e)},[]);return I(()=>{i.current||n(!1)},[]),[a,t]}function tn(e){let t=/^(data-.*)$/,n={};for(let r in e)t.test(r)||(n[r]=e[r]);return n}function nn(t,n,r){let{render:i,...a}=n,c=s(null),l=o(()=>ht(r,c),[r,c]);I(()=>{},[t,i]);let u={...a,ref:l};return i?i(u,void 0):e.createElement(t,u)}const rn={},an=new Proxy({},{get(e,t){if(typeof t!=`string`)return;let r=rn[t];return r||(r=n(nn.bind(null,t)),rn[t]=r),r}});function on(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function sn(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function cn(e){let t=s({isFocused:!1,observer:null});return I(()=>{let e=t.current;return()=>{e.observer&&=(e.observer.disconnect(),null)}},[]),r(n=>{let r=U(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=on(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===H()?null:H();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 ln=!1;function un(e){for(;e&&!Ht(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=B(e),n=t.document.activeElement;if(!n||n===e)return;ln=!0;let r=!1,i=e=>{(U(e)===n||r)&&e.stopImmediatePropagation()},a=t=>{(U(t)===n||r)&&(t.stopImmediatePropagation(),!e&&!r&&(r=!0,N(n),c()))},o=t=>{(U(t)===e||r)&&t.stopImmediatePropagation()},s=t=>{(U(t)===e||r)&&(t.stopImmediatePropagation(),r||(r=!0,N(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),ln=!1,r=!1},l=requestAnimationFrame(c);return c}let K=`default`,dn=``,fn=new WeakMap;function pn(e){if(ze()){if(K==="default"){let t=z(e);dn=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect=`none`}K=`disabled`}else if(e instanceof HTMLElement||e instanceof SVGElement){let t=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;fn.set(e,e.style[t]),e.style[t]=`none`}}function mn(e){if(ze()){if(K!==`disabled`)return;K=`restoring`,setTimeout(()=>{Dt(()=>{if(K===`restoring`){let t=z(e);t.documentElement.style.webkitUserSelect===`none`&&(t.documentElement.style.webkitUserSelect=dn||``),dn=``,K=`default`}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&fn.has(e)){let t=fn.get(e),n=`userSelect`in e.style?`userSelect`:`webkitUserSelect`;e.style[n]===`none`&&(e.style[n]=t),e.getAttribute(`style`)===``&&e.removeAttribute(`style`),fn.delete(e)}}const hn=e.createContext({register:()=>{}});hn.displayName=`PressResponderContext`;function gn(e){let t=i(hn);if(t){let{register:n,ref:r,...i}=t;e=W(i,e),n()}return Mt(t,e.ref),e}var _n=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 vn=Symbol(`linkClicked`),yn=`react-aria-pressable-style`,bn=`data-react-aria-pressable`;function xn(e){let{onPress:t,onPressChange:n,onPressStart:i,onPressEnd:l,onPressUp:u,onClick:d,isDisabled:f,isPressed:p,preventFocusOnPress:m,shouldCancelOnPointerExit:h,allowTextSelectionOnPress:g,ref:_,...v}=gn(e),[y,b]=c(!1),x=s({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:S,removeAllGlobalListeners:C}=Ot(),w=r((e,t)=>{let r=x.current;if(f||r.didFirePressStart)return!1;let a=!0;if(r.isTriggeringEvent=!0,i){let n=new _n(`pressstart`,t,e);i(n),a=n.shouldStopPropagation}return n&&n(!0),r.isTriggeringEvent=!1,r.didFirePressStart=!0,b(!0),a},[f,i,n]),T=r((e,r,i=!0)=>{let a=x.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let o=!0;if(l){let t=new _n(`pressend`,r,e);l(t),o=t.shouldStopPropagation}if(n&&n(!1),b(!1),t&&i&&!f){let n=new _n(`press`,r,e);t(n),o&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,o},[f,l,n,t]),E=jt(T),D=jt(r((e,t)=>{let n=x.current;if(f)return!1;if(u){n.isTriggeringEvent=!0;let r=new _n(`pressup`,t,e);return u(r),n.isTriggeringEvent=!1,r.shouldStopPropagation}return!0},[f,u])),ee=r(e=>{let t=x.current;if(t.isPressed&&t.target){t.didFirePressStart&&t.pointerType!=null&&T(q(t.target,e),t.pointerType,!1),t.isPressed=!1,t.isOverTarget=!1,t.activePointerId=null,t.pointerType=null,C(),g||mn(t.target);for(let e of t.disposables)e();t.disposables=[]}},[g,C,T]),O=jt(ee),te=r(e=>{h&&ee(e)},[h,ee]),ne=r(e=>{f||d?.(e)},[f,d]),re=r((e,t)=>{if(!f&&d){let n=new MouseEvent(`click`,e);sn(n,t),d(on(n))}},[f,d]),ie=o(()=>{let e=x.current,t={onKeyDown(t){if(Cn(t.nativeEvent,t.currentTarget)&&V(t.currentTarget,U(t))){Tn(U(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(z(t.currentTarget),`keyup`,ut(t=>{Cn(t,i)&&!t.repeat&&V(i,U(t))&&e.target&&D(q(e.target,t),`keyboard`)},n),!0),r&&t.stopPropagation(),t.metaKey&&M()&&e.metaKeyEvents?.set(t.key,t.nativeEvent)}else t.key===`Meta`&&(e.metaKeyEvents=new Map)},onClick(t){if(!(t&&!V(t.currentTarget,U(t)))&&t&&t.button===0&&!e.isTriggeringEvent&&!F.isOpening){let n=!0;if(f&&t.preventDefault(),!e.ignoreEmulatedMouseEvents&&!e.isPressed&&(e.pointerType===`virtual`||Nt(t.nativeEvent))){let e=w(t,`virtual`),r=D(t,`virtual`),i=E(t,`virtual`);ne(t),n=e&&r&&i}else if(e.isPressed&&e.pointerType!==`keyboard`){let r=e.pointerType||t.nativeEvent.pointerType||`virtual`,i=D(q(t.currentTarget,t),r),a=E(q(t.currentTarget,t),r,!0);n=i&&a,e.isOverTarget=!1,ne(t),O(t)}e.ignoreEmulatedMouseEvents=!1,n&&t.stopPropagation()}}},n=t=>{if(e.isPressed&&e.target&&Cn(t,e.target)){Tn(U(t),t.key)&&t.preventDefault();let n=U(t),r=V(e.target,n);E(q(e.target,t),`keyboard`,r),r&&re(t,e.target),C(),t.key!==`Enter`&&Sn(e.target)&&V(e.target,n)&&!t[vn]&&(t[vn]=!0,F(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||!V(t.currentTarget,U(t)))return;if(Pt(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||pn(e.target),i=w(t,e.pointerType);let a=U(t);`releasePointerCapture`in a&&(`hasPointerCapture`in a?a.hasPointerCapture(t.pointerId)&&a.releasePointerCapture(t.pointerId):a.releasePointerCapture(t.pointerId)),S(z(t.currentTarget),`pointerup`,n,!1),S(z(t.currentTarget),`pointercancel`,r,!1)}i&&t.stopPropagation()},t.onMouseDown=t=>{if(V(t.currentTarget,U(t))&&t.button===0){if(m){let n=un(t.target);n&&e.disposables.push(n)}t.stopPropagation()}},t.onPointerUp=t=>{!V(t.currentTarget,U(t))||e.pointerType===`virtual`||t.button===0&&!e.isPressed&&D(t,e.pointerType||t.pointerType)},t.onPointerEnter=t=>{t.pointerId===e.activePointerId&&e.target&&!e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!0,w(q(e.target,t),e.pointerType))},t.onPointerLeave=t=>{t.pointerId===e.activePointerId&&e.target&&e.isOverTarget&&e.pointerType!=null&&(e.isOverTarget=!1,E(q(e.target,t),e.pointerType,!1),te(t))};let n=t=>{if(t.pointerId===e.activePointerId&&e.isPressed&&t.button===0&&e.target){if(V(e.target,U(t))&&e.pointerType!=null){let n=!1,r=setTimeout(()=>{e.isPressed&&e.target instanceof HTMLElement&&(n?O(t):(N(e.target),e.target.click()))},80);S(t.currentTarget,`click`,()=>n=!0,!0),e.disposables.push(()=>clearTimeout(r))}else O(t);e.isOverTarget=!1}},r=e=>{O(e)};t.onDragStart=e=>{V(e.currentTarget,U(e))&&O(e)}}return t},[S,f,m,C,g,te,w,ne,re]);return a(()=>{if(!_)return;let e=z(_.current);if(!e||!e.head||e.getElementById(yn))return;let t=e.createElement(`style`);t.id=yn;let n=qt(e);n&&(t.nonce=n),t.textContent=`
2
- @layer {
3
- [${bn}] {
4
- touch-action: pan-x pan-y pinch-zoom;
5
- }
6
- }
7
- `.trim(),e.head.prepend(t)},[_]),a(()=>{let e=x.current;return()=>{g||mn(e.target??void 0);for(let t of e.disposables)t();e.disposables=[]}},[g]),{isPressed:p||y,pressProps:W(v,ie,{[bn]:!0})}}function Sn(e){return e.tagName===`A`&&e.hasAttribute(`href`)}function Cn(e,t){let{key:n,code:r}=e,i=t,a=i.getAttribute(`role`);return(n===`Enter`||n===` `||n===`Spacebar`||r===`Space`)&&!(i instanceof B(i).HTMLInputElement&&!Dn(i,n)||i instanceof B(i).HTMLTextAreaElement||i.isContentEditable)&&!((a===`link`||!a&&Sn(i))&&n!==`Enter`)}function q(e,t){let n=t.clientX,r=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:n,clientY:r,key:t.key}}function wn(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!==`submit`&&e.type!==`reset`:!Sn(e)}function Tn(e,t){return e instanceof HTMLInputElement?!Dn(e,t):wn(e)}const En=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Dn(e,t){return e.type===`checkbox`||e.type===`radio`?t===` `:En.has(e.type)}let J=null;const On=new Set;let Y=new Map,X=!1,kn=!1;const An={Tab:!0,Escape:!0};function jn(e,t){for(let n of On)n(e,t)}function Mn(e){return!(e.metaKey||!M()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function Z(e){X=!0,!F.isOpening&&Mn(e)&&(J=`keyboard`,jn(`keyboard`,e))}function Q(e){J=`pointer`,`pointerType`in e&&e.pointerType,(e.type===`mousedown`||e.type===`pointerdown`)&&(X=!0,jn(`pointer`,e))}function Nn(e){!F.isOpening&&Nt(e)&&(X=!0,J=`virtual`)}function Pn(e){let t=B(U(e)),n=z(U(e));U(e)===t||U(e)===n||ln||!e.isTrusted||(!X&&!kn&&(J=`virtual`,jn(`virtual`,e)),X=!1,kn=!1)}function Fn(){ln||(X=!1,kn=!0)}function In(e){if(typeof window>`u`||typeof document>`u`)return;let t=B(e),n=z(e);if(Y.get(t))return;let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){X=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,Z,!0),n.addEventListener(`keyup`,Z,!0),n.addEventListener(`click`,Nn,!0),t.addEventListener(`focus`,Pn,!0),t.addEventListener(`blur`,Fn,!1),typeof PointerEvent<`u`&&(n.addEventListener(`pointerdown`,Q,!0),n.addEventListener(`pointermove`,Q,!0),n.addEventListener(`pointerup`,Q,!0)),t.addEventListener(`beforeunload`,()=>{Ln(e)},{once:!0}),Y.set(t,{focus:r})}const Ln=(e,t)=>{let n=B(e),r=z(e);t&&r.removeEventListener(`DOMContentLoaded`,t),Y.has(n)&&(n.HTMLElement.prototype.focus=Y.get(n).focus,r.removeEventListener(`keydown`,Z,!0),r.removeEventListener(`keyup`,Z,!0),r.removeEventListener(`click`,Nn,!0),n.removeEventListener(`focus`,Pn,!0),n.removeEventListener(`blur`,Fn,!1),typeof PointerEvent<`u`&&(r.removeEventListener(`pointerdown`,Q,!0),r.removeEventListener(`pointermove`,Q,!0),r.removeEventListener(`pointerup`,Q,!0)),Y.delete(n))};function Rn(e){let t=z(e),n;return t.readyState===`loading`?(n=()=>{In(e)},t.addEventListener(`DOMContentLoaded`,n)):In(e),()=>Ln(e,n)}typeof document<`u`&&Rn();function zn(){return J!==`pointer`}function Bn(){return J}function Vn(e){J=e,jn(e,null)}const Hn=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function Un(e,t,n){let r=n?U(n):void 0,i=z(r),a=B(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=H(i);return e=e||u instanceof o&&!Hn.has(u.type)||u instanceof s||u instanceof c&&u.isContentEditable,!(e&&t===`keyboard`&&n instanceof l&&!An[n.key])}function Wn(e,t,n){In(),a(()=>{if(n?.enabled===!1)return;let t=(t,r)=>{Un(!!n?.isTextInput,t,r)&&e(zn())};return On.add(t),()=>{On.delete(t)}},t)}function Gn(e){if(!e.isConnected)return;let t=z(e);if(Bn()===`virtual`){let n=H(t);Dt(()=>{let r=H(t);(r===n||r===t.body)&&e.isConnected&&N(e)})}else N(e)}function Kn(e){let{isDisabled:t,onFocus:n,onBlur:i,onFocusChange:a}=e,o=r(e=>{if(U(e)===e.currentTarget)return i&&i(e),a&&a(!1),!0},[i,a]),s=cn(o),c=r(e=>{let t=U(e),r=z(t),i=r?H(r):H();t===e.currentTarget&&t===i&&(n&&n(e),a&&a(!0),s(e))},[a,n,s]);return{focusProps:{onFocus:!t&&(n||a||i)?c:void 0,onBlur:!t&&(i||a)?o:void 0}}}function qn(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 Jn(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:qn(e.onKeyDown),onKeyUp:qn(e.onKeyUp)}}}let Yn=e.createContext(null);function Xn(e){let t=i(Yn)||{};Mt(t,e);let{ref:n,...r}=t;return r}function Zn(e,t){let{focusProps:n}=Kn(e),{keyboardProps:r}=Jn(e),i=W(n,r),o=Xn(t),c=e.isDisabled?{}:o,l=s(e.autoFocus);a(()=>{l.current&&t.current&&Gn(t.current),l.current=!1},[t]);let u=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(u=void 0),{focusableProps:W({...i,tabIndex:u},c)}}function Qn(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:i,onFocusWithinChange:a}=e,o=s({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:l}=Ot(),u=r(e=>{V(e.currentTarget,U(e))&&o.current.isFocusWithin&&!V(e.currentTarget,e.relatedTarget)&&(o.current.isFocusWithin=!1,l(),n&&n(e),a&&a(!1))},[n,a,o,l]),d=cn(u),f=r(e=>{if(!V(e.currentTarget,U(e)))return;let t=U(e),n=z(t),r=H(n);if(!o.current.isFocusWithin&&r===t){i&&i(e),a&&a(!0),o.current.isFocusWithin=!0,d(e);let t=e.currentTarget;c(n,`focus`,e=>{let r=U(e);if(o.current.isFocusWithin&&!V(t,r)){let e=new n.defaultView.FocusEvent(`blur`,{relatedTarget:r});sn(e,t);let i=on(e);u(i)}},{capture:!0})}},[i,a,d,c,u]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:f,onBlur:u}}}function $n(e={}){let{autoFocus:t=!1,isTextInput:n,within:i}=e,a=s({isFocused:!1,isFocusVisible:t||zn()}),[o,l]=c(!1),[u,d]=c(()=>a.current.isFocused&&a.current.isFocusVisible),f=r(()=>d(a.current.isFocused&&a.current.isFocusVisible),[]),p=r(e=>{a.current.isFocused=e,a.current.isFocusVisible=zn(),l(e),f()},[f]);Wn(e=>{a.current.isFocusVisible=e,f()},[n,o],{enabled:o,isTextInput:n});let{focusProps:m}=Kn({isDisabled:i,onFocusChange:p}),{focusWithinProps:h}=Qn({isDisabled:!i,onFocusWithinChange:p});return{isFocused:o,isFocusVisible:u,focusProps:i?h:m}}let er=!1,tr=0;function nr(){er=!0,setTimeout(()=>{er=!1},500)}function rr(e){e.pointerType===`touch`&&nr()}function ir(){let e=z(null);if(e!==void 0)return tr===0&&typeof PointerEvent<`u`&&e.addEventListener(`pointerup`,rr),tr++,()=>{tr--,!(tr>0)&&typeof PointerEvent<`u`&&e.removeEventListener(`pointerup`,rr)}}function ar(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:i}=e,[l,u]=c(!1),d=s({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:``,target:null}).current;a(ir,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=Ot(),{hoverProps:m,triggerHoverEnd:h}=o(()=>{let e=(e,r)=>{if(d.pointerType=r,i||r===`touch`||d.isHovered||!V(e.currentTarget,U(e)))return;d.isHovered=!0;let o=e.currentTarget;d.target=o,f(z(U(e)),`pointerover`,e=>{d.isHovered&&d.target&&!V(d.target,U(e))&&a(e,e.pointerType)},{capture:!0}),t&&t({type:`hoverstart`,target:o,pointerType:r}),n&&n(!0),u(!0)},a=(e,t)=>{let i=d.target;d.pointerType=``,d.target=null,!(t===`touch`||!d.isHovered||!i)&&(d.isHovered=!1,p(),r&&r({type:`hoverend`,target:i,pointerType:t}),n&&n(!1),u(!1))},o={};return typeof PointerEvent<`u`&&(o.onPointerEnter=t=>{er&&t.pointerType===`mouse`||e(t,t.pointerType)},o.onPointerLeave=e=>{!i&&V(e.currentTarget,U(e))&&a(e,e.pointerType)}),{hoverProps:o,triggerHoverEnd:a}},[t,n,r,i,d,f,p]);return a(()=>{i&&h({currentTarget:d.target},d.pointerType)},[i]),{hoverProps:m,isHovered:l}}typeof HTMLTemplateElement<`u`&&(Object.defineProperty(HTMLTemplateElement.prototype,"firstChild",{configurable:!0,enumerable:!0,get:function(){return this.content.firstChild}}),Object.defineProperty(HTMLTemplateElement.prototype,"appendChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.appendChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"removeChild",{configurable:!0,enumerable:!0,value:function(e){return this.content.removeChild(e)}}),Object.defineProperty(HTMLTemplateElement.prototype,"insertBefore",{configurable:!0,enumerable:!0,value:function(e,t){return this.content.insertBefore(e,t)}}));const or=t(!1);function sr(e){let t=(t,n)=>i(or)?null:e(t,n);return t.displayName=e.displayName||e.name,n(t)}function cr(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}=xn({onPressStart:a,onPressEnd:o,onPressChange:c,onPress:i,onPressUp:s,onClick:d,isDisabled:r,preventFocusOnPress:l,ref:t}),{focusableProps:y}=Zn(e,t);u&&(y.tabIndex=r?-1:y.tabIndex);let b=W(y,_,Ct(e,{labelable:!0}));return{isPressed:v,buttonProps:W(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 lr=t(null),ur=7e3;let $=null;function dr(e,t=`assertive`,n=ur){$?$.announce(e,t,n):($=new fr,(typeof IS_REACT_ACT_ENVIRONMENT==`boolean`?IS_REACT_ACT_ENVIRONMENT:typeof jest<`u`)?$.announce(e,t,n):setTimeout(()=>{$?.isAttached()&&$?.announce(e,t,n)},100))}var fr=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=ur){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 pr=t({}),mr=sr(function(t,n){[t,n]=$t(t,n,pr);let r=t,{isPending:i}=r,{buttonProps:o,isPressed:c}=cr(t,n);o=gr(o,i);let{focusProps:l,isFocused:u,isFocusVisible:d}=$n(t),{hoverProps:f,isHovered:p}=ar({...t,isDisabled:t.isDisabled||i}),m={isHovered:p,isPressed:(r.isPressed||c)&&!i,isFocused:u,isFocusVisible:d,isDisabled:t.isDisabled||!1,isPending:i??!1},h=Xt({...t,values:m,defaultClassName:`react-aria-Button`}),g=st(o.id),_=st(),v=o[`aria-labelledby`];i&&(v?v=`${v} ${_}`:o[`aria-label`]&&(v=`${g} ${_}`));let y=s(i);a(()=>{let e={"aria-labelledby":v||g};(!y.current&&u&&i||y.current&&u&&!i)&&dr(e,`assertive`),y.current=i},[i,u,v,g]);let b=Ct(t,{global:!0});return delete b.onClick,e.createElement(an.button,{...W(b,h,o,l,f),type:o.type===`submit`&&i?`button`:o.type,id:g,ref:n,"aria-labelledby":v,slot:t.slot||void 0,"aria-disabled":i?`true`:o[`aria-disabled`],"data-disabled":t.isDisabled||void 0,"data-pressed":m.isPressed||void 0,"data-hovered":p||void 0,"data-focused":u||void 0,"data-pending":i||void 0,"data-focus-visible":d||void 0},e.createElement(lr.Provider,{value:{id:_}},h.children))}),hr=/Focus|Blur|Hover|Pointer(Enter|Leave|Over|Out)|Mouse(Enter|Leave|Over|Out)/;function gr(e,t){if(t){for(let t in e)t.startsWith(`on`)&&!hr.test(t)&&(e[t]=void 0);e.href=void 0,e.target=void 0}return e}export{oe as $,V as A,it as B,Ht as C,Ct as D,kt as E,z as F,Me as G,Ve as H,B as I,xe as J,Te as K,ut as L,H as M,U as N,W as O,pt as P,Se as Q,lt as R,qt as S,jt as T,He as U,I as V,ze as W,_e as X,ve as Y,be as Z,Zt as _,$n as a,tn as b,Gn as c,xn as d,se as et,hn as f,en as g,Xt as h,ar as i,mt as j,ht as k,Bn as l,$t as m,mr as n,p as nt,Qn as o,Yt as p,he as q,sr as r,Zn as s,pr as t,C as tt,Vn as u,Jt as v,Ut as w,Qt as x,an as y,st as z};
@@ -1 +0,0 @@
1
- import{G as e,n as t}from"./Button-uM2fAs2N.js";import{useEffect as n,useState as r}from"react";import{useLocalStorage as i}from"usehooks-ts";import{jsx as a,jsxs as o}from"react/jsx-runtime";import s from"clsx";function c(e,t){return t===void 0?!0:typeof t==`boolean`?t:t(e)}function l({surveyId:e,override:t}){let[r,a]=i(`cfti:${e}:respondent`,``);return n(()=>{r||a(crypto.randomUUID())},[r,a]),t||r}const u={lastRespondedAt:null,lastDismissedAt:null};async function d({client:t,surveyId:n,respondent:r,signal:i}){try{let a=await t.get(`api/v1/cfti/${n}/respondent/${r}`,{signal:i}).json(),o=e.safeParse(a);return o.success?{lastRespondedAt:o.data.lastRespondedAt?new Date(o.data.lastRespondedAt):null,lastDismissedAt:o.data.lastDismissedAt?new Date(o.data.lastDismissedAt):null}:(console.warn(`[confetti] Respondent response failed schema validation`,o.error),u)}catch{return u}}function f({client:e,surveyId:t,respondent:i}){let[a,o]=r(u),[s,c]=r(!1),[l,f]=r({client:e,surveyId:t,respondent:i});return(l.client!==e||l.surveyId!==t||l.respondent!==i)&&(f({client:e,surveyId:t,respondent:i}),o(u),c(!1)),n(()=>{if(!i||typeof window>`u`||typeof document>`u`)return;let n=null,r=()=>{n?.abort(),n=new AbortController;let r=n;d({client:e,surveyId:t,respondent:i,signal:r.signal}).then(e=>{r.signal.aborted||(o(e),c(!0))})};r();let a=()=>{document.visibilityState===`visible`&&r()};return document.addEventListener(`visibilitychange`,a),()=>{n?.abort(),document.removeEventListener(`visibilitychange`,a)}},[e,t,i]),{state:a,isSettled:s}}function p({client:e,surveyId:t}){let[i,a]=r(!1),[o,s]=r(!1),[c,l]=r({client:e,surveyId:t});return(c.client!==e||c.surveyId!==t)&&(l({client:e,surveyId:t}),a(!1),s(!1)),n(()=>{if(typeof window>`u`)return;let n=new AbortController;return e.head(`api/v1/cfti/${t}`,{signal:n.signal}).then(()=>{n.signal.aborted||a(!0)}).catch(()=>{n.signal.aborted||a(!1)}).finally(()=>{n.signal.aborted||s(!0)}),()=>{n.abort()}},[e,t]),{isAvailable:i,isSettled:o}}const m=e=>a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 44 38`,...e,children:o(`g`,{transform:`translate(-2 -2) scale(1.1)`,children:[a(`path`,{d:`M16.8395 3.2139C8.2208 3.9522 1.8331 11.5311 2.5721 20.1416C3.3111 28.7523 10.897 35.134 19.5157 34.3956L27.1631 33.7406C28.9787 33.585 30.6949 33.1248 32.2669 32.4163L38.7663 35.4396C39.3254 35.6994 39.9048 35.1205 39.6447 34.562L37.0707 29.0396C40.1147 25.8995 41.8336 21.5102 41.4304 16.8128C40.6913 8.2022 33.1054 1.8205 24.4867 2.5588L16.8395 3.2139Z`,fill:`#BAE6FD`}),a(`path`,{d:`M19.6764 24.0307C19.6764 24.0307 20.9773 25.4496 23.5438 25.1228C26.1103 24.7959 27.3642 23.0095 27.3642 23.0095`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M18.0861 16.4082C18.0861 16.4082 17.1255 18.619 14.8183 18.9139C12.5111 19.2088 11.1697 17.237 11.1697 17.237`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`}),a(`path`,{d:`M32.6296 15.0398C32.6296 15.0398 31.6691 17.2506 29.3619 17.5455C27.0548 17.8404 25.7132 15.8686 25.7132 15.8686`,stroke:`#382F40`,strokeWidth:2.4821,strokeLinecap:`round`})]})}),h=({onClick:e,isWidgetOpen:n,classNames:r,label:i=`Help us improve`})=>n?null:o(t,{onPress:e,className:s(`confetti-trigger`,r?.trigger),children:[a(`span`,{className:s(`confetti-trigger-icon-wrapper`,r?.iconWrapper),"aria-hidden":!0,children:a(m,{className:s(`confetti-trigger-icon`,r?.icon),width:24})}),a(`span`,{className:s(`confetti-trigger-label`,r?.label),children:i})]});export{l as a,f as i,m as n,c as o,p as r,h as t};