@qaiddev/quests-embed 1.1.0 → 1.2.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,96 +1,113 @@
1
- const C = `*{box-sizing:border-box}button{cursor:pointer;font-family:inherit}:where(.qaid-q-root){--qaid-q-card-bg: light-dark(#ffffff, #1f2937);--qaid-q-card-fg: light-dark(#1f2937, #f9fafb);--qaid-q-card-border: light-dark(#e5e7eb, #374151);--qaid-q-card-radius: 1rem;--qaid-q-card-padding: 1.5rem;--qaid-q-card-shadow: 0 25px 50px -12px light-dark(rgba(0, 0, 0, .25), rgba(0, 0, 0, .6));--qaid-q-muted-fg: light-dark(#6b7280, #9ca3af);--qaid-q-progress-track: light-dark(#e5e7eb, #374151);--qaid-q-btn-radius: .5rem;--qaid-q-btn-padding-y: .625rem;--qaid-q-btn-padding-x: 1.125rem;--qaid-q-btn-font-weight: 500;--qaid-q-btn-primary-bg: var(--qaid-q-accent, #10b981);--qaid-q-btn-primary-fg: var(--qaid-q-accent-text, #ffffff);--qaid-q-btn-primary-border: transparent;--qaid-q-btn-secondary-bg: transparent;--qaid-q-btn-secondary-fg: light-dark(#374151, #d1d5db);--qaid-q-btn-secondary-border: light-dark(#d1d5db, #4b5563);--qaid-q-btn-secondary-hover-bg: light-dark(#f3f4f6, #374151);--qaid-q-option-bg: light-dark(#ffffff, #111827);--qaid-q-option-bg-selected: color-mix(in srgb, var(--qaid-q-accent, #10b981) 10%, transparent);--qaid-q-option-bg-hover: light-dark(#f9fafb, #1f2937);--qaid-q-option-fg: light-dark(#1f2937, #f9fafb);--qaid-q-option-border: light-dark(#e5e7eb, #374151);--qaid-q-option-border-selected: var(--qaid-q-accent, #10b981);--qaid-q-option-border-hover: light-dark(#9ca3af, #4b5563);--qaid-q-option-radius: .625rem;--qaid-q-option-padding: .75rem .875rem;--qaid-q-marker-bg: light-dark(#ffffff, #111827);--qaid-q-marker-bg-selected: var(--qaid-q-accent, #10b981);--qaid-q-marker-border: light-dark(#d1d5db, #4b5563);--qaid-q-marker-icon: light-dark(#ffffff, #1f2937);--qaid-q-marker-radius: 50%;--qaid-q-input-bg: light-dark(#ffffff, #111827);--qaid-q-input-fg: light-dark(#1f2937, #f9fafb);--qaid-q-input-border: light-dark(#d1d5db, #374151);--qaid-q-input-radius: .625rem;--qaid-q-input-padding: .75rem .875rem;--qaid-q-input-placeholder: light-dark(#9ca3af, #6b7280);--qaid-q-gap: .75rem;--qaid-q-section-gap: 1.25rem}:where(.qaid-q-root.qaid-q-theme-light){--qaid-q-card-bg: #ffffff;--qaid-q-card-fg: #1f2937;--qaid-q-card-border: #e5e7eb;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);--qaid-q-muted-fg: #6b7280;--qaid-q-progress-track: #e5e7eb;--qaid-q-btn-secondary-fg: #374151;--qaid-q-btn-secondary-border: #d1d5db;--qaid-q-btn-secondary-hover-bg: #f3f4f6;--qaid-q-option-bg: #ffffff;--qaid-q-option-bg-hover: #f9fafb;--qaid-q-option-fg: #1f2937;--qaid-q-option-border: #e5e7eb;--qaid-q-option-border-hover: #9ca3af;--qaid-q-marker-bg: #ffffff;--qaid-q-marker-border: #d1d5db;--qaid-q-marker-icon: #ffffff;--qaid-q-input-bg: #ffffff;--qaid-q-input-fg: #1f2937;--qaid-q-input-border: #d1d5db;--qaid-q-input-placeholder: #9ca3af}:where(.qaid-q-root.qaid-q-theme-dark){--qaid-q-card-bg: #1f2937;--qaid-q-card-fg: #f9fafb;--qaid-q-card-border: #374151;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6);--qaid-q-muted-fg: #9ca3af;--qaid-q-progress-track: #374151;--qaid-q-btn-secondary-fg: #d1d5db;--qaid-q-btn-secondary-border: #4b5563;--qaid-q-btn-secondary-hover-bg: #374151;--qaid-q-option-bg: #111827;--qaid-q-option-bg-hover: #1f2937;--qaid-q-option-fg: #f9fafb;--qaid-q-option-border: #374151;--qaid-q-option-border-hover: #4b5563;--qaid-q-marker-bg: #111827;--qaid-q-marker-border: #4b5563;--qaid-q-marker-icon: #1f2937;--qaid-q-input-bg: #111827;--qaid-q-input-fg: #f9fafb;--qaid-q-input-border: #374151;--qaid-q-input-placeholder: #6b7280}.qaid-q-root{color-scheme:light dark;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);color:var(--qaid-q-card-fg)}.qaid-q-root.qaid-q-theme-light{color-scheme:light}.qaid-q-root.qaid-q-theme-dark{color-scheme:dark}.qaid-q-backdrop{position:fixed;inset:0;z-index:45;background:rgba(0,0,0,var(--qaid-backdrop-opacity, .4));animation:qaid-q-fade .18s ease-out}@keyframes qaid-q-fade{0%{opacity:0}to{opacity:1}}.qaid-q-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:50;width:var(--qaid-modal-width, 480px);max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);pointer-events:auto;display:flex;flex-direction:column}.qaid-q-card{background:var(--qaid-q-card-bg);color:var(--qaid-q-card-fg);border-radius:var(--qaid-q-card-radius);box-shadow:var(--qaid-q-card-shadow);padding:var(--qaid-q-card-padding);overflow:hidden;display:flex;flex-direction:column;min-height:0}:where(.qaid-q-root.qaid-q-inline) .qaid-q-card{box-shadow:none;border:1px solid var(--qaid-q-card-border);flex:1;min-height:0}:where(.qaid-q-root.qaid-q-inline){height:100%;display:flex;flex-direction:column;min-height:0}.qaid-q-header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-bottom:1rem}.qaid-q-title{font-size:1.125em;font-weight:700;margin:0;color:var(--qaid-q-card-fg)}.qaid-q-step-counter{font-size:.875em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums;white-space:nowrap}.qaid-q-close{width:28px;height:28px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--qaid-q-muted-fg);display:inline-flex;align-items:center;justify-content:center;-webkit-appearance:none;appearance:none}.qaid-q-close:hover{background:var(--qaid-q-btn-secondary-hover-bg);color:var(--qaid-q-card-fg)}.qaid-q-close:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-progress{position:relative;height:4px;background:var(--qaid-q-progress-track);border-radius:9999px;overflow:hidden;margin-bottom:var(--qaid-q-section-gap)}.qaid-q-progress--inline{flex:1;min-width:60px;margin-bottom:0}.qaid-q-progress-fill{position:absolute;inset:0 auto 0 0;background:var(--qaid-q-accent, #10b981);border-radius:9999px;transition:width .3s ease;width:0%}.qaid-q-body{flex:1;min-height:0;overflow-y:auto}.qaid-q-step{display:flex;flex-direction:column;gap:var(--qaid-q-gap);animation:qaid-q-slide .22s ease-out}@keyframes qaid-q-slide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.qaid-q-no-motion .qaid-q-step,.qaid-q-no-motion.qaid-q-root{animation:none!important}.qaid-q-label{font-size:1.125em;font-weight:600;margin:0;color:var(--qaid-q-card-fg);line-height:1.35}.qaid-q-label .qaid-q-required{color:var(--qaid-q-error, #ef4444);margin-left:.25rem}.qaid-q-description{font-size:.875em;color:var(--qaid-q-muted-fg);margin:0;line-height:1.4}.qaid-q-error{font-size:.8125em;color:var(--qaid-q-error, #ef4444);margin:0}.qaid-q-error:empty{display:none}.qaid-q-input,.qaid-q-textarea{width:100%;padding:var(--qaid-q-input-padding);border:1px solid var(--qaid-q-input-border);border-radius:var(--qaid-q-input-radius);font-family:inherit;font-size:1em;background:var(--qaid-q-input-bg);color:var(--qaid-q-input-fg);transition:border-color .15s,box-shadow .15s;-webkit-appearance:none;appearance:none}.qaid-q-textarea{min-height:7rem;resize:vertical;font-family:inherit}.qaid-q-input:focus,.qaid-q-textarea:focus{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 20%,transparent)}.qaid-q-input::placeholder,.qaid-q-textarea::placeholder{color:var(--qaid-q-input-placeholder)}.qaid-q-currency{position:relative}.qaid-q-currency-prefix{position:absolute;left:.875rem;top:50%;transform:translateY(-50%);color:var(--qaid-q-muted-fg);font-size:1em;font-weight:500;pointer-events:none}.qaid-q-currency .qaid-q-input{padding-left:2.25rem}.qaid-q-range-wrap{display:flex;flex-direction:column;gap:.5rem;padding:.5rem 0}.qaid-q-range-value{font-size:2em;font-weight:700;text-align:center;font-variant-numeric:tabular-nums;color:var(--qaid-q-accent, #10b981)}.qaid-q-range-value .qaid-q-range-unit{font-size:.5em;font-weight:500;color:var(--qaid-q-muted-fg);margin-left:.25rem}.qaid-q-range{width:100%;-webkit-appearance:none;appearance:none;height:6px;border-radius:9999px;background:var(--qaid-q-progress-track);outline:none}.qaid-q-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:22px;height:22px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer;transition:transform .1s}.qaid-q-range::-moz-range-thumb{width:22px;height:22px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer}.qaid-q-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range-bounds{display:flex;justify-content:space-between;font-size:.8125em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-options{display:flex;flex-direction:column;gap:.5rem}.qaid-q-option{display:flex;align-items:flex-start;gap:.625rem;padding:var(--qaid-q-option-padding);border:1px solid var(--qaid-q-option-border);border-radius:var(--qaid-q-option-radius);background:var(--qaid-q-option-bg);text-align:left;font-size:1em;color:var(--qaid-q-option-fg);cursor:pointer;transition:border-color .12s,background .12s,box-shadow .12s;-webkit-appearance:none;appearance:none;width:100%}.qaid-q-option:hover{border-color:var(--qaid-q-option-border-hover);background:var(--qaid-q-option-bg-hover)}.qaid-q-option:focus-visible{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 25%,transparent)}.qaid-q-option.qaid-q-selected{border-color:var(--qaid-q-option-border-selected);background:var(--qaid-q-option-bg-selected)}.qaid-q-option-marker{flex-shrink:0;width:1.25rem;height:1.25rem;border:2px solid var(--qaid-q-marker-border);border-radius:var(--qaid-q-marker-radius);display:inline-flex;align-items:center;justify-content:center;margin-top:.125rem;background:var(--qaid-q-marker-bg);transition:border-color .12s,background .12s}.qaid-q-option.qaid-q-multi .qaid-q-option-marker{border-radius:.25rem}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{border-color:var(--qaid-q-marker-bg-selected);background:var(--qaid-q-marker-bg-selected)}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:.5rem;height:.5rem;border-radius:50%;background:var(--qaid-q-marker-icon)}.qaid-q-option.qaid-q-multi.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:70%;height:70%;border-radius:0;background:var(--qaid-q-marker-icon);-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;transform:none}.qaid-q-option-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-option-image{display:block;width:48px;height:48px;aspect-ratio:1 / 1;object-fit:cover;border-radius:.375rem;background:var(--qaid-q-progress-track);flex-shrink:0}.qaid-q-options--image-horizontal .qaid-q-option-body{flex-direction:row;align-items:center;gap:.75rem}.qaid-q-options--image-horizontal .qaid-q-option-body>:not(.qaid-q-option-image){flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-options--image-vertical{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option{flex-direction:column;align-items:stretch;text-align:center;padding:.75rem;gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option-body{align-items:center;text-align:center}.qaid-q-options--image-vertical .qaid-q-option-image{width:100%;height:auto;max-width:100%}.qaid-q-options--image-vertical .qaid-q-option-marker{position:absolute;top:.5rem;right:.5rem;margin-top:0}.qaid-q-options--image-vertical .qaid-q-option{position:relative}.qaid-q-options--image-vertical .qaid-q-option-key{position:absolute;top:.5rem;left:.5rem;align-self:auto}.qaid-q-option-label{font-weight:500;line-height:1.3}.qaid-q-option-desc{font-size:.8125em;color:var(--qaid-q-muted-fg);line-height:1.4}.qaid-q-option-key{flex-shrink:0;align-self:center;font-size:.7em;font-weight:600;padding:.125rem .375rem;border-radius:.25rem;background:var(--qaid-q-progress-track);color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-top:var(--qaid-q-section-gap)}.qaid-q-footer--inline-progress{justify-content:flex-start;gap:.75rem}.qaid-q-footer-left,.qaid-q-footer-right{display:flex;gap:.5rem}.qaid-q-btn{padding:var(--qaid-q-btn-padding-y) var(--qaid-q-btn-padding-x);border-radius:var(--qaid-q-btn-radius);font-size:var(--qaid-q-btn-font-size, .9375em);font-weight:var(--qaid-q-btn-font-weight);border:1px solid transparent;cursor:pointer;transition:filter .15s,background .15s,color .15s;-webkit-appearance:none;appearance:none}.qaid-q-btn:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-btn-secondary{background:var(--qaid-q-btn-secondary-bg);border-color:var(--qaid-q-btn-secondary-border);color:var(--qaid-q-btn-secondary-fg)}.qaid-q-btn-secondary:hover{background:var(--qaid-q-btn-secondary-hover-bg)}.qaid-q-btn-primary{background:var(--qaid-q-btn-primary-bg);color:var(--qaid-q-btn-primary-fg);border-color:var(--qaid-q-btn-primary-border)}.qaid-q-btn-primary:hover{filter:brightness(.9)}.qaid-q-btn-primary:disabled{opacity:.5;cursor:not-allowed;filter:none}.qaid-q-done{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:.5rem;padding:1.5rem 0;flex:1;min-height:0}.qaid-q-done-icon{width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--qaid-q-accent, #10b981) 18%,transparent);color:var(--qaid-q-accent, #10b981);display:inline-flex;align-items:center;justify-content:center;margin-bottom:.5rem}.qaid-q-done-title{font-size:1.25em;font-weight:700;margin:0}.qaid-q-done-message{color:var(--qaid-q-muted-fg);margin:0}.qaid-q-saving{display:inline-flex;align-items:center;gap:.375rem;font-size:.75em;color:var(--qaid-q-muted-fg);opacity:0;transition:opacity .2s}.qaid-q-saving.qaid-q-visible{opacity:1}.qaid-q-saving-dot{width:6px;height:6px;border-radius:50%;background:var(--qaid-q-accent, #10b981);animation:qaid-q-pulse 1.2s ease-in-out infinite}@keyframes qaid-q-pulse{0%,to{opacity:.3}50%{opacity:1}}:where(.qaid-q-root.qaid-q-unstyled) :where(.qaid-q-card,.qaid-q-header,.qaid-q-title,.qaid-q-description,.qaid-q-step,.qaid-q-label,.qaid-q-options,.qaid-q-option,.qaid-q-option-marker,.qaid-q-option-body,.qaid-q-option-label,.qaid-q-option-desc,.qaid-q-input,.qaid-q-textarea,.qaid-q-currency,.qaid-q-currency-prefix,.qaid-q-range,.qaid-q-range-wrap,.qaid-q-range-value,.qaid-q-btn,.qaid-q-footer,.qaid-q-progress,.qaid-q-progress-fill,.qaid-q-step-counter,.qaid-q-error,.qaid-q-saving,.qaid-q-done,.qaid-q-done-icon,.qaid-q-done-title,.qaid-q-done-message){all:unset;display:revert;box-sizing:border-box}`;
2
- const S = ":where(.qaid-q-root){--qaid-q-card-radius: 0;--qaid-q-card-shadow: none;--qaid-q-btn-radius: 0;--qaid-q-option-radius: 0;--qaid-q-option-bg-selected: transparent;--qaid-q-input-radius: 0}", A = ":where(.qaid-q-root){--qaid-q-card-radius: 1.5rem;--qaid-q-btn-radius: 9999px;--qaid-q-btn-padding-x: 1.5rem;--qaid-q-option-radius: 9999px;--qaid-q-option-padding: .75rem 1.125rem;--qaid-q-input-radius: 9999px;--qaid-q-input-padding: .75rem 1.125rem}", I = ":where(.qaid-q-root){--qaid-q-card-padding: 1rem;--qaid-q-btn-padding-y: .5rem;--qaid-q-btn-padding-x: .875rem;--qaid-q-option-padding: .5rem .625rem;--qaid-q-input-padding: .5rem .625rem;--qaid-q-gap: .5rem;--qaid-q-section-gap: .875rem}", N = {
1
+ const T = `*{box-sizing:border-box}button{cursor:pointer;font-family:inherit}:where(.qaid-q-root){--qaid-q-card-bg: light-dark(#ffffff, #1f2937);--qaid-q-card-fg: light-dark(#1f2937, #f9fafb);--qaid-q-card-border: light-dark(#e5e7eb, #374151);--qaid-q-card-radius: 1rem;--qaid-q-card-padding: 1.5rem;--qaid-q-card-shadow: 0 25px 50px -12px light-dark(rgba(0, 0, 0, .25), rgba(0, 0, 0, .6));--qaid-q-muted-fg: light-dark(#6b7280, #9ca3af);--qaid-q-progress-track: light-dark(#e5e7eb, #374151);--qaid-q-btn-radius: .5rem;--qaid-q-btn-padding-y: .625rem;--qaid-q-btn-padding-x: 1.125rem;--qaid-q-btn-font-weight: 500;--qaid-q-btn-primary-bg: var(--qaid-q-accent, #10b981);--qaid-q-btn-primary-fg: var(--qaid-q-accent-text, #ffffff);--qaid-q-btn-primary-border: transparent;--qaid-q-btn-secondary-bg: transparent;--qaid-q-btn-secondary-fg: light-dark(#374151, #d1d5db);--qaid-q-btn-secondary-border: light-dark(#d1d5db, #4b5563);--qaid-q-btn-secondary-hover-bg: light-dark(#f3f4f6, #374151);--qaid-q-option-bg: light-dark(#ffffff, #111827);--qaid-q-option-bg-selected: color-mix(in srgb, var(--qaid-q-accent, #10b981) 10%, transparent);--qaid-q-option-bg-hover: light-dark(#f9fafb, #1f2937);--qaid-q-option-fg: light-dark(#1f2937, #f9fafb);--qaid-q-option-border: light-dark(#e5e7eb, #374151);--qaid-q-option-border-selected: var(--qaid-q-accent, #10b981);--qaid-q-option-border-hover: light-dark(#9ca3af, #4b5563);--qaid-q-option-radius: .625rem;--qaid-q-option-padding: .75rem .875rem;--qaid-q-marker-bg: light-dark(#ffffff, #111827);--qaid-q-marker-bg-selected: var(--qaid-q-accent, #10b981);--qaid-q-marker-border: light-dark(#d1d5db, #4b5563);--qaid-q-marker-icon: light-dark(#ffffff, #1f2937);--qaid-q-marker-radius: 50%;--qaid-q-input-bg: light-dark(#ffffff, #111827);--qaid-q-input-fg: light-dark(#1f2937, #f9fafb);--qaid-q-input-border: light-dark(#d1d5db, #374151);--qaid-q-input-radius: .625rem;--qaid-q-input-padding: .75rem .875rem;--qaid-q-input-placeholder: light-dark(#9ca3af, #6b7280);--qaid-q-gap: .75rem;--qaid-q-section-gap: 1.25rem}:where(.qaid-q-root.qaid-q-theme-light){--qaid-q-card-bg: #ffffff;--qaid-q-card-fg: #1f2937;--qaid-q-card-border: #e5e7eb;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);--qaid-q-muted-fg: #6b7280;--qaid-q-progress-track: #e5e7eb;--qaid-q-btn-secondary-fg: #374151;--qaid-q-btn-secondary-border: #d1d5db;--qaid-q-btn-secondary-hover-bg: #f3f4f6;--qaid-q-option-bg: #ffffff;--qaid-q-option-bg-hover: #f9fafb;--qaid-q-option-fg: #1f2937;--qaid-q-option-border: #e5e7eb;--qaid-q-option-border-hover: #9ca3af;--qaid-q-marker-bg: #ffffff;--qaid-q-marker-border: #d1d5db;--qaid-q-marker-icon: #ffffff;--qaid-q-input-bg: #ffffff;--qaid-q-input-fg: #1f2937;--qaid-q-input-border: #d1d5db;--qaid-q-input-placeholder: #9ca3af}:where(.qaid-q-root.qaid-q-theme-dark){--qaid-q-card-bg: #1f2937;--qaid-q-card-fg: #f9fafb;--qaid-q-card-border: #374151;--qaid-q-card-shadow: 0 25px 50px -12px rgba(0, 0, 0, .6);--qaid-q-muted-fg: #9ca3af;--qaid-q-progress-track: #374151;--qaid-q-btn-secondary-fg: #d1d5db;--qaid-q-btn-secondary-border: #4b5563;--qaid-q-btn-secondary-hover-bg: #374151;--qaid-q-option-bg: #111827;--qaid-q-option-bg-hover: #1f2937;--qaid-q-option-fg: #f9fafb;--qaid-q-option-border: #374151;--qaid-q-option-border-hover: #4b5563;--qaid-q-marker-bg: #111827;--qaid-q-marker-border: #4b5563;--qaid-q-marker-icon: #1f2937;--qaid-q-input-bg: #111827;--qaid-q-input-fg: #f9fafb;--qaid-q-input-border: #374151;--qaid-q-input-placeholder: #6b7280}.qaid-q-root{color-scheme:light dark;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px);color:var(--qaid-q-card-fg)}.qaid-q-root.qaid-q-theme-light{color-scheme:light}.qaid-q-root.qaid-q-theme-dark{color-scheme:dark}.qaid-q-backdrop{position:fixed;inset:0;z-index:45;background:rgba(0,0,0,var(--qaid-backdrop-opacity, .4));animation:qaid-q-fade .18s ease-out}@keyframes qaid-q-fade{0%{opacity:0}to{opacity:1}}.qaid-q-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:50;width:var(--qaid-modal-width, 480px);max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);pointer-events:auto;display:flex;flex-direction:column}.qaid-q-card{background:var(--qaid-q-card-bg);color:var(--qaid-q-card-fg);border-radius:var(--qaid-q-card-radius);box-shadow:var(--qaid-q-card-shadow);padding:var(--qaid-q-card-padding);overflow:hidden;display:flex;flex-direction:column;min-height:0}:where(.qaid-q-root.qaid-q-inline) .qaid-q-card{box-shadow:none;border:1px solid var(--qaid-q-card-border);flex:1;min-height:0}:where(.qaid-q-root.qaid-q-inline){height:100%;display:flex;flex-direction:column;min-height:0}.qaid-q-header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-bottom:1rem}.qaid-q-title{font-size:1.125em;font-weight:700;margin:0;color:var(--qaid-q-card-fg)}.qaid-q-step-counter{font-size:.875em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums;white-space:nowrap}.qaid-q-close{width:28px;height:28px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--qaid-q-muted-fg);display:inline-flex;align-items:center;justify-content:center;-webkit-appearance:none;appearance:none}.qaid-q-close:hover{background:var(--qaid-q-btn-secondary-hover-bg);color:var(--qaid-q-card-fg)}.qaid-q-close:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-progress{position:relative;height:4px;background:var(--qaid-q-progress-track);border-radius:9999px;overflow:hidden;margin-bottom:var(--qaid-q-section-gap)}.qaid-q-progress--inline{flex:1;min-width:60px;margin-bottom:0}.qaid-q-progress-fill{position:absolute;inset:0 auto 0 0;background:var(--qaid-q-accent, #10b981);border-radius:9999px;transition:width .3s ease;width:0%}.qaid-q-body{flex:1;min-height:0;overflow-y:auto}.qaid-q-step{display:flex;flex-direction:column;gap:var(--qaid-q-gap);animation:qaid-q-slide .22s ease-out}@keyframes qaid-q-slide{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.qaid-q-no-motion .qaid-q-step,.qaid-q-no-motion.qaid-q-root{animation:none!important}.qaid-q-label{font-size:1.125em;font-weight:600;margin:0;color:var(--qaid-q-card-fg);line-height:1.35}.qaid-q-label .qaid-q-required{color:var(--qaid-q-error, #ef4444);margin-left:.25rem}.qaid-q-description{font-size:.875em;color:var(--qaid-q-muted-fg);margin:0;line-height:1.4}.qaid-q-error{font-size:.8125em;color:var(--qaid-q-error, #ef4444);margin:0}.qaid-q-error:empty{display:none}.qaid-q-input,.qaid-q-textarea{width:100%;padding:var(--qaid-q-input-padding);border:1px solid var(--qaid-q-input-border);border-radius:var(--qaid-q-input-radius);font-family:inherit;font-size:1em;background:var(--qaid-q-input-bg);color:var(--qaid-q-input-fg);transition:border-color .15s,box-shadow .15s;-webkit-appearance:none;appearance:none}.qaid-q-textarea{min-height:7rem;resize:vertical;font-family:inherit}.qaid-q-input:focus,.qaid-q-textarea:focus{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 20%,transparent)}.qaid-q-input::placeholder,.qaid-q-textarea::placeholder{color:var(--qaid-q-input-placeholder)}.qaid-q-currency{position:relative}.qaid-q-currency-prefix{position:absolute;left:.875rem;top:50%;transform:translateY(-50%);color:var(--qaid-q-muted-fg);font-size:1em;font-weight:500;pointer-events:none}.qaid-q-currency .qaid-q-input{padding-left:2.25rem}.qaid-q-range-wrap{display:flex;flex-direction:column;gap:.5rem;padding:.5rem 0}.qaid-q-range-value{font-size:2em;font-weight:700;text-align:center;font-variant-numeric:tabular-nums;color:var(--qaid-q-accent, #10b981)}.qaid-q-range-value .qaid-q-range-unit{font-size:.5em;font-weight:500;color:var(--qaid-q-muted-fg);margin-left:.25rem}.qaid-q-range{width:100%;-webkit-appearance:none;appearance:none;height:6px;border-radius:9999px;background:var(--qaid-q-progress-track);outline:none}.qaid-q-range::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:24px;height:24px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer;transition:transform .1s}.qaid-q-range::-moz-range-thumb{width:24px;height:24px;border-radius:50%;background:var(--qaid-q-accent, #10b981);border:3px solid var(--qaid-q-card-bg);box-shadow:0 2px 6px #0003;cursor:pointer}.qaid-q-range:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range:focus-visible::-moz-range-thumb{box-shadow:0 0 0 6px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-range-bounds{display:flex;justify-content:space-between;font-size:.8125em;color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-options{display:flex;flex-direction:column;gap:.5rem}.qaid-q-option{display:flex;align-items:flex-start;gap:.625rem;padding:var(--qaid-q-option-padding);border:1px solid var(--qaid-q-option-border);border-radius:var(--qaid-q-option-radius);background:var(--qaid-q-option-bg);text-align:left;font-size:1em;color:var(--qaid-q-option-fg);cursor:pointer;transition:border-color .12s,background .12s,box-shadow .12s;-webkit-appearance:none;appearance:none;width:100%}.qaid-q-option:hover{border-color:var(--qaid-q-option-border-hover);background:var(--qaid-q-option-bg-hover)}.qaid-q-option:focus-visible{outline:none;border-color:var(--qaid-q-focus, #6366f1);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 25%,transparent)}.qaid-q-option.qaid-q-selected{border-color:var(--qaid-q-option-border-selected);background:var(--qaid-q-option-bg-selected)}.qaid-q-option-marker{flex-shrink:0;width:1.25rem;height:1.25rem;border:2px solid var(--qaid-q-marker-border);border-radius:var(--qaid-q-marker-radius);display:inline-flex;align-items:center;justify-content:center;margin-top:.125rem;background:var(--qaid-q-marker-bg);transition:border-color .12s,background .12s}.qaid-q-option.qaid-q-multi .qaid-q-option-marker{border-radius:.25rem}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{border-color:var(--qaid-q-marker-bg-selected);background:var(--qaid-q-marker-bg-selected)}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:.5rem;height:.5rem;border-radius:50%;background:var(--qaid-q-marker-icon)}.qaid-q-option.qaid-q-multi.qaid-q-selected .qaid-q-option-marker:after{content:"";display:block;width:70%;height:70%;border-radius:0;background:var(--qaid-q-marker-icon);-webkit-mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");mask-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12l4 4L19 7'/></svg>");-webkit-mask-size:contain;mask-size:contain;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;transform:none}.qaid-q-option-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-option-image{display:block;width:48px;height:48px;aspect-ratio:1 / 1;object-fit:cover;border-radius:.375rem;background:var(--qaid-q-progress-track);flex-shrink:0}.qaid-q-options--image-horizontal .qaid-q-option-body{flex-direction:row;align-items:center;gap:.75rem}.qaid-q-options--image-horizontal .qaid-q-option-body>:not(.qaid-q-option-image){flex:1;min-width:0;display:flex;flex-direction:column;gap:.125rem}.qaid-q-options--image-vertical{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option{flex-direction:column;align-items:stretch;text-align:center;padding:.75rem;gap:.5rem}.qaid-q-options--image-vertical .qaid-q-option-body{align-items:center;text-align:center}.qaid-q-options--image-vertical .qaid-q-option-image{width:100%;height:auto;max-width:100%}.qaid-q-options--image-vertical .qaid-q-option-marker{position:absolute;top:.5rem;right:.5rem;margin-top:0}.qaid-q-options--image-vertical .qaid-q-option{position:relative}.qaid-q-options--image-vertical .qaid-q-option-key{position:absolute;top:.5rem;left:.5rem;align-self:auto}.qaid-q-option-label{font-weight:500;line-height:1.3}.qaid-q-option-desc{font-size:.8125em;color:var(--qaid-q-muted-fg);line-height:1.4}.qaid-q-option-key{flex-shrink:0;align-self:center;font-size:.7em;font-weight:600;padding:.125rem .375rem;border-radius:.25rem;background:var(--qaid-q-progress-track);color:var(--qaid-q-muted-fg);font-variant-numeric:tabular-nums}.qaid-q-footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;margin-top:var(--qaid-q-section-gap)}.qaid-q-footer--inline-progress{justify-content:flex-start;gap:.75rem}.qaid-q-footer-left,.qaid-q-footer-right{display:flex;gap:.5rem}.qaid-q-btn{padding:var(--qaid-q-btn-padding-y) var(--qaid-q-btn-padding-x);border-radius:var(--qaid-q-btn-radius);font-size:var(--qaid-q-btn-font-size, .9375em);font-weight:var(--qaid-q-btn-font-weight);border:1px solid transparent;cursor:pointer;transition:filter .15s,background .15s,color .15s;-webkit-appearance:none;appearance:none}.qaid-q-btn:focus-visible{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-q-focus, #6366f1) 30%,transparent)}.qaid-q-btn-secondary{background:var(--qaid-q-btn-secondary-bg);border-color:var(--qaid-q-btn-secondary-border);color:var(--qaid-q-btn-secondary-fg)}.qaid-q-btn-secondary:hover{background:var(--qaid-q-btn-secondary-hover-bg)}.qaid-q-btn-primary{background:var(--qaid-q-btn-primary-bg);color:var(--qaid-q-btn-primary-fg);border-color:var(--qaid-q-btn-primary-border)}.qaid-q-btn-primary:hover{filter:brightness(.9)}.qaid-q-btn-primary:disabled{opacity:.5;cursor:not-allowed;filter:none}.qaid-q-done{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:.5rem;padding:1.5rem 0;flex:1;min-height:0}.qaid-q-done-icon{width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--qaid-q-accent, #10b981) 18%,transparent);color:var(--qaid-q-accent, #10b981);display:inline-flex;align-items:center;justify-content:center;margin-bottom:.5rem}.qaid-q-done-title{font-size:1.25em;font-weight:700;margin:0}.qaid-q-done-message{color:var(--qaid-q-muted-fg);margin:0}.qaid-q-saving{display:inline-flex;align-items:center;gap:.375rem;font-size:.75em;color:var(--qaid-q-muted-fg);opacity:0;transition:opacity .2s}.qaid-q-saving.qaid-q-visible{opacity:1}.qaid-q-saving-dot{width:6px;height:6px;border-radius:50%;background:var(--qaid-q-accent, #10b981);animation:qaid-q-pulse 1.2s ease-in-out infinite}@keyframes qaid-q-pulse{0%,to{opacity:.3}50%{opacity:1}}:where(.qaid-q-root.qaid-q-unstyled) :where(.qaid-q-card,.qaid-q-header,.qaid-q-title,.qaid-q-description,.qaid-q-step,.qaid-q-label,.qaid-q-options,.qaid-q-option,.qaid-q-option-marker,.qaid-q-option-body,.qaid-q-option-label,.qaid-q-option-desc,.qaid-q-input,.qaid-q-textarea,.qaid-q-currency,.qaid-q-currency-prefix,.qaid-q-range,.qaid-q-range-wrap,.qaid-q-range-value,.qaid-q-btn,.qaid-q-footer,.qaid-q-progress,.qaid-q-progress-fill,.qaid-q-step-counter,.qaid-q-error,.qaid-q-saving,.qaid-q-done,.qaid-q-done-icon,.qaid-q-done-title,.qaid-q-done-message){all:unset;display:revert;box-sizing:border-box}.qaid-q-input:focus-visible,.qaid-q-textarea:focus-visible,.qaid-q-option:focus-visible,.qaid-q-btn:focus-visible,.qaid-q-close:focus-visible,.qaid-q-range:focus-visible{outline:2px solid transparent;outline-offset:2px}@media(prefers-reduced-motion:reduce){.qaid-q-root *,.qaid-q-root *:before,.qaid-q-root *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}.qaid-q-range::-webkit-slider-thumb{transition:none!important}.qaid-q-range::-moz-range-thumb{transition:none!important}}@media(forced-colors:active){.qaid-q-input:focus-visible,.qaid-q-textarea:focus-visible,.qaid-q-option:focus-visible,.qaid-q-btn:focus-visible,.qaid-q-close:focus-visible,.qaid-q-range:focus-visible{outline:2px solid Highlight;outline-offset:2px}.qaid-q-card{border:1px solid CanvasText}.qaid-q-input,.qaid-q-textarea,.qaid-q-option{border-color:CanvasText}.qaid-q-option.qaid-q-selected{border-color:Highlight}.qaid-q-option.qaid-q-selected .qaid-q-option-marker{forced-color-adjust:none;background:Highlight;border-color:Highlight}.qaid-q-option.qaid-q-selected .qaid-q-option-marker:after{background:HighlightText}.qaid-q-progress{forced-color-adjust:none;background:Canvas;border:1px solid CanvasText}.qaid-q-progress-fill{forced-color-adjust:none;background:Highlight}}`;
2
+ const L = ":where(.qaid-q-root){--qaid-q-card-radius: 0;--qaid-q-card-shadow: none;--qaid-q-btn-radius: 0;--qaid-q-option-radius: 0;--qaid-q-option-bg-selected: transparent;--qaid-q-input-radius: 0}", z = ":where(.qaid-q-root){--qaid-q-card-radius: 1.5rem;--qaid-q-btn-radius: 9999px;--qaid-q-btn-padding-x: 1.5rem;--qaid-q-option-radius: 9999px;--qaid-q-option-padding: .75rem 1.125rem;--qaid-q-input-radius: 9999px;--qaid-q-input-padding: .75rem 1.125rem}", D = ":where(.qaid-q-root){--qaid-q-card-padding: 1rem;--qaid-q-btn-padding-y: .5rem;--qaid-q-btn-padding-x: .875rem;--qaid-q-option-padding: .5rem .625rem;--qaid-q-input-padding: .5rem .625rem;--qaid-q-gap: .5rem;--qaid-q-section-gap: .875rem}", V = {
3
3
  default: "",
4
- minimal: S,
5
- pill: A,
6
- dense: I
4
+ minimal: L,
5
+ pill: z,
6
+ dense: D
7
7
  };
8
- function L(t) {
9
- return N[t] ?? "";
8
+ function H(t) {
9
+ return V[t] ?? "";
10
10
  }
11
- function T(t, e, i) {
12
- const [n, a, o] = [t, e, i].map((r) => (r = r / 255, r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)));
13
- return 0.2126 * n + 0.7152 * a + 0.0722 * o;
11
+ function R(t, e, i) {
12
+ const [a, n, o] = [t, e, i].map((r) => (r = r / 255, r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)));
13
+ return 0.2126 * a + 0.7152 * n + 0.0722 * o;
14
14
  }
15
- function z(t) {
15
+ function O(t) {
16
16
  if (t.startsWith("#")) {
17
- const i = t.slice(1), n = i.length === 3 ? i.split("").map((o) => o + o).join("") : i, a = parseInt(n, 16);
18
- return { r: a >> 16 & 255, g: a >> 8 & 255, b: a & 255 };
17
+ const i = t.slice(1), a = i.length === 3 ? i.split("").map((o) => o + o).join("") : i, n = parseInt(a, 16);
18
+ return { r: n >> 16 & 255, g: n >> 8 & 255, b: n & 255 };
19
19
  }
20
20
  const e = t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
21
21
  return e ? { r: parseInt(e[1]), g: parseInt(e[2]), b: parseInt(e[3]) } : null;
22
22
  }
23
- function x(t) {
24
- const e = z(t);
25
- return e && T(e.r, e.g, e.b) > 0.4 ? "black" : "white";
23
+ function w(t) {
24
+ const e = O(t);
25
+ return e && R(e.r, e.g, e.b) > 0.4 ? "black" : "white";
26
26
  }
27
- function V(t = {}) {
27
+ function P(t = {}) {
28
28
  const e = {};
29
- return t.accentColor !== void 0 && (e["--qaid-q-accent"] = t.accentColor, e["--qaid-q-accent-text"] = x(t.accentColor)), t.errorColor !== void 0 && (e["--qaid-q-error"] = t.errorColor), t.focusColor !== void 0 && (e["--qaid-q-focus"] = t.focusColor, e["--qaid-q-focus-text"] = x(t.focusColor)), t.modalWidth !== void 0 && (e["--qaid-modal-width"] = `${t.modalWidth}px`), t.backdropOpacity !== void 0 && (e["--qaid-backdrop-opacity"] = String(t.backdropOpacity)), t.fontFamily !== void 0 && (e["--qaid-font-family"] = t.fontFamily), t.fontSize !== void 0 && (e["--qaid-font-size"] = `${t.fontSize}px`), e;
29
+ return t.accentColor !== void 0 && (e["--qaid-q-accent"] = t.accentColor, e["--qaid-q-accent-text"] = w(t.accentColor)), t.errorColor !== void 0 && (e["--qaid-q-error"] = t.errorColor), t.focusColor !== void 0 && (e["--qaid-q-focus"] = t.focusColor, e["--qaid-q-focus-text"] = w(t.focusColor)), t.modalWidth !== void 0 && (e["--qaid-modal-width"] = `${t.modalWidth}px`), t.backdropOpacity !== void 0 && (e["--qaid-backdrop-opacity"] = String(t.backdropOpacity)), t.fontFamily !== void 0 && (e["--qaid-font-family"] = t.fontFamily), t.fontSize !== void 0 && (e["--qaid-font-size"] = `${t.fontSize}px`), e;
30
30
  }
31
- function P(t, e) {
32
- for (const [i, n] of Object.entries(e))
33
- t.style.setProperty(i, n);
31
+ function j(t, e) {
32
+ for (const [i, a] of Object.entries(e))
33
+ t.style.setProperty(i, a);
34
34
  }
35
- function D() {
36
- return C;
35
+ function U() {
36
+ return T;
37
37
  }
38
- function O(t) {
39
- return L(t);
38
+ function $(t) {
39
+ return H(t);
40
40
  }
41
- function H(t) {
41
+ function b(t) {
42
+ let e = null;
43
+ return {
44
+ setInvalid(i) {
45
+ t.setAttribute("aria-invalid", "true");
46
+ const a = (t.getAttribute("aria-describedby") ?? "").split(/\s+/).filter(Boolean);
47
+ a.includes(i) || a.push(i), t.setAttribute("aria-describedby", a.join(" ")), e = i;
48
+ },
49
+ clearInvalid() {
50
+ if (t.removeAttribute("aria-invalid"), e) {
51
+ const i = (t.getAttribute("aria-describedby") ?? "").split(/\s+/).filter(Boolean).filter((a) => a !== e);
52
+ i.length ? t.setAttribute("aria-describedby", i.join(" ")) : t.removeAttribute("aria-describedby"), e = null;
53
+ }
54
+ }
55
+ };
56
+ }
57
+ function F(t) {
42
58
  switch (t.question.type) {
43
59
  case "text":
44
- return j(t.question, t);
60
+ return M(t.question, t);
45
61
  case "currency":
46
- return R(t.question, t);
62
+ return K(t.question, t);
47
63
  case "range":
48
- return Q(t.question, t);
64
+ return Y(t.question, t);
49
65
  case "date":
50
- return $(t.question, t);
66
+ return W(t.question, t);
51
67
  case "multiple-choice":
52
- return M(t.question, t);
68
+ return _(t.question, t);
53
69
  }
54
70
  }
55
- function j(t, e) {
71
+ function M(t, e) {
56
72
  const i = typeof e.initialValue == "string" ? e.initialValue : "";
57
- let n;
73
+ let a;
58
74
  if (t.multiline) {
59
- const a = document.createElement("textarea");
60
- a.className = "qaid-q-textarea", a.value = i, t.placeholder && (a.placeholder = t.placeholder), t.maxLength && (a.maxLength = t.maxLength), n = a;
75
+ const n = document.createElement("textarea");
76
+ n.className = "qaid-q-textarea", n.value = i, t.placeholder && (n.placeholder = t.placeholder), t.maxLength && (n.maxLength = t.maxLength), a = n;
61
77
  } else {
62
- const a = document.createElement("input");
63
- a.className = "qaid-q-input", a.type = t.inputType ?? "text", a.value = i, t.placeholder && (a.placeholder = t.placeholder), t.maxLength && (a.maxLength = t.maxLength), a.setAttribute("autocomplete", U(t.inputType)), n = a;
78
+ const n = document.createElement("input");
79
+ n.className = "qaid-q-input", n.type = t.inputType ?? "text", n.value = i, t.placeholder && (n.placeholder = t.placeholder), t.maxLength && (n.maxLength = t.maxLength), n.setAttribute("autocomplete", Q(t.inputType)), a = n;
64
80
  }
65
- return n.setAttribute("aria-label", t.label), n.addEventListener("input", () => {
66
- e.onChange(n.value);
67
- }), n.addEventListener("keydown", ((a) => {
68
- if (a.key === "Enter") {
81
+ return a.setAttribute("aria-label", t.label), t.required && a.setAttribute("aria-required", "true"), a.addEventListener("input", () => {
82
+ e.onChange(a.value);
83
+ }), a.addEventListener("keydown", ((n) => {
84
+ if (n.key === "Enter") {
69
85
  if (t.multiline) {
70
- (a.metaKey || a.ctrlKey) && (a.preventDefault(), e.onSubmit());
86
+ (n.metaKey || n.ctrlKey) && (n.preventDefault(), e.onSubmit());
71
87
  return;
72
88
  }
73
- a.isComposing || (a.preventDefault(), e.onSubmit());
89
+ n.isComposing || (n.preventDefault(), e.onSubmit());
74
90
  }
75
91
  })), {
76
- element: n,
92
+ element: a,
77
93
  focus: () => {
78
- n.focus();
79
- const a = n.value.length;
94
+ a.focus();
95
+ const n = a.value.length;
80
96
  try {
81
- n.setSelectionRange(a, a);
97
+ a.setSelectionRange(n, n);
82
98
  } catch {
83
99
  }
84
100
  },
85
- getValue: () => n.value,
101
+ getValue: () => a.value,
86
102
  isValid: () => {
87
103
  if (!t.required) return !0;
88
- const a = n.value.trim();
89
- return !(a.length === 0 || t.minLength && a.length < t.minLength);
90
- }
104
+ const n = a.value.trim();
105
+ return !(n.length === 0 || t.minLength && n.length < t.minLength);
106
+ },
107
+ ...b(a)
91
108
  };
92
109
  }
93
- function U(t) {
110
+ function Q(t) {
94
111
  switch (t) {
95
112
  case "email":
96
113
  return "email";
@@ -102,37 +119,38 @@ function U(t) {
102
119
  return "off";
103
120
  }
104
121
  }
105
- function R(t, e) {
122
+ function K(t, e) {
106
123
  const i = document.createElement("div");
107
124
  i.className = "qaid-q-currency";
108
- const n = document.createElement("span");
109
- n.className = "qaid-q-currency-prefix", n.textContent = F(t.currency ?? "USD", t.locale), i.appendChild(n);
110
- const a = document.createElement("input");
111
- return a.className = "qaid-q-input", a.type = "number", a.inputMode = "decimal", a.step = "0.01", typeof t.min == "number" && (a.min = String(t.min)), typeof t.max == "number" && (a.max = String(t.max)), t.placeholder && (a.placeholder = t.placeholder), typeof e.initialValue == "number" ? a.value = String(e.initialValue) : typeof e.initialValue == "string" && e.initialValue !== "" && (a.value = e.initialValue), a.setAttribute("aria-label", t.label), a.addEventListener("input", () => {
112
- const o = a.value;
125
+ const a = document.createElement("span");
126
+ a.className = "qaid-q-currency-prefix", a.textContent = B(t.currency ?? "USD", t.locale), i.appendChild(a);
127
+ const n = document.createElement("input");
128
+ return n.className = "qaid-q-input", n.type = "number", n.inputMode = "decimal", n.step = "0.01", typeof t.min == "number" && (n.min = String(t.min)), typeof t.max == "number" && (n.max = String(t.max)), t.placeholder && (n.placeholder = t.placeholder), typeof e.initialValue == "number" ? n.value = String(e.initialValue) : typeof e.initialValue == "string" && e.initialValue !== "" && (n.value = e.initialValue), n.setAttribute("aria-label", t.label), t.required && n.setAttribute("aria-required", "true"), n.addEventListener("input", () => {
129
+ const o = n.value;
113
130
  if (o === "")
114
131
  e.onChange(null);
115
132
  else {
116
133
  const r = Number(o);
117
134
  e.onChange(Number.isNaN(r) ? null : r);
118
135
  }
119
- }), a.addEventListener("keydown", (o) => {
136
+ }), n.addEventListener("keydown", (o) => {
120
137
  o.key === "Enter" && !o.isComposing && (o.preventDefault(), e.onSubmit());
121
- }), i.appendChild(a), {
138
+ }), i.appendChild(n), {
122
139
  element: i,
123
- focus: () => a.focus(),
140
+ focus: () => n.focus(),
124
141
  getValue: () => {
125
- if (a.value === "") return null;
126
- const o = Number(a.value);
142
+ if (n.value === "") return null;
143
+ const o = Number(n.value);
127
144
  return Number.isNaN(o) ? null : o;
128
145
  },
129
146
  isValid: () => {
130
- const o = a.value === "" ? null : Number(a.value);
147
+ const o = n.value === "" ? null : Number(n.value);
131
148
  return !(t.required && (o === null || Number.isNaN(o)) || o !== null && !Number.isNaN(o) && (typeof t.min == "number" && o < t.min || typeof t.max == "number" && o > t.max));
132
- }
149
+ },
150
+ ...b(n)
133
151
  };
134
152
  }
135
- function F(t, e) {
153
+ function B(t, e) {
136
154
  try {
137
155
  return new Intl.NumberFormat(e, {
138
156
  style: "currency",
@@ -144,107 +162,109 @@ function F(t, e) {
144
162
  return t;
145
163
  }
146
164
  }
147
- function Q(t, e) {
165
+ function Y(t, e) {
148
166
  const i = document.createElement("div");
149
167
  i.className = "qaid-q-range-wrap";
150
- const n = document.createElement("div");
151
- n.className = "qaid-q-range-value";
152
- const a = document.createElement("span");
153
- if (n.appendChild(a), t.unit) {
168
+ const a = document.createElement("div");
169
+ a.className = "qaid-q-range-value";
170
+ const n = document.createElement("span");
171
+ if (a.appendChild(n), t.unit) {
154
172
  const s = document.createElement("span");
155
- s.className = "qaid-q-range-unit", s.textContent = t.unit, n.appendChild(s);
173
+ s.className = "qaid-q-range-unit", s.textContent = t.unit, a.appendChild(s);
156
174
  }
157
175
  const o = typeof e.initialValue == "number" ? e.initialValue : t.defaultValue ?? t.min, r = document.createElement("input");
158
176
  r.className = "qaid-q-range", r.type = "range", r.min = String(t.min), r.max = String(t.max), r.step = String(t.step ?? 1), r.value = String(o), r.setAttribute("aria-label", t.label), r.setAttribute("aria-valuemin", String(t.min)), r.setAttribute("aria-valuemax", String(t.max));
159
- const q = () => {
160
- a.textContent = r.value, r.setAttribute("aria-valuenow", r.value);
177
+ const c = () => {
178
+ n.textContent = r.value, r.setAttribute("aria-valuenow", r.value);
161
179
  };
162
- q(), r.addEventListener("input", () => {
163
- q(), e.onChange(Number(r.value));
180
+ c(), r.addEventListener("input", () => {
181
+ c(), e.onChange(Number(r.value));
164
182
  }), r.addEventListener("keydown", (s) => {
165
183
  s.key === "Enter" && (s.preventDefault(), e.onSubmit());
166
184
  });
167
- const h = document.createElement("div");
168
- h.className = "qaid-q-range-bounds";
185
+ const q = document.createElement("div");
186
+ q.className = "qaid-q-range-bounds";
187
+ const p = document.createElement("span");
188
+ p.textContent = `${t.min}${t.unit ?? ""}`;
169
189
  const m = document.createElement("span");
170
- m.textContent = `${t.min}${t.unit ?? ""}`;
171
- const f = document.createElement("span");
172
- return f.textContent = `${t.max}${t.unit ?? ""}`, h.appendChild(m), h.appendChild(f), i.appendChild(n), i.appendChild(r), i.appendChild(h), queueMicrotask(() => e.onChange(Number(r.value))), {
190
+ return m.textContent = `${t.max}${t.unit ?? ""}`, q.appendChild(p), q.appendChild(m), i.appendChild(a), i.appendChild(r), i.appendChild(q), queueMicrotask(() => e.onChange(Number(r.value))), {
173
191
  element: i,
174
192
  focus: () => r.focus(),
175
193
  getValue: () => Number(r.value),
176
- isValid: () => !0
194
+ isValid: () => !0,
195
+ ...b(r)
177
196
  };
178
197
  }
179
- function $(t, e) {
198
+ function W(t, e) {
180
199
  const i = document.createElement("input");
181
- return i.className = "qaid-q-input", i.type = "date", t.min && (i.min = t.min), t.max && (i.max = t.max), typeof e.initialValue == "string" && (i.value = e.initialValue), i.setAttribute("aria-label", t.label), i.addEventListener("input", () => {
200
+ return i.className = "qaid-q-input", i.type = "date", t.min && (i.min = t.min), t.max && (i.max = t.max), typeof e.initialValue == "string" && (i.value = e.initialValue), i.setAttribute("aria-label", t.label), t.required && i.setAttribute("aria-required", "true"), i.addEventListener("input", () => {
182
201
  e.onChange(i.value || null);
183
- }), i.addEventListener("keydown", (n) => {
184
- n.key === "Enter" && !n.isComposing && (n.preventDefault(), e.onSubmit());
202
+ }), i.addEventListener("keydown", (a) => {
203
+ a.key === "Enter" && !a.isComposing && (a.preventDefault(), e.onSubmit());
185
204
  }), {
186
205
  element: i,
187
206
  focus: () => i.focus(),
188
207
  getValue: () => i.value || null,
189
- isValid: () => t.required ? i.value !== "" : !0
208
+ isValid: () => t.required ? i.value !== "" : !0,
209
+ ...b(i)
190
210
  };
191
211
  }
192
- function M(t, e) {
193
- const i = document.createElement("div"), n = t.imageAlignment ?? "horizontal", o = t.options.some((s) => !!s.image) ? n === "vertical" ? " qaid-q-options--image-vertical" : " qaid-q-options--image-horizontal" : "";
194
- i.className = `qaid-q-options${o}`, i.setAttribute("role", t.multiple ? "group" : "radiogroup"), i.setAttribute("aria-label", t.label);
212
+ function _(t, e) {
213
+ const i = document.createElement("div"), a = t.imageAlignment ?? "horizontal", o = t.options.some((s) => !!s.image) ? a === "vertical" ? " qaid-q-options--image-vertical" : " qaid-q-options--image-horizontal" : "";
214
+ i.className = `qaid-q-options${o}`, i.setAttribute("role", t.multiple ? "group" : "radiogroup"), i.setAttribute("aria-label", t.label), t.required && i.setAttribute("aria-required", "true");
195
215
  const r = /* @__PURE__ */ new Set();
196
216
  if (t.multiple && Array.isArray(e.initialValue))
197
217
  for (const s of e.initialValue) r.add(s);
198
218
  else !t.multiple && typeof e.initialValue == "string" && r.add(e.initialValue);
199
- const q = [];
200
- t.options.forEach((s, c) => {
219
+ const c = [];
220
+ t.options.forEach((s, u) => {
201
221
  const d = document.createElement("button");
202
222
  d.type = "button", d.className = `qaid-q-option${t.multiple ? " qaid-q-multi" : ""}`, d.dataset.value = s.value, d.setAttribute("role", t.multiple ? "checkbox" : "radio"), d.setAttribute("aria-checked", r.has(s.value) ? "true" : "false"), r.has(s.value) && d.classList.add("qaid-q-selected");
203
- const p = document.createElement("span");
204
- p.className = "qaid-q-option-marker", p.setAttribute("aria-hidden", "true");
223
+ const f = document.createElement("span");
224
+ f.className = "qaid-q-option-marker", f.setAttribute("aria-hidden", "true");
205
225
  const g = document.createElement("span");
206
226
  if (g.className = "qaid-q-option-body", s.image) {
207
227
  const l = document.createElement("img");
208
228
  l.className = "qaid-q-option-image", l.src = s.image, l.alt = "", l.loading = "lazy", l.decoding = "async", g.appendChild(l);
209
229
  }
210
- const u = document.createElement("span");
211
- if (u.className = "qaid-q-option-label", u.textContent = s.label, g.appendChild(u), s.description) {
230
+ const h = document.createElement("span");
231
+ if (h.className = "qaid-q-option-label", h.textContent = s.label, g.appendChild(h), s.description) {
212
232
  const l = document.createElement("span");
213
233
  l.className = "qaid-q-option-desc", l.textContent = s.description, g.appendChild(l);
214
234
  }
215
- if (d.appendChild(p), d.appendChild(g), c < 9) {
235
+ if (d.appendChild(f), d.appendChild(g), u < 9) {
216
236
  const l = document.createElement("span");
217
- l.className = "qaid-q-option-key", l.textContent = String(c + 1), l.setAttribute("aria-hidden", "true"), d.appendChild(l);
237
+ l.className = "qaid-q-option-key", l.textContent = String(u + 1), l.setAttribute("aria-hidden", "true"), d.appendChild(l);
218
238
  }
219
- d.addEventListener("click", () => m(c)), d.addEventListener("keydown", (l) => {
239
+ d.addEventListener("click", () => p(u)), d.addEventListener("keydown", (l) => {
220
240
  if (l.key === "ArrowDown" || l.key === "ArrowRight") {
221
- l.preventDefault(), h((c + 1) % q.length);
241
+ l.preventDefault(), q((u + 1) % c.length);
222
242
  return;
223
243
  }
224
244
  if (l.key === "ArrowUp" || l.key === "ArrowLeft") {
225
- l.preventDefault(), h((c - 1 + q.length) % q.length);
245
+ l.preventDefault(), q((u - 1 + c.length) % c.length);
226
246
  return;
227
247
  }
228
248
  !t.multiple && l.key === "Enter" && r.size > 0 && (l.preventDefault(), e.onSubmit());
229
- }), q.push(d), i.appendChild(d);
249
+ }), c.push(d), i.appendChild(d);
230
250
  }), i.addEventListener("keydown", (s) => {
231
- const c = s.key;
232
- if (c.length === 1 && c >= "1" && c <= "9") {
233
- const d = parseInt(c, 10) - 1;
234
- d < q.length && (s.preventDefault(), m(d), h(d));
251
+ const u = s.key;
252
+ if (u.length === 1 && u >= "1" && u <= "9") {
253
+ const d = parseInt(u, 10) - 1;
254
+ d < c.length && (s.preventDefault(), p(d), q(d));
235
255
  }
236
256
  });
237
- function h(s) {
238
- q[s]?.focus();
257
+ function q(s) {
258
+ c[s]?.focus();
239
259
  }
240
- function m(s) {
241
- const c = t.options[s].value;
242
- t.multiple ? r.has(c) ? r.delete(c) : r.add(c) : (r.clear(), r.add(c)), q.forEach((d) => {
243
- const p = d.dataset.value, g = r.has(p);
260
+ function p(s) {
261
+ const u = t.options[s].value;
262
+ t.multiple ? r.has(u) ? r.delete(u) : r.add(u) : (r.clear(), r.add(u)), c.forEach((d) => {
263
+ const f = d.dataset.value, g = r.has(f);
244
264
  d.classList.toggle("qaid-q-selected", g), d.setAttribute("aria-checked", g ? "true" : "false");
245
- }), e.onChange(f()), !t.multiple && e.autoAdvance && setTimeout(() => e.onAutoAdvance(), 180);
265
+ }), e.onChange(m()), !t.multiple && e.autoAdvance && setTimeout(() => e.onAutoAdvance(), 180);
246
266
  }
247
- function f() {
267
+ function m() {
248
268
  if (t.multiple) return Array.from(r);
249
269
  const s = r.values().next();
250
270
  return s.done ? null : s.value;
@@ -252,45 +272,158 @@ function M(t, e) {
252
272
  return {
253
273
  element: i,
254
274
  focus: () => {
255
- (q.find((c) => c.classList.contains("qaid-q-selected")) ?? q[0])?.focus();
275
+ (c.find((u) => u.classList.contains("qaid-q-selected")) ?? c[0])?.focus();
256
276
  },
257
- getValue: () => f(),
258
- isValid: () => t.required ? r.size > 0 : !0
277
+ getValue: () => m(),
278
+ isValid: () => t.required ? r.size > 0 : !0,
279
+ ...b(i)
259
280
  };
260
281
  }
261
- function K(t, e) {
282
+ function G(t, e) {
262
283
  return t.questions.filter(
263
- (i) => i.visibleIf ? v(i.visibleIf, e) : !0
284
+ (i) => i.visibleIf ? x(i.visibleIf, e) : !0
264
285
  );
265
286
  }
266
- function v(t, e) {
287
+ function x(t, e) {
267
288
  if ("allOf" in t) {
268
- for (const a of t.allOf)
269
- if (!v(a, e)) return !1;
289
+ for (const n of t.allOf)
290
+ if (!x(n, e)) return !1;
270
291
  return !0;
271
292
  }
272
293
  if ("anyOf" in t) {
273
- for (const a of t.anyOf)
274
- if (v(a, e)) return !0;
294
+ for (const n of t.anyOf)
295
+ if (x(n, e)) return !0;
275
296
  return !1;
276
297
  }
277
- const i = e[t.questionId], n = i != null && !(typeof i == "string" && i.trim() === "") && !(Array.isArray(i) && i.length === 0);
278
- return "answered" in t ? t.answered ? n : !n : n ? "equals" in t ? b(i, t.equals) : "notEquals" in t ? !b(i, t.notEquals) : "in" in t ? t.in.some((a) => b(i, a)) : !1 : !1;
298
+ const i = e[t.questionId], a = i != null && !(typeof i == "string" && i.trim() === "") && !(Array.isArray(i) && i.length === 0);
299
+ return "answered" in t ? t.answered ? a : !a : a ? "equals" in t ? y(i, t.equals) : "notEquals" in t ? !y(i, t.notEquals) : "in" in t ? t.in.some((n) => y(i, n)) : !1 : !1;
279
300
  }
280
- function b(t, e) {
301
+ function y(t, e) {
281
302
  return Array.isArray(t) ? t.some((i) => i === e) : t === e;
282
303
  }
283
- const E = "qaid_visitor_id";
284
- function B() {
304
+ const k = "data-qaid-a11y-live", J = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;", X = [
305
+ "a[href]",
306
+ "button",
307
+ "input",
308
+ "textarea",
309
+ "select",
310
+ "[tabindex]"
311
+ ].join(",");
312
+ function Z(t) {
313
+ return t.ownerDocument || document;
314
+ }
315
+ function ee(t, e) {
316
+ const i = e ? "assertive" : "polite", a = t.querySelector(
317
+ `[${k}="${i}"]`
318
+ );
319
+ if (a) return a;
320
+ const o = Z(t).createElement("div");
321
+ return o.setAttribute(k, i), o.setAttribute("role", e ? "alert" : "status"), o.setAttribute("aria-live", e ? "assertive" : "polite"), o.setAttribute("aria-atomic", "true"), o.style.cssText = J, t.appendChild(o), o;
322
+ }
323
+ function v(t, e, i = {}) {
324
+ const a = ee(t, !!i.assertive);
325
+ a.textContent = "", a.textContent = e;
326
+ }
327
+ function te(t) {
328
+ return t.hasAttribute("disabled") ? !0 : t.disabled === !0;
329
+ }
330
+ function ie(t) {
331
+ let e = t;
332
+ for (; e; ) {
333
+ if (e.hasAttribute("hidden")) return !0;
334
+ const i = e.style;
335
+ if (i && (i.display === "none" || i.visibility === "hidden" || i.visibility === "collapse"))
336
+ return !0;
337
+ e = e.parentElement;
338
+ }
339
+ return !1;
340
+ }
341
+ function C(t) {
342
+ return Array.from(
343
+ t.querySelectorAll(X)
344
+ ).filter((i) => !(i.getAttribute("tabindex") === "-1" || i instanceof HTMLInputElement && i.type === "hidden" || i instanceof HTMLAnchorElement && !i.getAttribute("href") || te(i) || ie(i)));
345
+ }
346
+ function S(t) {
347
+ let e = t.activeElement;
348
+ for (; e && e.shadowRoot && e.shadowRoot.activeElement; )
349
+ e = e.shadowRoot.activeElement;
350
+ return e instanceof HTMLElement ? e : null;
351
+ }
352
+ function ae(t) {
353
+ const e = t.ownerDocument || document;
354
+ let i = !1;
355
+ const a = (o) => {
356
+ if (o.key !== "Tab") return;
357
+ const r = C(t);
358
+ if (r.length === 0) {
359
+ o.preventDefault(), t.focus();
360
+ return;
361
+ }
362
+ const c = r[0], q = r[r.length - 1], p = S(e), m = p ? r.indexOf(p) !== -1 : !1;
363
+ o.shiftKey ? (!m || p === c) && (o.preventDefault(), q.focus()) : (!m || p === q) && (o.preventDefault(), c.focus());
364
+ };
365
+ t.addEventListener("keydown", a);
366
+ const n = C(t);
367
+ return n.length > 0 ? n[0].focus() : (t.hasAttribute("tabindex") || (t.setAttribute("tabindex", "-1"), i = !0), t.focus()), {
368
+ release() {
369
+ t.removeEventListener("keydown", a), i && (t.removeAttribute("tabindex"), i = !1);
370
+ }
371
+ };
372
+ }
373
+ function ne() {
374
+ return S(document);
375
+ }
376
+ function re(t) {
377
+ if (!(!t || typeof t.focus != "function"))
378
+ try {
379
+ t.focus();
380
+ } catch {
381
+ }
382
+ }
383
+ function oe(t, e = {}) {
384
+ t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "true"), e.labelledbyId && t.setAttribute("aria-labelledby", e.labelledbyId), e.describedbyId && t.setAttribute("aria-describedby", e.describedbyId), e.label && t.setAttribute("aria-label", e.label);
385
+ }
386
+ function se(t, e) {
387
+ let i = t;
388
+ for (; i && i !== e; ) {
389
+ const a = i.parentNode;
390
+ if (a === e) return i;
391
+ if (a && a.host) {
392
+ i = a.host;
393
+ continue;
394
+ }
395
+ if (!a) return null;
396
+ i = a;
397
+ }
398
+ return null;
399
+ }
400
+ function de(t) {
401
+ const i = (t.ownerDocument || document).body;
402
+ if (!i) return () => {
403
+ };
404
+ const a = se(t, i), n = [];
405
+ return Array.from(i.children).forEach((o) => {
406
+ if (!(o instanceof HTMLElement) || a && o === a) return;
407
+ const r = o.inert === !0, c = o.getAttribute("aria-hidden");
408
+ r && c === "true" || (o.inert = !0, o.setAttribute("aria-hidden", "true"), n.push({ el: o, prevInert: r, prevAriaHidden: c }));
409
+ }), function() {
410
+ for (; n.length; ) {
411
+ const r = n.pop();
412
+ r && (r.el.inert = r.prevInert, r.prevAriaHidden === null ? r.el.removeAttribute("aria-hidden") : r.el.setAttribute("aria-hidden", r.prevAriaHidden));
413
+ }
414
+ };
415
+ }
416
+ const A = "qaid_visitor_id";
417
+ function le() {
285
418
  try {
286
- let t = localStorage.getItem(E);
287
- return t || (t = crypto.randomUUID(), localStorage.setItem(E, t)), t;
419
+ let t = localStorage.getItem(A);
420
+ return t || (t = crypto.randomUUID(), localStorage.setItem(A, t)), t;
288
421
  } catch {
289
422
  return crypto.randomUUID();
290
423
  }
291
424
  }
292
- const W = '<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>', Y = '<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12l4 4L19 7" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg>';
293
- class G {
425
+ const ce = '<svg width="14" height="14" viewBox="0 0 14 14" aria-hidden="true"><path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>', ue = '<svg width="24" height="24" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12l4 4L19 7" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/></svg>';
426
+ class he {
294
427
  config;
295
428
  questionnaire = null;
296
429
  inlineQuestionnaire;
@@ -335,6 +468,11 @@ class G {
335
468
  backdropEl = null;
336
469
  currentInput = null;
337
470
  boundKeyDown;
471
+ // Modal-mode a11y plumbing (never set in inline/container mode, which
472
+ // keeps normal page tab flow and never traps or restores focus).
473
+ savedOpener = null;
474
+ focusTrap = null;
475
+ inertRestore = null;
338
476
  cssVars = {};
339
477
  // Track which theme-related fields the host explicitly set so the
340
478
  // theme document can fill the rest. A `themeUrl` / `themeDocument`
@@ -393,10 +531,10 @@ class G {
393
531
  backdropOpacity: e.backdropOpacity,
394
532
  fontFamily: e.fontFamily,
395
533
  fontSize: e.fontSize
396
- }, this.themeUrl = e.themeUrl, this.themeDocument = e.themeDocument, this.hostCss = e.css ?? "", this.inlineQuestionnaire = e.questionnaire, this.configUrl = e.configUrl, this.visitorId = B(), this.boundKeyDown = this.handleKeyDown.bind(this), this.init();
534
+ }, this.themeUrl = e.themeUrl, this.themeDocument = e.themeDocument, this.hostCss = e.css ?? "", this.inlineQuestionnaire = e.questionnaire, this.configUrl = e.configUrl, this.visitorId = le(), this.boundKeyDown = this.handleKeyDown.bind(this), this.init();
397
535
  }
398
536
  async init() {
399
- this.cssVars = V(this.hostInlineVars), this.mountShell(), this.renderLoading();
537
+ this.cssVars = P(this.hostInlineVars), this.mountShell(), this.renderLoading();
400
538
  try {
401
539
  const [e, i] = await Promise.all([
402
540
  this.loadQuestionnaire(),
@@ -405,12 +543,12 @@ class G {
405
543
  if (!e || !e.questions || e.questions.length === 0)
406
544
  throw new Error("Questionnaire is empty");
407
545
  if (this.questionnaire = e, this.applyResolvedTheme(i), this.recomputeVisible(), this.pendingGoToStep) {
408
- const n = this.visibleQuestions.findIndex(
409
- (a) => a.id === this.pendingGoToStep
546
+ const a = this.visibleQuestions.findIndex(
547
+ (n) => n.id === this.pendingGoToStep
410
548
  );
411
- n !== -1 && (this.stepIndex = n), this.pendingGoToStep = null;
549
+ a !== -1 && (this.stepIndex = a), this.pendingGoToStep = null;
412
550
  }
413
- this.createResponse(), this.state = "READY", this.renderHeader(), this.renderStep();
551
+ this.createResponse(), this.state = "READY", this.renderHeader(), this.renderStep(), this.setupModalA11y();
414
552
  } catch (e) {
415
553
  this.state = "ERROR", this.renderError(e);
416
554
  }
@@ -446,24 +584,24 @@ class G {
446
584
  */
447
585
  applyResolvedTheme(e) {
448
586
  if (!this.shadowRoot || !this.rootEl) return;
449
- const i = this.hostThemeOverrides.preset ? this.config.preset : e?.preset ?? this.config.preset, n = this.hostThemeOverrides.mode ? this.config.theme : e?.mode ?? this.config.theme, a = this.hostThemeOverrides.unstyled ? this.config.unstyled : e?.unstyled ?? this.config.unstyled;
587
+ const i = this.hostThemeOverrides.preset ? this.config.preset : e?.preset ?? this.config.preset, a = this.hostThemeOverrides.mode ? this.config.theme : e?.mode ?? this.config.theme, n = this.hostThemeOverrides.unstyled ? this.config.unstyled : e?.unstyled ?? this.config.unstyled;
450
588
  this.rootEl.classList.toggle(
451
589
  "qaid-q-theme-light",
452
- n === "light"
590
+ a === "light"
453
591
  ), this.rootEl.classList.toggle(
454
592
  "qaid-q-theme-dark",
455
- n === "dark"
456
- ), this.rootEl.classList.toggle("qaid-q-unstyled", !!a);
593
+ a === "dark"
594
+ ), this.rootEl.classList.toggle("qaid-q-unstyled", !!n);
457
595
  const o = [];
458
596
  if (e?.tokens && Object.keys(e.tokens).length > 0) {
459
- const r = Object.entries(e.tokens).filter(([, q]) => typeof q == "string" && q.trim() !== "").map(([q, h]) => ` ${q}: ${h};`).join(`
597
+ const r = Object.entries(e.tokens).filter(([, c]) => typeof c == "string" && c.trim() !== "").map(([c, q]) => ` ${c}: ${q};`).join(`
460
598
  `);
461
599
  r && o.push(`:where(.qaid-q-root) {
462
600
  ${r}
463
601
  }`);
464
602
  }
465
603
  if (i && i !== "default") {
466
- const r = O(i);
604
+ const r = $(i);
467
605
  r && o.push(r);
468
606
  }
469
607
  if (e?.css && e.css.trim() !== "" && o.push(e.css), this.hostCss && this.hostCss.trim() !== "" && o.push(this.hostCss), o.length > 0) {
@@ -493,34 +631,36 @@ ${r}
493
631
  mountShell() {
494
632
  this.shadowHost = document.createElement("div"), this.shadowHost.setAttribute("data-qaid-quests", "");
495
633
  const e = this.config.container ? document.querySelector(this.config.container) : null;
496
- e ? (this.shadowHost.style.display = "block", this.shadowHost.style.height = "100%", this.shadowHost.style.minHeight = "0", e.appendChild(this.shadowHost), this.isUserContainer = !0) : (this.shadowHost.style.position = "fixed", this.shadowHost.style.inset = "0", this.shadowHost.style.zIndex = String(this.config.zIndex), this.shadowHost.style.pointerEvents = "none", document.body.appendChild(this.shadowHost)), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
634
+ e ? (this.shadowHost.style.display = "block", this.shadowHost.style.height = "100%", this.shadowHost.style.minHeight = "0", e.appendChild(this.shadowHost), this.isUserContainer = !0) : (this.savedOpener = ne(), this.shadowHost.style.position = "fixed", this.shadowHost.style.inset = "0", this.shadowHost.style.zIndex = String(this.config.zIndex), this.shadowHost.style.pointerEvents = "none", document.body.appendChild(this.shadowHost)), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
497
635
  const i = document.createElement("style");
498
- if (i.textContent = D(), this.shadowRoot.appendChild(i), this.rootEl = document.createElement("div"), this.rootEl.className = [
636
+ if (i.textContent = U(), this.shadowRoot.appendChild(i), this.rootEl = document.createElement("div"), this.rootEl.className = [
499
637
  "qaid-q-root",
500
638
  this.isUserContainer ? "qaid-q-inline" : "",
501
639
  this.config.animate ? "" : "qaid-q-no-motion"
502
- ].filter(Boolean).join(" "), P(this.rootEl, this.cssVars), this.isUserContainer)
640
+ ].filter(Boolean).join(" "), j(this.rootEl, this.cssVars), this.isUserContainer)
503
641
  this.cardEl = document.createElement("div"), this.cardEl.className = "qaid-q-card", this.rootEl.appendChild(this.cardEl);
504
642
  else {
505
643
  this.backdropEl = document.createElement("div"), this.backdropEl.className = "qaid-q-backdrop", this.backdropEl.addEventListener("click", () => this.close()), this.rootEl.appendChild(this.backdropEl);
506
- const n = document.createElement("div");
507
- n.className = "qaid-q-modal", this.cardEl = document.createElement("div"), this.cardEl.className = "qaid-q-card", n.appendChild(this.cardEl), this.rootEl.appendChild(n);
644
+ const a = document.createElement("div");
645
+ a.className = "qaid-q-modal", this.cardEl = document.createElement("div"), this.cardEl.className = "qaid-q-card", a.appendChild(this.cardEl), this.rootEl.appendChild(a);
508
646
  }
509
- this.shadowRoot.appendChild(this.rootEl), !this.isUserContainer && this.shadowHost && (this.shadowHost.style.pointerEvents = "auto"), document.addEventListener("keydown", this.boundKeyDown);
647
+ this.shadowRoot.appendChild(this.rootEl), !this.isUserContainer && this.shadowHost && (this.shadowHost.style.pointerEvents = "auto"), !this.isUserContainer && this.cardEl && oe(this.cardEl), document.addEventListener("keydown", this.boundKeyDown);
510
648
  }
511
649
  renderLoading() {
512
650
  if (!this.cardEl) return;
513
651
  this.cardEl.replaceChildren();
514
652
  const e = document.createElement("p");
515
- e.className = "qaid-q-description", e.textContent = "Loading…", this.cardEl.appendChild(e);
653
+ e.className = "qaid-q-description", e.textContent = "Loading…", this.cardEl.appendChild(e), this.shadowRoot && v(this.shadowRoot, "Loading");
516
654
  }
517
655
  renderError(e) {
518
656
  if (!this.cardEl) return;
519
657
  this.cardEl.replaceChildren();
520
658
  const i = document.createElement("h3");
521
659
  i.className = "qaid-q-title", i.textContent = "Couldn't load form";
522
- const n = document.createElement("p");
523
- n.className = "qaid-q-description", n.textContent = e instanceof Error ? e.message : String(e), this.cardEl.appendChild(i), this.cardEl.appendChild(n);
660
+ const a = e instanceof Error ? e.message : String(e), n = document.createElement("p");
661
+ n.className = "qaid-q-description", n.textContent = a, this.cardEl.appendChild(i), this.cardEl.appendChild(n), this.shadowRoot && v(this.shadowRoot, `Couldn't load form. ${a}`, {
662
+ assertive: !0
663
+ });
524
664
  }
525
665
  effectiveProgressPosition() {
526
666
  return this.config.progressPosition ?? this.questionnaire?.progressPosition ?? "top";
@@ -528,28 +668,31 @@ ${r}
528
668
  renderHeader() {
529
669
  if (!this.cardEl || !this.questionnaire) return;
530
670
  this.cardEl.replaceChildren();
531
- const e = !!this.questionnaire.hideProgress || this.questionnaire.questions.length <= 1, i = !e && this.effectiveProgressPosition() === "bottom", n = !!this.questionnaire.hideTitle, a = !!this.questionnaire.title && !n, o = !!this.questionnaire.description && !n, r = !this.isUserContainer, q = r || !i && !e;
671
+ const e = !!this.questionnaire.hideProgress || this.questionnaire.questions.length <= 1, i = !e && this.effectiveProgressPosition() === "bottom", a = !!this.questionnaire.hideTitle, n = !!this.questionnaire.title && !a, o = !!this.questionnaire.description && !a, r = !this.isUserContainer, c = r || !i && !e;
532
672
  this.savingEl = document.createElement("div"), this.savingEl.className = "qaid-q-saving";
533
- const h = document.createElement("span");
534
- h.className = "qaid-q-saving-dot";
535
- const m = document.createElement("span");
536
- m.textContent = "Saving…", this.savingEl.appendChild(h), this.savingEl.appendChild(m), this.stepCounterEl = document.createElement("div"), this.stepCounterEl.className = "qaid-q-step-counter", this.progressEl = document.createElement("div"), this.progressEl.className = i ? "qaid-q-progress qaid-q-progress--inline" : "qaid-q-progress", this.progressFillEl = document.createElement("div"), this.progressFillEl.className = "qaid-q-progress-fill", this.progressEl.appendChild(this.progressFillEl);
537
- const f = a || q;
538
- if (f) {
673
+ const q = document.createElement("span");
674
+ q.className = "qaid-q-saving-dot";
675
+ const p = document.createElement("span");
676
+ p.textContent = "Saving…", this.savingEl.appendChild(q), this.savingEl.appendChild(p), this.stepCounterEl = document.createElement("div"), this.stepCounterEl.className = "qaid-q-step-counter", this.progressEl = document.createElement("div"), this.progressEl.className = i ? "qaid-q-progress qaid-q-progress--inline" : "qaid-q-progress", this.progressFillEl = document.createElement("div"), this.progressFillEl.className = "qaid-q-progress-fill", this.progressEl.appendChild(this.progressFillEl);
677
+ const m = n || c;
678
+ if (m) {
539
679
  const s = document.createElement("div");
540
680
  s.className = "qaid-q-header";
541
- const c = document.createElement("div");
542
- a && (this.titleEl = document.createElement("h2"), this.titleEl.className = "qaid-q-title", this.titleEl.textContent = this.questionnaire.title, c.appendChild(this.titleEl));
681
+ const u = document.createElement("div");
682
+ n && (this.titleEl = document.createElement("h2"), this.titleEl.className = "qaid-q-title", this.titleEl.textContent = this.questionnaire.title, u.appendChild(this.titleEl));
543
683
  const d = document.createElement("div");
544
684
  if (d.style.display = "flex", d.style.alignItems = "center", d.style.gap = "0.5rem", i || (d.appendChild(this.savingEl), e || d.appendChild(this.stepCounterEl)), r) {
545
- const p = document.createElement("button");
546
- p.type = "button", p.className = "qaid-q-close", p.setAttribute("aria-label", "Close form"), p.innerHTML = W, p.addEventListener("click", () => this.close()), d.appendChild(p);
685
+ const f = document.createElement("button");
686
+ f.type = "button", f.className = "qaid-q-close", f.setAttribute("aria-label", "Close form"), f.innerHTML = ce, f.addEventListener("click", () => this.close()), d.appendChild(f);
547
687
  }
548
- s.appendChild(c), s.appendChild(d), this.cardEl.appendChild(s);
688
+ s.appendChild(u), s.appendChild(d), this.cardEl.appendChild(s);
549
689
  }
550
- if (o) {
690
+ if (!this.isUserContainer && this.cardEl && (this.titleEl ? (this.titleEl.id = this.titleEl.id || "qaid-q-dialog-title", this.cardEl.setAttribute("aria-labelledby", this.titleEl.id), this.cardEl.removeAttribute("aria-label")) : (this.cardEl.removeAttribute("aria-labelledby"), this.cardEl.setAttribute(
691
+ "aria-label",
692
+ this.questionnaire.title ?? "Questionnaire"
693
+ ))), o) {
551
694
  const s = document.createElement("p");
552
- s.className = "qaid-q-description", s.textContent = this.questionnaire.description, s.style.marginTop = f ? "-0.5rem" : "0", s.style.marginBottom = "0.75rem", this.cardEl.appendChild(s);
695
+ s.className = "qaid-q-description", s.textContent = this.questionnaire.description, s.style.marginTop = m ? "-0.5rem" : "0", s.style.marginBottom = "0.75rem", this.cardEl.appendChild(s);
553
696
  }
554
697
  !i && !e && this.cardEl.appendChild(this.progressEl), this.bodyEl = document.createElement("div"), this.bodyEl.className = "qaid-q-body", this.cardEl.appendChild(this.bodyEl), this.footerEl = document.createElement("div"), this.footerEl.className = "qaid-q-footer", this.cardEl.appendChild(this.footerEl);
555
698
  }
@@ -564,50 +707,54 @@ ${r}
564
707
  return;
565
708
  }
566
709
  this.stepIndex >= e && (this.stepIndex = e - 1);
567
- const i = this.stepIndex, n = this.visibleQuestions[i];
710
+ const i = this.stepIndex, a = this.visibleQuestions[i];
568
711
  if (this.stepCounterEl && (this.stepCounterEl.textContent = `${i + 1} / ${e}`), this.progressFillEl) {
569
- const u = (i + 1) / e * 100;
570
- this.progressFillEl.style.width = `${u}%`;
712
+ const h = (i + 1) / e * 100;
713
+ this.progressFillEl.style.width = `${h}%`;
571
714
  }
572
- const a = document.createElement("div");
573
- a.className = "qaid-q-step", a.setAttribute("role", "group"), a.setAttribute("aria-labelledby", `qaid-q-label-${i}`);
715
+ this.progressEl && (this.progressEl.setAttribute("role", "progressbar"), this.progressEl.setAttribute("aria-label", "Progress"), this.progressEl.setAttribute("aria-valuemin", "0"), this.progressEl.setAttribute("aria-valuemax", String(e)), this.progressEl.setAttribute("aria-valuenow", String(i + 1)), this.progressEl.setAttribute(
716
+ "aria-valuetext",
717
+ `Question ${i + 1} of ${e}`
718
+ )), this.shadowRoot && e > 1 && v(this.shadowRoot, `Step ${i + 1} of ${e}`);
719
+ const n = document.createElement("div");
720
+ n.className = "qaid-q-step", n.setAttribute("role", "group"), n.setAttribute("aria-labelledby", `qaid-q-label-${i}`);
574
721
  const o = document.createElement("label");
575
- if (o.id = `qaid-q-label-${i}`, o.className = "qaid-q-label", o.textContent = n.label, n.required) {
576
- const u = document.createElement("span");
577
- u.className = "qaid-q-required", u.textContent = "*", u.setAttribute("aria-label", "required"), o.appendChild(u);
722
+ if (o.id = `qaid-q-label-${i}`, o.className = "qaid-q-label", o.textContent = a.label, a.required) {
723
+ const h = document.createElement("span");
724
+ h.className = "qaid-q-required", h.textContent = "*", h.setAttribute("aria-label", "required"), o.appendChild(h);
578
725
  }
579
- if (a.appendChild(o), n.description) {
580
- const u = document.createElement("p");
581
- u.className = "qaid-q-description", u.textContent = n.description, a.appendChild(u);
726
+ if (n.appendChild(o), a.description) {
727
+ const h = document.createElement("p");
728
+ h.className = "qaid-q-description", h.textContent = a.description, n.appendChild(h);
582
729
  }
583
730
  const r = document.createElement("p");
584
- r.className = "qaid-q-error", r.setAttribute("aria-live", "polite");
585
- const q = this.answers[n.id] ?? null, h = i === e - 1, m = H({
586
- question: n,
587
- initialValue: q,
588
- onChange: (u) => {
589
- this.handleAnswerChange(n, u), r.textContent && (r.textContent = "");
731
+ r.className = "qaid-q-error", r.id = `qaid-q-error-${i}`, r.setAttribute("aria-live", "polite");
732
+ const c = this.answers[a.id] ?? null, q = i === e - 1, p = F({
733
+ question: a,
734
+ initialValue: c,
735
+ onChange: (h) => {
736
+ this.handleAnswerChange(a, h), r.textContent && (r.textContent = "", this.currentInput?.clearInvalid());
590
737
  },
591
- onSubmit: () => this.advance(n, r),
592
- onAutoAdvance: () => this.advance(n, r),
738
+ onSubmit: () => this.advance(a, r),
739
+ onAutoAdvance: () => this.advance(a, r),
593
740
  autoAdvance: this.config.autoAdvance
594
741
  });
595
- this.currentInput = m, a.appendChild(m.element), a.appendChild(r), this.bodyEl.replaceChildren(a), this.footerEl.replaceChildren();
596
- const s = !(!!this.questionnaire.hideProgress || this.questionnaire.questions.length <= 1) && this.effectiveProgressPosition() === "bottom", c = i > 0 ? (() => {
597
- const u = document.createElement("button");
598
- return u.type = "button", u.className = "qaid-q-btn qaid-q-btn-secondary", u.textContent = this.questionnaire.backLabel ?? "Back", u.addEventListener("click", () => this.back()), u;
742
+ this.currentInput = p, n.appendChild(p.element), n.appendChild(r), this.bodyEl.replaceChildren(n), this.footerEl.replaceChildren();
743
+ const s = !(!!this.questionnaire.hideProgress || this.questionnaire.questions.length <= 1) && this.effectiveProgressPosition() === "bottom", u = i > 0 ? (() => {
744
+ const h = document.createElement("button");
745
+ return h.type = "button", h.className = "qaid-q-btn qaid-q-btn-secondary", h.textContent = this.questionnaire.backLabel ?? "Back", h.addEventListener("click", () => this.back()), h;
599
746
  })() : null, d = document.createElement("button");
600
- if (d.type = "button", d.className = "qaid-q-btn qaid-q-btn-primary", d.textContent = h ? this.questionnaire.submitLabel ?? "Submit" : this.questionnaire.nextLabel ?? "Next", d.addEventListener("click", () => this.advance(n, r)), s)
601
- this.footerEl.classList.add("qaid-q-footer--inline-progress"), c && this.footerEl.appendChild(c), this.progressEl && this.footerEl.appendChild(this.progressEl), this.savingEl && this.footerEl.appendChild(this.savingEl), this.stepCounterEl && this.footerEl.appendChild(this.stepCounterEl), this.footerEl.appendChild(d);
747
+ if (d.type = "button", d.className = "qaid-q-btn qaid-q-btn-primary", d.textContent = q ? this.questionnaire.submitLabel ?? "Submit" : this.questionnaire.nextLabel ?? "Next", d.addEventListener("click", () => this.advance(a, r)), s)
748
+ this.footerEl.classList.add("qaid-q-footer--inline-progress"), u && this.footerEl.appendChild(u), this.progressEl && this.footerEl.appendChild(this.progressEl), this.savingEl && this.footerEl.appendChild(this.savingEl), this.stepCounterEl && this.footerEl.appendChild(this.stepCounterEl), this.footerEl.appendChild(d);
602
749
  else {
603
750
  this.footerEl.classList.remove("qaid-q-footer--inline-progress");
604
- const u = document.createElement("div");
605
- u.className = "qaid-q-footer-left";
751
+ const h = document.createElement("div");
752
+ h.className = "qaid-q-footer-left";
606
753
  const l = document.createElement("div");
607
- l.className = "qaid-q-footer-right", c && u.appendChild(c), l.appendChild(d), this.footerEl.appendChild(u), this.footerEl.appendChild(l);
754
+ l.className = "qaid-q-footer-right", u && h.appendChild(u), l.appendChild(d), this.footerEl.appendChild(h), this.footerEl.appendChild(l);
608
755
  }
609
- const p = !this.hasRenderedStep;
610
- this.hasRenderedStep = !0, (!p || this.config.autoFocus) && requestAnimationFrame(() => m.focus());
756
+ const f = !this.hasRenderedStep;
757
+ this.hasRenderedStep = !0, (!f || this.config.autoFocus) && requestAnimationFrame(() => p.focus());
611
758
  }
612
759
  renderDone() {
613
760
  if (!this.cardEl || !this.questionnaire) return;
@@ -615,17 +762,22 @@ ${r}
615
762
  const e = document.createElement("div");
616
763
  e.className = "qaid-q-done";
617
764
  const i = document.createElement("div");
618
- i.className = "qaid-q-done-icon", i.innerHTML = Y, e.appendChild(i);
619
- const n = document.createElement("h3");
620
- if (n.className = "qaid-q-done-title", n.textContent = this.questionnaire.thankYouTitle ?? "Thank you!", e.appendChild(n), this.questionnaire.thankYouMessage) {
621
- const a = document.createElement("p");
622
- a.className = "qaid-q-done-message", a.textContent = this.questionnaire.thankYouMessage, e.appendChild(a);
765
+ i.className = "qaid-q-done-icon", i.innerHTML = ue, e.appendChild(i);
766
+ const a = document.createElement("h3");
767
+ a.className = "qaid-q-done-title";
768
+ const n = this.questionnaire.thankYouTitle ?? "Thank you!";
769
+ if (a.textContent = n, a.setAttribute("tabindex", "-1"), e.appendChild(a), this.questionnaire.thankYouMessage) {
770
+ const o = document.createElement("p");
771
+ o.className = "qaid-q-done-message", o.textContent = this.questionnaire.thankYouMessage, e.appendChild(o);
623
772
  }
624
773
  if (!this.isUserContainer) {
625
- const a = document.createElement("button");
626
- a.type = "button", a.className = "qaid-q-btn qaid-q-btn-primary", a.textContent = "Close", a.style.marginTop = "1rem", a.addEventListener("click", () => this.close()), e.appendChild(a);
774
+ const o = document.createElement("button");
775
+ o.type = "button", o.className = "qaid-q-btn qaid-q-btn-primary", o.textContent = "Close", o.style.marginTop = "1rem", o.addEventListener("click", () => this.close()), e.appendChild(o);
776
+ }
777
+ if (this.cardEl.appendChild(e), requestAnimationFrame(() => a.focus()), this.shadowRoot) {
778
+ const o = this.questionnaire.thankYouMessage ? `${n}. ${this.questionnaire.thankYouMessage}` : n;
779
+ v(this.shadowRoot, o);
627
780
  }
628
- this.cardEl.appendChild(e);
629
781
  }
630
782
  // ------------------------------------------------------------------
631
783
  // Navigation
@@ -633,7 +785,7 @@ ${r}
633
785
  advance(e, i) {
634
786
  if (!this.currentInput || !this.questionnaire) return;
635
787
  if (!this.currentInput.isValid()) {
636
- i.textContent = _(e), this.currentInput.focus();
788
+ i.textContent = qe(e), this.currentInput.setInvalid(i.id), this.currentInput.focus();
637
789
  return;
638
790
  }
639
791
  if (this.handleAnswerChange(e, this.currentInput.getValue(), { immediate: !0 }), this.stepIndex === this.visibleQuestions.length - 1) {
@@ -649,12 +801,12 @@ ${r}
649
801
  // Answer handling + autosave
650
802
  // ------------------------------------------------------------------
651
803
  recomputeVisible() {
652
- this.questionnaire && (this.visibleQuestions = K(this.questionnaire, this.answers));
804
+ this.questionnaire && (this.visibleQuestions = G(this.questionnaire, this.answers));
653
805
  }
654
- handleAnswerChange(e, i, n = {}) {
806
+ handleAnswerChange(e, i, a = {}) {
655
807
  this.answers[e.id] = i, this.recomputeVisible();
656
- const a = e.type === "text" || e.type === "currency" || e.type === "range";
657
- if (n.immediate || !a) {
808
+ const n = e.type === "text" || e.type === "currency" || e.type === "range";
809
+ if (a.immediate || !n) {
658
810
  this.flushPendingSave(), this.saveAnswer(e.id, i);
659
811
  return;
660
812
  }
@@ -674,9 +826,9 @@ ${r}
674
826
  });
675
827
  }
676
828
  async doSave(e, i) {
677
- let n = 0;
678
- for (; this.responseId === null && n < 5e3; )
679
- await new Promise((a) => setTimeout(a, 50)), n += 50;
829
+ let a = 0;
830
+ for (; this.responseId === null && a < 5e3; )
831
+ await new Promise((n) => setTimeout(n, 50)), a += 50;
680
832
  if (this.responseId !== null)
681
833
  try {
682
834
  await fetch(`${this.config.endpoint}/${this.responseId}`, {
@@ -684,8 +836,8 @@ ${r}
684
836
  headers: this.jsonHeaders(),
685
837
  body: JSON.stringify({ questionId: e, value: i })
686
838
  });
687
- } catch (a) {
688
- console.error("[quests-embed] failed to save answer:", a);
839
+ } catch (n) {
840
+ console.error("[quests-embed] failed to save answer:", n);
689
841
  }
690
842
  }
691
843
  async createResponse() {
@@ -740,12 +892,21 @@ ${r}
740
892
  handleKeyDown(e) {
741
893
  e.key === "Escape" && !this.isUserContainer && this.state !== "DONE" && this.close();
742
894
  }
895
+ /**
896
+ * Modal mode only: trap Tab within the card and mark the rest of the
897
+ * page inert while the dialog is open. Runs once (guarded) after the
898
+ * first step renders. Inline mode keeps normal page tab flow and is
899
+ * never trapped or isolated.
900
+ */
901
+ setupModalA11y() {
902
+ this.isUserContainer || !this.cardEl || this.focusTrap || (this.focusTrap = ae(this.cardEl), this.inertRestore = de(this.cardEl));
903
+ }
743
904
  close() {
744
905
  this.flushPendingSave(), this.destroy();
745
906
  }
746
907
  /** Destroy the embed and clean up all resources */
747
908
  destroy() {
748
- document.removeEventListener("keydown", this.boundKeyDown), this.pendingSaveTimer && (clearTimeout(this.pendingSaveTimer), this.pendingSaveTimer = null), this.shadowHost && (this.shadowHost.remove(), this.shadowHost = null, this.shadowRoot = null), this.rootEl = null, this.cardEl = null, this.bodyEl = null, this.footerEl = null, this.titleEl = null, this.stepCounterEl = null, this.progressFillEl = null, this.savingEl = null, this.backdropEl = null, this.currentInput = null;
909
+ document.removeEventListener("keydown", this.boundKeyDown), this.pendingSaveTimer && (clearTimeout(this.pendingSaveTimer), this.pendingSaveTimer = null), this.focusTrap && (this.focusTrap.release(), this.focusTrap = null), this.inertRestore && (this.inertRestore(), this.inertRestore = null), !this.isUserContainer && this.savedOpener && re(this.savedOpener), this.savedOpener = null, this.shadowHost && (this.shadowHost.remove(), this.shadowHost = null, this.shadowRoot = null), this.rootEl = null, this.cardEl = null, this.bodyEl = null, this.footerEl = null, this.titleEl = null, this.stepCounterEl = null, this.progressFillEl = null, this.savingEl = null, this.backdropEl = null, this.currentInput = null;
749
910
  }
750
911
  /** Read-only snapshot of current answers */
751
912
  getAnswers() {
@@ -774,11 +935,11 @@ ${r}
774
935
  goToStep(e) {
775
936
  if (this.state !== "READY" || !this.questionnaire)
776
937
  return this.pendingGoToStep = e, !1;
777
- const i = this.visibleQuestions.findIndex((n) => n.id === e);
938
+ const i = this.visibleQuestions.findIndex((a) => a.id === e);
778
939
  return i === -1 ? !1 : (i === this.stepIndex || (this.flushPendingSave(), this.stepIndex = i, this.renderStep()), !0);
779
940
  }
780
941
  }
781
- function _(t) {
942
+ function qe(t) {
782
943
  switch (t.type) {
783
944
  case "text":
784
945
  return t.minLength ? `Please enter at least ${t.minLength} characters.` : "This field is required.";
@@ -792,10 +953,10 @@ function _(t) {
792
953
  return "Please choose a value.";
793
954
  }
794
955
  }
795
- function w(t) {
956
+ function I(t) {
796
957
  return document.querySelector(t)?.textContent?.trim() ?? "";
797
958
  }
798
- function J() {
959
+ function pe() {
799
960
  const t = document.querySelector(
800
961
  'script[type="application/json"][data-quests-config]'
801
962
  );
@@ -804,49 +965,49 @@ function J() {
804
965
  if (!e) return null;
805
966
  try {
806
967
  const i = JSON.parse(e);
807
- return i.cssSelector && !i.css && (i.css = w(i.cssSelector), delete i.cssSelector), i;
968
+ return i.cssSelector && !i.css && (i.css = I(i.cssSelector), delete i.cssSelector), i;
808
969
  } catch {
809
970
  return null;
810
971
  }
811
972
  }
812
- function X(t) {
973
+ function fe(t) {
813
974
  const e = t.getAttribute("data-endpoint");
814
975
  if (!e) return null;
815
- const i = t.getAttribute("data-config-url"), n = t.getAttribute("data-api-key"), a = t.getAttribute("data-container"), o = t.getAttribute("data-zindex"), r = t.getAttribute("data-positive-color"), q = t.getAttribute("data-negative-color"), h = t.getAttribute("data-marker-color"), m = t.getAttribute("data-modal-width"), f = t.getAttribute("data-backdrop-opacity"), s = t.getAttribute("data-font-family"), c = t.getAttribute("data-font-size"), d = t.getAttribute("data-css-selector"), p = t.getAttribute("data-auto-advance"), g = t.getAttribute("data-save-debounce-ms"), u = t.getAttribute("data-theme-url"), l = t.getAttribute("data-preset"), y = t.getAttribute("data-theme"), k = t.getAttribute("data-unstyled");
976
+ const i = t.getAttribute("data-config-url"), a = t.getAttribute("data-api-key"), n = t.getAttribute("data-container"), o = t.getAttribute("data-zindex"), r = t.getAttribute("data-positive-color"), c = t.getAttribute("data-negative-color"), q = t.getAttribute("data-marker-color"), p = t.getAttribute("data-modal-width"), m = t.getAttribute("data-backdrop-opacity"), s = t.getAttribute("data-font-family"), u = t.getAttribute("data-font-size"), d = t.getAttribute("data-css-selector"), f = t.getAttribute("data-auto-advance"), g = t.getAttribute("data-save-debounce-ms"), h = t.getAttribute("data-theme-url"), l = t.getAttribute("data-preset"), E = t.getAttribute("data-theme"), N = t.getAttribute("data-unstyled");
816
977
  return {
817
978
  endpoint: e,
818
979
  configUrl: i ?? void 0,
819
- apiKey: n ?? void 0,
820
- container: a ?? void 0,
980
+ apiKey: a ?? void 0,
981
+ container: n ?? void 0,
821
982
  zIndex: o ? parseInt(o, 10) : void 0,
822
983
  colors: {
823
984
  positive: r ?? void 0,
824
- negative: q ?? void 0,
825
- marker: h ?? void 0
985
+ negative: c ?? void 0,
986
+ marker: q ?? void 0
826
987
  },
827
- modalWidth: m ? parseInt(m, 10) : void 0,
828
- backdropOpacity: f ? parseFloat(f) : void 0,
988
+ modalWidth: p ? parseInt(p, 10) : void 0,
989
+ backdropOpacity: m ? parseFloat(m) : void 0,
829
990
  fontFamily: s ?? void 0,
830
- fontSize: c ? parseInt(c, 10) : void 0,
831
- css: d ? w(d) : void 0,
832
- autoAdvance: p === "true" ? !0 : void 0,
991
+ fontSize: u ? parseInt(u, 10) : void 0,
992
+ css: d ? I(d) : void 0,
993
+ autoAdvance: f === "true" ? !0 : void 0,
833
994
  saveDebounceMs: g ? parseInt(g, 10) : void 0,
834
- themeUrl: u ?? void 0,
995
+ themeUrl: h ?? void 0,
835
996
  preset: l || void 0,
836
- theme: y || void 0,
837
- unstyled: k === "true" ? !0 : void 0
997
+ theme: E || void 0,
998
+ unstyled: N === "true" ? !0 : void 0
838
999
  };
839
1000
  }
840
1001
  if (typeof document < "u") {
841
1002
  const t = () => {
842
- const e = document.currentScript, i = J(), n = e ? X(e) : null, a = i ?? n;
843
- a?.endpoint && (a.configUrl || a.questionnaire) && new G(a);
1003
+ const e = document.currentScript, i = pe(), a = e ? fe(e) : null, n = i ?? a;
1004
+ n?.endpoint && (n.configUrl || n.questionnaire) && new he(n);
844
1005
  };
845
1006
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : t();
846
1007
  }
847
1008
  export {
848
- G as QaidQuests,
849
- v as evaluateRule,
850
- K as getVisibleQuestions
1009
+ he as QaidQuests,
1010
+ x as evaluateRule,
1011
+ G as getVisibleQuestions
851
1012
  };
852
1013
  //# sourceMappingURL=qaid-quests.js.map