makethisbetter 1.14.2 → 1.14.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/makethisbetter.cjs +13 -13
- package/dist/makethisbetter.cjs.map +1 -1
- package/dist/makethisbetter.esm.js +434 -397
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +12 -12
- package/dist/makethisbetter.js.map +1 -1
- package/dist/popup/comment.d.ts +1 -0
- package/dist/popup/comment.d.ts.map +1 -1
- package/dist/popup/keyboard-inset.d.ts +1 -0
- package/dist/popup/keyboard-inset.d.ts.map +1 -1
- package/dist/popup/replay-click-guard.d.ts +2 -0
- package/dist/popup/replay-click-guard.d.ts.map +1 -0
- package/dist/popup/replay-click-guard.test.d.ts +2 -0
- package/dist/popup/replay-click-guard.test.d.ts.map +1 -0
- package/dist/widget/controller.d.ts +8 -0
- package/dist/widget/controller.d.ts.map +1 -1
- package/dist/widget/dim-overlay.d.ts +2 -1
- package/dist/widget/dim-overlay.d.ts.map +1 -1
- package/dist/widget/pointer-kind.d.ts +12 -0
- package/dist/widget/pointer-kind.d.ts.map +1 -0
- package/dist/widget/scroll-lock.d.ts +14 -4
- package/dist/widget/scroll-lock.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/popup/comment.ts +10 -0
- package/src/popup/keyboard-inset.ts +30 -2
- package/src/popup/replay-click-guard.ts +29 -0
- package/src/widget/controller.ts +46 -1
- package/src/widget/dim-overlay.ts +21 -3
- package/src/widget/pointer-kind.ts +13 -0
- package/src/widget/scroll-lock.ts +20 -24
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const Xt = `*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;font-size:14px;line-height:1.5;color:#191a1c;-webkit-font-smoothing:antialiased}:host([data-mtb-theme="dark"]) .mtb-popup,:host([data-mtb-theme="dark"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-popup-title,:host([data-mtb-theme="dark"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-quick-option,:host([data-mtb-theme="dark"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-close,:host([data-mtb-theme="dark"]) .mtb-success-msg,:host([data-mtb-theme="dark"]) .mtb-close-link{color:#ffffffad}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-popup,:host([data-mtb-theme="auto"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-popup-title,:host([data-mtb-theme="auto"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-quick-option,:host([data-mtb-theme="auto"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-close,:host([data-mtb-theme="auto"]) .mtb-success-msg,:host([data-mtb-theme="auto"]) .mtb-close-link{color:#ffffffad}}.mtb-tab{--mtb-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Ccircle cx='12' cy='12' r='2.4' fill='%23000' stroke='none'/%3E%3Cpath d='M12 1.8v3.4M12 18.8v3.4M1.8 12h3.4M18.8 12h3.4'/%3E%3C/svg%3E");position:fixed;top:50%;right:0;transform:translateY(-50%);z-index:2147483646;display:flex;align-items:center;justify-content:center;width:32px;padding:14px 0;background:#059669;color:#fff;border-radius:8px 0 0 8px;cursor:pointer;box-shadow:-2px 0 14px #05966959;transition:background .15s,box-shadow .15s,width .15s;writing-mode:vertical-lr;text-orientation:mixed;font-size:12px;font-weight:600;letter-spacing:.04em;user-select:none;border:none;outline:none}.mtb-tab.left{right:auto;left:0;border-radius:0 8px 8px 0;box-shadow:2px 0 14px #05966959}.mtb-tab:hover{background:#047857;box-shadow:-3px 0 20px #05966973}.mtb-tab.active{background:#065f46}.mtb-hint-bar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;height:38px;padding:0 16px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbHintIn .2s ease;white-space:nowrap;transition:opacity .15s ease;pointer-events:none}.mtb-hint-bar--under-pointer{opacity:.3}@keyframes mtbHintIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar{position:fixed;top:50%;right:8px;transform:translateY(-50%);z-index:2147483647;display:flex;flex-direction:column;align-items:center;gap:6px;width:38px;padding:6px 0;max-height:calc(100vh - 24px);border-radius:19px;background:linear-gradient(160deg,#10b981,#059669);box-shadow:0 8px 22px #0f172a33;animation:mtbEdgeBarIn .2s ease;white-space:nowrap;pointer-events:none}.mtb-toolbar.left{right:auto;left:8px;animation:mtbEdgeBarInLeft .2s ease}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}@keyframes mtbEdgeBarIn{0%{transform:translate(12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}@keyframes mtbEdgeBarInLeft{0%{transform:translate(-12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}.mtb-toolbar-label{display:none}:host([data-mtb-toolbar]) .mtb-tab{display:none}.mtb-toolbar-modes{display:flex;align-items:center;gap:3px;background:#ffffff29;border-radius:9px;padding:3px}.mtb-toolbar-mode-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:7px;border:none;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;white-space:nowrap;background:transparent;color:#fffffff2;transition:all .12s}.mtb-toolbar-mode-btn.active{background:#fff;color:#047857}.mtb-toolbar-hint{font-size:12px;color:#fffffff2;white-space:nowrap}.mtb-toolbar-sep{width:20px;height:1px;align-self:center;background:#ffffff38}.mtb-exit-btn{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 12px;border-radius:8px;font-size:11.5px;font-weight:500;color:#fff;cursor:pointer;background:#ffffff29;border:none;font-family:inherit;transition:background .12s}.mtb-toolbar-modes{flex-direction:column;gap:6px;padding:0;background:none;border-radius:0}.mtb-toolbar-mode-btn,.mtb-exit-btn{pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:0;width:30px;height:30px;padding:0;border-radius:50%;background:none;color:#ffffffb8}.mtb-toolbar-mode-btn:hover,.mtb-exit-btn:hover{background:#ffffff29;color:#fff}.mtb-toolbar-mode-btn.active,.mtb-toolbar-mode-btn.active:hover{background:#fff;color:#047857}.mtb-exit-btn{color:#fff}.mtb-toolbar-sep{width:16px;height:1px;margin:1px 0;align-self:center;background:#ffffff47}.mtb-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair;touch-action:none}.mtb-dim{position:fixed;inset:0;z-index:2147483639;background:#00000014}.mtb-highlight{position:fixed;z-index:2147483641;pointer-events:none;border:2px solid #10b981;border-radius:6px;background:#10b9810f;transition:all .08s ease}.mtb-highlight.selected{border-color:#3b82f6;background:#3b82f60a}.mtb-highlight-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%,-100%);max-width:240px;overflow:hidden;text-overflow:ellipsis;background:#064e3b;color:#fff;padding:4px 10px;border-radius:6px;font-size:11px;font-weight:500;white-space:nowrap;box-shadow:0 4px 12px #0000002e;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-highlight-tooltip.below{transform:translate(-50%)}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-color:#064e3b}.mtb-highlight-tooltip.below:after{top:auto;bottom:100%;border-top-color:transparent;border-bottom-color:#064e3b}.mtb-draw-svg{position:fixed;inset:0;z-index:2147483643;pointer-events:none;width:100%;height:100%;overflow:visible}.mtb-pin{position:fixed;z-index:2147483644;pointer-events:none;width:22px;height:22px;border-radius:50% 50% 50% 2px;background:#059669;border:2px solid #fff;display:flex;align-items:center;justify-content:center;font-size:10px;color:#fff;font-weight:700;box-shadow:0 2px 8px #05966973;animation:mtbPinPop .25s cubic-bezier(.34,1.56,.64,1);transform:translate(-50%,-50%)}@keyframes mtbPinPop{0%{transform:translate(-50%,-50%) scale(.4)}to{transform:translate(-50%,-50%) scale(1)}}.mtb-popup{position:fixed;z-index:2147483645;display:flex;flex-direction:column;width:min(320px,calc(100vw - 56px));background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{flex-shrink:0;padding:11px 13px 11px 14px;border-bottom:1px solid rgba(0,0,0,.06);display:flex;align-items:center;gap:8px}.mtb-popup-icon{width:20px;height:20px;border-radius:5px;background:#10b9811a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-popup-title{flex:1;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#191a1c}.mtb-popup-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;align-items:center;border-radius:4px;transition:color .12s}.mtb-popup-close:hover{color:#000000b3}.mtb-popup-body{min-height:0;padding:13px;overflow-y:auto;overscroll-behavior:contain}.mtb-quick-options{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}.mtb-quick-option{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border:1px solid rgba(0,0,0,.09);border-radius:10px;background:#fafafa;cursor:pointer;font-family:inherit;font-size:13px;color:#191a1c;text-align:left;transition:all .12s}.mtb-quick-option:hover{background:#10b9810f;border-color:#10b9814d}.mtb-quick-option.selected{background:#10b9811a;border-color:#10b98180}.mtb-quick-option-emoji{font-size:15px;flex-shrink:0;line-height:1}.mtb-textarea-wrap{position:relative}.mtb-textarea{width:100%;height:64px;padding:9px 11px;border:1px solid rgba(0,0,0,.12);border-radius:10px;font-family:inherit;font-size:12.5px;line-height:1.5;color:#191a1c;outline:none;background:#fff;resize:none;transition:border-color .12s,box-shadow .12s}.mtb-textarea:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#dc2626;font-size:11.5px}.mtb-popup-error:empty,.mtb-popup-error[hidden]{display:none}.mtb-popup-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.mtb-cancel-btn,.mtb-submit-btn{min-width:72px;height:32px;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-cancel-btn{background:#f3f4f6;color:#000000ad}.mtb-cancel-btn:hover{background:#e5e7eb}.mtb-submit-btn{background:#d1d5db;color:#fff}.mtb-submit-btn.ready{background:#059669}.mtb-submit-btn.ready:hover{background:#047857}.mtb-submit-btn.loading{background:#059669;opacity:.7;cursor:wait}.mtb-submit-btn:disabled{cursor:not-allowed}.mtb-success{position:fixed;z-index:2147483645;width:332px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;padding:24px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-success-icon{width:46px;height:46px;border-radius:50%;background:#05966917;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:5px;letter-spacing:-.01em;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-view-feedback-link{display:inline-flex;align-items:center;gap:5px;color:#047857;text-decoration:none;font-size:13px;font-weight:500;font-family:JetBrains Mono,monospace;background:none;border:none;cursor:pointer;transition:text-decoration .12s}.mtb-view-feedback-link:hover{text-decoration:underline}.mtb-close-link{margin-top:13px;background:none;border:none;cursor:pointer;font-size:12px;color:#0006;font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:#000000b3}.mtb-email-capture{margin-bottom:14px;text-align:left}.mtb-email-prompt{font-size:12px;color:#0000008c;line-height:1.5;margin-bottom:8px}.mtb-email-row{display:flex;gap:6px}.mtb-email-input{flex:1;min-width:0;font-size:12.5px;font-family:inherit;padding:7px 10px;border:1px solid rgba(0,0,0,.14);border-radius:8px;outline:none}.mtb-email-input:focus{border-color:#059669}.mtb-email-input.mtb-email-invalid{border-color:#dc2626}.mtb-email-submit{font-size:12px;font-weight:600;font-family:inherit;color:#fff;background:#059669;border:none;border-radius:8px;padding:7px 12px;cursor:pointer;white-space:nowrap}.mtb-email-submit:disabled{opacity:.6;cursor:default}.mtb-email-error{font-size:11.5px;color:#dc2626;margin-top:6px}.mtb-email-saved{font-size:12px;color:#059669;line-height:1.5}.mtb-my-feedback{display:block;margin:8px auto 0;background:none;border:none;cursor:pointer;font-size:11.5px;font-family:inherit;color:#0006;text-decoration:underline;text-underline-offset:2px;transition:color .12s}.mtb-my-feedback:hover{color:#059669}.mtb-pet{position:fixed;bottom:20px;right:20px;z-index:2147483646;cursor:pointer;width:52px;height:52px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:transparent;animation:mtbPetBounce 3s ease-in-out infinite;transition:transform .2s;user-select:none;outline:none;filter:drop-shadow(0 4px 12px rgba(5,150,105,.35))}.mtb-pet:hover{transform:scale(1.12);animation-play-state:paused}.mtb-pet:hover .mtb-pet-bubble{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet.active{animation:none;opacity:.6}.mtb-pet-svg{display:block}@keyframes mtbPetBounce{0%,to{transform:translateY(0)}50%{transform:translateY(-6px)}}.mtb-pet-bubble{position:absolute;bottom:100%;left:50%;transform:translate(-50%) translateY(4px);margin-bottom:8px;background:#064e3b;color:#fff;padding:6px 12px;border-radius:8px;font-size:12px;font-weight:500;white-space:nowrap;box-shadow:0 4px 14px #0000002e;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}.mtb-pet-bubble.visible{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet-bubble.hidden{opacity:0;pointer-events:none}.mtb-pet-bubble:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:5px solid transparent;border-top-color:#064e3b}.mtb-frustration-prompt{position:fixed;bottom:20px;right:20px;z-index:2147483645;display:flex;align-items:center;gap:10px;padding:12px 16px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:12px;box-shadow:0 8px 30px #0000001f;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}:host([data-mtb-theme="dark"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}}.mtb-frustration-icon{width:32px;height:32px;border-radius:50%;background:#eab3081a;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:16px;line-height:1}.mtb-frustration-text{font-size:13px;font-weight:500;color:inherit;line-height:1.4}.mtb-frustration-actions{display:flex;gap:6px;flex-shrink:0}.mtb-frustration-tell{height:28px;padding:0 12px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-frustration-tell:hover{background:#047857}.mtb-frustration-dismiss{height:28px;padding:0 8px;border:none;border-radius:7px;background:transparent;color:#0006;cursor:pointer;font-family:inherit;font-size:12px;transition:color .12s}.mtb-frustration-dismiss:hover{color:#000000b3}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}}.mtb-record-bar{position:fixed;bottom:48px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:12px;height:42px;padding:0 8px 0 14px;border-radius:12px;background:#0f172aeb;box-shadow:0 8px 24px #00000040;animation:mtbBarIn .2s ease}.mtb-record-dot{width:8px;height:8px;border-radius:50%;background:#ef4444;animation:mtbRecordPulse 1.2s ease-in-out infinite;flex-shrink:0}@keyframes mtbRecordPulse{0%,to{opacity:1}50%{opacity:.3}}.mtb-record-timer{font-family:JetBrains Mono,SF Mono,Fira Code,Cascadia Code,monospace;font-size:13px;font-weight:500;color:#fff;font-variant-numeric:tabular-nums;letter-spacing:.02em;min-width:38px}.mtb-record-stop{height:28px;padding:0 14px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-record-stop:hover{background:#047857}.mtb-click-ripple{position:fixed;z-index:2147483644;width:24px;height:24px;border-radius:50%;border:2px solid #10b981;background:#10b98133;pointer-events:none;transform:translate(-50%,-50%) scale(.5);animation:mtbClickRipple .3s ease-out forwards}@keyframes mtbClickRipple{0%{transform:translate(-50%,-50%) scale(.5);opacity:1}to{transform:translate(-50%,-50%) scale(2);opacity:0}}.mtb-dot{display:inline-block;width:4px;height:4px;border-radius:50%;background:#fff;animation:mtbDot 1.2s infinite}.mtb-dot:nth-child(2){animation-delay:.2s}.mtb-dot:nth-child(3){animation-delay:.4s}@keyframes mtbDot{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}.mtb-clarify{position:fixed;z-index:2147483645;width:min(346px,calc(100vw - 56px));background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;display:flex;flex-direction:column;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;overflow:hidden}.mtb-clarify-continuation{width:min(320px,calc(100vw - 56px));animation:none}.mtb-clarify-header{padding:8px 10px;display:flex;align-items:center;gap:7px;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:20px;height:20px;border-radius:6px;background:linear-gradient(140deg,#10b981,#059669);box-shadow:0 1px 3px #05966966;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-clarify-titles{flex:1;min-width:0}.mtb-clarify-title{font-size:12px;font-weight:650;line-height:1.2;color:#191a1c}.mtb-clarify-subtitle{font-size:9.5px;color:#0000006b}.mtb-clarify-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;transition:color .12s}.mtb-clarify-close:hover{color:#000000b3}.mtb-clarify-messages{flex:1;overflow-y:auto;padding:8px 10px 4px;display:flex;flex-direction:column;gap:6px}.mtb-clarify-bubble{max-width:82%;padding:6px 10px;font-size:12px;line-height:1.4;white-space:pre-wrap;word-break:break-word}.mtb-clarify-ai{align-self:flex-start;background:#fff;color:#191a1c;border:1px solid rgba(0,0,0,.09);border-radius:11px 11px 11px 3px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border:1px solid #059669;border-radius:11px 11px 3px}.mtb-clarify-thinking{display:flex;align-items:center;gap:4px;padding:8px 12px}.mtb-clarify-thinking .mtb-dot{width:6px;height:6px;background:#059669b3}.mtb-clarify-footer{padding:3px 10px 10px;display:flex;flex-direction:column}.mtb-clarify-input{width:100%;height:40px;padding:7px 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:12px;line-height:1.4;color:#191a1c;outline:none;background:#fafafa;resize:none;box-sizing:border-box;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-clarify-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126;background:#fff}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-actions{display:flex;gap:6px;margin-top:6px}.mtb-clarify-skip,.mtb-clarify-fallback{flex:0 0 auto;height:30px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;color:#0000008c;white-space:nowrap;transition:background .12s}.mtb-clarify-skip:hover,.mtb-clarify-fallback:hover{background:#0000000a}.mtb-clarify-send,.mtb-clarify-retry{flex:1;height:30px;display:inline-flex;align-items:center;justify-content:center;gap:5px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-clarify-send:not(:disabled):hover,.mtb-clarify-retry:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled,.mtb-clarify-retry:disabled{background:#00000026;cursor:not-allowed}.mtb-clarify-send-feedback{width:100%;height:34px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:none;border-radius:9px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-clarify-send-feedback:not(:disabled):hover{background:#047857}.mtb-clarify-send-feedback:disabled{background:#00000026;cursor:not-allowed}.mtb-clarify-error{margin-bottom:8px;color:#dc2626;font-size:11.5px;line-height:1.4;text-align:center}:host([data-mtb-theme="dark"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-subtitle{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-close{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-close:hover{color:#ffffffbf}:host([data-mtb-theme="dark"]) .mtb-clarify-skip,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback:hover{background:#ffffff0f}:host([data-mtb-theme="dark"]) .mtb-clarify-ai{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-subtitle{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-close{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-close:hover{color:#ffffffbf}:host([data-mtb-theme="auto"]) .mtb-clarify-skip,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback:hover{background:#ffffff0f}:host([data-mtb-theme="auto"]) .mtb-clarify-ai{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}}.mtb-dim-clickable{z-index:2147483643;pointer-events:auto;cursor:default;background:#0000001f}.mtb-draw-bar{position:fixed;bottom:48px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:8px;height:46px;padding:0 8px 0 12px;border-radius:13px;background:#fff;border:1px solid rgba(0,0,0,.08);box-shadow:0 10px 30px #0f172a38;animation:mtbBarIn .2s ease;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-draw-input{width:220px;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:13px;color:#191a1c;outline:none;background:#fafafa;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-draw-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126;background:#fff}.mtb-draw-input::placeholder{color:#00000057}.mtb-draw-icon-btn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:8px;background:transparent;color:#374151;cursor:pointer;transition:background .12s,color .12s}.mtb-draw-icon-btn:hover:not(:disabled){background:#0000000f}.mtb-draw-icon-btn:disabled{color:#00000038;cursor:default}.mtb-draw-sep{width:1px;height:22px;background:#0000001a}.mtb-draw-cancel{height:32px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;color:#0000008c;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:550;transition:background .12s}.mtb-draw-cancel:hover{background:#0000000a}.mtb-draw-submit{height:32px;padding:0 14px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-draw-submit:hover:not(:disabled){background:#047857}.mtb-draw-submit:disabled{opacity:.6;cursor:default}.mtb-draw-error{position:absolute;bottom:100%;left:12px;margin-bottom:6px;color:#dc2626;font-size:11.5px}.mtb-record-preview{margin-bottom:12px}.mtb-record-preview-stage{position:relative;width:100%;height:132px;border-radius:10px;overflow:hidden;background:#0f172a;display:flex;align-items:center;justify-content:center}.mtb-record-preview-stage.playing{align-items:flex-start;justify-content:flex-start}.mtb-record-preview-play{width:44px;height:44px;border-radius:50%;border:none;background:#ffffffeb;color:#059669;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .12s,background .12s}.mtb-record-preview-play:hover:not(:disabled){transform:scale(1.06);background:#fff}.mtb-record-preview-play:disabled{cursor:default;opacity:.6}.mtb-record-preview-badge{position:absolute;right:8px;bottom:8px;padding:2px 7px;border-radius:6px;background:#0009;color:#fff;font-size:11px;font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,monospace}.mtb-record-preview-fallback{color:#ffffffd9;font-size:12px}.mtb-record-preview-name{display:block;margin-top:5px;font-size:11px;color:#0000006b}@media (pointer: coarse){.mtb-tab:after{content:"";position:absolute;inset:-6px 0 -6px -12px}.mtb-tab.left:after{inset:-6px -12px -6px 0}.mtb-toolbar{min-height:56px;border-radius:16px}.mtb-toolbar-mode-btn,.mtb-exit-btn,.mtb-popup-close,.mtb-cancel-btn,.mtb-submit-btn{min-height:44px}.mtb-textarea,.mtb-clarify-input,.mtb-draw-input,.mtb-email-input{font-size:16px}}@media (max-width: 480px){.mtb-tab{width:36px;height:40px;padding:0;font-size:0;writing-mode:horizontal-tb;border-radius:12px 0 0 12px;right:env(safe-area-inset-right,0px)}.mtb-tab.left{left:env(safe-area-inset-left,0px);border-radius:0 12px 12px 0}.mtb-tab:before{content:"";width:18px;height:18px;background:currentColor;-webkit-mask:var(--mtb-tab-icon) center / contain no-repeat;mask:var(--mtb-tab-icon) center / contain no-repeat}.mtb-toolbar{inset:0 0 auto;width:100%;max-width:none;max-height:none;transform:none;flex-direction:row;align-items:center;border-radius:0;gap:6px;justify-content:center;padding:env(safe-area-inset-top,0px) 8px 0;height:calc(56px + env(safe-area-inset-top,0px));animation:mtbBarInMobile .2s ease}.mtb-toolbar-modes{flex-direction:row;gap:3px;padding:3px;background:#ffffff29;border-radius:9px}.mtb-hint-bar,.mtb-toolbar-sep{display:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{width:auto;height:30px;gap:6px;border-radius:7px;padding-right:10px;padding-left:10px;color:#fffffff2}.mtb-exit-btn{border-radius:8px;background:#ffffff29}.mtb-toolbar-label{display:inline}:host([data-mtb-toolbar]) .mtb-tab{display:flex}.mtb-popup{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0;animation:mtbSheetUp .28s cubic-bezier(.34,1.56,.64,1)}.mtb-popup-actions{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-clarify{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0}.mtb-clarify-footer{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-draw-bar{left:0;right:0;bottom:0;transform:none;height:auto;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0}}@keyframes mtbBarInMobile{0%{transform:translateY(-14px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes mtbSheetUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}`;
|
|
2
|
-
class
|
|
1
|
+
const Gt = `*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;font-size:14px;line-height:1.5;color:#191a1c;-webkit-font-smoothing:antialiased}:host([data-mtb-theme="dark"]) .mtb-popup,:host([data-mtb-theme="dark"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-popup-title,:host([data-mtb-theme="dark"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-quick-option,:host([data-mtb-theme="dark"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-popup-close,:host([data-mtb-theme="dark"]) .mtb-success-msg,:host([data-mtb-theme="dark"]) .mtb-close-link{color:#ffffffad}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-popup,:host([data-mtb-theme="auto"]) .mtb-success{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-popup-title,:host([data-mtb-theme="auto"]) .mtb-success-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-quick-option,:host([data-mtb-theme="auto"]) .mtb-textarea{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-popup-close,:host([data-mtb-theme="auto"]) .mtb-success-msg,:host([data-mtb-theme="auto"]) .mtb-close-link{color:#ffffffad}}.mtb-tab{--mtb-tab-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Ccircle cx='12' cy='12' r='2.4' fill='%23000' stroke='none'/%3E%3Cpath d='M12 1.8v3.4M12 18.8v3.4M1.8 12h3.4M18.8 12h3.4'/%3E%3C/svg%3E");position:fixed;top:50%;right:0;transform:translateY(-50%);z-index:2147483646;display:flex;align-items:center;justify-content:center;width:32px;padding:14px 0;background:#059669;color:#fff;border-radius:8px 0 0 8px;cursor:pointer;box-shadow:-2px 0 14px #05966959;transition:background .15s,box-shadow .15s,width .15s;writing-mode:vertical-lr;text-orientation:mixed;font-size:12px;font-weight:600;letter-spacing:.04em;user-select:none;border:none;outline:none}.mtb-tab.left{right:auto;left:0;border-radius:0 8px 8px 0;box-shadow:2px 0 14px #05966959}.mtb-tab:hover{background:#047857;box-shadow:-3px 0 20px #05966973}.mtb-tab.active{background:#065f46}.mtb-hint-bar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;height:38px;padding:0 16px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbHintIn .2s ease;white-space:nowrap;transition:opacity .15s ease;pointer-events:none}.mtb-hint-bar--under-pointer{opacity:.3}@keyframes mtbHintIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.mtb-toolbar{position:fixed;top:50%;right:8px;transform:translateY(-50%);z-index:2147483647;display:flex;flex-direction:column;align-items:center;gap:6px;width:38px;padding:6px 0;max-height:calc(100vh - 24px);border-radius:19px;background:linear-gradient(160deg,#10b981,#059669);box-shadow:0 8px 22px #0f172a33;animation:mtbEdgeBarIn .2s ease;white-space:nowrap;pointer-events:none}.mtb-toolbar.left{right:auto;left:8px;animation:mtbEdgeBarInLeft .2s ease}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}@keyframes mtbEdgeBarIn{0%{transform:translate(12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}@keyframes mtbEdgeBarInLeft{0%{transform:translate(-12px,-50%);opacity:0}to{transform:translateY(-50%);opacity:1}}.mtb-toolbar-label{display:none}:host([data-mtb-toolbar]) .mtb-tab{display:none}.mtb-toolbar-modes{display:flex;align-items:center;gap:3px;background:#ffffff29;border-radius:9px;padding:3px}.mtb-toolbar-mode-btn{display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px;border-radius:7px;border:none;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;white-space:nowrap;background:transparent;color:#fffffff2;transition:all .12s}.mtb-toolbar-mode-btn.active{background:#fff;color:#047857}.mtb-toolbar-hint{font-size:12px;color:#fffffff2;white-space:nowrap}.mtb-toolbar-sep{width:20px;height:1px;align-self:center;background:#ffffff38}.mtb-exit-btn{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 12px;border-radius:8px;font-size:11.5px;font-weight:500;color:#fff;cursor:pointer;background:#ffffff29;border:none;font-family:inherit;transition:background .12s}.mtb-toolbar-modes{flex-direction:column;gap:6px;padding:0;background:none;border-radius:0}.mtb-toolbar-mode-btn,.mtb-exit-btn{pointer-events:auto;display:flex;align-items:center;justify-content:center;gap:0;width:30px;height:30px;padding:0;border-radius:50%;background:none;color:#ffffffb8}.mtb-toolbar-mode-btn:hover,.mtb-exit-btn:hover{background:#ffffff29;color:#fff}.mtb-toolbar-mode-btn.active,.mtb-toolbar-mode-btn.active:hover{background:#fff;color:#047857}.mtb-exit-btn{color:#fff}.mtb-toolbar-sep{width:16px;height:1px;margin:1px 0;align-self:center;background:#ffffff47}.mtb-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair;touch-action:none}.mtb-dim{position:fixed;inset:0;z-index:2147483639;background:#00000014}.mtb-highlight{position:fixed;z-index:2147483641;pointer-events:none;border:2px solid #10b981;border-radius:6px;background:#10b9810f;transition:all .08s ease}.mtb-highlight.selected{border-color:#3b82f6;background:#3b82f60a}.mtb-highlight-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%,-100%);max-width:240px;overflow:hidden;text-overflow:ellipsis;background:#064e3b;color:#fff;padding:4px 10px;border-radius:6px;font-size:11px;font-weight:500;white-space:nowrap;box-shadow:0 4px 12px #0000002e;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-highlight-tooltip.below{transform:translate(-50%)}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-color:#064e3b}.mtb-highlight-tooltip.below:after{top:auto;bottom:100%;border-top-color:transparent;border-bottom-color:#064e3b}.mtb-draw-svg{position:fixed;inset:0;z-index:2147483643;pointer-events:none;width:100%;height:100%;overflow:visible}.mtb-pin{position:fixed;z-index:2147483644;pointer-events:none;width:22px;height:22px;border-radius:50% 50% 50% 2px;background:#059669;border:2px solid #fff;display:flex;align-items:center;justify-content:center;font-size:10px;color:#fff;font-weight:700;box-shadow:0 2px 8px #05966973;animation:mtbPinPop .25s cubic-bezier(.34,1.56,.64,1);transform:translate(-50%,-50%)}@keyframes mtbPinPop{0%{transform:translate(-50%,-50%) scale(.4)}to{transform:translate(-50%,-50%) scale(1)}}.mtb-popup{position:fixed;z-index:2147483645;display:flex;flex-direction:column;width:min(320px,calc(100vw - 56px));background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{flex-shrink:0;padding:11px 13px 11px 14px;border-bottom:1px solid rgba(0,0,0,.06);display:flex;align-items:center;gap:8px}.mtb-popup-icon{width:20px;height:20px;border-radius:5px;background:#10b9811a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-popup-title{flex:1;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#191a1c}.mtb-popup-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;align-items:center;border-radius:4px;transition:color .12s}.mtb-popup-close:hover{color:#000000b3}.mtb-popup-body{min-height:0;padding:13px;overflow-y:auto;overscroll-behavior:contain}.mtb-quick-options{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}.mtb-quick-option{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border:1px solid rgba(0,0,0,.09);border-radius:10px;background:#fafafa;cursor:pointer;font-family:inherit;font-size:13px;color:#191a1c;text-align:left;transition:all .12s}.mtb-quick-option:hover{background:#10b9810f;border-color:#10b9814d}.mtb-quick-option.selected{background:#10b9811a;border-color:#10b98180}.mtb-quick-option-emoji{font-size:15px;flex-shrink:0;line-height:1}.mtb-textarea-wrap{position:relative}.mtb-textarea{width:100%;height:64px;padding:9px 11px;border:1px solid rgba(0,0,0,.12);border-radius:10px;font-family:inherit;font-size:12.5px;line-height:1.5;color:#191a1c;outline:none;background:#fff;resize:none;transition:border-color .12s,box-shadow .12s}.mtb-textarea:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#dc2626;font-size:11.5px}.mtb-popup-error:empty,.mtb-popup-error[hidden]{display:none}.mtb-popup-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.mtb-cancel-btn,.mtb-submit-btn{min-width:72px;height:32px;border:none;border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-cancel-btn{background:#f3f4f6;color:#000000ad}.mtb-cancel-btn:hover{background:#e5e7eb}.mtb-submit-btn{background:#d1d5db;color:#fff}.mtb-submit-btn.ready{background:#059669}.mtb-submit-btn.ready:hover{background:#047857}.mtb-submit-btn.loading{background:#059669;opacity:.7;cursor:wait}.mtb-submit-btn:disabled{cursor:not-allowed}.mtb-success{position:fixed;z-index:2147483645;width:332px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;padding:24px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-success-icon{width:46px;height:46px;border-radius:50%;background:#05966917;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:5px;letter-spacing:-.01em;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-view-feedback-link{display:inline-flex;align-items:center;gap:5px;color:#047857;text-decoration:none;font-size:13px;font-weight:500;font-family:JetBrains Mono,monospace;background:none;border:none;cursor:pointer;transition:text-decoration .12s}.mtb-view-feedback-link:hover{text-decoration:underline}.mtb-close-link{margin-top:13px;background:none;border:none;cursor:pointer;font-size:12px;color:#0006;font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:#000000b3}.mtb-email-capture{margin-bottom:14px;text-align:left}.mtb-email-prompt{font-size:12px;color:#0000008c;line-height:1.5;margin-bottom:8px}.mtb-email-row{display:flex;gap:6px}.mtb-email-input{flex:1;min-width:0;font-size:12.5px;font-family:inherit;padding:7px 10px;border:1px solid rgba(0,0,0,.14);border-radius:8px;outline:none}.mtb-email-input:focus{border-color:#059669}.mtb-email-input.mtb-email-invalid{border-color:#dc2626}.mtb-email-submit{font-size:12px;font-weight:600;font-family:inherit;color:#fff;background:#059669;border:none;border-radius:8px;padding:7px 12px;cursor:pointer;white-space:nowrap}.mtb-email-submit:disabled{opacity:.6;cursor:default}.mtb-email-error{font-size:11.5px;color:#dc2626;margin-top:6px}.mtb-email-saved{font-size:12px;color:#059669;line-height:1.5}.mtb-my-feedback{display:block;margin:8px auto 0;background:none;border:none;cursor:pointer;font-size:11.5px;font-family:inherit;color:#0006;text-decoration:underline;text-underline-offset:2px;transition:color .12s}.mtb-my-feedback:hover{color:#059669}.mtb-pet{position:fixed;bottom:20px;right:20px;z-index:2147483646;cursor:pointer;width:52px;height:52px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:transparent;animation:mtbPetBounce 3s ease-in-out infinite;transition:transform .2s;user-select:none;outline:none;filter:drop-shadow(0 4px 12px rgba(5,150,105,.35))}.mtb-pet:hover{transform:scale(1.12);animation-play-state:paused}.mtb-pet:hover .mtb-pet-bubble{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet.active{animation:none;opacity:.6}.mtb-pet-svg{display:block}@keyframes mtbPetBounce{0%,to{transform:translateY(0)}50%{transform:translateY(-6px)}}.mtb-pet-bubble{position:absolute;bottom:100%;left:50%;transform:translate(-50%) translateY(4px);margin-bottom:8px;background:#064e3b;color:#fff;padding:6px 12px;border-radius:8px;font-size:12px;font-weight:500;white-space:nowrap;box-shadow:0 4px 14px #0000002e;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s}.mtb-pet-bubble.visible{opacity:1;transform:translate(-50%) translateY(0);pointer-events:auto}.mtb-pet-bubble.hidden{opacity:0;pointer-events:none}.mtb-pet-bubble:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:5px solid transparent;border-top-color:#064e3b}.mtb-frustration-prompt{position:fixed;bottom:20px;right:20px;z-index:2147483645;display:flex;align-items:center;gap:10px;padding:12px 16px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:12px;box-shadow:0 8px 30px #0000001f;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}:host([data-mtb-theme="dark"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-prompt{background:#151719;border-color:#ffffff1f;color:#f9fafb}}.mtb-frustration-icon{width:32px;height:32px;border-radius:50%;background:#eab3081a;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:16px;line-height:1}.mtb-frustration-text{font-size:13px;font-weight:500;color:inherit;line-height:1.4}.mtb-frustration-actions{display:flex;gap:6px;flex-shrink:0}.mtb-frustration-tell{height:28px;padding:0 12px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-frustration-tell:hover{background:#047857}.mtb-frustration-dismiss{height:28px;padding:0 8px;border:none;border-radius:7px;background:transparent;color:#0006;cursor:pointer;font-family:inherit;font-size:12px;transition:color .12s}.mtb-frustration-dismiss:hover{color:#000000b3}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="dark"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss{color:#fff6}:host([data-mtb-theme="auto"]) .mtb-frustration-dismiss:hover{color:#ffffffb3}}.mtb-record-bar{position:fixed;bottom:48px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:12px;height:42px;padding:0 8px 0 14px;border-radius:12px;background:#0f172aeb;box-shadow:0 8px 24px #00000040;animation:mtbBarIn .2s ease}.mtb-record-dot{width:8px;height:8px;border-radius:50%;background:#ef4444;animation:mtbRecordPulse 1.2s ease-in-out infinite;flex-shrink:0}@keyframes mtbRecordPulse{0%,to{opacity:1}50%{opacity:.3}}.mtb-record-timer{font-family:JetBrains Mono,SF Mono,Fira Code,Cascadia Code,monospace;font-size:13px;font-weight:500;color:#fff;font-variant-numeric:tabular-nums;letter-spacing:.02em;min-width:38px}.mtb-record-stop{height:28px;padding:0 14px;border:none;border-radius:7px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-record-stop:hover{background:#047857}.mtb-click-ripple{position:fixed;z-index:2147483644;width:24px;height:24px;border-radius:50%;border:2px solid #10b981;background:#10b98133;pointer-events:none;transform:translate(-50%,-50%) scale(.5);animation:mtbClickRipple .3s ease-out forwards}@keyframes mtbClickRipple{0%{transform:translate(-50%,-50%) scale(.5);opacity:1}to{transform:translate(-50%,-50%) scale(2);opacity:0}}.mtb-dot{display:inline-block;width:4px;height:4px;border-radius:50%;background:#fff;animation:mtbDot 1.2s infinite}.mtb-dot:nth-child(2){animation-delay:.2s}.mtb-dot:nth-child(3){animation-delay:.4s}@keyframes mtbDot{0%,80%,to{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}.mtb-clarify{position:fixed;z-index:2147483645;width:min(346px,calc(100vw - 56px));background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 24px 64px #0000003d;display:flex;flex-direction:column;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;overflow:hidden}.mtb-clarify-continuation{width:min(320px,calc(100vw - 56px));animation:none}.mtb-clarify-header{padding:8px 10px;display:flex;align-items:center;gap:7px;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:20px;height:20px;border-radius:6px;background:linear-gradient(140deg,#10b981,#059669);box-shadow:0 1px 3px #05966966;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-clarify-titles{flex:1;min-width:0}.mtb-clarify-title{font-size:12px;font-weight:650;line-height:1.2;color:#191a1c}.mtb-clarify-subtitle{font-size:9.5px;color:#0000006b}.mtb-clarify-close{background:none;border:none;cursor:pointer;padding:3px;color:#00000061;display:flex;transition:color .12s}.mtb-clarify-close:hover{color:#000000b3}.mtb-clarify-messages{flex:1;overflow-y:auto;padding:8px 10px 4px;display:flex;flex-direction:column;gap:6px}.mtb-clarify-bubble{max-width:82%;padding:6px 10px;font-size:12px;line-height:1.4;white-space:pre-wrap;word-break:break-word}.mtb-clarify-ai{align-self:flex-start;background:#fff;color:#191a1c;border:1px solid rgba(0,0,0,.09);border-radius:11px 11px 11px 3px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border:1px solid #059669;border-radius:11px 11px 3px}.mtb-clarify-thinking{display:flex;align-items:center;gap:4px;padding:8px 12px}.mtb-clarify-thinking .mtb-dot{width:6px;height:6px;background:#059669b3}.mtb-clarify-footer{padding:3px 10px 10px;display:flex;flex-direction:column}.mtb-clarify-input{width:100%;height:40px;padding:7px 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:12px;line-height:1.4;color:#191a1c;outline:none;background:#fafafa;resize:none;box-sizing:border-box;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-clarify-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126;background:#fff}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-actions{display:flex;gap:6px;margin-top:6px}.mtb-clarify-skip,.mtb-clarify-fallback{flex:0 0 auto;height:30px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:550;color:#0000008c;white-space:nowrap;transition:background .12s}.mtb-clarify-skip:hover,.mtb-clarify-fallback:hover{background:#0000000a}.mtb-clarify-send,.mtb-clarify-retry{flex:1;height:30px;display:inline-flex;align-items:center;justify-content:center;gap:5px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s}.mtb-clarify-send:not(:disabled):hover,.mtb-clarify-retry:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled,.mtb-clarify-retry:disabled{background:#00000026;cursor:not-allowed}.mtb-clarify-send-feedback{width:100%;height:34px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:none;border-radius:9px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-clarify-send-feedback:not(:disabled):hover{background:#047857}.mtb-clarify-send-feedback:disabled{background:#00000026;cursor:not-allowed}.mtb-clarify-error{margin-bottom:8px;color:#dc2626;font-size:11.5px;line-height:1.4;text-align:center}:host([data-mtb-theme="dark"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-title{color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-subtitle{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-close{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-close:hover{color:#ffffffbf}:host([data-mtb-theme="dark"]) .mtb-clarify-skip,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="dark"]) .mtb-clarify-fallback:hover{background:#ffffff0f}:host([data-mtb-theme="dark"]) .mtb-clarify-ai{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="dark"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}@media (prefers-color-scheme: dark){:host([data-mtb-theme="auto"]) .mtb-clarify{background:#151719;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-header{border-bottom-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-title{color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-subtitle{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-close{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-close:hover{color:#ffffffbf}:host([data-mtb-theme="auto"]) .mtb-clarify-skip,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback{background:#1f2327;border-color:#ffffff24;color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover,:host([data-mtb-theme="auto"]) .mtb-clarify-fallback:hover{background:#ffffff0f}:host([data-mtb-theme="auto"]) .mtb-clarify-ai{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}}.mtb-dim-clickable{z-index:2147483643;pointer-events:auto;cursor:default;background:#0000001f}.mtb-draw-bar{position:fixed;bottom:48px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:8px;height:46px;padding:0 8px 0 12px;border-radius:13px;background:#fff;border:1px solid rgba(0,0,0,.08);box-shadow:0 10px 30px #0f172a38;animation:mtbBarIn .2s ease;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}.mtb-draw-input{width:220px;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:13px;color:#191a1c;outline:none;background:#fafafa;transition:border-color .12s,box-shadow .12s,background .12s}.mtb-draw-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b98126;background:#fff}.mtb-draw-input::placeholder{color:#00000057}.mtb-draw-icon-btn{width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;border:none;border-radius:8px;background:transparent;color:#374151;cursor:pointer;transition:background .12s,color .12s}.mtb-draw-icon-btn:hover:not(:disabled){background:#0000000f}.mtb-draw-icon-btn:disabled{color:#00000038;cursor:default}.mtb-draw-sep{width:1px;height:22px;background:#0000001a}.mtb-draw-cancel{height:32px;padding:0 12px;border:1px solid rgba(0,0,0,.12);border-radius:8px;background:#fff;color:#0000008c;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:550;transition:background .12s}.mtb-draw-cancel:hover{background:#0000000a}.mtb-draw-submit{height:32px;padding:0 14px;border:none;border-radius:8px;background:#059669;color:#fff;cursor:pointer;font-family:inherit;font-size:12.5px;font-weight:600;transition:background .12s}.mtb-draw-submit:hover:not(:disabled){background:#047857}.mtb-draw-submit:disabled{opacity:.6;cursor:default}.mtb-draw-error{position:absolute;bottom:100%;left:12px;margin-bottom:6px;color:#dc2626;font-size:11.5px}.mtb-record-preview{margin-bottom:12px}.mtb-record-preview-stage{position:relative;width:100%;height:132px;border-radius:10px;overflow:hidden;background:#0f172a;display:flex;align-items:center;justify-content:center}.mtb-record-preview-stage.playing{align-items:flex-start;justify-content:flex-start}.mtb-record-preview-play{width:44px;height:44px;border-radius:50%;border:none;background:#ffffffeb;color:#059669;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:transform .12s,background .12s}.mtb-record-preview-play:hover:not(:disabled){transform:scale(1.06);background:#fff}.mtb-record-preview-play:disabled{cursor:default;opacity:.6}.mtb-record-preview-badge{position:absolute;right:8px;bottom:8px;padding:2px 7px;border-radius:6px;background:#0009;color:#fff;font-size:11px;font-variant-numeric:tabular-nums;font-family:JetBrains Mono,SF Mono,monospace}.mtb-record-preview-fallback{color:#ffffffd9;font-size:12px}.mtb-record-preview-name{display:block;margin-top:5px;font-size:11px;color:#0000006b}@media (pointer: coarse){.mtb-tab:after{content:"";position:absolute;inset:-6px 0 -6px -12px}.mtb-tab.left:after{inset:-6px -12px -6px 0}.mtb-toolbar{min-height:56px;border-radius:16px}.mtb-toolbar-mode-btn,.mtb-exit-btn,.mtb-popup-close,.mtb-cancel-btn,.mtb-submit-btn{min-height:44px}.mtb-textarea,.mtb-clarify-input,.mtb-draw-input,.mtb-email-input{font-size:16px}}@media (max-width: 480px){.mtb-tab{width:36px;height:40px;padding:0;font-size:0;writing-mode:horizontal-tb;border-radius:12px 0 0 12px;right:env(safe-area-inset-right,0px)}.mtb-tab.left{left:env(safe-area-inset-left,0px);border-radius:0 12px 12px 0}.mtb-tab:before{content:"";width:18px;height:18px;background:currentColor;-webkit-mask:var(--mtb-tab-icon) center / contain no-repeat;mask:var(--mtb-tab-icon) center / contain no-repeat}.mtb-toolbar{inset:0 0 auto;width:100%;max-width:none;max-height:none;transform:none;flex-direction:row;align-items:center;border-radius:0;gap:6px;justify-content:center;padding:env(safe-area-inset-top,0px) 8px 0;height:calc(56px + env(safe-area-inset-top,0px));animation:mtbBarInMobile .2s ease}.mtb-toolbar-modes{flex-direction:row;gap:3px;padding:3px;background:#ffffff29;border-radius:9px}.mtb-hint-bar,.mtb-toolbar-sep{display:none}.mtb-toolbar-mode-btn,.mtb-exit-btn{width:auto;height:30px;gap:6px;border-radius:7px;padding-right:10px;padding-left:10px;color:#fffffff2}.mtb-exit-btn{border-radius:8px;background:#ffffff29}.mtb-toolbar-label{display:inline}:host([data-mtb-toolbar]) .mtb-tab{display:flex}.mtb-popup{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0;animation:mtbSheetUp .28s cubic-bezier(.34,1.56,.64,1)}.mtb-popup-actions{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-clarify{inset:auto 0 0;width:auto;max-height:85%;border-radius:20px 20px 0 0}.mtb-clarify-footer{padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.mtb-draw-bar{left:0;right:0;bottom:0;transform:none;height:auto;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0}}@keyframes mtbBarInMobile{0%{transform:translateY(-14px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes mtbSheetUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}`;
|
|
2
|
+
class Jt {
|
|
3
3
|
constructor(t = "auto") {
|
|
4
4
|
const e = document.getElementById("mtb-widget-host");
|
|
5
5
|
this.ownsHost = !e, this.host = e ?? document.createElement("div"), this.host.id = "mtb-widget-host", this.host.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646;", this.host.setAttribute("data-mtb-theme", t), this.ownsHost && document.body.appendChild(this.host), this.root = this.host.shadowRoot ?? this.host.attachShadow({ mode: "open" }), this.root.replaceChildren();
|
|
6
6
|
const r = document.createElement("style");
|
|
7
|
-
r.textContent =
|
|
7
|
+
r.textContent = Gt, this.root.appendChild(r);
|
|
8
8
|
}
|
|
9
9
|
el(t, e) {
|
|
10
10
|
const r = document.createElement(t);
|
|
@@ -25,7 +25,7 @@ class Kt {
|
|
|
25
25
|
this.host.remove();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
class
|
|
28
|
+
class Qt {
|
|
29
29
|
constructor(t, e, r, n, s) {
|
|
30
30
|
this.active = !1, this.onClick = n, this.customText = s, this.el = t.el("button", "mtb-tab"), r === "left" && this.el.classList.add("left"), this.idleLabel = s ?? e.tab, this.activeLabel = e.toolbar.exit, this.setLabel(this.idleLabel), this.el.addEventListener("click", n), t.append(this.el);
|
|
31
31
|
}
|
|
@@ -42,8 +42,8 @@ class Gt {
|
|
|
42
42
|
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
class
|
|
45
|
+
const Zt = 8e3;
|
|
46
|
+
class te {
|
|
47
47
|
constructor(t, e, r) {
|
|
48
48
|
this.autoHideTimer = null, this.el = t.el("div", "mtb-frustration-prompt"), this.el.innerHTML = `
|
|
49
49
|
<div class="mtb-frustration-icon">⚠️</div>
|
|
@@ -52,42 +52,41 @@ class Qt {
|
|
|
52
52
|
<button class="mtb-frustration-tell">${e.frustration.action}</button>
|
|
53
53
|
<button class="mtb-frustration-dismiss">${e.frustration.dismiss}</button>
|
|
54
54
|
</div>
|
|
55
|
-
`, this.el.querySelector(".mtb-frustration-tell").addEventListener("click", r.onTell), this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click", r.onDismiss), t.append(this.el), this.autoHideTimer = setTimeout(r.onAutoHide,
|
|
55
|
+
`, this.el.querySelector(".mtb-frustration-tell").addEventListener("click", r.onTell), this.el.querySelector(".mtb-frustration-dismiss").addEventListener("click", r.onDismiss), t.append(this.el), this.autoHideTimer = setTimeout(r.onAutoHide, Zt);
|
|
56
56
|
}
|
|
57
57
|
destroy() {
|
|
58
58
|
this.autoHideTimer && (clearTimeout(this.autoHideTimer), this.autoHideTimer = null), this.el.remove();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const ee = 400;
|
|
62
|
+
class ie {
|
|
63
|
+
constructor(t, e, r = () => Date.now()) {
|
|
64
|
+
this.bornAt = Date.now(), this.bornAt = r(), this.onClick = () => {
|
|
65
|
+
r() - this.bornAt < ee || e();
|
|
66
|
+
}, this.el = t.el("div", "mtb-dim mtb-dim-clickable"), this.el.addEventListener("click", this.onClick), t.append(this.el);
|
|
64
67
|
}
|
|
65
68
|
destroy() {
|
|
66
69
|
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
|
-
|
|
72
|
+
function G() {
|
|
73
|
+
return window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
74
|
+
}
|
|
75
|
+
class re {
|
|
70
76
|
constructor() {
|
|
71
|
-
this.locked = !1, this.prevOverflow = "", this.prevTouchAction = "", this.
|
|
72
|
-
(window.scrollX !== this.anchorX || window.scrollY !== this.anchorY) && window.scrollTo(this.anchorX, this.anchorY);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
// No matchMedia means no evidence of a touch device — assume a mouse and
|
|
76
|
-
// leave the host page alone.
|
|
77
|
-
isTouchPointer() {
|
|
78
|
-
return window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
77
|
+
this.locked = !1, this.prevOverflow = "", this.prevTouchAction = "", this.prevRootOverflow = "";
|
|
79
78
|
}
|
|
80
79
|
lock() {
|
|
81
|
-
this.locked || !
|
|
80
|
+
this.locked || !G() || (this.locked = !0, this.prevOverflow = document.body.style.overflow, this.prevTouchAction = document.body.style.touchAction, this.prevRootOverflow = document.documentElement.style.overflow, document.body.style.overflow = "hidden", document.body.style.touchAction = "none", document.documentElement.style.overflow = "hidden");
|
|
82
81
|
}
|
|
83
82
|
unlock() {
|
|
84
|
-
this.locked && (this.locked = !1,
|
|
83
|
+
this.locked && (this.locked = !1, document.body.style.overflow = this.prevOverflow, document.body.style.touchAction = this.prevTouchAction, document.documentElement.style.overflow = this.prevRootOverflow);
|
|
85
84
|
}
|
|
86
85
|
isLocked() {
|
|
87
86
|
return this.locked;
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
|
-
class
|
|
89
|
+
class ne {
|
|
91
90
|
constructor(t, e, r, n, s = "right") {
|
|
92
91
|
this.currentMode = "markup", this.handlePointerMove = (o) => {
|
|
93
92
|
if (o.pointerType !== "mouse") return;
|
|
@@ -127,7 +126,7 @@ class ee {
|
|
|
127
126
|
document.removeEventListener("pointermove", this.handlePointerMove), this.host.removeAttribute("data-mtb-toolbar"), this.hintBarEl.remove(), this.el.remove();
|
|
128
127
|
}
|
|
129
128
|
}
|
|
130
|
-
class
|
|
129
|
+
class se {
|
|
131
130
|
constructor(t, e) {
|
|
132
131
|
this.handlers = e, this.overlayEl = t.el("div", "mtb-overlay"), this.onPointerDown = (r) => {
|
|
133
132
|
const n = r;
|
|
@@ -159,7 +158,7 @@ class ie {
|
|
|
159
158
|
this.overlayEl.removeEventListener("pointerdown", this.onPointerDown), this.overlayEl.removeEventListener("pointermove", this.onPointerMove), this.overlayEl.removeEventListener("pointerup", this.onPointerUp), this.overlayEl.removeEventListener("pointercancel", this.onPointerCancel), this.overlayEl.remove(), this.dimEl.remove();
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
|
-
class
|
|
161
|
+
class oe {
|
|
163
162
|
constructor(t) {
|
|
164
163
|
this.highlightEl = t.el("div", "mtb-highlight"), this.tooltipEl = t.el("div", "mtb-highlight-tooltip"), this.hide(), t.append(this.highlightEl, this.tooltipEl);
|
|
165
164
|
}
|
|
@@ -168,7 +167,7 @@ class re {
|
|
|
168
167
|
this.highlightEl.style.top = `${e.top - 2}px`, this.highlightEl.style.left = `${e.left - 2}px`, this.highlightEl.style.width = `${e.width + 4}px`, this.highlightEl.style.height = `${e.height + 4}px`, this.highlightEl.style.display = "block", this.showTooltip(t, e);
|
|
169
168
|
}
|
|
170
169
|
showTooltip(t, e) {
|
|
171
|
-
this.tooltipEl.textContent =
|
|
170
|
+
this.tooltipEl.textContent = J(t);
|
|
172
171
|
const r = e.top < 30;
|
|
173
172
|
this.tooltipEl.classList.toggle("below", r), this.tooltipEl.style.left = `${e.left + e.width / 2}px`, this.tooltipEl.style.top = r ? `${e.bottom + 8}px` : `${e.top - 8}px`, this.tooltipEl.style.display = "block";
|
|
174
173
|
}
|
|
@@ -182,22 +181,22 @@ class re {
|
|
|
182
181
|
this.highlightEl.remove(), this.tooltipEl.remove();
|
|
183
182
|
}
|
|
184
183
|
}
|
|
185
|
-
const
|
|
186
|
-
function
|
|
184
|
+
const ae = /^(script|style|noscript|template)$/i;
|
|
185
|
+
function Mt(i, t = 80) {
|
|
187
186
|
let e = "";
|
|
188
187
|
for (const r of Array.from(i.childNodes)) {
|
|
189
188
|
if (e.length >= t) break;
|
|
190
|
-
r.nodeType === 3 ? e += r.nodeValue ?? "" : r instanceof Element && !
|
|
189
|
+
r.nodeType === 3 ? e += r.nodeValue ?? "" : r instanceof Element && !ae.test(r.tagName) && (e += Mt(r, t - e.length));
|
|
191
190
|
}
|
|
192
191
|
return e;
|
|
193
192
|
}
|
|
194
|
-
function
|
|
193
|
+
function J(i) {
|
|
195
194
|
if (i instanceof HTMLElement) {
|
|
196
195
|
const t = i.getAttribute("aria-label");
|
|
197
196
|
if (t) return t;
|
|
198
197
|
const e = i.getAttribute("title");
|
|
199
198
|
if (e) return e;
|
|
200
|
-
const r =
|
|
199
|
+
const r = Mt(i).trim().slice(0, 40);
|
|
201
200
|
if (r) return r;
|
|
202
201
|
const n = i.placeholder;
|
|
203
202
|
if (n) return n;
|
|
@@ -208,7 +207,7 @@ function G(i) {
|
|
|
208
207
|
}
|
|
209
208
|
return i.tagName.toLowerCase();
|
|
210
209
|
}
|
|
211
|
-
function
|
|
210
|
+
function At(i) {
|
|
212
211
|
const t = [];
|
|
213
212
|
let e = i;
|
|
214
213
|
for (; e && e !== document.body && t.length < 5; ) {
|
|
@@ -233,7 +232,7 @@ function Lt(i) {
|
|
|
233
232
|
}
|
|
234
233
|
return t.join(" > ");
|
|
235
234
|
}
|
|
236
|
-
class
|
|
235
|
+
class le {
|
|
237
236
|
constructor(t) {
|
|
238
237
|
this.pins = [], this.shadow = t;
|
|
239
238
|
}
|
|
@@ -249,18 +248,18 @@ class se {
|
|
|
249
248
|
this.clearAll();
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
|
-
const
|
|
253
|
-
function
|
|
254
|
-
return `rgba(${
|
|
251
|
+
const O = "#059669", ce = "5,150,105";
|
|
252
|
+
function Q(i) {
|
|
253
|
+
return `rgba(${ce},${i})`;
|
|
255
254
|
}
|
|
256
|
-
const
|
|
257
|
-
color:
|
|
255
|
+
const de = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', C = {
|
|
256
|
+
color: O,
|
|
258
257
|
width: "3.5",
|
|
259
258
|
linecap: "round",
|
|
260
259
|
linejoin: "round",
|
|
261
|
-
filter: `drop-shadow(0 1px 2px ${
|
|
260
|
+
filter: `drop-shadow(0 1px 2px ${Q(0.35)})`
|
|
262
261
|
};
|
|
263
|
-
class
|
|
262
|
+
class he {
|
|
264
263
|
constructor(t) {
|
|
265
264
|
this.currentPath = null, this.currentPoints = [], this.isDrawing = !1, this.committed = [], this.redoStack = [], this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.svg.setAttribute("class", "mtb-draw-svg"), t.append(this.svg);
|
|
266
265
|
}
|
|
@@ -268,7 +267,7 @@ class le {
|
|
|
268
267
|
this.isDrawing = !0, this.currentPoints = [[t, e]], this.currentPath = this.createPath(), this.svg.appendChild(this.currentPath);
|
|
269
268
|
}
|
|
270
269
|
continueDraw(t, e) {
|
|
271
|
-
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, e]), this.currentPath.setAttribute("d",
|
|
270
|
+
!this.isDrawing || !this.currentPath || (this.currentPoints.push([t, e]), this.currentPath.setAttribute("d", rt(this.currentPoints)));
|
|
272
271
|
}
|
|
273
272
|
/**
|
|
274
273
|
* How far the pointer has wandered from where it went down, in pixels.
|
|
@@ -289,7 +288,7 @@ class le {
|
|
|
289
288
|
// Commits the in-progress stroke to the undo stack and clears the redo stack.
|
|
290
289
|
// Callers decide whether the stroke has enough points before committing.
|
|
291
290
|
commitStroke() {
|
|
292
|
-
return !this.isDrawing || !this.currentPath ? !1 : (this.isDrawing = !1, this.committed.push({ path: this.currentPath, d:
|
|
291
|
+
return !this.isDrawing || !this.currentPath ? !1 : (this.isDrawing = !1, this.committed.push({ path: this.currentPath, d: rt(this.currentPoints), points: this.currentPoints }), this.redoStack = [], this.currentPath = null, this.currentPoints = [], !0);
|
|
293
292
|
}
|
|
294
293
|
cancelCurrentDraw() {
|
|
295
294
|
this.currentPath?.remove(), this.currentPath = null, this.isDrawing = !1, this.currentPoints = [];
|
|
@@ -315,7 +314,7 @@ class le {
|
|
|
315
314
|
}
|
|
316
315
|
getAnnotation() {
|
|
317
316
|
if (this.committed.length === 0) return null;
|
|
318
|
-
const t = this.committed.flatMap((n) => n.points), [e, r] =
|
|
317
|
+
const t = this.committed.flatMap((n) => n.points), [e, r] = ue(t);
|
|
319
318
|
return {
|
|
320
319
|
type: "draw",
|
|
321
320
|
x: e,
|
|
@@ -338,7 +337,7 @@ class le {
|
|
|
338
337
|
return t.setAttribute("fill", "none"), t.setAttribute("stroke", C.color), t.setAttribute("stroke-width", C.width), t.setAttribute("stroke-linecap", C.linecap), t.setAttribute("stroke-linejoin", C.linejoin), t.setAttribute("style", `filter:${C.filter}`), t;
|
|
339
338
|
}
|
|
340
339
|
}
|
|
341
|
-
function
|
|
340
|
+
function rt(i) {
|
|
342
341
|
if (i.length === 0) return "";
|
|
343
342
|
const [t, e] = i[0];
|
|
344
343
|
let r = `M ${t} ${e}`;
|
|
@@ -348,14 +347,14 @@ function it(i) {
|
|
|
348
347
|
}
|
|
349
348
|
return r;
|
|
350
349
|
}
|
|
351
|
-
function
|
|
350
|
+
function ue(i) {
|
|
352
351
|
const t = i.map((s) => s[0]), e = i.map((s) => s[1]), r = (Math.min(...t) + Math.max(...t)) / 2, n = (Math.min(...e) + Math.max(...e)) / 2;
|
|
353
352
|
return [r, n];
|
|
354
353
|
}
|
|
355
|
-
const
|
|
356
|
-
class
|
|
354
|
+
const me = 10;
|
|
355
|
+
class fe {
|
|
357
356
|
constructor(t, e, r) {
|
|
358
|
-
this.messages = e, this.handlers = r, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new
|
|
357
|
+
this.messages = e, this.handlers = r, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new oe(t), this.pinMarker = new le(t), this.drawLayer = new he(t), this.overlay = new se(t, {
|
|
359
358
|
onPointerDown: (n) => this.handlePointerDown(n),
|
|
360
359
|
onPointerMove: (n) => this.handlePointerMove(n),
|
|
361
360
|
onPointerUp: (n) => this.handlePointerUp(n),
|
|
@@ -381,7 +380,7 @@ class he {
|
|
|
381
380
|
}
|
|
382
381
|
updateHighlight() {
|
|
383
382
|
if (!this.interactionActive || this.drawLayer.isCurrentlyDrawing() || this.drawSessionActive()) return;
|
|
384
|
-
const t =
|
|
383
|
+
const t = nt(this.lastMoveX, this.lastMoveY);
|
|
385
384
|
t ? this.highlighter.highlight(t) : this.highlighter.hide();
|
|
386
385
|
}
|
|
387
386
|
cancelPendingHighlight() {
|
|
@@ -394,16 +393,16 @@ class he {
|
|
|
394
393
|
// draw note bar; a tap on an element becomes a pin. Stray taps while a
|
|
395
394
|
// drawing already exists are ignored so they don't hijack the draw flow.
|
|
396
395
|
finishStroke(t) {
|
|
397
|
-
if (this.drawLayer.getCurrentSpan() >=
|
|
396
|
+
if (this.drawLayer.getCurrentSpan() >= me) {
|
|
398
397
|
this.drawLayer.commitStroke(), this.highlighter.hide(), this.handlers.onDrawStroke();
|
|
399
398
|
return;
|
|
400
399
|
}
|
|
401
400
|
if (this.drawLayer.cancelCurrentDraw(), this.drawLayer.hasStrokes() || !t) return;
|
|
402
|
-
const e =
|
|
401
|
+
const e = nt(t.clientX, t.clientY), r = e ? J(e) : this.messages.annotation.element, n = e?.getBoundingClientRect(), s = {
|
|
403
402
|
type: "pin",
|
|
404
403
|
x: t.clientX,
|
|
405
404
|
y: t.clientY,
|
|
406
|
-
targetSelector: e ?
|
|
405
|
+
targetSelector: e ? At(e) : void 0,
|
|
407
406
|
targetText: e?.textContent?.trim().slice(0, 200) ?? "",
|
|
408
407
|
targetName: r,
|
|
409
408
|
targetRect: n ? { top: n.top, left: n.left, width: n.width, height: n.height, bottom: n.bottom } : void 0
|
|
@@ -444,26 +443,31 @@ class he {
|
|
|
444
443
|
this.dismissInteraction(), this.highlighter.destroy(), this.pinMarker.destroy(), this.drawLayer.destroy();
|
|
445
444
|
}
|
|
446
445
|
}
|
|
447
|
-
function
|
|
446
|
+
function nt(i, t) {
|
|
448
447
|
return document.elementsFromPoint(i, t).find((e) => e.id !== "mtb-widget-host") ?? null;
|
|
449
448
|
}
|
|
450
|
-
const
|
|
449
|
+
const pe = "mtb-widget-host";
|
|
451
450
|
function S(i) {
|
|
452
|
-
const t = document.getElementById(
|
|
451
|
+
const t = document.getElementById(pe);
|
|
453
452
|
return t ? t === i || t.contains(i) : !1;
|
|
454
453
|
}
|
|
455
454
|
function h(i) {
|
|
456
455
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
457
456
|
}
|
|
458
|
-
|
|
457
|
+
const be = 140, ge = 0.6;
|
|
458
|
+
class ye {
|
|
459
459
|
constructor() {
|
|
460
|
-
this.onChange = null, this.handler = () => {
|
|
461
|
-
this.
|
|
460
|
+
this.onChange = null, this.timer = null, this.handler = () => {
|
|
461
|
+
this.timer !== null && clearTimeout(this.timer), this.timer = setTimeout(() => {
|
|
462
|
+
this.timer = null, this.onChange?.(this.current());
|
|
463
|
+
}, be);
|
|
462
464
|
};
|
|
463
465
|
}
|
|
464
466
|
current() {
|
|
465
467
|
const t = window.visualViewport;
|
|
466
|
-
|
|
468
|
+
if (!t) return 0;
|
|
469
|
+
const e = Math.max(0, Math.round(window.innerHeight - (t.height + t.offsetTop)));
|
|
470
|
+
return e > window.innerHeight * ge ? 0 : e;
|
|
467
471
|
}
|
|
468
472
|
observe(t) {
|
|
469
473
|
const e = window.visualViewport;
|
|
@@ -471,20 +475,20 @@ class me {
|
|
|
471
475
|
}
|
|
472
476
|
stop() {
|
|
473
477
|
const t = window.visualViewport;
|
|
474
|
-
this.onChange = null, t && (t.removeEventListener("resize", this.handler), t.removeEventListener("scroll", this.handler));
|
|
478
|
+
this.onChange = null, this.timer !== null && (clearTimeout(this.timer), this.timer = null), t && (t.removeEventListener("resize", this.handler), t.removeEventListener("scroll", this.handler));
|
|
475
479
|
}
|
|
476
480
|
}
|
|
477
|
-
const
|
|
478
|
-
function
|
|
479
|
-
return window.innerWidth <=
|
|
481
|
+
const we = 480;
|
|
482
|
+
function xe() {
|
|
483
|
+
return window.innerWidth <= we;
|
|
480
484
|
}
|
|
481
|
-
class
|
|
485
|
+
class Z {
|
|
482
486
|
constructor(t) {
|
|
483
|
-
this.el = t, this.inset = new
|
|
487
|
+
this.el = t, this.inset = new ye();
|
|
484
488
|
}
|
|
485
489
|
/** Returns true when this took over layout, i.e. the caller should not position. */
|
|
486
490
|
apply() {
|
|
487
|
-
return
|
|
491
|
+
return xe() ? (this.el.style.left = "", this.el.style.top = "", this.el.style.maxHeight = "", this.lift(this.inset.current()), this.inset.observe((t) => this.lift(t)), !0) : !1;
|
|
488
492
|
}
|
|
489
493
|
release() {
|
|
490
494
|
this.inset.stop();
|
|
@@ -493,9 +497,9 @@ class Q {
|
|
|
493
497
|
this.el.style.bottom = t > 0 ? `${t}px` : "";
|
|
494
498
|
}
|
|
495
499
|
}
|
|
496
|
-
class
|
|
500
|
+
class ve {
|
|
497
501
|
constructor(t, e) {
|
|
498
|
-
this.loading = !1, this.onSubmit = e.onSubmit, this.submitLabel = e.messages.draw.submit, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.sheet = new
|
|
502
|
+
this.loading = !1, this.onSubmit = e.onSubmit, this.submitLabel = e.messages.draw.submit, this.el = t.el("div", "mtb-draw-bar"), this.el.innerHTML = this.buildHTML(e.messages), t.append(this.el), this.sheet = new Z(this.el), this.sheet.apply(), this.input = this.el.querySelector(".mtb-draw-input"), this.undoBtn = this.el.querySelector(".mtb-draw-undo"), this.redoBtn = this.el.querySelector(".mtb-draw-redo"), this.submitBtn = this.el.querySelector(".mtb-draw-submit"), this.errorEl = this.el.querySelector(".mtb-draw-error"), this.undoBtn.addEventListener("click", e.onUndo), this.redoBtn.addEventListener("click", e.onRedo), this.el.querySelector(".mtb-draw-cancel").addEventListener("click", e.onCancel), this.submitBtn.addEventListener("click", () => this.submit()), this.input.addEventListener("keydown", (r) => {
|
|
499
503
|
r.isComposing || r.keyCode === 229 || r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.submit());
|
|
500
504
|
}), this.input.focus({ preventScroll: !0 });
|
|
501
505
|
}
|
|
@@ -530,9 +534,20 @@ class pe {
|
|
|
530
534
|
this.sheet.release(), this.el.remove();
|
|
531
535
|
}
|
|
532
536
|
}
|
|
533
|
-
|
|
537
|
+
const ke = 400;
|
|
538
|
+
function Se(i, t = ke) {
|
|
539
|
+
const e = i.style.pointerEvents;
|
|
540
|
+
i.style.pointerEvents = "none";
|
|
541
|
+
const r = setTimeout(() => {
|
|
542
|
+
i.style.pointerEvents = e;
|
|
543
|
+
}, t);
|
|
544
|
+
return () => {
|
|
545
|
+
clearTimeout(r), i.style.pointerEvents = e;
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
class st {
|
|
534
549
|
constructor(t, e) {
|
|
535
|
-
this.loading = !1, this.selectedQuickOption = null, this.onSubmit = e.onSubmit, this.onClose = e.onClose, this.submitLabel = e.messages.popup.submit, this.messages = e.messages, this.el = t.el("div", "mtb-popup"), this.el.innerHTML = this.buildHTML(e), t.append(this.el), this.sheet = new
|
|
550
|
+
this.releaseGuard = null, this.loading = !1, this.selectedQuickOption = null, this.onSubmit = e.onSubmit, this.onClose = e.onClose, this.submitLabel = e.messages.popup.submit, this.messages = e.messages, this.el = t.el("div", "mtb-popup"), this.el.innerHTML = this.buildHTML(e), t.append(this.el), this.sheet = new Z(this.el), G() && (this.releaseGuard = Se(this.el)), this.textarea = this.el.querySelector(".mtb-textarea"), this.submitBtn = this.el.querySelector(".mtb-submit-btn"), this.positionPopup(e.x, e.y, e.targetRect, e.position ?? "right"), this.bindEvents(e.messages), e.onMyFeedback && this.el.querySelector(".mtb-my-feedback").addEventListener("click", e.onMyFeedback), this.textarea.focus({ preventScroll: !0 });
|
|
536
551
|
}
|
|
537
552
|
buildHTML(t) {
|
|
538
553
|
const e = t.messages, r = e.popup.quickOptions.map(
|
|
@@ -576,8 +591,8 @@ class ge {
|
|
|
576
591
|
if (this.sheet.apply()) return;
|
|
577
592
|
const s = window.innerWidth, o = window.innerHeight, a = 12, l = 8, c = 32, d = Math.min(320, s - 2 * a - c), u = this.el.offsetHeight || 260, m = a + (n === "left" ? c : 0), g = s - a - (n === "right" ? c : 0);
|
|
578
593
|
let y, w;
|
|
579
|
-
const
|
|
580
|
-
r &&
|
|
594
|
+
const Kt = r && r.width < s * 0.6 && r.height < o * 0.6;
|
|
595
|
+
r && Kt ? (y = r.left, w = r.bottom + l, w + u > o - a && (w = r.top - u - l), w < a && (w = Math.min(r.bottom + l, o - u - a))) : (y = t + 12, w = e + 12), y + d > g && (y = g - d), y < m && (y = m), w < a && (w = a), this.el.style.left = `${y}px`, this.el.style.top = `${w}px`, this.el.style.maxHeight = `${o - w - a}px`;
|
|
581
596
|
}
|
|
582
597
|
bindEvents(t) {
|
|
583
598
|
this.el.querySelector(".mtb-popup-close").addEventListener("click", () => this.onClose()), this.el.querySelector(".mtb-cancel-btn").addEventListener("click", () => this.onClose()), this.errorEl = this.el.querySelector(".mtb-popup-error"), this.el.querySelectorAll(".mtb-quick-option").forEach((e) => {
|
|
@@ -612,24 +627,24 @@ class ge {
|
|
|
612
627
|
this.errorEl.textContent = t, this.errorEl.hidden = !1;
|
|
613
628
|
}
|
|
614
629
|
releaseElement() {
|
|
615
|
-
return this.sheet.release(), this.el;
|
|
630
|
+
return this.releaseGuard?.(), this.releaseGuard = null, this.sheet.release(), this.el;
|
|
616
631
|
}
|
|
617
632
|
destroy() {
|
|
618
|
-
this.sheet.release(), this.el.remove();
|
|
633
|
+
this.releaseGuard?.(), this.releaseGuard = null, this.sheet.release(), this.el.remove();
|
|
619
634
|
}
|
|
620
635
|
}
|
|
621
|
-
class
|
|
636
|
+
class Pt extends Error {
|
|
622
637
|
constructor(t) {
|
|
623
638
|
super(`HTTP ${t}`), this.name = "ApiError", this.status = t;
|
|
624
639
|
}
|
|
625
640
|
}
|
|
626
|
-
function
|
|
627
|
-
return i instanceof
|
|
641
|
+
function Ee(i) {
|
|
642
|
+
return i instanceof Pt && i.status === 409;
|
|
628
643
|
}
|
|
629
|
-
const
|
|
630
|
-
class
|
|
644
|
+
const Ce = "https://makethisbetter.dev/api/v1";
|
|
645
|
+
class _e {
|
|
631
646
|
constructor(t, e, r = 1e3, n, s) {
|
|
632
|
-
this.projectKey = t, this.apiUrl = (e ??
|
|
647
|
+
this.projectKey = t, this.apiUrl = (e ?? Ce).replace(/\/$/, ""), this.retryDelayMs = r, this.userToken = n, this.userTokenFn = s;
|
|
633
648
|
}
|
|
634
649
|
async resolveUserToken() {
|
|
635
650
|
return this.userTokenFn ? this.userTokenFn() : this.userToken;
|
|
@@ -643,7 +658,7 @@ class xe {
|
|
|
643
658
|
return r["X-Submission-Token"] = t, r;
|
|
644
659
|
}
|
|
645
660
|
async createSubmissionSession(t, e) {
|
|
646
|
-
const r =
|
|
661
|
+
const r = Me(), n = new FormData();
|
|
647
662
|
if (n.append("feedback[description]", t.description), n.append("feedback[page_url]", t.page_url), n.append("feedback[user_agent]", t.user_agent), n.append("feedback[browser]", t.browser), n.append("feedback[os]", t.os), n.append("feedback[screen_width]", String(t.screen_width)), n.append("feedback[screen_height]", String(t.screen_height)), n.append("feedback[console_errors]", JSON.stringify(t.console_errors)), n.append("feedback[annotations]", JSON.stringify(t.annotations)), t.target_element && n.append("feedback[target_element]", JSON.stringify(t.target_element)), t.user_id && n.append("feedback[user_id]", t.user_id), t.reporter_external_id && n.append("feedback[reporter_external_id]", t.reporter_external_id), t.reporter_email && n.append("feedback[reporter_email]", t.reporter_email), t.user_email && n.append("feedback[user_email]", t.user_email), t.user_name && n.append("feedback[user_name]", t.user_name), t.breadcrumbs && t.breadcrumbs.length > 0 && n.append("feedback[breadcrumbs]", JSON.stringify(t.breadcrumbs)), t.recording_events && t.recording_events.length > 0) {
|
|
648
663
|
const l = JSON.stringify(t.recording_events), c = new Blob([l], { type: "application/json" });
|
|
649
664
|
n.append("feedback[recording]", c, "interaction-replay.json"), n.append("feedback[recording_duration]", String(t.recording_duration ?? 0));
|
|
@@ -653,7 +668,7 @@ class xe {
|
|
|
653
668
|
n.append("feedback[screenshot]", e, `screenshot.${l}`);
|
|
654
669
|
}
|
|
655
670
|
const s = await this.authHeaders();
|
|
656
|
-
return s["X-Submission-Token"] = r, s["X-Idempotency-Key"] =
|
|
671
|
+
return s["X-Submission-Token"] = r, s["X-Idempotency-Key"] = Le(), { ...(await (await this.fetchWithRetry(`${this.apiUrl}/widget/feedback_submission_sessions`, {
|
|
657
672
|
method: "POST",
|
|
658
673
|
headers: s,
|
|
659
674
|
body: n
|
|
@@ -720,7 +735,7 @@ class xe {
|
|
|
720
735
|
}), a = o.headers.get("Content-Type") ?? "";
|
|
721
736
|
if (!o.ok || !o.body || !a.includes("text/event-stream"))
|
|
722
737
|
throw new Error("clarify stream unavailable");
|
|
723
|
-
return
|
|
738
|
+
return Te(o.body, r);
|
|
724
739
|
}
|
|
725
740
|
async finalizeSubmissionSession(t, e) {
|
|
726
741
|
const r = await this.submissionHeaders(e);
|
|
@@ -742,19 +757,19 @@ class xe {
|
|
|
742
757
|
n = await fetch(t, e);
|
|
743
758
|
} catch (s) {
|
|
744
759
|
if (r > 0)
|
|
745
|
-
return await
|
|
760
|
+
return await ot(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
746
761
|
throw s;
|
|
747
762
|
}
|
|
748
763
|
if (n.ok) return n;
|
|
749
764
|
if (n.status >= 500 && r > 0)
|
|
750
|
-
return await
|
|
751
|
-
throw new
|
|
765
|
+
return await ot(this.retryDelayMs), this.fetchWithRetry(t, e, r - 1);
|
|
766
|
+
throw new Pt(n.status);
|
|
752
767
|
}
|
|
753
768
|
}
|
|
754
|
-
function
|
|
769
|
+
function ot(i) {
|
|
755
770
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
756
771
|
}
|
|
757
|
-
async function
|
|
772
|
+
async function Te(i, t) {
|
|
758
773
|
const e = i.getReader(), r = new TextDecoder();
|
|
759
774
|
let n = "", s = null;
|
|
760
775
|
const o = (a) => {
|
|
@@ -793,27 +808,27 @@ async function ve(i, t) {
|
|
|
793
808
|
if (!s) throw new Error("clarify stream ended before done");
|
|
794
809
|
return s;
|
|
795
810
|
}
|
|
796
|
-
function
|
|
811
|
+
function Le() {
|
|
797
812
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
798
813
|
}
|
|
799
|
-
function
|
|
814
|
+
function Me() {
|
|
800
815
|
if (typeof crypto > "u" || typeof crypto.getRandomValues != "function")
|
|
801
816
|
throw new Error("Secure random generation is unavailable");
|
|
802
817
|
const i = crypto.getRandomValues(new Uint8Array(32));
|
|
803
818
|
return Array.from(i, (t) => t.toString(16).padStart(2, "0")).join("");
|
|
804
819
|
}
|
|
805
|
-
const
|
|
806
|
-
class
|
|
820
|
+
const Ae = 2e3, Pe = 45e3, Re = 346, Ie = 270;
|
|
821
|
+
class De {
|
|
807
822
|
constructor(t, e) {
|
|
808
823
|
this.pollTimer = null, this.pollDeadline = 0, this.streamingBubble = null, this.lastMessages = [], this.done = !1, this.sending = !1, this.finalizing = !1, this.destroyed = !1, this.unrecoverable = !1, this.submissionSessionId = e.submissionSessionId, this.submissionToken = e.submissionToken, this.apiClient = e.apiClient, this.onFinalize = e.onFinalize, this.i18n = e.messages, this.preloadedResult = e.preloadedResult, this.pendingClarification = e.pendingClarification;
|
|
809
824
|
const r = e.element;
|
|
810
|
-
this.el = r ?? t.el("div", "mtb-clarify"), this.el.className = r ? "mtb-clarify mtb-clarify-continuation" : "mtb-clarify", this.el.innerHTML = this.buildHTML(e.messages), this.sheet = new
|
|
825
|
+
this.el = r ?? t.el("div", "mtb-clarify"), this.el.className = r ? "mtb-clarify mtb-clarify-continuation" : "mtb-clarify", this.el.innerHTML = this.buildHTML(e.messages), this.sheet = new Z(this.el), r ? this.sheet.apply() : (t.append(this.el), this.positionCard(e.x, e.y, e.position ?? "right")), this.messagesEl = this.el.querySelector(".mtb-clarify-messages"), this.bindEvents(), this.startConversation();
|
|
811
826
|
}
|
|
812
827
|
// Anchors the card near the annotation point, clamped to the viewport so it
|
|
813
828
|
// never overflows a screen edge (mirrors CommentPopup.positionPopup).
|
|
814
829
|
positionCard(t, e, r) {
|
|
815
830
|
if (this.sheet.apply()) return;
|
|
816
|
-
const n = window.innerWidth, s = window.innerHeight, o = 12, a = 32, l = Math.min(
|
|
831
|
+
const n = window.innerWidth, s = window.innerHeight, o = 12, a = 32, l = Math.min(Re, n - 2 * o - a), c = this.el.offsetHeight || Ie, d = o + (r === "left" ? a : 0), u = n - o - (r === "right" ? a : 0);
|
|
817
832
|
if (t === void 0 || e === void 0) {
|
|
818
833
|
const y = Math.max(d, (n - l) / 2);
|
|
819
834
|
this.el.style.left = `${Math.min(y, u - l)}px`, this.el.style.top = `${Math.max(o, (s - c) / 2)}px`, this.el.style.maxHeight = `${s - 2 * o}px`;
|
|
@@ -956,7 +971,7 @@ class Le {
|
|
|
956
971
|
this.streamingBubble = null;
|
|
957
972
|
}
|
|
958
973
|
startPolling() {
|
|
959
|
-
this.stopPolling(), this.pollDeadline = Date.now() +
|
|
974
|
+
this.stopPolling(), this.pollDeadline = Date.now() + Pe, this.pollTimer = setInterval(() => this.poll(), Ae);
|
|
960
975
|
}
|
|
961
976
|
stopPolling() {
|
|
962
977
|
this.pollTimer !== null && (clearInterval(this.pollTimer), this.pollTimer = null);
|
|
@@ -1050,7 +1065,7 @@ class Le {
|
|
|
1050
1065
|
await this.onFinalize();
|
|
1051
1066
|
} catch (t) {
|
|
1052
1067
|
if (this.destroyed) return;
|
|
1053
|
-
if (this.finalizing = !1, this.clearError(),
|
|
1068
|
+
if (this.finalizing = !1, this.clearError(), Ee(t)) {
|
|
1054
1069
|
this.showUnrecoverable();
|
|
1055
1070
|
return;
|
|
1056
1071
|
}
|
|
@@ -1102,8 +1117,8 @@ class Le {
|
|
|
1102
1117
|
this.destroyed = !0, this.stopPolling(), this.sheet.release(), this.el.remove();
|
|
1103
1118
|
}
|
|
1104
1119
|
}
|
|
1105
|
-
const
|
|
1106
|
-
class
|
|
1120
|
+
const He = 5e3, $e = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1121
|
+
class Be {
|
|
1107
1122
|
constructor(t, e, r, n, s) {
|
|
1108
1123
|
this.messages = e, this.el = t.el("div", "mtb-success"), this.el.style.right = "20px", this.el.style.bottom = "20px";
|
|
1109
1124
|
const o = s?.skipFollowup ? e.success.title_no_ai : e.success.title, a = s?.skipFollowup ? e.success.message_no_ai : e.success.message, l = n ? `<button class="mtb-view-feedback-link">${e.success.view_feedback} <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5l7 7-7 7"/></svg></button>` : "", c = s?.emailCapture ? `
|
|
@@ -1117,7 +1132,7 @@ class Ae {
|
|
|
1117
1132
|
</div>` : "";
|
|
1118
1133
|
this.el.innerHTML = `
|
|
1119
1134
|
<div class="mtb-success-icon">
|
|
1120
|
-
<svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="${
|
|
1135
|
+
<svg width="23" height="23" viewBox="0 0 24 24" fill="none" stroke="${O}" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
|
|
1121
1136
|
<polyline points="20 6 9 17 4 12"/>
|
|
1122
1137
|
</svg>
|
|
1123
1138
|
</div>
|
|
@@ -1126,12 +1141,12 @@ class Ae {
|
|
|
1126
1141
|
${c}
|
|
1127
1142
|
${l}
|
|
1128
1143
|
<button class="mtb-close-link">${e.success.close}</button>
|
|
1129
|
-
`, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", r), n && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", n), s?.emailCapture ? this.bindEmailCapture(s.emailCapture.onSubmit) : setTimeout(() => r(),
|
|
1144
|
+
`, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", r), n && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", n), s?.emailCapture ? this.bindEmailCapture(s.emailCapture.onSubmit) : setTimeout(() => r(), He);
|
|
1130
1145
|
}
|
|
1131
1146
|
bindEmailCapture(t) {
|
|
1132
1147
|
const e = this.el.querySelector(".mtb-email-input"), r = this.el.querySelector(".mtb-email-submit"), n = this.el.querySelector(".mtb-email-error"), s = async () => {
|
|
1133
1148
|
const o = e.value.trim();
|
|
1134
|
-
if (
|
|
1149
|
+
if (!$e.test(o)) {
|
|
1135
1150
|
e.classList.add("mtb-email-invalid");
|
|
1136
1151
|
return;
|
|
1137
1152
|
}
|
|
@@ -1145,7 +1160,7 @@ class Ae {
|
|
|
1145
1160
|
this.el.remove();
|
|
1146
1161
|
}
|
|
1147
1162
|
}
|
|
1148
|
-
function
|
|
1163
|
+
function Fe(i, t) {
|
|
1149
1164
|
if (i.match(/^[a-z]+:\/\//i))
|
|
1150
1165
|
return i;
|
|
1151
1166
|
if (i.match(/^\/\//))
|
|
@@ -1155,7 +1170,7 @@ function Re(i, t) {
|
|
|
1155
1170
|
const e = document.implementation.createHTMLDocument(), r = e.createElement("base"), n = e.createElement("a");
|
|
1156
1171
|
return e.head.appendChild(r), e.body.appendChild(n), t && (r.href = t), n.href = i, n.href;
|
|
1157
1172
|
}
|
|
1158
|
-
const
|
|
1173
|
+
const Ue = /* @__PURE__ */ (() => {
|
|
1159
1174
|
let i = 0;
|
|
1160
1175
|
const t = () => (
|
|
1161
1176
|
// eslint-disable-next-line no-bitwise
|
|
@@ -1170,26 +1185,26 @@ function x(i) {
|
|
|
1170
1185
|
return t;
|
|
1171
1186
|
}
|
|
1172
1187
|
let v = null;
|
|
1173
|
-
function
|
|
1188
|
+
function Rt(i = {}) {
|
|
1174
1189
|
return v || (i.includeStyleProperties ? (v = i.includeStyleProperties, v) : (v = x(window.getComputedStyle(document.documentElement)), v));
|
|
1175
1190
|
}
|
|
1176
1191
|
function $(i, t) {
|
|
1177
1192
|
const r = (i.ownerDocument.defaultView || window).getComputedStyle(i).getPropertyValue(t);
|
|
1178
1193
|
return r ? parseFloat(r.replace("px", "")) : 0;
|
|
1179
1194
|
}
|
|
1180
|
-
function
|
|
1195
|
+
function Oe(i) {
|
|
1181
1196
|
const t = $(i, "border-left-width"), e = $(i, "border-right-width");
|
|
1182
1197
|
return i.clientWidth + t + e;
|
|
1183
1198
|
}
|
|
1184
|
-
function
|
|
1199
|
+
function ze(i) {
|
|
1185
1200
|
const t = $(i, "border-top-width"), e = $(i, "border-bottom-width");
|
|
1186
1201
|
return i.clientHeight + t + e;
|
|
1187
1202
|
}
|
|
1188
|
-
function
|
|
1189
|
-
const e = t.width ||
|
|
1203
|
+
function It(i, t = {}) {
|
|
1204
|
+
const e = t.width || Oe(i), r = t.height || ze(i);
|
|
1190
1205
|
return { width: e, height: r };
|
|
1191
1206
|
}
|
|
1192
|
-
function
|
|
1207
|
+
function je() {
|
|
1193
1208
|
let i, t;
|
|
1194
1209
|
try {
|
|
1195
1210
|
t = process;
|
|
@@ -1198,9 +1213,9 @@ function $e() {
|
|
|
1198
1213
|
const e = t && t.env ? t.env.devicePixelRatio : null;
|
|
1199
1214
|
return e && (i = parseInt(e, 10), Number.isNaN(i) && (i = 1)), i || window.devicePixelRatio || 1;
|
|
1200
1215
|
}
|
|
1201
|
-
const
|
|
1202
|
-
function
|
|
1203
|
-
(i.width >
|
|
1216
|
+
const b = 16384;
|
|
1217
|
+
function qe(i) {
|
|
1218
|
+
(i.width > b || i.height > b) && (i.width > b && i.height > b ? i.width > i.height ? (i.height *= b / i.width, i.width = b) : (i.width *= b / i.height, i.height = b) : i.width > b ? (i.height *= b / i.width, i.width = b) : (i.width *= b / i.height, i.height = b));
|
|
1204
1219
|
}
|
|
1205
1220
|
function B(i) {
|
|
1206
1221
|
return new Promise((t, e) => {
|
|
@@ -1212,80 +1227,80 @@ function B(i) {
|
|
|
1212
1227
|
}, r.onerror = e, r.crossOrigin = "anonymous", r.decoding = "async", r.src = i;
|
|
1213
1228
|
});
|
|
1214
1229
|
}
|
|
1215
|
-
async function
|
|
1230
|
+
async function Ne(i) {
|
|
1216
1231
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
|
|
1217
1232
|
}
|
|
1218
|
-
async function
|
|
1233
|
+
async function We(i, t, e) {
|
|
1219
1234
|
const r = "http://www.w3.org/2000/svg", n = document.createElementNS(r, "svg"), s = document.createElementNS(r, "foreignObject");
|
|
1220
|
-
return n.setAttribute("width", `${t}`), n.setAttribute("height", `${e}`), n.setAttribute("viewBox", `0 0 ${t} ${e}`), s.setAttribute("width", "100%"), s.setAttribute("height", "100%"), s.setAttribute("x", "0"), s.setAttribute("y", "0"), s.setAttribute("externalResourcesRequired", "true"), n.appendChild(s), s.appendChild(i),
|
|
1235
|
+
return n.setAttribute("width", `${t}`), n.setAttribute("height", `${e}`), n.setAttribute("viewBox", `0 0 ${t} ${e}`), s.setAttribute("width", "100%"), s.setAttribute("height", "100%"), s.setAttribute("x", "0"), s.setAttribute("y", "0"), s.setAttribute("externalResourcesRequired", "true"), n.appendChild(s), s.appendChild(i), Ne(n);
|
|
1221
1236
|
}
|
|
1222
|
-
const
|
|
1237
|
+
const p = (i, t) => {
|
|
1223
1238
|
if (i instanceof t)
|
|
1224
1239
|
return !0;
|
|
1225
1240
|
const e = Object.getPrototypeOf(i);
|
|
1226
|
-
return e === null ? !1 : e.constructor.name === t.name ||
|
|
1241
|
+
return e === null ? !1 : e.constructor.name === t.name || p(e, t);
|
|
1227
1242
|
};
|
|
1228
|
-
function
|
|
1243
|
+
function Ve(i) {
|
|
1229
1244
|
const t = i.getPropertyValue("content");
|
|
1230
1245
|
return `${i.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
1231
1246
|
}
|
|
1232
|
-
function
|
|
1233
|
-
return
|
|
1247
|
+
function Ye(i, t) {
|
|
1248
|
+
return Rt(t).map((e) => {
|
|
1234
1249
|
const r = i.getPropertyValue(e), n = i.getPropertyPriority(e);
|
|
1235
1250
|
return `${e}: ${r}${n ? " !important" : ""};`;
|
|
1236
1251
|
}).join(" ");
|
|
1237
1252
|
}
|
|
1238
|
-
function
|
|
1239
|
-
const n = `.${i}:${t}`, s = e.cssText ?
|
|
1253
|
+
function Xe(i, t, e, r) {
|
|
1254
|
+
const n = `.${i}:${t}`, s = e.cssText ? Ve(e) : Ye(e, r);
|
|
1240
1255
|
return document.createTextNode(`${n}{${s}}`);
|
|
1241
1256
|
}
|
|
1242
|
-
function
|
|
1257
|
+
function at(i, t, e, r) {
|
|
1243
1258
|
const n = window.getComputedStyle(i, e), s = n.getPropertyValue("content");
|
|
1244
1259
|
if (s === "" || s === "none")
|
|
1245
1260
|
return;
|
|
1246
|
-
const o =
|
|
1261
|
+
const o = Ue();
|
|
1247
1262
|
try {
|
|
1248
1263
|
t.className = `${t.className} ${o}`;
|
|
1249
1264
|
} catch {
|
|
1250
1265
|
return;
|
|
1251
1266
|
}
|
|
1252
1267
|
const a = document.createElement("style");
|
|
1253
|
-
a.appendChild(
|
|
1268
|
+
a.appendChild(Xe(o, e, n, r)), t.appendChild(a);
|
|
1254
1269
|
}
|
|
1255
|
-
function
|
|
1256
|
-
|
|
1270
|
+
function Ke(i, t, e) {
|
|
1271
|
+
at(i, t, ":before", e), at(i, t, ":after", e);
|
|
1257
1272
|
}
|
|
1258
|
-
const
|
|
1259
|
-
woff:
|
|
1260
|
-
woff2:
|
|
1273
|
+
const lt = "application/font-woff", ct = "image/jpeg", Ge = {
|
|
1274
|
+
woff: lt,
|
|
1275
|
+
woff2: lt,
|
|
1261
1276
|
ttf: "application/font-truetype",
|
|
1262
1277
|
eot: "application/vnd.ms-fontobject",
|
|
1263
1278
|
png: "image/png",
|
|
1264
|
-
jpg:
|
|
1265
|
-
jpeg:
|
|
1279
|
+
jpg: ct,
|
|
1280
|
+
jpeg: ct,
|
|
1266
1281
|
gif: "image/gif",
|
|
1267
1282
|
tiff: "image/tiff",
|
|
1268
1283
|
svg: "image/svg+xml",
|
|
1269
1284
|
webp: "image/webp"
|
|
1270
1285
|
};
|
|
1271
|
-
function
|
|
1286
|
+
function Je(i) {
|
|
1272
1287
|
const t = /\.([^./]*?)$/g.exec(i);
|
|
1273
1288
|
return t ? t[1] : "";
|
|
1274
1289
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const t =
|
|
1277
|
-
return
|
|
1290
|
+
function tt(i) {
|
|
1291
|
+
const t = Je(i).toLowerCase();
|
|
1292
|
+
return Ge[t] || "";
|
|
1278
1293
|
}
|
|
1279
|
-
function
|
|
1294
|
+
function Qe(i) {
|
|
1280
1295
|
return i.split(/,/)[1];
|
|
1281
1296
|
}
|
|
1282
1297
|
function V(i) {
|
|
1283
1298
|
return i.search(/^(data:)/) !== -1;
|
|
1284
1299
|
}
|
|
1285
|
-
function
|
|
1300
|
+
function Ze(i, t) {
|
|
1286
1301
|
return `data:${t};base64,${i}`;
|
|
1287
1302
|
}
|
|
1288
|
-
async function
|
|
1303
|
+
async function Dt(i, t, e) {
|
|
1289
1304
|
const r = await fetch(i, t);
|
|
1290
1305
|
if (r.status === 404)
|
|
1291
1306
|
throw new Error(`Resource "${r.url}" not found`);
|
|
@@ -1302,19 +1317,19 @@ async function Rt(i, t, e) {
|
|
|
1302
1317
|
});
|
|
1303
1318
|
}
|
|
1304
1319
|
const j = {};
|
|
1305
|
-
function
|
|
1320
|
+
function ti(i, t, e) {
|
|
1306
1321
|
let r = i.replace(/\?.*/, "");
|
|
1307
1322
|
return e && (r = i), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
|
|
1308
1323
|
}
|
|
1309
|
-
async function
|
|
1310
|
-
const r =
|
|
1324
|
+
async function et(i, t, e) {
|
|
1325
|
+
const r = ti(i, t, e.includeQueryParams);
|
|
1311
1326
|
if (j[r] != null)
|
|
1312
1327
|
return j[r];
|
|
1313
1328
|
e.cacheBust && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
1314
1329
|
let n;
|
|
1315
1330
|
try {
|
|
1316
|
-
const s = await
|
|
1317
|
-
n =
|
|
1331
|
+
const s = await Dt(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""), Qe(a)));
|
|
1332
|
+
n = Ze(s, t);
|
|
1318
1333
|
} catch (s) {
|
|
1319
1334
|
n = e.imagePlaceholder || "";
|
|
1320
1335
|
let o = `Failed to fetch resource: ${i}`;
|
|
@@ -1322,65 +1337,65 @@ async function tt(i, t, e) {
|
|
|
1322
1337
|
}
|
|
1323
1338
|
return j[r] = n, n;
|
|
1324
1339
|
}
|
|
1325
|
-
async function
|
|
1340
|
+
async function ei(i) {
|
|
1326
1341
|
const t = i.toDataURL();
|
|
1327
1342
|
return t === "data:," ? i.cloneNode(!1) : B(t);
|
|
1328
1343
|
}
|
|
1329
|
-
async function
|
|
1344
|
+
async function ii(i, t) {
|
|
1330
1345
|
if (i.currentSrc) {
|
|
1331
1346
|
const s = document.createElement("canvas"), o = s.getContext("2d");
|
|
1332
1347
|
s.width = i.clientWidth, s.height = i.clientHeight, o?.drawImage(i, 0, 0, s.width, s.height);
|
|
1333
1348
|
const a = s.toDataURL();
|
|
1334
1349
|
return B(a);
|
|
1335
1350
|
}
|
|
1336
|
-
const e = i.poster, r =
|
|
1351
|
+
const e = i.poster, r = tt(e), n = await et(e, r, t);
|
|
1337
1352
|
return B(n);
|
|
1338
1353
|
}
|
|
1339
|
-
async function
|
|
1354
|
+
async function ri(i, t) {
|
|
1340
1355
|
var e;
|
|
1341
1356
|
try {
|
|
1342
1357
|
if (!((e = i?.contentDocument) === null || e === void 0) && e.body)
|
|
1343
|
-
return await
|
|
1358
|
+
return await z(i.contentDocument.body, t, !0);
|
|
1344
1359
|
} catch {
|
|
1345
1360
|
}
|
|
1346
1361
|
return i.cloneNode(!1);
|
|
1347
1362
|
}
|
|
1348
|
-
async function
|
|
1349
|
-
return
|
|
1363
|
+
async function ni(i, t) {
|
|
1364
|
+
return p(i, HTMLCanvasElement) ? ei(i) : p(i, HTMLVideoElement) ? ii(i, t) : p(i, HTMLIFrameElement) ? ri(i, t) : i.cloneNode(Ht(i));
|
|
1350
1365
|
}
|
|
1351
|
-
const
|
|
1352
|
-
async function
|
|
1366
|
+
const si = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT", Ht = (i) => i.tagName != null && i.tagName.toUpperCase() === "SVG";
|
|
1367
|
+
async function oi(i, t, e) {
|
|
1353
1368
|
var r, n;
|
|
1354
|
-
if (
|
|
1369
|
+
if (Ht(t))
|
|
1355
1370
|
return t;
|
|
1356
1371
|
let s = [];
|
|
1357
|
-
return
|
|
1372
|
+
return si(i) && i.assignedNodes ? s = x(i.assignedNodes()) : p(i, HTMLIFrameElement) && (!((r = i.contentDocument) === null || r === void 0) && r.body) ? s = x(i.contentDocument.body.childNodes) : s = x(((n = i.shadowRoot) !== null && n !== void 0 ? n : i).childNodes), s.length === 0 || p(i, HTMLVideoElement) || await s.reduce((o, a) => o.then(() => z(a, e)).then((l) => {
|
|
1358
1373
|
l && t.appendChild(l);
|
|
1359
1374
|
}), Promise.resolve()), t;
|
|
1360
1375
|
}
|
|
1361
|
-
function
|
|
1376
|
+
function ai(i, t, e) {
|
|
1362
1377
|
const r = t.style;
|
|
1363
1378
|
if (!r)
|
|
1364
1379
|
return;
|
|
1365
1380
|
const n = window.getComputedStyle(i);
|
|
1366
|
-
n.cssText ? (r.cssText = n.cssText, r.transformOrigin = n.transformOrigin) :
|
|
1381
|
+
n.cssText ? (r.cssText = n.cssText, r.transformOrigin = n.transformOrigin) : Rt(e).forEach((s) => {
|
|
1367
1382
|
let o = n.getPropertyValue(s);
|
|
1368
|
-
s === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`),
|
|
1383
|
+
s === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), p(i, HTMLIFrameElement) && s === "display" && o === "inline" && (o = "block"), s === "d" && t.getAttribute("d") && (o = `path(${t.getAttribute("d")})`), r.setProperty(s, o, n.getPropertyPriority(s));
|
|
1369
1384
|
});
|
|
1370
1385
|
}
|
|
1371
|
-
function
|
|
1372
|
-
|
|
1386
|
+
function li(i, t) {
|
|
1387
|
+
p(i, HTMLTextAreaElement) && (t.innerHTML = i.value), p(i, HTMLInputElement) && t.setAttribute("value", i.value);
|
|
1373
1388
|
}
|
|
1374
|
-
function
|
|
1375
|
-
if (
|
|
1389
|
+
function ci(i, t) {
|
|
1390
|
+
if (p(i, HTMLSelectElement)) {
|
|
1376
1391
|
const e = t, r = Array.from(e.children).find((n) => i.value === n.getAttribute("value"));
|
|
1377
1392
|
r && r.setAttribute("selected", "");
|
|
1378
1393
|
}
|
|
1379
1394
|
}
|
|
1380
|
-
function
|
|
1381
|
-
return
|
|
1395
|
+
function di(i, t, e) {
|
|
1396
|
+
return p(t, Element) && (ai(i, t, e), Ke(i, t, e), li(i, t), ci(i, t)), t;
|
|
1382
1397
|
}
|
|
1383
|
-
async function
|
|
1398
|
+
async function hi(i, t) {
|
|
1384
1399
|
const e = i.querySelectorAll ? i.querySelectorAll("use") : [];
|
|
1385
1400
|
if (e.length === 0)
|
|
1386
1401
|
return i;
|
|
@@ -1389,7 +1404,7 @@ async function si(i, t) {
|
|
|
1389
1404
|
const a = e[s].getAttribute("xlink:href");
|
|
1390
1405
|
if (a) {
|
|
1391
1406
|
const l = i.querySelector(a), c = document.querySelector(a);
|
|
1392
|
-
!l && c && !r[a] && (r[a] = await
|
|
1407
|
+
!l && c && !r[a] && (r[a] = await z(c, t, !0));
|
|
1393
1408
|
}
|
|
1394
1409
|
}
|
|
1395
1410
|
const n = Object.values(r);
|
|
@@ -1404,31 +1419,31 @@ async function si(i, t) {
|
|
|
1404
1419
|
}
|
|
1405
1420
|
return i;
|
|
1406
1421
|
}
|
|
1407
|
-
async function
|
|
1408
|
-
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) =>
|
|
1422
|
+
async function z(i, t, e) {
|
|
1423
|
+
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((r) => ni(r, t)).then((r) => oi(i, r, t)).then((r) => di(i, r, t)).then((r) => hi(r, t));
|
|
1409
1424
|
}
|
|
1410
|
-
const
|
|
1411
|
-
function
|
|
1425
|
+
const $t = /url\((['"]?)([^'"]+?)\1\)/g, ui = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, mi = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
1426
|
+
function fi(i) {
|
|
1412
1427
|
const t = i.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
1413
1428
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
1414
1429
|
}
|
|
1415
|
-
function
|
|
1430
|
+
function pi(i) {
|
|
1416
1431
|
const t = [];
|
|
1417
|
-
return i.replace(
|
|
1432
|
+
return i.replace($t, (e, r, n) => (t.push(n), e)), t.filter((e) => !V(e));
|
|
1418
1433
|
}
|
|
1419
|
-
async function
|
|
1434
|
+
async function bi(i, t, e, r, n) {
|
|
1420
1435
|
try {
|
|
1421
|
-
const s = e ?
|
|
1436
|
+
const s = e ? Fe(t, e) : t, o = tt(t);
|
|
1422
1437
|
let a;
|
|
1423
|
-
return n || (a = await
|
|
1438
|
+
return n || (a = await et(s, o, r)), i.replace(fi(t), `$1${a}$3`);
|
|
1424
1439
|
} catch {
|
|
1425
1440
|
}
|
|
1426
1441
|
return i;
|
|
1427
1442
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return t ? i.replace(
|
|
1443
|
+
function gi(i, { preferredFontFormat: t }) {
|
|
1444
|
+
return t ? i.replace(mi, (e) => {
|
|
1430
1445
|
for (; ; ) {
|
|
1431
|
-
const [r, , n] =
|
|
1446
|
+
const [r, , n] = ui.exec(e) || [];
|
|
1432
1447
|
if (!n)
|
|
1433
1448
|
return "";
|
|
1434
1449
|
if (n === t)
|
|
@@ -1436,32 +1451,32 @@ function hi(i, { preferredFontFormat: t }) {
|
|
|
1436
1451
|
}
|
|
1437
1452
|
}) : i;
|
|
1438
1453
|
}
|
|
1439
|
-
function
|
|
1440
|
-
return i.search(
|
|
1454
|
+
function Bt(i) {
|
|
1455
|
+
return i.search($t) !== -1;
|
|
1441
1456
|
}
|
|
1442
|
-
async function
|
|
1443
|
-
if (!
|
|
1457
|
+
async function Ft(i, t, e) {
|
|
1458
|
+
if (!Bt(i))
|
|
1444
1459
|
return i;
|
|
1445
|
-
const r =
|
|
1446
|
-
return
|
|
1460
|
+
const r = gi(i, e);
|
|
1461
|
+
return pi(r).reduce((s, o) => s.then((a) => bi(a, o, t, e)), Promise.resolve(r));
|
|
1447
1462
|
}
|
|
1448
1463
|
async function k(i, t, e) {
|
|
1449
1464
|
var r;
|
|
1450
1465
|
const n = (r = t.style) === null || r === void 0 ? void 0 : r.getPropertyValue(i);
|
|
1451
1466
|
if (n) {
|
|
1452
|
-
const s = await
|
|
1467
|
+
const s = await Ft(n, null, e);
|
|
1453
1468
|
return t.style.setProperty(i, s, t.style.getPropertyPriority(i)), !0;
|
|
1454
1469
|
}
|
|
1455
1470
|
return !1;
|
|
1456
1471
|
}
|
|
1457
|
-
async function
|
|
1472
|
+
async function yi(i, t) {
|
|
1458
1473
|
await k("background", i, t) || await k("background-image", i, t), await k("mask", i, t) || await k("-webkit-mask", i, t) || await k("mask-image", i, t) || await k("-webkit-mask-image", i, t);
|
|
1459
1474
|
}
|
|
1460
|
-
async function
|
|
1461
|
-
const e =
|
|
1462
|
-
if (!(e && !V(i.src)) && !(
|
|
1475
|
+
async function wi(i, t) {
|
|
1476
|
+
const e = p(i, HTMLImageElement);
|
|
1477
|
+
if (!(e && !V(i.src)) && !(p(i, SVGImageElement) && !V(i.href.baseVal)))
|
|
1463
1478
|
return;
|
|
1464
|
-
const r = e ? i.src : i.href.baseVal, n = await
|
|
1479
|
+
const r = e ? i.src : i.href.baseVal, n = await et(r, tt(r), t);
|
|
1465
1480
|
await new Promise((s, o) => {
|
|
1466
1481
|
i.onload = s, i.onerror = t.onImageErrorHandler ? (...l) => {
|
|
1467
1482
|
try {
|
|
@@ -1474,14 +1489,14 @@ async function mi(i, t) {
|
|
|
1474
1489
|
a.decode && (a.decode = s), a.loading === "lazy" && (a.loading = "eager"), e ? (i.srcset = "", i.src = n) : i.href.baseVal = n;
|
|
1475
1490
|
});
|
|
1476
1491
|
}
|
|
1477
|
-
async function
|
|
1478
|
-
const r = x(i.childNodes).map((n) =>
|
|
1492
|
+
async function xi(i, t) {
|
|
1493
|
+
const r = x(i.childNodes).map((n) => Ut(n, t));
|
|
1479
1494
|
await Promise.all(r).then(() => i);
|
|
1480
1495
|
}
|
|
1481
|
-
async function
|
|
1482
|
-
|
|
1496
|
+
async function Ut(i, t) {
|
|
1497
|
+
p(i, Element) && (await yi(i, t), await wi(i, t), await xi(i, t));
|
|
1483
1498
|
}
|
|
1484
|
-
function
|
|
1499
|
+
function vi(i, t) {
|
|
1485
1500
|
const { style: e } = i;
|
|
1486
1501
|
t.backgroundColor && (e.backgroundColor = t.backgroundColor), t.width && (e.width = `${t.width}px`), t.height && (e.height = `${t.height}px`);
|
|
1487
1502
|
const r = t.style;
|
|
@@ -1489,23 +1504,23 @@ function bi(i, t) {
|
|
|
1489
1504
|
e[n] = r[n];
|
|
1490
1505
|
}), i;
|
|
1491
1506
|
}
|
|
1492
|
-
const
|
|
1493
|
-
async function
|
|
1494
|
-
let t =
|
|
1507
|
+
const dt = {};
|
|
1508
|
+
async function ht(i) {
|
|
1509
|
+
let t = dt[i];
|
|
1495
1510
|
if (t != null)
|
|
1496
1511
|
return t;
|
|
1497
1512
|
const r = await (await fetch(i)).text();
|
|
1498
|
-
return t = { url: i, cssText: r },
|
|
1513
|
+
return t = { url: i, cssText: r }, dt[i] = t, t;
|
|
1499
1514
|
}
|
|
1500
|
-
async function
|
|
1515
|
+
async function ut(i, t) {
|
|
1501
1516
|
let e = i.cssText;
|
|
1502
1517
|
const r = /url\(["']?([^"')]+)["']?\)/g, s = (e.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
1503
1518
|
let a = o.replace(r, "$1");
|
|
1504
|
-
return a.startsWith("https://") || (a = new URL(a, i.url).href),
|
|
1519
|
+
return a.startsWith("https://") || (a = new URL(a, i.url).href), Dt(a, t.fetchRequestInit, ({ result: l }) => (e = e.replace(o, `url(${l})`), [o, l]));
|
|
1505
1520
|
});
|
|
1506
1521
|
return Promise.all(s).then(() => e);
|
|
1507
1522
|
}
|
|
1508
|
-
function
|
|
1523
|
+
function mt(i) {
|
|
1509
1524
|
if (i == null)
|
|
1510
1525
|
return [];
|
|
1511
1526
|
const t = [], e = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -1531,7 +1546,7 @@ function ht(i) {
|
|
|
1531
1546
|
}
|
|
1532
1547
|
return t;
|
|
1533
1548
|
}
|
|
1534
|
-
async function
|
|
1549
|
+
async function ki(i, t) {
|
|
1535
1550
|
const e = [], r = [];
|
|
1536
1551
|
return i.forEach((n) => {
|
|
1537
1552
|
if ("cssRules" in n)
|
|
@@ -1539,7 +1554,7 @@ async function pi(i, t) {
|
|
|
1539
1554
|
x(n.cssRules || []).forEach((s, o) => {
|
|
1540
1555
|
if (s.type === CSSRule.IMPORT_RULE) {
|
|
1541
1556
|
let a = o + 1;
|
|
1542
|
-
const l = s.href, c =
|
|
1557
|
+
const l = s.href, c = ht(l).then((d) => ut(d, t)).then((d) => mt(d).forEach((u) => {
|
|
1543
1558
|
try {
|
|
1544
1559
|
n.insertRule(u, u.startsWith("@import") ? a += 1 : n.cssRules.length);
|
|
1545
1560
|
} catch (m) {
|
|
@@ -1556,7 +1571,7 @@ async function pi(i, t) {
|
|
|
1556
1571
|
});
|
|
1557
1572
|
} catch (s) {
|
|
1558
1573
|
const o = i.find((a) => a.href == null) || document.styleSheets[0];
|
|
1559
|
-
n.href != null && r.push(
|
|
1574
|
+
n.href != null && r.push(ht(n.href).then((a) => ut(a, t)).then((a) => mt(a).forEach((l) => {
|
|
1560
1575
|
o.insertRule(l, o.cssRules.length);
|
|
1561
1576
|
})).catch((a) => {
|
|
1562
1577
|
console.error("Error loading remote stylesheet", a);
|
|
@@ -1573,57 +1588,57 @@ async function pi(i, t) {
|
|
|
1573
1588
|
}
|
|
1574
1589
|
}), e));
|
|
1575
1590
|
}
|
|
1576
|
-
function
|
|
1577
|
-
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) =>
|
|
1591
|
+
function Si(i) {
|
|
1592
|
+
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => Bt(t.style.getPropertyValue("src")));
|
|
1578
1593
|
}
|
|
1579
|
-
async function
|
|
1594
|
+
async function Ei(i, t) {
|
|
1580
1595
|
if (i.ownerDocument == null)
|
|
1581
1596
|
throw new Error("Provided element is not within a Document");
|
|
1582
|
-
const e = x(i.ownerDocument.styleSheets), r = await
|
|
1583
|
-
return
|
|
1597
|
+
const e = x(i.ownerDocument.styleSheets), r = await ki(e, t);
|
|
1598
|
+
return Si(r);
|
|
1584
1599
|
}
|
|
1585
|
-
function
|
|
1600
|
+
function Ot(i) {
|
|
1586
1601
|
return i.trim().replace(/["']/g, "");
|
|
1587
1602
|
}
|
|
1588
|
-
function
|
|
1603
|
+
function Ci(i) {
|
|
1589
1604
|
const t = /* @__PURE__ */ new Set();
|
|
1590
1605
|
function e(r) {
|
|
1591
1606
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((s) => {
|
|
1592
|
-
t.add(
|
|
1607
|
+
t.add(Ot(s));
|
|
1593
1608
|
}), Array.from(r.children).forEach((s) => {
|
|
1594
1609
|
s instanceof HTMLElement && e(s);
|
|
1595
1610
|
});
|
|
1596
1611
|
}
|
|
1597
1612
|
return e(i), t;
|
|
1598
1613
|
}
|
|
1599
|
-
async function
|
|
1600
|
-
const e = await
|
|
1601
|
-
return (await Promise.all(e.filter((s) => r.has(
|
|
1614
|
+
async function _i(i, t) {
|
|
1615
|
+
const e = await Ei(i, t), r = Ci(i);
|
|
1616
|
+
return (await Promise.all(e.filter((s) => r.has(Ot(s.style.fontFamily))).map((s) => {
|
|
1602
1617
|
const o = s.parentStyleSheet ? s.parentStyleSheet.href : null;
|
|
1603
|
-
return
|
|
1618
|
+
return Ft(s.cssText, o, t);
|
|
1604
1619
|
}))).join(`
|
|
1605
1620
|
`);
|
|
1606
1621
|
}
|
|
1607
|
-
async function
|
|
1608
|
-
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await
|
|
1622
|
+
async function Ti(i, t) {
|
|
1623
|
+
const e = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await _i(i, t);
|
|
1609
1624
|
if (e) {
|
|
1610
1625
|
const r = document.createElement("style"), n = document.createTextNode(e);
|
|
1611
1626
|
r.appendChild(n), i.firstChild ? i.insertBefore(r, i.firstChild) : i.appendChild(r);
|
|
1612
1627
|
}
|
|
1613
1628
|
}
|
|
1614
|
-
async function
|
|
1615
|
-
const { width: e, height: r } =
|
|
1616
|
-
return await
|
|
1629
|
+
async function Li(i, t = {}) {
|
|
1630
|
+
const { width: e, height: r } = It(i, t), n = await z(i, t, !0);
|
|
1631
|
+
return await Ti(n, t), await Ut(n, t), vi(n, t), await We(n, e, r);
|
|
1617
1632
|
}
|
|
1618
|
-
async function
|
|
1619
|
-
const { width: e, height: r } =
|
|
1620
|
-
return o.width = c * l, o.height = d * l, t.skipAutoScale ||
|
|
1633
|
+
async function Mi(i, t = {}) {
|
|
1634
|
+
const { width: e, height: r } = It(i, t), n = await Li(i, t), s = await B(n), o = document.createElement("canvas"), a = o.getContext("2d"), l = t.pixelRatio || je(), c = t.canvasWidth || e, d = t.canvasHeight || r;
|
|
1635
|
+
return o.width = c * l, o.height = d * l, t.skipAutoScale || qe(o), o.style.width = `${c}`, o.style.height = `${d}`, t.backgroundColor && (a.fillStyle = t.backgroundColor, a.fillRect(0, 0, o.width, o.height)), a.drawImage(s, 0, 0, o.width, o.height), o;
|
|
1621
1636
|
}
|
|
1622
|
-
async function
|
|
1623
|
-
return (await
|
|
1637
|
+
async function Ai(i, t = {}) {
|
|
1638
|
+
return (await Mi(i, t)).toDataURL("image/jpeg", t.quality || 1);
|
|
1624
1639
|
}
|
|
1625
|
-
const q = 400, N = 300,
|
|
1626
|
-
function
|
|
1640
|
+
const q = 400, N = 300, ft = 150, pt = 0.3, bt = 0.85;
|
|
1641
|
+
function Pi(i) {
|
|
1627
1642
|
let t = 1 / 0, e = 1 / 0, r = -1 / 0, n = -1 / 0;
|
|
1628
1643
|
for (const s of i)
|
|
1629
1644
|
if (s.type === "pin") {
|
|
@@ -1632,32 +1647,32 @@ function Ci(i) {
|
|
|
1632
1647
|
t = Math.min(t, o.left), e = Math.min(e, o.top), r = Math.max(r, o.left + o.width), n = Math.max(n, o.bottom);
|
|
1633
1648
|
}
|
|
1634
1649
|
} else if (s.type === "draw" && s.drawPath)
|
|
1635
|
-
for (const o of
|
|
1650
|
+
for (const o of zt(s.drawPath))
|
|
1636
1651
|
for (const [a, l] of o)
|
|
1637
1652
|
t = Math.min(t, a), e = Math.min(e, l), r = Math.max(r, a), n = Math.max(n, l);
|
|
1638
1653
|
return !isFinite(t) || !isFinite(e) ? null : { minX: t, minY: e, maxX: r, maxY: n };
|
|
1639
1654
|
}
|
|
1640
|
-
function
|
|
1641
|
-
const r =
|
|
1655
|
+
function Ri(i, t, e) {
|
|
1656
|
+
const r = Pi(i);
|
|
1642
1657
|
if (!r) return null;
|
|
1643
|
-
const n = Math.max(
|
|
1658
|
+
const n = Math.max(ft, t * pt), s = Math.max(ft, e * pt);
|
|
1644
1659
|
let o = r.minX - n, a = r.minY - s, l = r.maxX - r.minX + n * 2, c = r.maxY - r.minY + s * 2;
|
|
1645
|
-
return l < q && (o -= (q - l) / 2, l = q), c < N && (a -= (N - c) / 2, c = N), o = Math.max(0, o), a = Math.max(0, a), l = Math.min(l, t - o), c = Math.min(c, e - a), l >= t *
|
|
1660
|
+
return l < q && (o -= (q - l) / 2, l = q), c < N && (a -= (N - c) / 2, c = N), o = Math.max(0, o), a = Math.max(0, a), l = Math.min(l, t - o), c = Math.min(c, e - a), l >= t * bt && c >= e * bt ? null : {
|
|
1646
1661
|
x: Math.round(o),
|
|
1647
1662
|
y: Math.round(a),
|
|
1648
1663
|
width: Math.round(l),
|
|
1649
1664
|
height: Math.round(c)
|
|
1650
1665
|
};
|
|
1651
1666
|
}
|
|
1652
|
-
function
|
|
1667
|
+
function Ii(i, t) {
|
|
1653
1668
|
const e = document.createElement("canvas");
|
|
1654
1669
|
e.width = t.width, e.height = t.height;
|
|
1655
1670
|
const r = e.getContext("2d");
|
|
1656
1671
|
return r && r.drawImage(i, t.x, t.y, t.width, t.height, 0, 0, t.width, t.height), e;
|
|
1657
1672
|
}
|
|
1658
|
-
async function
|
|
1673
|
+
async function Di(i = []) {
|
|
1659
1674
|
try {
|
|
1660
|
-
const t =
|
|
1675
|
+
const t = Bi(document.body), e = await Ai(document.body, {
|
|
1661
1676
|
quality: 0.85,
|
|
1662
1677
|
pixelRatio: 1,
|
|
1663
1678
|
backgroundColor: "#ffffff",
|
|
@@ -1666,30 +1681,30 @@ async function Li(i = []) {
|
|
|
1666
1681
|
filter: (r) => !(r instanceof HTMLElement && r.id === "mtb-widget-host")
|
|
1667
1682
|
});
|
|
1668
1683
|
if (i.length > 0) {
|
|
1669
|
-
const r = await
|
|
1684
|
+
const r = await Hi(e, i, t);
|
|
1670
1685
|
if (r) return r;
|
|
1671
1686
|
}
|
|
1672
|
-
return
|
|
1687
|
+
return Oi(e);
|
|
1673
1688
|
} catch {
|
|
1674
1689
|
return null;
|
|
1675
1690
|
}
|
|
1676
1691
|
}
|
|
1677
|
-
async function
|
|
1692
|
+
async function Hi(i, t, e) {
|
|
1678
1693
|
const r = document.createElement("canvas"), n = r.getContext("2d");
|
|
1679
1694
|
if (!n) return null;
|
|
1680
|
-
const s = await
|
|
1695
|
+
const s = await Ui(i);
|
|
1681
1696
|
if (!s) return null;
|
|
1682
1697
|
r.width = s.naturalWidth || window.innerWidth, r.height = s.naturalHeight || window.innerHeight, n.drawImage(s, 0, 0);
|
|
1683
1698
|
const o = r.width / e.width, a = r.height / e.height;
|
|
1684
1699
|
let l = 0;
|
|
1685
1700
|
for (const d of t)
|
|
1686
|
-
d.type === "draw" && d.drawPath ?
|
|
1701
|
+
d.type === "draw" && d.drawPath ? $i(n, d.drawPath, e, o, a) : d.type === "pin" && Fi(
|
|
1687
1702
|
n,
|
|
1688
1703
|
(d.x - e.left) * o,
|
|
1689
1704
|
(d.y - e.top) * a,
|
|
1690
1705
|
++l
|
|
1691
1706
|
);
|
|
1692
|
-
const c =
|
|
1707
|
+
const c = Ri(t, window.innerWidth, window.innerHeight);
|
|
1693
1708
|
if (c) {
|
|
1694
1709
|
const d = Math.max(0, Math.round((c.x - e.left) * o)), u = Math.max(0, Math.round((c.y - e.top) * a)), m = Math.min(r.width, Math.round((c.x + c.width - e.left) * o)), g = Math.min(r.height, Math.round((c.y + c.height - e.top) * a)), y = {
|
|
1695
1710
|
x: d,
|
|
@@ -1697,13 +1712,13 @@ async function Mi(i, t, e) {
|
|
|
1697
1712
|
width: m - d,
|
|
1698
1713
|
height: g - u
|
|
1699
1714
|
};
|
|
1700
|
-
return
|
|
1715
|
+
return gt(Ii(r, y));
|
|
1701
1716
|
}
|
|
1702
|
-
return
|
|
1717
|
+
return gt(r);
|
|
1703
1718
|
}
|
|
1704
|
-
function
|
|
1705
|
-
i.save(), i.strokeStyle =
|
|
1706
|
-
for (const s of
|
|
1719
|
+
function $i(i, t, e, r, n) {
|
|
1720
|
+
i.save(), i.strokeStyle = O, i.lineWidth = 3.5, i.lineCap = "round", i.lineJoin = "round", i.shadowColor = Q(0.35), i.shadowOffsetY = 1, i.shadowBlur = 2;
|
|
1721
|
+
for (const s of zt(t))
|
|
1707
1722
|
if (s.length !== 0) {
|
|
1708
1723
|
i.beginPath(), i.moveTo(
|
|
1709
1724
|
(s[0][0] - e.left) * r,
|
|
@@ -1718,7 +1733,7 @@ function Pi(i, t, e, r, n) {
|
|
|
1718
1733
|
}
|
|
1719
1734
|
i.restore();
|
|
1720
1735
|
}
|
|
1721
|
-
function
|
|
1736
|
+
function Bi(i) {
|
|
1722
1737
|
const t = i.getBoundingClientRect(), e = window.getComputedStyle(i), r = parseFloat(e.borderLeftWidth) + parseFloat(e.borderRightWidth), n = parseFloat(e.borderTopWidth) + parseFloat(e.borderBottomWidth);
|
|
1723
1738
|
return {
|
|
1724
1739
|
left: t.left,
|
|
@@ -1727,10 +1742,10 @@ function Ai(i) {
|
|
|
1727
1742
|
height: i.clientHeight + (Number.isFinite(n) ? n : 0) || window.innerHeight
|
|
1728
1743
|
};
|
|
1729
1744
|
}
|
|
1730
|
-
function
|
|
1731
|
-
i.save(), i.shadowColor =
|
|
1745
|
+
function Fi(i, t, e, r) {
|
|
1746
|
+
i.save(), i.shadowColor = Q(0.45), i.shadowOffsetY = 2, i.shadowBlur = 8, i.fillStyle = O, i.beginPath(), i.arc(t, e, 11, 0, Math.PI * 2), i.fill(), i.shadowColor = "transparent", i.lineWidth = 2, i.strokeStyle = "#ffffff", i.stroke(), i.fillStyle = "#ffffff", i.font = `700 10px ${de}`, i.textAlign = "center", i.textBaseline = "middle", i.fillText(String(r), t, e), i.restore();
|
|
1732
1747
|
}
|
|
1733
|
-
function
|
|
1748
|
+
function zt(i) {
|
|
1734
1749
|
const t = [];
|
|
1735
1750
|
let e = null;
|
|
1736
1751
|
const r = i.match(/[ML]\s*[-\d.]+\s+[-\d.]+/g) ?? [];
|
|
@@ -1740,13 +1755,13 @@ function Ut(i) {
|
|
|
1740
1755
|
}
|
|
1741
1756
|
return t;
|
|
1742
1757
|
}
|
|
1743
|
-
function
|
|
1758
|
+
function Ui(i) {
|
|
1744
1759
|
return new Promise((t) => {
|
|
1745
1760
|
const e = new Image();
|
|
1746
1761
|
e.onload = () => t(e), e.onerror = () => t(null), e.src = i;
|
|
1747
1762
|
});
|
|
1748
1763
|
}
|
|
1749
|
-
function
|
|
1764
|
+
function gt(i) {
|
|
1750
1765
|
return new Promise((t) => {
|
|
1751
1766
|
try {
|
|
1752
1767
|
i.toBlob((e) => t(e), "image/jpeg", 0.85);
|
|
@@ -1755,13 +1770,13 @@ function bt(i) {
|
|
|
1755
1770
|
}
|
|
1756
1771
|
});
|
|
1757
1772
|
}
|
|
1758
|
-
function
|
|
1773
|
+
function Oi(i) {
|
|
1759
1774
|
const [t, e] = i.split(","), r = t.match(/:(.*?);/)?.[1] ?? "image/png", n = atob(e), s = new Uint8Array(n.length);
|
|
1760
1775
|
for (let o = 0; o < n.length; o++)
|
|
1761
1776
|
s[o] = n.charCodeAt(o);
|
|
1762
1777
|
return new Blob([s], { type: r });
|
|
1763
1778
|
}
|
|
1764
|
-
class
|
|
1779
|
+
class zi {
|
|
1765
1780
|
constructor() {
|
|
1766
1781
|
this.listeners = /* @__PURE__ */ new Set(), this.originalOnError = null, this.installedOnError = null, this.rejectionHandler = null, this.hooked = !1;
|
|
1767
1782
|
}
|
|
@@ -1783,20 +1798,20 @@ class Hi {
|
|
|
1783
1798
|
for (const e of this.listeners) e(t);
|
|
1784
1799
|
}
|
|
1785
1800
|
}
|
|
1786
|
-
const
|
|
1787
|
-
class
|
|
1801
|
+
const it = new zi(), ji = 20;
|
|
1802
|
+
class qi {
|
|
1788
1803
|
constructor() {
|
|
1789
1804
|
this.errors = [], this.unsubscribe = null;
|
|
1790
1805
|
}
|
|
1791
1806
|
start() {
|
|
1792
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1807
|
+
this.unsubscribe || (this.unsubscribe = it.subscribe((t) => this.record(t)));
|
|
1793
1808
|
}
|
|
1794
1809
|
record(t) {
|
|
1795
1810
|
const e = t.line != null ? ` (${t.line}:${t.col ?? 0})` : "";
|
|
1796
1811
|
this.addError(`${t.message}${e}`);
|
|
1797
1812
|
}
|
|
1798
1813
|
addError(t) {
|
|
1799
|
-
this.errors.length >=
|
|
1814
|
+
this.errors.length >= ji || this.errors.includes(t) || this.errors.push(t);
|
|
1800
1815
|
}
|
|
1801
1816
|
getErrors() {
|
|
1802
1817
|
return [...this.errors];
|
|
@@ -1806,12 +1821,12 @@ class Bi {
|
|
|
1806
1821
|
}
|
|
1807
1822
|
}
|
|
1808
1823
|
const D = /* @__PURE__ */ new Set();
|
|
1809
|
-
let L = null, M = null,
|
|
1810
|
-
function
|
|
1811
|
-
D.add(i),
|
|
1824
|
+
let L = null, M = null, A = null, F = null, P = null;
|
|
1825
|
+
function jt(i) {
|
|
1826
|
+
D.add(i), Ni();
|
|
1812
1827
|
let t = !1;
|
|
1813
1828
|
return () => {
|
|
1814
|
-
t || (t = !0, D.delete(i), D.size === 0 &&
|
|
1829
|
+
t || (t = !0, D.delete(i), D.size === 0 && Wi());
|
|
1815
1830
|
};
|
|
1816
1831
|
}
|
|
1817
1832
|
function W() {
|
|
@@ -1821,26 +1836,26 @@ function W() {
|
|
|
1821
1836
|
} catch {
|
|
1822
1837
|
}
|
|
1823
1838
|
}
|
|
1824
|
-
function
|
|
1825
|
-
if (
|
|
1826
|
-
|
|
1839
|
+
function Ni() {
|
|
1840
|
+
if (A) return;
|
|
1841
|
+
P = () => W(), window.addEventListener("popstate", P), L = history.pushState, M = history.replaceState;
|
|
1827
1842
|
const i = L, t = M;
|
|
1828
|
-
|
|
1843
|
+
A = function(e, r, n) {
|
|
1829
1844
|
i.call(history, e, r, n), W();
|
|
1830
1845
|
}, F = function(e, r, n) {
|
|
1831
1846
|
t.call(history, e, r, n), W();
|
|
1832
|
-
}, history.pushState =
|
|
1847
|
+
}, history.pushState = A, history.replaceState = F;
|
|
1833
1848
|
}
|
|
1834
|
-
function
|
|
1835
|
-
|
|
1849
|
+
function Wi() {
|
|
1850
|
+
P && (window.removeEventListener("popstate", P), P = null), L && history.pushState === A && (history.pushState = L), M && history.replaceState === F && (history.replaceState = M), L = null, M = null, A = null, F = null;
|
|
1836
1851
|
}
|
|
1837
|
-
const
|
|
1838
|
-
class
|
|
1852
|
+
const Vi = 20;
|
|
1853
|
+
class Yi {
|
|
1839
1854
|
constructor() {
|
|
1840
1855
|
this.breadcrumbs = [], this.active = !1, this.unsubscribeErrors = null, this.unsubscribeNavigation = null, this.lastUrl = "", this.boundClickHandler = (t) => this.handleClick(t), this.boundChangeHandler = (t) => this.handleChange(t);
|
|
1841
1856
|
}
|
|
1842
1857
|
start() {
|
|
1843
|
-
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors =
|
|
1858
|
+
this.active || (this.active = !0, this.lastUrl = location.href, document.addEventListener("click", this.boundClickHandler, { capture: !0, passive: !0 }), document.addEventListener("change", this.boundChangeHandler, { capture: !0, passive: !0 }), this.unsubscribeErrors = it.subscribe((t) => this.recordError(t)), this.unsubscribeNavigation = jt(() => this.handleNavigation()));
|
|
1844
1859
|
}
|
|
1845
1860
|
stop() {
|
|
1846
1861
|
this.active && (this.active = !1, document.removeEventListener("click", this.boundClickHandler, !0), document.removeEventListener("change", this.boundChangeHandler, !0), this.unsubscribeErrors?.(), this.unsubscribeErrors = null, this.unsubscribeNavigation?.(), this.unsubscribeNavigation = null);
|
|
@@ -1849,7 +1864,7 @@ class Oi {
|
|
|
1849
1864
|
return [...this.breadcrumbs];
|
|
1850
1865
|
}
|
|
1851
1866
|
add(t) {
|
|
1852
|
-
this.breadcrumbs.push(t), this.breadcrumbs.length >
|
|
1867
|
+
this.breadcrumbs.push(t), this.breadcrumbs.length > Vi && this.breadcrumbs.shift();
|
|
1853
1868
|
}
|
|
1854
1869
|
handleClick(t) {
|
|
1855
1870
|
const e = t.target;
|
|
@@ -1859,8 +1874,8 @@ class Oi {
|
|
|
1859
1874
|
type: "ui",
|
|
1860
1875
|
category: "ui.click",
|
|
1861
1876
|
timestamp: Date.now(),
|
|
1862
|
-
message:
|
|
1863
|
-
data: { selector:
|
|
1877
|
+
message: J(e),
|
|
1878
|
+
data: { selector: At(e) }
|
|
1864
1879
|
});
|
|
1865
1880
|
} catch {
|
|
1866
1881
|
}
|
|
@@ -1901,29 +1916,29 @@ class Oi {
|
|
|
1901
1916
|
}));
|
|
1902
1917
|
}
|
|
1903
1918
|
}
|
|
1904
|
-
const
|
|
1919
|
+
const qt = "mtb_frustration_state";
|
|
1905
1920
|
let Y = null;
|
|
1906
1921
|
function U() {
|
|
1907
1922
|
try {
|
|
1908
|
-
const i = window.sessionStorage.getItem(
|
|
1923
|
+
const i = window.sessionStorage.getItem(qt);
|
|
1909
1924
|
return H(i ? JSON.parse(i) : Y);
|
|
1910
1925
|
} catch {
|
|
1911
1926
|
return H(Y);
|
|
1912
1927
|
}
|
|
1913
1928
|
}
|
|
1914
|
-
function
|
|
1929
|
+
function Nt(i) {
|
|
1915
1930
|
const t = H(i);
|
|
1916
1931
|
Y = t;
|
|
1917
1932
|
try {
|
|
1918
|
-
window.sessionStorage.setItem(
|
|
1933
|
+
window.sessionStorage.setItem(qt, JSON.stringify(t));
|
|
1919
1934
|
} catch {
|
|
1920
1935
|
}
|
|
1921
1936
|
}
|
|
1922
|
-
function
|
|
1937
|
+
function Xi() {
|
|
1923
1938
|
return U().dismissedByUser;
|
|
1924
1939
|
}
|
|
1925
|
-
function
|
|
1926
|
-
|
|
1940
|
+
function Ki() {
|
|
1941
|
+
Nt({ ...U(), dismissedByUser: !0 });
|
|
1927
1942
|
}
|
|
1928
1943
|
function H(i) {
|
|
1929
1944
|
const t = i ?? {};
|
|
@@ -1934,7 +1949,7 @@ function H(i) {
|
|
|
1934
1949
|
dismissedByUser: t.dismissedByUser === !0
|
|
1935
1950
|
};
|
|
1936
1951
|
}
|
|
1937
|
-
const
|
|
1952
|
+
const Gi = 3, Ji = 1e3, Qi = 3, Zi = 5e3, yt = 500, tr = 500, er = 300, ir = /* @__PURE__ */ new Set([
|
|
1938
1953
|
"A",
|
|
1939
1954
|
"BUTTON",
|
|
1940
1955
|
"INPUT",
|
|
@@ -1943,7 +1958,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
1943
1958
|
"LABEL",
|
|
1944
1959
|
"SUMMARY",
|
|
1945
1960
|
"DETAILS"
|
|
1946
|
-
]),
|
|
1961
|
+
]), rr = /* @__PURE__ */ new Set([
|
|
1947
1962
|
"button",
|
|
1948
1963
|
"link",
|
|
1949
1964
|
"checkbox",
|
|
@@ -1957,7 +1972,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
1957
1972
|
"listbox",
|
|
1958
1973
|
"slider",
|
|
1959
1974
|
"spinbutton"
|
|
1960
|
-
]),
|
|
1975
|
+
]), wt = [
|
|
1961
1976
|
"404",
|
|
1962
1977
|
"500",
|
|
1963
1978
|
"not found",
|
|
@@ -1969,7 +1984,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
1969
1984
|
this.clickHistory = [], this.unsubscribeErrors = null, this.active = !1, this.errorCount = 0, this.deadClickCount = 0, this.cooldownUntil = 0, this.navTimestamps = [], this.unsubscribeNavigation = null, this.boundPageLeaveHandler = null, this.lastNavigationAt = -1, this.boundSubmitHandler = null, this.boundInvalidHandler = null, this.recentSubmitForms = /* @__PURE__ */ new WeakSet(), this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.onFrustration = t, this.boundClickHandler = (e) => this.handleClick(e);
|
|
1970
1985
|
}
|
|
1971
1986
|
start() {
|
|
1972
|
-
this.active || (this.active = !0, this.restoreState(), document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors =
|
|
1987
|
+
this.active || (this.active = !0, this.restoreState(), document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = it.subscribe((t) => {
|
|
1973
1988
|
this.errorCount++;
|
|
1974
1989
|
}), this.startNavigationTracking(), this.startFormTracking(), this.checkErrorPage());
|
|
1975
1990
|
}
|
|
@@ -1977,7 +1992,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
1977
1992
|
this.active && (this.active = !1, document.removeEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors?.(), this.unsubscribeErrors = null, this.clickHistory = [], this.stopNavigationTracking(), this.stopFormTracking(), this.errorPageUrls.clear(), this.disconnectDomObserver());
|
|
1978
1993
|
}
|
|
1979
1994
|
startNavigationTracking() {
|
|
1980
|
-
this.unsubscribeNavigation =
|
|
1995
|
+
this.unsubscribeNavigation = jt(() => this.handleNavigation()), this.boundPageLeaveHandler = () => this.noteNavigationStarted(), window.addEventListener("beforeunload", this.boundPageLeaveHandler), window.addEventListener("pagehide", this.boundPageLeaveHandler);
|
|
1981
1996
|
}
|
|
1982
1997
|
stopNavigationTracking() {
|
|
1983
1998
|
this.unsubscribeNavigation?.(), this.unsubscribeNavigation = null, this.navTimestamps = [], this.boundPageLeaveHandler && (window.removeEventListener("beforeunload", this.boundPageLeaveHandler), window.removeEventListener("pagehide", this.boundPageLeaveHandler), this.boundPageLeaveHandler = null), this.lastNavigationAt = -1;
|
|
@@ -1995,7 +2010,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
1995
2010
|
}
|
|
1996
2011
|
persistState() {
|
|
1997
2012
|
const t = U();
|
|
1998
|
-
|
|
2013
|
+
Nt({
|
|
1999
2014
|
...t,
|
|
2000
2015
|
navTimestamps: this.navTimestamps,
|
|
2001
2016
|
cooldownUntil: this.cooldownUntil,
|
|
@@ -2014,8 +2029,8 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2014
2029
|
this.trackFormSubmitIntent(e);
|
|
2015
2030
|
const r = Date.now();
|
|
2016
2031
|
this.clickHistory.push({ target: e, time: r });
|
|
2017
|
-
const n = r -
|
|
2018
|
-
if (this.clickHistory = this.clickHistory.filter((o) => o.time > n), this.clickHistory.filter((o) => o.target === e).length >=
|
|
2032
|
+
const n = r - Ji;
|
|
2033
|
+
if (this.clickHistory = this.clickHistory.filter((o) => o.time > n), this.clickHistory.filter((o) => o.target === e).length >= Gi) {
|
|
2019
2034
|
this.clickHistory = [], this.emitHighPriority({
|
|
2020
2035
|
signal: "rage_click",
|
|
2021
2036
|
target: _(e),
|
|
@@ -2032,13 +2047,13 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2032
2047
|
handleNavigation() {
|
|
2033
2048
|
const t = Date.now();
|
|
2034
2049
|
this.noteNavigationStarted(), this.navTimestamps.push(t);
|
|
2035
|
-
const e = t -
|
|
2036
|
-
this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >=
|
|
2050
|
+
const e = t - Zi;
|
|
2051
|
+
this.navTimestamps = this.navTimestamps.filter((r) => r > e), this.navTimestamps.length >= Qi && (this.navTimestamps = [], this.emitIfReady({
|
|
2037
2052
|
signal: "rapid_navigation",
|
|
2038
2053
|
timestamp: t
|
|
2039
2054
|
})), this.persistState(), setTimeout(() => {
|
|
2040
2055
|
this.active && this.checkErrorPage();
|
|
2041
|
-
},
|
|
2056
|
+
}, er);
|
|
2042
2057
|
}
|
|
2043
2058
|
handleFormSubmit(t) {
|
|
2044
2059
|
const e = t.target;
|
|
@@ -2048,7 +2063,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2048
2063
|
target: _(e),
|
|
2049
2064
|
timestamp: Date.now()
|
|
2050
2065
|
});
|
|
2051
|
-
},
|
|
2066
|
+
}, yt)));
|
|
2052
2067
|
}
|
|
2053
2068
|
trackFormSubmitIntent(t) {
|
|
2054
2069
|
const e = t.closest("button, input");
|
|
@@ -2057,7 +2072,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2057
2072
|
rememberSubmitAttempt(t) {
|
|
2058
2073
|
this.recentSubmitForms.add(t), setTimeout(() => {
|
|
2059
2074
|
this.recentSubmitForms.delete(t);
|
|
2060
|
-
},
|
|
2075
|
+
}, yt);
|
|
2061
2076
|
}
|
|
2062
2077
|
handleFormInvalid(t) {
|
|
2063
2078
|
const e = t.target;
|
|
@@ -2073,7 +2088,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2073
2088
|
const t = location.href;
|
|
2074
2089
|
if (this.errorPageUrls.has(t)) return;
|
|
2075
2090
|
const e = document.title.toLowerCase();
|
|
2076
|
-
if (
|
|
2091
|
+
if (wt.some((n) => e.includes(n))) {
|
|
2077
2092
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
2078
2093
|
signal: "error_page",
|
|
2079
2094
|
detail: document.title,
|
|
@@ -2086,7 +2101,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2086
2101
|
);
|
|
2087
2102
|
for (const n of r) {
|
|
2088
2103
|
const s = n.textContent ?? "";
|
|
2089
|
-
if (s.length < 200 &&
|
|
2104
|
+
if (s.length < 200 && wt.some((o) => s.toLowerCase().includes(o))) {
|
|
2090
2105
|
this.errorPageUrls.add(t), this.emitHighPriority({
|
|
2091
2106
|
signal: "error_page",
|
|
2092
2107
|
detail: s.trim().slice(0, 60),
|
|
@@ -2108,7 +2123,7 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2108
2123
|
target: _(t),
|
|
2109
2124
|
timestamp: e
|
|
2110
2125
|
});
|
|
2111
|
-
},
|
|
2126
|
+
}, tr));
|
|
2112
2127
|
}
|
|
2113
2128
|
ensureDomObserver() {
|
|
2114
2129
|
this.domObserver || (this.domObserver = new MutationObserver(() => {
|
|
@@ -2133,9 +2148,9 @@ const Ni = 3, Wi = 1e3, Vi = 3, Yi = 5e3, pt = 500, Xi = 500, Ki = 300, Gi = /*
|
|
|
2133
2148
|
return !1;
|
|
2134
2149
|
}
|
|
2135
2150
|
isInteractive(t) {
|
|
2136
|
-
if (
|
|
2151
|
+
if (ir.has(t.tagName)) return !0;
|
|
2137
2152
|
const e = t.getAttribute("role");
|
|
2138
|
-
return !!(e &&
|
|
2153
|
+
return !!(e && rr.has(e) || t.hasAttribute("onclick") || t.hasAttribute("tabindex") || t.contentEditable === "true" || window.getComputedStyle(t).cursor === "pointer" || t.closest('a, button, [role="button"], [role="link"], label'));
|
|
2139
2154
|
}
|
|
2140
2155
|
emitIfReady(t) {
|
|
2141
2156
|
const e = Date.now();
|
|
@@ -2151,25 +2166,25 @@ function _(i) {
|
|
|
2151
2166
|
const t = i.tagName.toLowerCase(), e = i.id ? `#${i.id}` : "", r = i.className && typeof i.className == "string" ? "." + i.className.trim().split(/\s+/).slice(0, 2).join(".") : "", n = i.textContent?.trim().slice(0, 30) ?? "";
|
|
2152
2167
|
return `<${t}${e}${r}>${n ? ` "${n}"` : ""}`;
|
|
2153
2168
|
}
|
|
2154
|
-
function
|
|
2169
|
+
function nr() {
|
|
2155
2170
|
return {
|
|
2156
2171
|
page_url: window.location.href,
|
|
2157
2172
|
user_agent: navigator.userAgent,
|
|
2158
|
-
browser:
|
|
2159
|
-
os:
|
|
2173
|
+
browser: sr(),
|
|
2174
|
+
os: or(),
|
|
2160
2175
|
screen_width: window.screen.width,
|
|
2161
2176
|
screen_height: window.screen.height
|
|
2162
2177
|
};
|
|
2163
2178
|
}
|
|
2164
|
-
function
|
|
2179
|
+
function sr() {
|
|
2165
2180
|
const i = navigator.userAgent;
|
|
2166
2181
|
return /Edg\//.test(i) ? `Edge ${i.match(/Edg\/(\S+)/)?.[1] ?? ""}` : /OPR\//.test(i) ? `Opera ${i.match(/OPR\/(\S+)/)?.[1] ?? ""}` : /Chrome\//.test(i) ? `Chrome ${i.match(/Chrome\/(\S+)/)?.[1] ?? ""}` : /Safari\//.test(i) && /Version\//.test(i) ? `Safari ${i.match(/Version\/(\S+)/)?.[1] ?? ""}` : /Firefox\//.test(i) ? `Firefox ${i.match(/Firefox\/(\S+)/)?.[1] ?? ""}` : "Unknown";
|
|
2167
2182
|
}
|
|
2168
|
-
function
|
|
2183
|
+
function or() {
|
|
2169
2184
|
const i = navigator.userAgent;
|
|
2170
2185
|
return /Windows NT 10/.test(i) ? "Windows 10/11" : /Windows NT/.test(i) ? "Windows" : /Mac OS X 10_15|macOS 1[56789]/.test(i) || /Mac OS X/.test(i) ? "macOS" : /Android/.test(i) ? `Android ${i.match(/Android (\d+)/)?.[1] ?? ""}` : /iPhone|iPad|iPod/.test(i) ? "iOS" : /Linux/.test(i) ? "Linux" : "Unknown";
|
|
2171
2186
|
}
|
|
2172
|
-
function
|
|
2187
|
+
function ar(i, t, e, r, n, s, o, a, l) {
|
|
2173
2188
|
return {
|
|
2174
2189
|
description: i,
|
|
2175
2190
|
...t,
|
|
@@ -2190,50 +2205,50 @@ function er(i, t, e, r, n, s, o, a, l) {
|
|
|
2190
2205
|
breadcrumbs: l
|
|
2191
2206
|
};
|
|
2192
2207
|
}
|
|
2193
|
-
const
|
|
2194
|
-
let
|
|
2195
|
-
function
|
|
2208
|
+
const xt = "mtb_anon_id", Wt = "mtb_reporter_email", Vt = "mtb_board_url";
|
|
2209
|
+
let vt = null, Yt = null, Xt = null;
|
|
2210
|
+
function kt() {
|
|
2196
2211
|
try {
|
|
2197
|
-
const i = window.localStorage.getItem(
|
|
2212
|
+
const i = window.localStorage.getItem(xt);
|
|
2198
2213
|
if (i?.startsWith("anon_")) return i;
|
|
2199
|
-
const t =
|
|
2200
|
-
return window.localStorage.setItem(
|
|
2214
|
+
const t = Ct();
|
|
2215
|
+
return window.localStorage.setItem(xt, t), t;
|
|
2201
2216
|
} catch {
|
|
2202
|
-
return
|
|
2217
|
+
return vt ?? (vt = Ct()), vt;
|
|
2203
2218
|
}
|
|
2204
2219
|
}
|
|
2205
|
-
function
|
|
2220
|
+
function St() {
|
|
2206
2221
|
try {
|
|
2207
|
-
return window.localStorage.getItem(
|
|
2222
|
+
return window.localStorage.getItem(Wt) ?? void 0;
|
|
2208
2223
|
} catch {
|
|
2209
|
-
return
|
|
2224
|
+
return Yt ?? void 0;
|
|
2210
2225
|
}
|
|
2211
2226
|
}
|
|
2212
|
-
function
|
|
2213
|
-
|
|
2227
|
+
function lr(i) {
|
|
2228
|
+
Yt = i;
|
|
2214
2229
|
try {
|
|
2215
|
-
window.localStorage.setItem(
|
|
2230
|
+
window.localStorage.setItem(Wt, i);
|
|
2216
2231
|
} catch {
|
|
2217
2232
|
}
|
|
2218
2233
|
}
|
|
2219
|
-
function
|
|
2234
|
+
function cr() {
|
|
2220
2235
|
try {
|
|
2221
|
-
return window.localStorage.getItem(
|
|
2236
|
+
return window.localStorage.getItem(Vt) ?? void 0;
|
|
2222
2237
|
} catch {
|
|
2223
|
-
return
|
|
2238
|
+
return Xt ?? void 0;
|
|
2224
2239
|
}
|
|
2225
2240
|
}
|
|
2226
|
-
function
|
|
2227
|
-
|
|
2241
|
+
function Et(i) {
|
|
2242
|
+
Xt = i;
|
|
2228
2243
|
try {
|
|
2229
|
-
window.localStorage.setItem(
|
|
2244
|
+
window.localStorage.setItem(Vt, i);
|
|
2230
2245
|
} catch {
|
|
2231
2246
|
}
|
|
2232
2247
|
}
|
|
2233
|
-
function
|
|
2248
|
+
function Ct() {
|
|
2234
2249
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `anon_${crypto.randomUUID()}` : `anon_${`${Date.now().toString(16)}-${Math.random().toString(16).slice(2, 10)}`}`;
|
|
2235
2250
|
}
|
|
2236
|
-
const
|
|
2251
|
+
const dr = {
|
|
2237
2252
|
tab: "Feedback",
|
|
2238
2253
|
toolbar: {
|
|
2239
2254
|
markup: "Mark up",
|
|
@@ -2310,7 +2325,7 @@ const nr = {
|
|
|
2310
2325
|
error: "AI clarification failed. Please try again.",
|
|
2311
2326
|
expired: "This feedback session expired before it could be sent. Please close the widget and submit again."
|
|
2312
2327
|
}
|
|
2313
|
-
},
|
|
2328
|
+
}, hr = {
|
|
2314
2329
|
tab: "反馈",
|
|
2315
2330
|
toolbar: {
|
|
2316
2331
|
markup: "标注",
|
|
@@ -2387,7 +2402,7 @@ const nr = {
|
|
|
2387
2402
|
error: "AI 澄清失败,请重试。",
|
|
2388
2403
|
expired: "这条反馈在发送前已过期。请关闭组件后重新提交。"
|
|
2389
2404
|
}
|
|
2390
|
-
},
|
|
2405
|
+
}, ur = {
|
|
2391
2406
|
tab: "フィードバック",
|
|
2392
2407
|
toolbar: {
|
|
2393
2408
|
markup: "マークアップ",
|
|
@@ -2464,7 +2479,7 @@ const nr = {
|
|
|
2464
2479
|
error: "AIによる確認に失敗しました。もう一度お試しください。",
|
|
2465
2480
|
expired: "このフィードバックは送信される前に有効期限が切れました。ウィジェットを閉じて、もう一度送信してください。"
|
|
2466
2481
|
}
|
|
2467
|
-
},
|
|
2482
|
+
}, mr = {
|
|
2468
2483
|
tab: "피드백",
|
|
2469
2484
|
toolbar: {
|
|
2470
2485
|
markup: "마크업",
|
|
@@ -2541,7 +2556,7 @@ const nr = {
|
|
|
2541
2556
|
error: "AI 확인에 실패했습니다. 다시 시도해 주세요.",
|
|
2542
2557
|
expired: "이 피드백 세션은 전송되기 전에 만료되었습니다. 위젯을 닫고 다시 보내 주세요."
|
|
2543
2558
|
}
|
|
2544
|
-
},
|
|
2559
|
+
}, fr = {
|
|
2545
2560
|
tab: "Comentarios",
|
|
2546
2561
|
toolbar: {
|
|
2547
2562
|
markup: "Anotar",
|
|
@@ -2618,7 +2633,7 @@ const nr = {
|
|
|
2618
2633
|
error: "No se pudo completar la aclaración con IA. Inténtalo de nuevo.",
|
|
2619
2634
|
expired: "Esta sesión de comentarios caducó antes de poder enviarse. Cierra el widget y envíalo de nuevo."
|
|
2620
2635
|
}
|
|
2621
|
-
},
|
|
2636
|
+
}, pr = {
|
|
2622
2637
|
tab: "Avis",
|
|
2623
2638
|
toolbar: {
|
|
2624
2639
|
markup: "Annoter",
|
|
@@ -2695,7 +2710,7 @@ const nr = {
|
|
|
2695
2710
|
error: "La clarification par IA a échoué. Réessayez.",
|
|
2696
2711
|
expired: "Cette session de retour a expiré avant d'avoir pu être envoyée. Fermez le widget et renvoyez-la."
|
|
2697
2712
|
}
|
|
2698
|
-
},
|
|
2713
|
+
}, br = {
|
|
2699
2714
|
tab: "Feedback",
|
|
2700
2715
|
toolbar: {
|
|
2701
2716
|
markup: "Markieren",
|
|
@@ -2773,51 +2788,51 @@ const nr = {
|
|
|
2773
2788
|
expired: "Diese Feedback-Sitzung ist abgelaufen, bevor sie gesendet werden konnte. Bitte schließe das Widget und sende erneut."
|
|
2774
2789
|
}
|
|
2775
2790
|
}, T = {
|
|
2776
|
-
en:
|
|
2777
|
-
"zh-CN":
|
|
2778
|
-
ja:
|
|
2779
|
-
ko:
|
|
2780
|
-
es:
|
|
2781
|
-
fr:
|
|
2782
|
-
de:
|
|
2791
|
+
en: dr,
|
|
2792
|
+
"zh-CN": hr,
|
|
2793
|
+
ja: ur,
|
|
2794
|
+
ko: mr,
|
|
2795
|
+
es: fr,
|
|
2796
|
+
fr: pr,
|
|
2797
|
+
de: br
|
|
2783
2798
|
};
|
|
2784
|
-
function
|
|
2799
|
+
function _t(i) {
|
|
2785
2800
|
if (T[i]) return T[i];
|
|
2786
2801
|
const t = i.split("-")[0];
|
|
2787
2802
|
return T[t] ? T[t] : T.en;
|
|
2788
2803
|
}
|
|
2789
|
-
const
|
|
2804
|
+
const gr = 60, yr = "rr-block", wr = "rr-mask", xr = "https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js", vr = "sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";
|
|
2790
2805
|
let I = null;
|
|
2791
|
-
function
|
|
2792
|
-
return I || (I =
|
|
2806
|
+
function kr() {
|
|
2807
|
+
return I || (I = Sr().catch(() => Er()), I);
|
|
2793
2808
|
}
|
|
2794
|
-
async function
|
|
2809
|
+
async function Sr() {
|
|
2795
2810
|
return (await import("@rrweb/record")).record;
|
|
2796
2811
|
}
|
|
2797
|
-
function
|
|
2812
|
+
function Tt() {
|
|
2798
2813
|
const i = globalThis;
|
|
2799
2814
|
return i.rrwebRecord?.record ?? i.rrweb?.record;
|
|
2800
2815
|
}
|
|
2801
|
-
function
|
|
2816
|
+
function Er() {
|
|
2802
2817
|
return new Promise((i, t) => {
|
|
2803
|
-
const e =
|
|
2818
|
+
const e = Tt();
|
|
2804
2819
|
if (e) {
|
|
2805
2820
|
i(e);
|
|
2806
2821
|
return;
|
|
2807
2822
|
}
|
|
2808
2823
|
const r = document.createElement("script");
|
|
2809
|
-
r.src =
|
|
2810
|
-
const n =
|
|
2824
|
+
r.src = xr, r.integrity = vr, r.crossOrigin = "anonymous", r.onload = () => {
|
|
2825
|
+
const n = Tt();
|
|
2811
2826
|
n ? i(n) : t(new Error("rrweb record global not found after script load"));
|
|
2812
2827
|
}, r.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(r);
|
|
2813
2828
|
});
|
|
2814
2829
|
}
|
|
2815
|
-
class
|
|
2830
|
+
class Cr {
|
|
2816
2831
|
constructor(t, e, r = {}) {
|
|
2817
2832
|
this.events = [], this.stopFn = null, this.startedAt = 0, this.timer = null, this.clickHandler = null, this.stopped = !1, this.destroyed = !1, this.shadow = t, this.onMaxReached = e, this.options = r;
|
|
2818
2833
|
}
|
|
2819
2834
|
async start() {
|
|
2820
|
-
const t = await
|
|
2835
|
+
const t = await kr();
|
|
2821
2836
|
this.destroyed || (this.startedAt = Date.now(), this.stopped = !1, this.stopFn = t({
|
|
2822
2837
|
emit: (e) => {
|
|
2823
2838
|
this.stopped || this.events.push(e);
|
|
@@ -2827,8 +2842,8 @@ class wr {
|
|
|
2827
2842
|
// to be on, which may be a checkout or a 2FA prompt, and nothing downstream
|
|
2828
2843
|
// scrubs it. Customers who need real values in replays must opt in.
|
|
2829
2844
|
maskAllInputs: this.options.maskAllInputs ?? !0,
|
|
2830
|
-
blockClass:
|
|
2831
|
-
maskTextClass:
|
|
2845
|
+
blockClass: yr,
|
|
2846
|
+
maskTextClass: wr
|
|
2832
2847
|
}), this.clickHandler = (e) => {
|
|
2833
2848
|
this.showClickRipple(e.clientX, e.clientY), t.addCustomEvent?.("mtb-click", {
|
|
2834
2849
|
x: e.clientX,
|
|
@@ -2837,7 +2852,7 @@ class wr {
|
|
|
2837
2852
|
});
|
|
2838
2853
|
}, document.addEventListener("click", this.clickHandler, !0), this.timer = setTimeout(() => {
|
|
2839
2854
|
this.onMaxReached?.();
|
|
2840
|
-
},
|
|
2855
|
+
}, gr * 1e3));
|
|
2841
2856
|
}
|
|
2842
2857
|
stop() {
|
|
2843
2858
|
return this.stopped = !0, this.stopFn?.(), this.stopFn = null, this.cleanupTimer(), this.cleanupClickHandler(), {
|
|
@@ -2862,7 +2877,7 @@ class wr {
|
|
|
2862
2877
|
r.style.left = `${t}px`, r.style.top = `${e}px`, this.shadow.append(r), r.addEventListener("animationend", () => r.remove());
|
|
2863
2878
|
}
|
|
2864
2879
|
}
|
|
2865
|
-
class
|
|
2880
|
+
class _r {
|
|
2866
2881
|
constructor(t, e, r, n) {
|
|
2867
2882
|
this.intervalId = null, this.getDuration = r, this.el = t.el("div", "mtb-record-bar"), this.el.innerHTML = `
|
|
2868
2883
|
<span class="mtb-record-dot"></span>
|
|
@@ -2878,12 +2893,12 @@ class xr {
|
|
|
2878
2893
|
this.intervalId && (clearInterval(this.intervalId), this.intervalId = null), this.el.remove();
|
|
2879
2894
|
}
|
|
2880
2895
|
}
|
|
2881
|
-
class
|
|
2896
|
+
class Tr {
|
|
2882
2897
|
constructor() {
|
|
2883
2898
|
this.session = null, this.bar = null, this.result = null;
|
|
2884
2899
|
}
|
|
2885
2900
|
async start(t, e, r, n = {}) {
|
|
2886
|
-
this.session = new
|
|
2901
|
+
this.session = new Cr(t, r, n), this.bar = new _r(
|
|
2887
2902
|
t,
|
|
2888
2903
|
e,
|
|
2889
2904
|
() => this.session?.getDuration() ?? 0,
|
|
@@ -2903,14 +2918,14 @@ class vr {
|
|
|
2903
2918
|
this.session?.destroy(), this.session = null, this.bar?.destroy(), this.bar = null;
|
|
2904
2919
|
}
|
|
2905
2920
|
}
|
|
2906
|
-
const
|
|
2907
|
-
function
|
|
2921
|
+
const Lr = 3e3, Lt = 12e3;
|
|
2922
|
+
function Mr() {
|
|
2908
2923
|
const { hostname: i } = window.location;
|
|
2909
2924
|
return i === "localhost" || i === "127.0.0.1" || i === "[::1]" || i.endsWith(".localhost") || i.endsWith(".local") || i.endsWith(".test");
|
|
2910
2925
|
}
|
|
2911
2926
|
class K {
|
|
2912
2927
|
constructor(t) {
|
|
2913
|
-
this.tab = null, this.toolbar = null, this.session = null, this.scrollLock = new
|
|
2928
|
+
this.tab = null, this.toolbar = null, this.session = null, this.scrollLock = new re(), this.drawBar = null, this.dim = null, this.popup = null, this.clarify = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.mode = "idle", this.via = "pin", this.currentAnnotation = null, this.submittingUi = null, this.lastPopupPos = null, this.recordingManager = null, this.activeSubmission = null, this.submissionAttempt = 0, this.lastHandoff = {}, this.handleKeydown = (e) => {
|
|
2914
2929
|
if (e.key === "Escape")
|
|
2915
2930
|
switch (this.mode) {
|
|
2916
2931
|
case "annotating":
|
|
@@ -2926,11 +2941,11 @@ class K {
|
|
|
2926
2941
|
}
|
|
2927
2942
|
}, this.handleRecordStop = () => {
|
|
2928
2943
|
this.recordingManager && (this.recordingManager.stop(), this.via = "record", this.showPopup(window.innerWidth / 2, window.innerHeight / 2, this.messages.record.timer_label));
|
|
2929
|
-
}, this.config = t, this.messages =
|
|
2944
|
+
}, this.config = t, this.messages = _t(t.locale ?? document.documentElement.lang ?? "en"), this.apiClient = new _e(t.projectKey, t.apiUrl, void 0, t.userToken, t.userTokenFn), this.consoleCollector = new qi(), this.consoleCollector.start(), this.breadcrumbCollector = new Yi(), this.breadcrumbCollector.start(), this.buildUI(), t.frustrationDetection !== !1 && (this.frustrationDetector = new X(() => this.handleFrustration()), this.frustrationDetector.start()), document.addEventListener("keydown", this.handleKeydown, !0);
|
|
2930
2945
|
}
|
|
2931
2946
|
buildUI() {
|
|
2932
|
-
if (this.shadow = new
|
|
2933
|
-
|
|
2947
|
+
if (this.shadow = new Jt(this.config.theme ?? "auto"), this.config.entryMode === "api") {
|
|
2948
|
+
Mr() && console.warn(
|
|
2934
2949
|
'[MakeThisBetter] entryMode: "api" renders no launcher. Call MakeThisBetter.open() from your own UI, or use showLauncher().'
|
|
2935
2950
|
);
|
|
2936
2951
|
return;
|
|
@@ -2938,7 +2953,7 @@ class K {
|
|
|
2938
2953
|
this.mountTab();
|
|
2939
2954
|
}
|
|
2940
2955
|
mountTab() {
|
|
2941
|
-
this.tab || (this.tab = new
|
|
2956
|
+
this.tab || (this.tab = new Qt(
|
|
2942
2957
|
this.shadow,
|
|
2943
2958
|
this.messages,
|
|
2944
2959
|
this.config.position ?? "right",
|
|
@@ -2963,18 +2978,18 @@ class K {
|
|
|
2963
2978
|
// the language they were opened in rather than being re-rendered underneath a
|
|
2964
2979
|
// reporter who may be mid-sentence.
|
|
2965
2980
|
setLocale(t) {
|
|
2966
|
-
this.config.locale = t, this.messages =
|
|
2981
|
+
this.config.locale = t, this.messages = _t(t), this.tab?.setMessages(this.messages);
|
|
2967
2982
|
}
|
|
2968
2983
|
handleTabClick() {
|
|
2969
2984
|
this.mode === "idle" ? (this.dismissFrustrationPrompt(), this.enterAnnotationMode()) : this.exitAll();
|
|
2970
2985
|
}
|
|
2971
2986
|
handleFrustration() {
|
|
2972
|
-
this.mode !== "idle" || this.frustrationPrompt ||
|
|
2987
|
+
this.mode !== "idle" || this.frustrationPrompt || Xi() || (this.frustrationPrompt = new te(this.shadow, this.messages, {
|
|
2973
2988
|
onTell: () => {
|
|
2974
2989
|
this.dismissFrustrationPrompt(), this.enterAnnotationMode();
|
|
2975
2990
|
},
|
|
2976
2991
|
onDismiss: () => {
|
|
2977
|
-
|
|
2992
|
+
Ki(), this.dismissFrustrationPrompt();
|
|
2978
2993
|
},
|
|
2979
2994
|
// An unnoticed card is not a refusal, so it must not suppress later
|
|
2980
2995
|
// prompts. The detector's own 60s cooldown does the rate limiting.
|
|
@@ -2985,7 +3000,7 @@ class K {
|
|
|
2985
3000
|
this.frustrationPrompt?.destroy(), this.frustrationPrompt = null;
|
|
2986
3001
|
}
|
|
2987
3002
|
enterAnnotationMode() {
|
|
2988
|
-
this.mode = "annotating", this.tab?.setActive(!0), this.scrollLock.lock(), this.toolbar = new
|
|
3003
|
+
this.mode = "annotating", this.tab?.setActive(!0), this.scrollLock.lock(), this.toolbar = new ne(
|
|
2989
3004
|
this.shadow,
|
|
2990
3005
|
this.messages,
|
|
2991
3006
|
() => this.exitAll(),
|
|
@@ -2997,7 +3012,7 @@ class K {
|
|
|
2997
3012
|
), this.session = this.createSession();
|
|
2998
3013
|
}
|
|
2999
3014
|
createSession() {
|
|
3000
|
-
return new
|
|
3015
|
+
return new fe(this.shadow, this.messages, {
|
|
3001
3016
|
onPin: (t, e) => {
|
|
3002
3017
|
this.currentAnnotation = t, this.via = "pin", this.showPopup(t.x, t.y, e, t.targetRect);
|
|
3003
3018
|
},
|
|
@@ -3011,7 +3026,7 @@ class K {
|
|
|
3011
3026
|
}
|
|
3012
3027
|
if (t === "record") {
|
|
3013
3028
|
if (this.mode === "recording") return;
|
|
3014
|
-
this.mode = "recording", this.currentAnnotation = null, this.teardownDraw(), this.session?.destroy(), this.session = null, this.scrollLock.unlock(), this.recordingManager = new
|
|
3029
|
+
this.mode = "recording", this.currentAnnotation = null, this.teardownDraw(), this.session?.destroy(), this.session = null, this.scrollLock.unlock(), this.recordingManager = new Tr(), this.recordingManager.start(
|
|
3015
3030
|
this.shadow,
|
|
3016
3031
|
this.messages,
|
|
3017
3032
|
this.handleRecordStop,
|
|
@@ -3023,7 +3038,11 @@ class K {
|
|
|
3023
3038
|
this.recordingManager?.destroy(), this.recordingManager = null, this.teardownDraw(), this.session || (this.session = this.createSession()), this.scrollLock.lock(), this.mode = "annotating";
|
|
3024
3039
|
}
|
|
3025
3040
|
handleDrawStroke() {
|
|
3026
|
-
|
|
3041
|
+
if (G()) {
|
|
3042
|
+
this.showDrawSheet();
|
|
3043
|
+
return;
|
|
3044
|
+
}
|
|
3045
|
+
this.mode !== "drawing" && (this.mode = "drawing", this.drawBar = new ve(this.shadow, {
|
|
3027
3046
|
messages: this.messages,
|
|
3028
3047
|
onUndo: () => this.handleDrawUndoRedo("undo"),
|
|
3029
3048
|
onRedo: () => this.handleDrawUndoRedo("redo"),
|
|
@@ -3031,6 +3050,24 @@ class K {
|
|
|
3031
3050
|
onSubmit: (t) => this.handleDrawSubmit(t)
|
|
3032
3051
|
})), this.refreshDrawBar();
|
|
3033
3052
|
}
|
|
3053
|
+
/**
|
|
3054
|
+
* The note sheet for a finished drawing on touch.
|
|
3055
|
+
*
|
|
3056
|
+
* Cancel here means "throw the drawing away and keep annotating", not "close
|
|
3057
|
+
* the widget" — the reporter is mid-task and a stray stroke should cost one
|
|
3058
|
+
* tap, not the whole session.
|
|
3059
|
+
*/
|
|
3060
|
+
showDrawSheet() {
|
|
3061
|
+
this.mode !== "drawing" && (this.mode = "drawing", this.popup = new st(this.shadow, {
|
|
3062
|
+
targetName: this.messages.annotation.drawing,
|
|
3063
|
+
x: window.innerWidth / 2,
|
|
3064
|
+
y: window.innerHeight / 2,
|
|
3065
|
+
messages: this.messages,
|
|
3066
|
+
onSubmit: (t) => this.handleDrawSubmit(t),
|
|
3067
|
+
onClose: () => this.cancelDraw(),
|
|
3068
|
+
position: this.config.position ?? "right"
|
|
3069
|
+
}), this.submittingUi = this.popup);
|
|
3070
|
+
}
|
|
3034
3071
|
handleDrawUndoRedo(t) {
|
|
3035
3072
|
t === "undo" ? this.session?.undoDraw() : this.session?.redoDraw(), this.refreshDrawBar();
|
|
3036
3073
|
}
|
|
@@ -3038,7 +3075,7 @@ class K {
|
|
|
3038
3075
|
this.session && this.drawBar?.setUndoRedo(this.session.canUndoDraw(), this.session.canRedoDraw());
|
|
3039
3076
|
}
|
|
3040
3077
|
cancelDraw() {
|
|
3041
|
-
this.session?.clearDraw(), this.teardownDraw(), this.mode = "annotating";
|
|
3078
|
+
this.session?.clearDraw(), this.teardownDraw(), this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.submittingUi = null, this.mode = "annotating";
|
|
3042
3079
|
}
|
|
3043
3080
|
teardownDraw() {
|
|
3044
3081
|
this.drawBar?.destroy(), this.drawBar = null;
|
|
@@ -3049,10 +3086,10 @@ class K {
|
|
|
3049
3086
|
this.cancelDraw();
|
|
3050
3087
|
return;
|
|
3051
3088
|
}
|
|
3052
|
-
this.currentAnnotation = e, this.via = "draw", this.session?.dismissInteraction(), this.submittingUi = this.drawBar, this.handleSubmit(t || this.messages.annotation.drawing);
|
|
3089
|
+
this.currentAnnotation = e, this.via = "draw", this.session?.dismissInteraction(), this.submittingUi = this.drawBar ?? this.popup, this.handleSubmit(t || this.messages.annotation.drawing);
|
|
3053
3090
|
}
|
|
3054
3091
|
showPopup(t, e, r, n) {
|
|
3055
|
-
this.mode = "popup", this.lastPopupPos = { x: t, y: e }, this.teardownDraw(), this.session?.dismissInteraction(), this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.dim = new
|
|
3092
|
+
this.mode = "popup", this.lastPopupPos = { x: t, y: e }, this.teardownDraw(), this.session?.dismissInteraction(), this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.dim = new ie(this.shadow, () => this.exitAll()), this.popup = new st(this.shadow, {
|
|
3056
3093
|
targetName: r,
|
|
3057
3094
|
x: t,
|
|
3058
3095
|
y: e,
|
|
@@ -3065,29 +3102,29 @@ class K {
|
|
|
3065
3102
|
}), this.submittingUi = this.popup;
|
|
3066
3103
|
}
|
|
3067
3104
|
buildMyFeedbackHandler() {
|
|
3068
|
-
if (!this.config.user &&
|
|
3105
|
+
if (!this.config.user && cr())
|
|
3069
3106
|
return async () => {
|
|
3070
|
-
const t = await this.apiClient.createIdentityToken(
|
|
3071
|
-
!t?.identity_token || !t.board_url || (
|
|
3107
|
+
const t = await this.apiClient.createIdentityToken(kt());
|
|
3108
|
+
!t?.identity_token || !t.board_url || (Et(t.board_url), window.open(`${t.board_url}?identity=${encodeURIComponent(t.identity_token)}`, "_blank"));
|
|
3072
3109
|
};
|
|
3073
3110
|
}
|
|
3074
3111
|
async handleSubmit(t) {
|
|
3075
3112
|
const e = this.submittingUi;
|
|
3076
3113
|
if (!e) return;
|
|
3077
3114
|
const r = ++this.submissionAttempt;
|
|
3078
|
-
e.setLoading(!0), await
|
|
3115
|
+
e.setLoading(!0), await Ar();
|
|
3079
3116
|
const n = this.currentAnnotation, s = this.recordingManager?.getRecording() ?? void 0, [o, a] = await Promise.all([
|
|
3080
|
-
|
|
3081
|
-
Promise.resolve(
|
|
3082
|
-
]), l =
|
|
3117
|
+
Di(n ? [n] : []),
|
|
3118
|
+
Promise.resolve(nr())
|
|
3119
|
+
]), l = ar(
|
|
3083
3120
|
t,
|
|
3084
3121
|
a,
|
|
3085
3122
|
this.consoleCollector.getErrors(),
|
|
3086
3123
|
n,
|
|
3087
3124
|
this.config.user,
|
|
3088
3125
|
s,
|
|
3089
|
-
this.config.user ? void 0 :
|
|
3090
|
-
this.config.user ? void 0 :
|
|
3126
|
+
this.config.user ? void 0 : kt(),
|
|
3127
|
+
this.config.user ? void 0 : St(),
|
|
3091
3128
|
this.breadcrumbCollector.getBreadcrumbs()
|
|
3092
3129
|
);
|
|
3093
3130
|
try {
|
|
@@ -3113,16 +3150,16 @@ class K {
|
|
|
3113
3150
|
return;
|
|
3114
3151
|
}
|
|
3115
3152
|
const n = new AbortController();
|
|
3116
|
-
let s = setTimeout(() => n.abort(),
|
|
3153
|
+
let s = setTimeout(() => n.abort(), Lt);
|
|
3117
3154
|
const o = () => {
|
|
3118
|
-
clearTimeout(s), s = setTimeout(() => n.abort(),
|
|
3155
|
+
clearTimeout(s), s = setTimeout(() => n.abort(), Lt);
|
|
3119
3156
|
}, a = this.apiClient.streamClarification(
|
|
3120
3157
|
t.id,
|
|
3121
3158
|
t.token,
|
|
3122
3159
|
o,
|
|
3123
3160
|
n.signal
|
|
3124
3161
|
).catch(() => null).finally(() => clearTimeout(s)), l = new Promise(
|
|
3125
|
-
(u) => setTimeout(() => u(null),
|
|
3162
|
+
(u) => setTimeout(() => u(null), Lr)
|
|
3126
3163
|
), c = await Promise.race([a, l]);
|
|
3127
3164
|
if (r !== this.submissionAttempt) return;
|
|
3128
3165
|
const d = this.teardownSubmittingUi(!0);
|
|
@@ -3133,7 +3170,7 @@ class K {
|
|
|
3133
3170
|
return this.scrollLock.unlock(), this.teardownDraw(), e || this.popup?.destroy(), this.popup = null, this.dim?.destroy(), this.dim = null, this.session?.hideHighlight(), this.session?.destroy(), this.session = null, this.recordingManager?.destroy(), this.recordingManager = null, this.submittingUi = null, e;
|
|
3134
3171
|
}
|
|
3135
3172
|
showClarify(t, e, r) {
|
|
3136
|
-
this.mode = "clarifying", this.tab?.setActive(!0), this.clarify = new
|
|
3173
|
+
this.mode = "clarifying", this.tab?.setActive(!0), this.clarify = new De(this.shadow, {
|
|
3137
3174
|
submissionSessionId: t.id,
|
|
3138
3175
|
submissionToken: t.token,
|
|
3139
3176
|
apiClient: this.apiClient,
|
|
@@ -3155,21 +3192,21 @@ class K {
|
|
|
3155
3192
|
feedbackId: r.id,
|
|
3156
3193
|
boardUrl: r.board_url,
|
|
3157
3194
|
identityToken: r.identity_token
|
|
3158
|
-
}, r.board_url &&
|
|
3195
|
+
}, r.board_url && Et(r.board_url), this.clarify?.destroy(), this.clarify = null, this.toolbar?.destroy(), this.toolbar = null, this.showSuccess({ skipFollowup: t.ai_clarify_available === !1 }));
|
|
3159
3196
|
}
|
|
3160
3197
|
showSuccess(t) {
|
|
3161
|
-
this.mode = "idle", this.tab?.setActive(!1), this.success = new
|
|
3198
|
+
this.mode = "idle", this.tab?.setActive(!1), this.success = new Be(this.shadow, this.messages, () => {
|
|
3162
3199
|
this.success?.destroy(), this.success = null;
|
|
3163
3200
|
}, this.buildViewFeedbackHandler(), { ...t, emailCapture: this.buildEmailCapture() });
|
|
3164
3201
|
}
|
|
3165
3202
|
buildEmailCapture() {
|
|
3166
3203
|
if (this.config.user) return;
|
|
3167
3204
|
const { feedbackId: t, identityToken: e } = this.lastHandoff;
|
|
3168
|
-
if (!(!t || !e) && !
|
|
3205
|
+
if (!(!t || !e) && !St())
|
|
3169
3206
|
return {
|
|
3170
3207
|
onSubmit: async (r) => {
|
|
3171
3208
|
const n = await this.apiClient.updateReporter(t, r, e);
|
|
3172
|
-
return n &&
|
|
3209
|
+
return n && lr(r), n;
|
|
3173
3210
|
}
|
|
3174
3211
|
};
|
|
3175
3212
|
}
|
|
@@ -3197,11 +3234,11 @@ class K {
|
|
|
3197
3234
|
document.removeEventListener("keydown", this.handleKeydown, !0), this.exitAll(), this.consoleCollector.stop(), this.breadcrumbCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.recordingManager?.destroy(), this.shadow.destroy();
|
|
3198
3235
|
}
|
|
3199
3236
|
}
|
|
3200
|
-
function
|
|
3237
|
+
function Ar() {
|
|
3201
3238
|
return new Promise((i) => requestAnimationFrame(() => setTimeout(i, 0)));
|
|
3202
3239
|
}
|
|
3203
3240
|
let f = null, E = null;
|
|
3204
|
-
const
|
|
3241
|
+
const Pr = {
|
|
3205
3242
|
init(i) {
|
|
3206
3243
|
f && (f.destroy(), f = null), E = i, document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
|
|
3207
3244
|
f = new K(i);
|
|
@@ -3231,11 +3268,11 @@ const Cr = {
|
|
|
3231
3268
|
f?.hideLauncher();
|
|
3232
3269
|
}
|
|
3233
3270
|
};
|
|
3234
|
-
typeof window < "u" && (window.MakeThisBetter =
|
|
3271
|
+
typeof window < "u" && (window.MakeThisBetter = Pr, document.addEventListener("turbo:load", () => {
|
|
3235
3272
|
const i = document.getElementById("mtb-widget-host");
|
|
3236
3273
|
E && (!i || !i.shadowRoot) && (f?.destroy(), i?.remove(), f = new K(E));
|
|
3237
3274
|
}));
|
|
3238
3275
|
export {
|
|
3239
|
-
|
|
3276
|
+
Pr as MakeThisBetter
|
|
3240
3277
|
};
|
|
3241
3278
|
//# sourceMappingURL=makethisbetter.esm.js.map
|