makethisbetter 1.1.3 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -62
- package/README.md +4 -4
- package/dist/context/frustration.d.ts +1 -1
- package/dist/context/frustration.d.ts.map +1 -1
- package/dist/i18n/de.d.ts +2 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/en.d.ts +2 -0
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/es.d.ts +2 -0
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/fr.d.ts +2 -0
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/ja.d.ts +2 -0
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ko.d.ts +2 -0
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/zh-CN.d.ts +2 -0
- package/dist/i18n/zh-CN.d.ts.map +1 -1
- package/dist/makethisbetter.cjs.js +21 -35
- package/dist/makethisbetter.cjs.js.map +1 -1
- package/dist/makethisbetter.esm.js +178 -190
- package/dist/makethisbetter.esm.js.map +1 -1
- package/dist/makethisbetter.js +18 -32
- package/dist/makethisbetter.js.map +1 -1
- package/dist/popup/success.d.ts +4 -1
- package/dist/popup/success.d.ts.map +1 -1
- package/dist/record/session.cdn.test.d.ts +2 -0
- package/dist/record/session.cdn.test.d.ts.map +1 -0
- package/dist/record/session.d.ts.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/widget/controller.d.ts +0 -1
- package/dist/widget/controller.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/context/frustration.test.ts +2 -3
- package/src/context/frustration.ts +0 -1
- package/src/i18n/de.ts +2 -0
- package/src/i18n/en.ts +2 -0
- package/src/i18n/es.ts +2 -0
- package/src/i18n/fr.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-CN.ts +2 -0
- package/src/popup/success.test.ts +13 -0
- package/src/popup/success.ts +10 -3
- package/src/record/session.cdn.test.ts +89 -0
- package/src/record/session.ts +21 -7
- package/src/types.ts +2 -1
- package/src/widget/controller.test.ts +4 -1
- package/src/widget/controller.ts +15 -23
- package/src/widget/pet.test.ts +34 -32
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const st = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,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{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 #05966980}.mtb-tab.active{background:#065f46}.mtb-toolbar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:11px;height:46px;padding:0 7px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbBarIn .2s ease;white-space:nowrap}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.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:1px;height:20px;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-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair}.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-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%);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}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-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;width:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:14px;box-shadow:0 12px 40px #00000029;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{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{padding:13px}.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-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:9px;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 #10b9811f}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#b91c1c;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:30px;border:none;border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12px;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:300px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;padding:26px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.mtb-success-icon{width:44px;height:44px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:6px;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-close-link{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:#000000b3}.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:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,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:24px;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:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;display:flex;flex-direction:column;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;overflow:hidden}.mtb-clarify-header{padding:10px 13px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:26px;height:26px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-clarify-skip{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-clarify-skip:hover{color:#000000b3}.mtb-clarify-messages{flex:1;max-height:240px;overflow-y:auto;padding:12px 13px;display:flex;flex-direction:column;gap:8px}.mtb-clarify-bubble{max-width:85%;padding:8px 12px;border-radius:12px;font-size:13px;line-height:1.5;word-wrap:break-word}.mtb-clarify-ai{align-self:flex-start;background:#f3f4f6;color:#191a1c;border-bottom-left-radius:4px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border-bottom-right-radius:4px}.mtb-clarify-thinking{display:flex;align-items:center;gap:3px;padding:10px 16px}.mtb-clarify-thinking .mtb-dot{background:#9ca3af}.mtb-clarify-footer{padding:10px 13px;border-top:1px solid rgba(0,0,0,.06);display:flex;gap:8px}.mtb-clarify-input{flex:1;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:12.5px;color:#191a1c;outline:none;background:#fff;transition:border-color .12s,box-shadow .12s}.mtb-clarify-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b9811f}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-send{height:32px;padding:0 14px;border:none;border-radius:8px;background:#d1d5db;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s;flex-shrink:0}.mtb-clarify-send:not(:disabled){background:#059669}.mtb-clarify-send:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled{cursor:not-allowed}: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-footer{border-top-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-skip{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover{color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-ai{background:#1f2327;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-footer{border-top-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-skip{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover{color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-ai{background:#1f2327;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}}';
|
|
2
|
-
class
|
|
1
|
+
const rt = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:host{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,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{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 #05966980}.mtb-tab.active{background:#065f46}.mtb-toolbar{position:fixed;top:18px;left:50%;transform:translate(-50%);z-index:2147483647;display:flex;align-items:center;gap:11px;height:46px;padding:0 7px;border-radius:13px;background:linear-gradient(120deg,#10b981,#059669);box-shadow:0 10px 26px #0f172a38;animation:mtbBarIn .2s ease;white-space:nowrap}@keyframes mtbBarIn{0%{transform:translate(-50%,12px);opacity:0}to{transform:translate(-50%);opacity:1}}.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:1px;height:20px;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-exit-btn:hover{background:#ffffff47}.mtb-overlay{position:fixed;inset:0;z-index:2147483640;cursor:crosshair}.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-tooltip{position:fixed;z-index:2147483642;pointer-events:none;transform:translate(-50%);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}.mtb-highlight-tooltip:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);border:4px solid transparent;border-top-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;width:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:14px;box-shadow:0 12px 40px #00000029;overflow:hidden;animation:mtbSlideUp .28s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}@keyframes mtbSlideUp{0%{transform:translateY(14px) scale(.97);opacity:0}to{transform:translateY(0) scale(1);opacity:1}}.mtb-popup-header{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{padding:13px}.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-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:9px;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 #10b9811f}.mtb-textarea::placeholder{color:#00000057}.mtb-popup-error{margin-top:8px;color:#b91c1c;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:30px;border:none;border-radius:7px;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 12px;font-family:inherit;font-size:12px;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:300px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;padding:26px 22px;text-align:center;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.mtb-success-icon{width:44px;height:44px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;margin:0 auto 12px}.mtb-success-title{font-size:16px;font-weight:700;margin-bottom:6px;color:#191a1c}.mtb-success-msg{font-size:13px;color:#0000008c;margin-bottom:16px;line-height:1.6}.mtb-close-link{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-close-link:hover{color:#000000b3}.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:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,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:24px;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:320px;background:#fff;border:1px solid rgba(0,0,0,.1);border-radius:16px;box-shadow:0 20px 60px #0000001f;display:flex;flex-direction:column;animation:mtbSlideUp .35s cubic-bezier(.34,1.56,.64,1);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;overflow:hidden}.mtb-clarify-header{padding:10px 13px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(0,0,0,.06)}.mtb-clarify-icon{width:26px;height:26px;border-radius:50%;background:#05966914;display:flex;align-items:center;justify-content:center;flex-shrink:0}.mtb-clarify-skip{background:none;border:none;cursor:pointer;font-size:12px;color:#00000073;font-family:inherit;transition:color .12s}.mtb-clarify-skip:hover{color:#000000b3}.mtb-clarify-messages{flex:1;max-height:240px;overflow-y:auto;padding:12px 13px;display:flex;flex-direction:column;gap:8px}.mtb-clarify-bubble{max-width:85%;padding:8px 12px;border-radius:12px;font-size:13px;line-height:1.5;word-wrap:break-word}.mtb-clarify-ai{align-self:flex-start;background:#f3f4f6;color:#191a1c;border-bottom-left-radius:4px}.mtb-clarify-user{align-self:flex-end;background:#059669;color:#fff;border-bottom-right-radius:4px}.mtb-clarify-thinking{display:flex;align-items:center;gap:3px;padding:10px 16px}.mtb-clarify-thinking .mtb-dot{background:#9ca3af}.mtb-clarify-footer{padding:10px 13px;border-top:1px solid rgba(0,0,0,.06);display:flex;gap:8px}.mtb-clarify-input{flex:1;height:32px;padding:0 10px;border:1px solid rgba(0,0,0,.12);border-radius:8px;font-family:inherit;font-size:12.5px;color:#191a1c;outline:none;background:#fff;transition:border-color .12s,box-shadow .12s}.mtb-clarify-input:focus{border-color:#10b981;box-shadow:0 0 0 3px #10b9811f}.mtb-clarify-input::placeholder{color:#00000057}.mtb-clarify-send{height:32px;padding:0 14px;border:none;border-radius:8px;background:#d1d5db;color:#fff;cursor:pointer;font-family:inherit;font-size:12px;font-weight:600;transition:background .12s;flex-shrink:0}.mtb-clarify-send:not(:disabled){background:#059669}.mtb-clarify-send:not(:disabled):hover{background:#047857}.mtb-clarify-send:disabled{cursor:not-allowed}: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-footer{border-top-color:#ffffff1a}:host([data-mtb-theme="dark"]) .mtb-clarify-skip{color:#ffffff73}:host([data-mtb-theme="dark"]) .mtb-clarify-skip:hover{color:#ffffffb3}:host([data-mtb-theme="dark"]) .mtb-clarify-ai{background:#1f2327;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-footer{border-top-color:#ffffff1a}:host([data-mtb-theme="auto"]) .mtb-clarify-skip{color:#ffffff73}:host([data-mtb-theme="auto"]) .mtb-clarify-skip:hover{color:#ffffffb3}:host([data-mtb-theme="auto"]) .mtb-clarify-ai{background:#1f2327;color:#f9fafb}:host([data-mtb-theme="auto"]) .mtb-clarify-input{background:#1f2327;border-color:#ffffff1f;color:#f9fafb}}';
|
|
2
|
+
class nt {
|
|
3
3
|
constructor(t = "auto") {
|
|
4
4
|
this.host = 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), document.body.appendChild(this.host), this.root = this.host.attachShadow({ mode: "open" });
|
|
5
5
|
const e = document.createElement("style");
|
|
6
|
-
e.textContent =
|
|
6
|
+
e.textContent = rt, this.root.appendChild(e);
|
|
7
7
|
}
|
|
8
8
|
el(t, e) {
|
|
9
9
|
const s = document.createElement(t);
|
|
@@ -20,7 +20,7 @@ class rt {
|
|
|
20
20
|
document.body.removeChild(this.host);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
class
|
|
23
|
+
class ot {
|
|
24
24
|
constructor(t, e, s, r, n) {
|
|
25
25
|
this.onClick = r, this.el = t.el("button", "mtb-tab"), s === "left" && this.el.classList.add("left");
|
|
26
26
|
const o = n ?? e.tab;
|
|
@@ -33,43 +33,6 @@ class nt {
|
|
|
33
33
|
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
const x = "#059669", w = {
|
|
37
|
-
color: x,
|
|
38
|
-
width: "3.5",
|
|
39
|
-
linecap: "round",
|
|
40
|
-
linejoin: "round",
|
|
41
|
-
filter: "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"
|
|
42
|
-
};
|
|
43
|
-
class ot {
|
|
44
|
-
constructor(t, e, s) {
|
|
45
|
-
this.onClick = s, this.el = t.el("div", "mtb-pet"), this.el.innerHTML = this.buildSVG(), this.el.setAttribute("role", "button"), this.el.setAttribute("aria-label", e.tab), this.el.tabIndex = 0, this.bubble = t.el("div", "mtb-pet-bubble"), this.bubble.textContent = e.pet.bubble, this.el.appendChild(this.bubble), this.el.addEventListener("click", this.onClick), this.el.addEventListener("keydown", (r) => {
|
|
46
|
-
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), this.onClick());
|
|
47
|
-
}), t.append(this.el);
|
|
48
|
-
}
|
|
49
|
-
buildSVG() {
|
|
50
|
-
return `<svg class="mtb-pet-svg" width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
51
|
-
<circle cx="24" cy="28" r="16" fill="${x}"/>
|
|
52
|
-
<circle cx="24" cy="28" r="14" fill="#10b981"/>
|
|
53
|
-
<circle cx="19" cy="25" r="3" fill="#fff"/>
|
|
54
|
-
<circle cx="29" cy="25" r="3" fill="#fff"/>
|
|
55
|
-
<circle cx="20" cy="24.5" r="1.5" fill="#064e3b"/>
|
|
56
|
-
<circle cx="30" cy="24.5" r="1.5" fill="#064e3b"/>
|
|
57
|
-
<ellipse cx="19.5" cy="23.5" rx="0.8" ry="0.6" fill="#fff" opacity="0.7"/>
|
|
58
|
-
<ellipse cx="29.5" cy="23.5" rx="0.8" ry="0.6" fill="#fff" opacity="0.7"/>
|
|
59
|
-
<path d="M20 31 Q24 34 28 31" stroke="#064e3b" stroke-width="1.5" stroke-linecap="round" fill="none"/>
|
|
60
|
-
<circle cx="15" cy="30" r="2.5" fill="${x}" opacity="0.4"/>
|
|
61
|
-
<circle cx="33" cy="30" r="2.5" fill="${x}" opacity="0.4"/>
|
|
62
|
-
<path d="M14 17 Q16 12 20 15" stroke="#10b981" stroke-width="2" stroke-linecap="round" fill="none"/>
|
|
63
|
-
<path d="M34 17 Q32 12 28 15" stroke="#10b981" stroke-width="2" stroke-linecap="round" fill="none"/>
|
|
64
|
-
</svg>`;
|
|
65
|
-
}
|
|
66
|
-
setActive(t) {
|
|
67
|
-
this.el.classList.toggle("active", t), t && this.bubble.classList.add("hidden");
|
|
68
|
-
}
|
|
69
|
-
destroy() {
|
|
70
|
-
this.el.removeEventListener("click", this.onClick), this.el.remove();
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
36
|
const at = 8e3;
|
|
74
37
|
class lt {
|
|
75
38
|
constructor(t, e, s) {
|
|
@@ -188,7 +151,7 @@ function pt(i) {
|
|
|
188
151
|
}
|
|
189
152
|
return t.join(" > ");
|
|
190
153
|
}
|
|
191
|
-
class
|
|
154
|
+
class mt {
|
|
192
155
|
constructor(t) {
|
|
193
156
|
this.pins = [], this.shadow = t;
|
|
194
157
|
}
|
|
@@ -204,12 +167,19 @@ class ft {
|
|
|
204
167
|
this.clearAll();
|
|
205
168
|
}
|
|
206
169
|
}
|
|
207
|
-
|
|
170
|
+
const A = "#059669", x = {
|
|
171
|
+
color: A,
|
|
172
|
+
width: "3.5",
|
|
173
|
+
linecap: "round",
|
|
174
|
+
linejoin: "round",
|
|
175
|
+
filter: "drop-shadow(0 1px 2px rgba(5,150,105,0.35))"
|
|
176
|
+
};
|
|
177
|
+
class ft {
|
|
208
178
|
constructor(t, e) {
|
|
209
179
|
this.path = null, this.points = [], this.isDrawing = !1, this.onDrawComplete = e, this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"), this.svg.setAttribute("class", "mtb-draw-svg"), t.append(this.svg);
|
|
210
180
|
}
|
|
211
181
|
startDraw(t, e) {
|
|
212
|
-
this.isDrawing = !0, this.points = [[t, e]], this.path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this.path.setAttribute("fill", "none"), this.path.setAttribute("stroke",
|
|
182
|
+
this.isDrawing = !0, this.points = [[t, e]], this.path = document.createElementNS("http://www.w3.org/2000/svg", "path"), this.path.setAttribute("fill", "none"), this.path.setAttribute("stroke", x.color), this.path.setAttribute("stroke-width", x.width), this.path.setAttribute("stroke-linecap", x.linecap), this.path.setAttribute("stroke-linejoin", x.linejoin), this.path.setAttribute("style", `filter:${x.filter}`), this.svg.appendChild(this.path);
|
|
213
183
|
}
|
|
214
184
|
continueDraw(t, e) {
|
|
215
185
|
!this.isDrawing || !this.path || (this.points.push([t, e]), this.path.setAttribute("d", this.buildPathD()));
|
|
@@ -262,7 +232,7 @@ class mt {
|
|
|
262
232
|
const bt = 5;
|
|
263
233
|
class H {
|
|
264
234
|
constructor(t, e, s) {
|
|
265
|
-
this.messages = e, this.onReady = s, this.pinCount = 0, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new dt(t), this.pinMarker = new
|
|
235
|
+
this.messages = e, this.onReady = s, this.pinCount = 0, this.interactionActive = !0, this.pendingHighlightFrame = null, this.lastMoveX = 0, this.lastMoveY = 0, this.highlighter = new dt(t), this.pinMarker = new mt(t), this.drawLayer = new ft(t, (r) => {
|
|
266
236
|
this.onReady(r, this.messages.annotation.drawing);
|
|
267
237
|
}), this.overlay = new ht(t, {
|
|
268
238
|
onMouseDown: (r) => this.handleMouseDown(r),
|
|
@@ -327,9 +297,9 @@ class gt {
|
|
|
327
297
|
buildHTML(t) {
|
|
328
298
|
const e = t.messages, s = e.popup.quickOptions.map(
|
|
329
299
|
(r) => `
|
|
330
|
-
<button class="mtb-quick-option" data-quick="${
|
|
300
|
+
<button class="mtb-quick-option" data-quick="${f(r.label)}">
|
|
331
301
|
<span class="mtb-quick-option-emoji">${r.emoji}</span>
|
|
332
|
-
<span>${
|
|
302
|
+
<span>${f(r.label)}</span>
|
|
333
303
|
</button>`
|
|
334
304
|
).join("");
|
|
335
305
|
return `
|
|
@@ -339,7 +309,7 @@ class gt {
|
|
|
339
309
|
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/>
|
|
340
310
|
</svg>
|
|
341
311
|
</div>
|
|
342
|
-
<span class="mtb-popup-title">${e.popup.about} "${
|
|
312
|
+
<span class="mtb-popup-title">${e.popup.about} "${f(t.targetName)}"</span>
|
|
343
313
|
<button class="mtb-popup-close" aria-label="Close">
|
|
344
314
|
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
|
345
315
|
<path d="M18 6L6 18M6 6l12 12"/>
|
|
@@ -351,12 +321,12 @@ class gt {
|
|
|
351
321
|
${s}
|
|
352
322
|
</div>
|
|
353
323
|
<div class="mtb-textarea-wrap">
|
|
354
|
-
<textarea class="mtb-textarea" placeholder="${
|
|
324
|
+
<textarea class="mtb-textarea" placeholder="${f(e.popup.placeholder)}"></textarea>
|
|
355
325
|
</div>
|
|
356
326
|
<div class="mtb-popup-error" role="alert"></div>
|
|
357
327
|
<div class="mtb-popup-actions">
|
|
358
|
-
<button class="mtb-cancel-btn" type="button">${
|
|
359
|
-
<button class="mtb-submit-btn" type="button" disabled>${
|
|
328
|
+
<button class="mtb-cancel-btn" type="button">${f(e.popup.cancel)}</button>
|
|
329
|
+
<button class="mtb-submit-btn" type="button" disabled>${f(e.popup.submit)}</button>
|
|
360
330
|
</div>
|
|
361
331
|
</div>
|
|
362
332
|
`;
|
|
@@ -394,7 +364,7 @@ class gt {
|
|
|
394
364
|
this.el.remove();
|
|
395
365
|
}
|
|
396
366
|
}
|
|
397
|
-
function
|
|
367
|
+
function f(i) {
|
|
398
368
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
399
369
|
}
|
|
400
370
|
const yt = 2e3, xt = 2e3;
|
|
@@ -406,16 +376,16 @@ class wt {
|
|
|
406
376
|
return `
|
|
407
377
|
<div class="mtb-clarify-header">
|
|
408
378
|
<div class="mtb-clarify-icon">
|
|
409
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${
|
|
379
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${A}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
410
380
|
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
|
411
381
|
</svg>
|
|
412
382
|
</div>
|
|
413
|
-
<button class="mtb-clarify-skip">${
|
|
383
|
+
<button class="mtb-clarify-skip">${T(t.clarify.skip)}</button>
|
|
414
384
|
</div>
|
|
415
385
|
<div class="mtb-clarify-messages"></div>
|
|
416
386
|
<div class="mtb-clarify-footer">
|
|
417
|
-
<input class="mtb-clarify-input" type="text" placeholder="${
|
|
418
|
-
<button class="mtb-clarify-send" disabled>${
|
|
387
|
+
<input class="mtb-clarify-input" type="text" placeholder="${T(t.clarify.placeholder)}" />
|
|
388
|
+
<button class="mtb-clarify-send" disabled>${T(t.clarify.send)}</button>
|
|
419
389
|
</div>
|
|
420
390
|
`;
|
|
421
391
|
}
|
|
@@ -500,23 +470,23 @@ class wt {
|
|
|
500
470
|
this.destroyed = !0, this.stopPolling(), this.doneTimer !== null && (clearTimeout(this.doneTimer), this.doneTimer = null), this.el.remove();
|
|
501
471
|
}
|
|
502
472
|
}
|
|
503
|
-
function
|
|
473
|
+
function T(i) {
|
|
504
474
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
505
475
|
}
|
|
506
476
|
const kt = 5e3;
|
|
507
477
|
class vt {
|
|
508
|
-
constructor(t, e, s, r) {
|
|
478
|
+
constructor(t, e, s, r, n) {
|
|
509
479
|
this.el = t.el("div", "mtb-success"), this.el.style.right = "20px", this.el.style.bottom = "20px";
|
|
510
|
-
const n = r ? `<button class="mtb-view-feedback-link">${e.success.view_feedback}</button>` : "";
|
|
480
|
+
const o = n?.skipFollowup ? e.success.title_no_ai : e.success.title, a = n?.skipFollowup ? e.success.message_no_ai : e.success.message, l = r ? `<button class="mtb-view-feedback-link">${e.success.view_feedback}</button>` : "";
|
|
511
481
|
this.el.innerHTML = `
|
|
512
482
|
<div class="mtb-success-icon">
|
|
513
|
-
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${
|
|
483
|
+
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="${A}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
|
514
484
|
<polyline points="20 6 9 17 4 12"/>
|
|
515
485
|
</svg>
|
|
516
486
|
</div>
|
|
517
|
-
<div class="mtb-success-title">${
|
|
518
|
-
<div class="mtb-success-msg">${
|
|
519
|
-
${
|
|
487
|
+
<div class="mtb-success-title">${o}</div>
|
|
488
|
+
<div class="mtb-success-msg">${a}</div>
|
|
489
|
+
${l}
|
|
520
490
|
<button class="mtb-close-link">${e.success.close}</button>
|
|
521
491
|
`, t.append(this.el), this.el.querySelector(".mtb-close-link").addEventListener("click", s), r && this.el.querySelector(".mtb-view-feedback-link").addEventListener("click", r), setTimeout(() => s(), kt);
|
|
522
492
|
}
|
|
@@ -524,7 +494,7 @@ class vt {
|
|
|
524
494
|
this.el.remove();
|
|
525
495
|
}
|
|
526
496
|
}
|
|
527
|
-
function
|
|
497
|
+
function St(i, t) {
|
|
528
498
|
if (i.match(/^[a-z]+:\/\//i))
|
|
529
499
|
return i;
|
|
530
500
|
if (i.match(/^\/\//))
|
|
@@ -534,7 +504,7 @@ function Et(i, t) {
|
|
|
534
504
|
const e = document.implementation.createHTMLDocument(), s = e.createElement("base"), r = e.createElement("a");
|
|
535
505
|
return e.head.appendChild(s), e.body.appendChild(r), t && (s.href = t), r.href = i, r.href;
|
|
536
506
|
}
|
|
537
|
-
const
|
|
507
|
+
const Et = /* @__PURE__ */ (() => {
|
|
538
508
|
let i = 0;
|
|
539
509
|
const t = () => (
|
|
540
510
|
// eslint-disable-next-line no-bitwise
|
|
@@ -549,7 +519,7 @@ function p(i) {
|
|
|
549
519
|
return t;
|
|
550
520
|
}
|
|
551
521
|
let b = null;
|
|
552
|
-
function
|
|
522
|
+
function Y(i = {}) {
|
|
553
523
|
return b || (i.includeStyleProperties ? (b = i.includeStyleProperties, b) : (b = p(window.getComputedStyle(document.documentElement)), b));
|
|
554
524
|
}
|
|
555
525
|
function S(i, t) {
|
|
@@ -564,7 +534,7 @@ function Mt(i) {
|
|
|
564
534
|
const t = S(i, "border-top-width"), e = S(i, "border-bottom-width");
|
|
565
535
|
return i.clientHeight + t + e;
|
|
566
536
|
}
|
|
567
|
-
function
|
|
537
|
+
function X(i, t = {}) {
|
|
568
538
|
const e = t.width || Ct(i), s = t.height || Mt(i);
|
|
569
539
|
return { width: e, height: s };
|
|
570
540
|
}
|
|
@@ -581,7 +551,7 @@ const d = 16384;
|
|
|
581
551
|
function Lt(i) {
|
|
582
552
|
(i.width > d || i.height > d) && (i.width > d && i.height > d ? i.width > i.height ? (i.height *= d / i.width, i.width = d) : (i.width *= d / i.height, i.height = d) : i.width > d ? (i.height *= d / i.width, i.width = d) : (i.width *= d / i.height, i.height = d));
|
|
583
553
|
}
|
|
584
|
-
function
|
|
554
|
+
function E(i) {
|
|
585
555
|
return new Promise((t, e) => {
|
|
586
556
|
const s = new Image();
|
|
587
557
|
s.onload = () => {
|
|
@@ -591,12 +561,12 @@ function C(i) {
|
|
|
591
561
|
}, s.onerror = e, s.crossOrigin = "anonymous", s.decoding = "async", s.src = i;
|
|
592
562
|
});
|
|
593
563
|
}
|
|
594
|
-
async function
|
|
564
|
+
async function _t(i) {
|
|
595
565
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(i)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
|
|
596
566
|
}
|
|
597
567
|
async function Dt(i, t, e) {
|
|
598
568
|
const s = "http://www.w3.org/2000/svg", r = document.createElementNS(s, "svg"), n = document.createElementNS(s, "foreignObject");
|
|
599
|
-
return r.setAttribute("width", `${t}`), r.setAttribute("height", `${e}`), r.setAttribute("viewBox", `0 0 ${t} ${e}`), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), r.appendChild(n), n.appendChild(i),
|
|
569
|
+
return r.setAttribute("width", `${t}`), r.setAttribute("height", `${e}`), r.setAttribute("viewBox", `0 0 ${t} ${e}`), n.setAttribute("width", "100%"), n.setAttribute("height", "100%"), n.setAttribute("x", "0"), n.setAttribute("y", "0"), n.setAttribute("externalResourcesRequired", "true"), r.appendChild(n), n.appendChild(i), _t(r);
|
|
600
570
|
}
|
|
601
571
|
const h = (i, t) => {
|
|
602
572
|
if (i instanceof t)
|
|
@@ -604,44 +574,44 @@ const h = (i, t) => {
|
|
|
604
574
|
const e = Object.getPrototypeOf(i);
|
|
605
575
|
return e === null ? !1 : e.constructor.name === t.name || h(e, t);
|
|
606
576
|
};
|
|
607
|
-
function
|
|
577
|
+
function At(i) {
|
|
608
578
|
const t = i.getPropertyValue("content");
|
|
609
579
|
return `${i.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
610
580
|
}
|
|
611
|
-
function
|
|
612
|
-
return
|
|
581
|
+
function Pt(i, t) {
|
|
582
|
+
return Y(t).map((e) => {
|
|
613
583
|
const s = i.getPropertyValue(e), r = i.getPropertyPriority(e);
|
|
614
584
|
return `${e}: ${s}${r ? " !important" : ""};`;
|
|
615
585
|
}).join(" ");
|
|
616
586
|
}
|
|
617
|
-
function
|
|
618
|
-
const r = `.${i}:${t}`, n = e.cssText ?
|
|
587
|
+
function Rt(i, t, e, s) {
|
|
588
|
+
const r = `.${i}:${t}`, n = e.cssText ? At(e) : Pt(e, s);
|
|
619
589
|
return document.createTextNode(`${r}{${n}}`);
|
|
620
590
|
}
|
|
621
591
|
function I(i, t, e, s) {
|
|
622
592
|
const r = window.getComputedStyle(i, e), n = r.getPropertyValue("content");
|
|
623
593
|
if (n === "" || n === "none")
|
|
624
594
|
return;
|
|
625
|
-
const o =
|
|
595
|
+
const o = Et();
|
|
626
596
|
try {
|
|
627
597
|
t.className = `${t.className} ${o}`;
|
|
628
598
|
} catch {
|
|
629
599
|
return;
|
|
630
600
|
}
|
|
631
601
|
const a = document.createElement("style");
|
|
632
|
-
a.appendChild(
|
|
602
|
+
a.appendChild(Rt(o, e, r, s)), t.appendChild(a);
|
|
633
603
|
}
|
|
634
604
|
function Ht(i, t, e) {
|
|
635
605
|
I(i, t, ":before", e), I(i, t, ":after", e);
|
|
636
606
|
}
|
|
637
|
-
const
|
|
638
|
-
woff:
|
|
639
|
-
woff2:
|
|
607
|
+
const F = "application/font-woff", O = "image/jpeg", $t = {
|
|
608
|
+
woff: F,
|
|
609
|
+
woff2: F,
|
|
640
610
|
ttf: "application/font-truetype",
|
|
641
611
|
eot: "application/vnd.ms-fontobject",
|
|
642
612
|
png: "image/png",
|
|
643
|
-
jpg:
|
|
644
|
-
jpeg:
|
|
613
|
+
jpg: O,
|
|
614
|
+
jpeg: O,
|
|
645
615
|
gif: "image/gif",
|
|
646
616
|
tiff: "image/tiff",
|
|
647
617
|
svg: "image/svg+xml",
|
|
@@ -651,20 +621,20 @@ function It(i) {
|
|
|
651
621
|
const t = /\.([^./]*?)$/g.exec(i);
|
|
652
622
|
return t ? t[1] : "";
|
|
653
623
|
}
|
|
654
|
-
function
|
|
624
|
+
function P(i) {
|
|
655
625
|
const t = It(i).toLowerCase();
|
|
656
626
|
return $t[t] || "";
|
|
657
627
|
}
|
|
658
|
-
function
|
|
628
|
+
function Ft(i) {
|
|
659
629
|
return i.split(/,/)[1];
|
|
660
630
|
}
|
|
661
|
-
function
|
|
631
|
+
function _(i) {
|
|
662
632
|
return i.search(/^(data:)/) !== -1;
|
|
663
633
|
}
|
|
664
|
-
function
|
|
634
|
+
function Ot(i, t) {
|
|
665
635
|
return `data:${t};base64,${i}`;
|
|
666
636
|
}
|
|
667
|
-
async function
|
|
637
|
+
async function G(i, t, e) {
|
|
668
638
|
const s = await fetch(i, t);
|
|
669
639
|
if (s.status === 404)
|
|
670
640
|
throw new Error(`Resource "${s.url}" not found`);
|
|
@@ -680,60 +650,60 @@ async function X(i, t, e) {
|
|
|
680
650
|
}, a.readAsDataURL(r);
|
|
681
651
|
});
|
|
682
652
|
}
|
|
683
|
-
const
|
|
653
|
+
const L = {};
|
|
684
654
|
function jt(i, t, e) {
|
|
685
655
|
let s = i.replace(/\?.*/, "");
|
|
686
656
|
return e && (s = i), /ttf|otf|eot|woff2?/i.test(s) && (s = s.replace(/.*\//, "")), t ? `[${t}]${s}` : s;
|
|
687
657
|
}
|
|
688
|
-
async function
|
|
658
|
+
async function R(i, t, e) {
|
|
689
659
|
const s = jt(i, t, e.includeQueryParams);
|
|
690
|
-
if (
|
|
691
|
-
return
|
|
660
|
+
if (L[s] != null)
|
|
661
|
+
return L[s];
|
|
692
662
|
e.cacheBust && (i += (/\?/.test(i) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
693
663
|
let r;
|
|
694
664
|
try {
|
|
695
|
-
const n = await
|
|
696
|
-
r =
|
|
665
|
+
const n = await G(i, e.fetchRequestInit, ({ res: o, result: a }) => (t || (t = o.headers.get("Content-Type") || ""), Ft(a)));
|
|
666
|
+
r = Ot(n, t);
|
|
697
667
|
} catch (n) {
|
|
698
668
|
r = e.imagePlaceholder || "";
|
|
699
669
|
let o = `Failed to fetch resource: ${i}`;
|
|
700
670
|
n && (o = typeof n == "string" ? n : n.message), o && console.warn(o);
|
|
701
671
|
}
|
|
702
|
-
return
|
|
672
|
+
return L[s] = r, r;
|
|
703
673
|
}
|
|
704
674
|
async function Ut(i) {
|
|
705
675
|
const t = i.toDataURL();
|
|
706
|
-
return t === "data:," ? i.cloneNode(!1) :
|
|
676
|
+
return t === "data:," ? i.cloneNode(!1) : E(t);
|
|
707
677
|
}
|
|
708
678
|
async function zt(i, t) {
|
|
709
679
|
if (i.currentSrc) {
|
|
710
680
|
const n = document.createElement("canvas"), o = n.getContext("2d");
|
|
711
681
|
n.width = i.clientWidth, n.height = i.clientHeight, o?.drawImage(i, 0, 0, n.width, n.height);
|
|
712
682
|
const a = n.toDataURL();
|
|
713
|
-
return
|
|
683
|
+
return E(a);
|
|
714
684
|
}
|
|
715
|
-
const e = i.poster, s =
|
|
716
|
-
return
|
|
685
|
+
const e = i.poster, s = P(e), r = await R(e, s, t);
|
|
686
|
+
return E(r);
|
|
717
687
|
}
|
|
718
688
|
async function Bt(i, t) {
|
|
719
689
|
var e;
|
|
720
690
|
try {
|
|
721
691
|
if (!((e = i?.contentDocument) === null || e === void 0) && e.body)
|
|
722
|
-
return await
|
|
692
|
+
return await C(i.contentDocument.body, t, !0);
|
|
723
693
|
} catch {
|
|
724
694
|
}
|
|
725
695
|
return i.cloneNode(!1);
|
|
726
696
|
}
|
|
727
697
|
async function qt(i, t) {
|
|
728
|
-
return h(i, HTMLCanvasElement) ? Ut(i) : h(i, HTMLVideoElement) ? zt(i, t) : h(i, HTMLIFrameElement) ? Bt(i, t) : i.cloneNode(
|
|
698
|
+
return h(i, HTMLCanvasElement) ? Ut(i) : h(i, HTMLVideoElement) ? zt(i, t) : h(i, HTMLIFrameElement) ? Bt(i, t) : i.cloneNode(K(i));
|
|
729
699
|
}
|
|
730
|
-
const Wt = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT",
|
|
700
|
+
const Wt = (i) => i.tagName != null && i.tagName.toUpperCase() === "SLOT", K = (i) => i.tagName != null && i.tagName.toUpperCase() === "SVG";
|
|
731
701
|
async function Nt(i, t, e) {
|
|
732
702
|
var s, r;
|
|
733
|
-
if (
|
|
703
|
+
if (K(t))
|
|
734
704
|
return t;
|
|
735
705
|
let n = [];
|
|
736
|
-
return Wt(i) && i.assignedNodes ? n = p(i.assignedNodes()) : h(i, HTMLIFrameElement) && (!((s = i.contentDocument) === null || s === void 0) && s.body) ? n = p(i.contentDocument.body.childNodes) : n = p(((r = i.shadowRoot) !== null && r !== void 0 ? r : i).childNodes), n.length === 0 || h(i, HTMLVideoElement) || await n.reduce((o, a) => o.then(() =>
|
|
706
|
+
return Wt(i) && i.assignedNodes ? n = p(i.assignedNodes()) : h(i, HTMLIFrameElement) && (!((s = i.contentDocument) === null || s === void 0) && s.body) ? n = p(i.contentDocument.body.childNodes) : n = p(((r = i.shadowRoot) !== null && r !== void 0 ? r : i).childNodes), n.length === 0 || h(i, HTMLVideoElement) || await n.reduce((o, a) => o.then(() => C(a, e)).then((l) => {
|
|
737
707
|
l && t.appendChild(l);
|
|
738
708
|
}), Promise.resolve()), t;
|
|
739
709
|
}
|
|
@@ -742,7 +712,7 @@ function Vt(i, t, e) {
|
|
|
742
712
|
if (!s)
|
|
743
713
|
return;
|
|
744
714
|
const r = window.getComputedStyle(i);
|
|
745
|
-
r.cssText ? (s.cssText = r.cssText, s.transformOrigin = r.transformOrigin) :
|
|
715
|
+
r.cssText ? (s.cssText = r.cssText, s.transformOrigin = r.transformOrigin) : Y(e).forEach((n) => {
|
|
746
716
|
let o = r.getPropertyValue(n);
|
|
747
717
|
n === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), h(i, HTMLIFrameElement) && n === "display" && o === "inline" && (o = "block"), n === "d" && t.getAttribute("d") && (o = `path(${t.getAttribute("d")})`), s.setProperty(n, o, r.getPropertyPriority(n));
|
|
748
718
|
});
|
|
@@ -768,7 +738,7 @@ async function Kt(i, t) {
|
|
|
768
738
|
const a = e[n].getAttribute("xlink:href");
|
|
769
739
|
if (a) {
|
|
770
740
|
const l = i.querySelector(a), c = document.querySelector(a);
|
|
771
|
-
!l && c && !s[a] && (s[a] = await
|
|
741
|
+
!l && c && !s[a] && (s[a] = await C(c, t, !0));
|
|
772
742
|
}
|
|
773
743
|
}
|
|
774
744
|
const r = Object.values(s);
|
|
@@ -783,23 +753,23 @@ async function Kt(i, t) {
|
|
|
783
753
|
}
|
|
784
754
|
return i;
|
|
785
755
|
}
|
|
786
|
-
async function
|
|
756
|
+
async function C(i, t, e) {
|
|
787
757
|
return !e && t.filter && !t.filter(i) ? null : Promise.resolve(i).then((s) => qt(s, t)).then((s) => Nt(i, s, t)).then((s) => Gt(i, s, t)).then((s) => Kt(s, t));
|
|
788
758
|
}
|
|
789
|
-
const
|
|
759
|
+
const J = /url\((['"]?)([^'"]+?)\1\)/g, Jt = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Qt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
790
760
|
function Zt(i) {
|
|
791
761
|
const t = i.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
792
762
|
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
793
763
|
}
|
|
794
764
|
function te(i) {
|
|
795
765
|
const t = [];
|
|
796
|
-
return i.replace(
|
|
766
|
+
return i.replace(J, (e, s, r) => (t.push(r), e)), t.filter((e) => !_(e));
|
|
797
767
|
}
|
|
798
768
|
async function ee(i, t, e, s, r) {
|
|
799
769
|
try {
|
|
800
|
-
const n = e ?
|
|
770
|
+
const n = e ? St(t, e) : t, o = P(t);
|
|
801
771
|
let a;
|
|
802
|
-
return r || (a = await
|
|
772
|
+
return r || (a = await R(n, o, s)), i.replace(Zt(t), `$1${a}$3`);
|
|
803
773
|
} catch {
|
|
804
774
|
}
|
|
805
775
|
return i;
|
|
@@ -815,11 +785,11 @@ function ie(i, { preferredFontFormat: t }) {
|
|
|
815
785
|
}
|
|
816
786
|
}) : i;
|
|
817
787
|
}
|
|
818
|
-
function
|
|
819
|
-
return i.search(
|
|
788
|
+
function Q(i) {
|
|
789
|
+
return i.search(J) !== -1;
|
|
820
790
|
}
|
|
821
|
-
async function
|
|
822
|
-
if (!
|
|
791
|
+
async function Z(i, t, e) {
|
|
792
|
+
if (!Q(i))
|
|
823
793
|
return i;
|
|
824
794
|
const s = ie(i, e);
|
|
825
795
|
return te(s).reduce((n, o) => n.then((a) => ee(a, o, t, e)), Promise.resolve(s));
|
|
@@ -828,7 +798,7 @@ async function g(i, t, e) {
|
|
|
828
798
|
var s;
|
|
829
799
|
const r = (s = t.style) === null || s === void 0 ? void 0 : s.getPropertyValue(i);
|
|
830
800
|
if (r) {
|
|
831
|
-
const n = await
|
|
801
|
+
const n = await Z(r, null, e);
|
|
832
802
|
return t.style.setProperty(i, n, t.style.getPropertyPriority(i)), !0;
|
|
833
803
|
}
|
|
834
804
|
return !1;
|
|
@@ -838,9 +808,9 @@ async function se(i, t) {
|
|
|
838
808
|
}
|
|
839
809
|
async function re(i, t) {
|
|
840
810
|
const e = h(i, HTMLImageElement);
|
|
841
|
-
if (!(e && !
|
|
811
|
+
if (!(e && !_(i.src)) && !(h(i, SVGImageElement) && !_(i.href.baseVal)))
|
|
842
812
|
return;
|
|
843
|
-
const s = e ? i.src : i.href.baseVal, r = await
|
|
813
|
+
const s = e ? i.src : i.href.baseVal, r = await R(s, P(s), t);
|
|
844
814
|
await new Promise((n, o) => {
|
|
845
815
|
i.onload = n, i.onerror = t.onImageErrorHandler ? (...l) => {
|
|
846
816
|
try {
|
|
@@ -854,10 +824,10 @@ async function re(i, t) {
|
|
|
854
824
|
});
|
|
855
825
|
}
|
|
856
826
|
async function ne(i, t) {
|
|
857
|
-
const s = p(i.childNodes).map((r) =>
|
|
827
|
+
const s = p(i.childNodes).map((r) => tt(r, t));
|
|
858
828
|
await Promise.all(s).then(() => i);
|
|
859
829
|
}
|
|
860
|
-
async function
|
|
830
|
+
async function tt(i, t) {
|
|
861
831
|
h(i, Element) && (await se(i, t), await re(i, t), await ne(i, t));
|
|
862
832
|
}
|
|
863
833
|
function oe(i, t) {
|
|
@@ -880,7 +850,7 @@ async function z(i, t) {
|
|
|
880
850
|
let e = i.cssText;
|
|
881
851
|
const s = /url\(["']?([^"')]+)["']?\)/g, n = (e.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
882
852
|
let a = o.replace(s, "$1");
|
|
883
|
-
return a.startsWith("https://") || (a = new URL(a, i.url).href),
|
|
853
|
+
return a.startsWith("https://") || (a = new URL(a, i.url).href), G(a, t.fetchRequestInit, ({ result: l }) => (e = e.replace(o, `url(${l})`), [o, l]));
|
|
884
854
|
});
|
|
885
855
|
return Promise.all(n).then(() => e);
|
|
886
856
|
}
|
|
@@ -918,13 +888,13 @@ async function ae(i, t) {
|
|
|
918
888
|
p(r.cssRules || []).forEach((n, o) => {
|
|
919
889
|
if (n.type === CSSRule.IMPORT_RULE) {
|
|
920
890
|
let a = o + 1;
|
|
921
|
-
const l = n.href, c = U(l).then((u) => z(u, t)).then((u) => B(u).forEach((
|
|
891
|
+
const l = n.href, c = U(l).then((u) => z(u, t)).then((u) => B(u).forEach((M) => {
|
|
922
892
|
try {
|
|
923
|
-
r.insertRule(
|
|
924
|
-
} catch (
|
|
893
|
+
r.insertRule(M, M.startsWith("@import") ? a += 1 : r.cssRules.length);
|
|
894
|
+
} catch (st) {
|
|
925
895
|
console.error("Error inserting rule from remote css", {
|
|
926
|
-
rule:
|
|
927
|
-
error:
|
|
896
|
+
rule: M,
|
|
897
|
+
error: st
|
|
928
898
|
});
|
|
929
899
|
}
|
|
930
900
|
})).catch((u) => {
|
|
@@ -953,7 +923,7 @@ async function ae(i, t) {
|
|
|
953
923
|
}), e));
|
|
954
924
|
}
|
|
955
925
|
function le(i) {
|
|
956
|
-
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) =>
|
|
926
|
+
return i.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => Q(t.style.getPropertyValue("src")));
|
|
957
927
|
}
|
|
958
928
|
async function ce(i, t) {
|
|
959
929
|
if (i.ownerDocument == null)
|
|
@@ -961,14 +931,14 @@ async function ce(i, t) {
|
|
|
961
931
|
const e = p(i.ownerDocument.styleSheets), s = await ae(e, t);
|
|
962
932
|
return le(s);
|
|
963
933
|
}
|
|
964
|
-
function
|
|
934
|
+
function et(i) {
|
|
965
935
|
return i.trim().replace(/["']/g, "");
|
|
966
936
|
}
|
|
967
937
|
function he(i) {
|
|
968
938
|
const t = /* @__PURE__ */ new Set();
|
|
969
939
|
function e(s) {
|
|
970
940
|
(s.style.fontFamily || getComputedStyle(s).fontFamily).split(",").forEach((n) => {
|
|
971
|
-
t.add(
|
|
941
|
+
t.add(et(n));
|
|
972
942
|
}), Array.from(s.children).forEach((n) => {
|
|
973
943
|
n instanceof HTMLElement && e(n);
|
|
974
944
|
});
|
|
@@ -977,9 +947,9 @@ function he(i) {
|
|
|
977
947
|
}
|
|
978
948
|
async function de(i, t) {
|
|
979
949
|
const e = await ce(i, t), s = he(i);
|
|
980
|
-
return (await Promise.all(e.filter((n) => s.has(
|
|
950
|
+
return (await Promise.all(e.filter((n) => s.has(et(n.style.fontFamily))).map((n) => {
|
|
981
951
|
const o = n.parentStyleSheet ? n.parentStyleSheet.href : null;
|
|
982
|
-
return
|
|
952
|
+
return Z(n.cssText, o, t);
|
|
983
953
|
}))).join(`
|
|
984
954
|
`);
|
|
985
955
|
}
|
|
@@ -991,20 +961,20 @@ async function ue(i, t) {
|
|
|
991
961
|
}
|
|
992
962
|
}
|
|
993
963
|
async function pe(i, t = {}) {
|
|
994
|
-
const { width: e, height: s } =
|
|
995
|
-
return await ue(r, t), await
|
|
964
|
+
const { width: e, height: s } = X(i, t), r = await C(i, t, !0);
|
|
965
|
+
return await ue(r, t), await tt(r, t), oe(r, t), await Dt(r, e, s);
|
|
996
966
|
}
|
|
997
|
-
async function
|
|
998
|
-
const { width: e, height: s } =
|
|
967
|
+
async function me(i, t = {}) {
|
|
968
|
+
const { width: e, height: s } = X(i, t), r = await pe(i, t), n = await E(r), o = document.createElement("canvas"), a = o.getContext("2d"), l = t.pixelRatio || Tt(), c = t.canvasWidth || e, u = t.canvasHeight || s;
|
|
999
969
|
return o.width = c * l, o.height = u * l, t.skipAutoScale || Lt(o), o.style.width = `${c}`, o.style.height = `${u}`, t.backgroundColor && (a.fillStyle = t.backgroundColor, a.fillRect(0, 0, o.width, o.height)), a.drawImage(n, 0, 0, o.width, o.height), o;
|
|
1000
970
|
}
|
|
1001
|
-
async function
|
|
1002
|
-
return (await
|
|
971
|
+
async function fe(i, t = {}) {
|
|
972
|
+
return (await me(i, t)).toDataURL();
|
|
1003
973
|
}
|
|
1004
974
|
async function be(i = []) {
|
|
1005
975
|
const t = ge(i);
|
|
1006
976
|
try {
|
|
1007
|
-
const e = await
|
|
977
|
+
const e = await fe(document.body, {
|
|
1008
978
|
cacheBust: !0,
|
|
1009
979
|
skipAutoScale: !1,
|
|
1010
980
|
filter: (s) => !(s instanceof HTMLElement && s.id === "mtb-widget-host")
|
|
@@ -1078,13 +1048,13 @@ class ke {
|
|
|
1078
1048
|
for (const e of this.listeners) e(t);
|
|
1079
1049
|
}
|
|
1080
1050
|
}
|
|
1081
|
-
const
|
|
1082
|
-
class
|
|
1051
|
+
const it = new ke(), ve = 20;
|
|
1052
|
+
class Se {
|
|
1083
1053
|
constructor() {
|
|
1084
1054
|
this.errors = [], this.unsubscribe = null;
|
|
1085
1055
|
}
|
|
1086
1056
|
start() {
|
|
1087
|
-
this.unsubscribe || (this.unsubscribe =
|
|
1057
|
+
this.unsubscribe || (this.unsubscribe = it.subscribe((t) => this.record(t)));
|
|
1088
1058
|
}
|
|
1089
1059
|
record(t) {
|
|
1090
1060
|
const e = t.line != null ? ` (${t.line}:${t.col ?? 0})` : "";
|
|
@@ -1100,7 +1070,7 @@ class Ee {
|
|
|
1100
1070
|
this.unsubscribe?.(), this.unsubscribe = null;
|
|
1101
1071
|
}
|
|
1102
1072
|
}
|
|
1103
|
-
const
|
|
1073
|
+
const Ee = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, _e = 500, De = 300, Ae = /* @__PURE__ */ new Set([
|
|
1104
1074
|
"A",
|
|
1105
1075
|
"BUTTON",
|
|
1106
1076
|
"INPUT",
|
|
@@ -1109,7 +1079,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1109
1079
|
"LABEL",
|
|
1110
1080
|
"SUMMARY",
|
|
1111
1081
|
"DETAILS"
|
|
1112
|
-
]),
|
|
1082
|
+
]), Pe = /* @__PURE__ */ new Set([
|
|
1113
1083
|
"button",
|
|
1114
1084
|
"link",
|
|
1115
1085
|
"checkbox",
|
|
@@ -1130,12 +1100,12 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1130
1100
|
"page not found",
|
|
1131
1101
|
"server error",
|
|
1132
1102
|
"internal server error"
|
|
1133
|
-
],
|
|
1103
|
+
], k = class k {
|
|
1134
1104
|
constructor(t) {
|
|
1135
1105
|
this.clickHistory = [], this.unsubscribeErrors = null, this.active = !1, this.errorCount = 0, this.deadClickCount = 0, this.cooldownUntil = 0, this.navTimestamps = [], this.boundPopstateHandler = null, this.originalPushState = null, this.originalReplaceState = null, this.installedPushState = null, this.installedReplaceState = null, this.boundSubmitHandler = null, this.boundInvalidHandler = null, this.errorPageUrls = /* @__PURE__ */ new Set(), this.domObserver = null, this.pendingDomChecks = 0, this.lastMutationAt = -1, this.onFrustration = t, this.boundClickHandler = (e) => this.handleClick(e);
|
|
1136
1106
|
}
|
|
1137
1107
|
start() {
|
|
1138
|
-
this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors =
|
|
1108
|
+
this.active || (this.active = !0, document.addEventListener("click", this.boundClickHandler, !0), this.unsubscribeErrors = it.subscribe((t) => {
|
|
1139
1109
|
this.errorCount++;
|
|
1140
1110
|
}), this.startNavigationTracking(), this.startFormTracking(), this.checkErrorPage());
|
|
1141
1111
|
}
|
|
@@ -1166,7 +1136,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1166
1136
|
const s = Date.now();
|
|
1167
1137
|
this.clickHistory.push({ target: e, time: s });
|
|
1168
1138
|
const r = s - Ce;
|
|
1169
|
-
if (this.clickHistory = this.clickHistory.filter((o) => o.time > r), this.clickHistory.filter((o) => o.target === e).length >=
|
|
1139
|
+
if (this.clickHistory = this.clickHistory.filter((o) => o.time > r), this.clickHistory.filter((o) => o.target === e).length >= Ee) {
|
|
1170
1140
|
this.clickHistory = [], this.emitHighPriority({
|
|
1171
1141
|
signal: "rage_click",
|
|
1172
1142
|
target: y(e),
|
|
@@ -1250,7 +1220,7 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1250
1220
|
target: y(t),
|
|
1251
1221
|
timestamp: e
|
|
1252
1222
|
});
|
|
1253
|
-
},
|
|
1223
|
+
}, _e));
|
|
1254
1224
|
}
|
|
1255
1225
|
ensureDomObserver() {
|
|
1256
1226
|
this.domObserver || (this.domObserver = new MutationObserver(() => {
|
|
@@ -1275,9 +1245,9 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1275
1245
|
return !1;
|
|
1276
1246
|
}
|
|
1277
1247
|
isInteractive(t) {
|
|
1278
|
-
if (
|
|
1248
|
+
if (Ae.has(t.tagName)) return !0;
|
|
1279
1249
|
const e = t.getAttribute("role");
|
|
1280
|
-
return !!(e &&
|
|
1250
|
+
return !!(e && Pe.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'));
|
|
1281
1251
|
}
|
|
1282
1252
|
isWidgetElement(t) {
|
|
1283
1253
|
const e = document.getElementById("mtb-widget-host");
|
|
@@ -1285,19 +1255,19 @@ const Se = 3, Ce = 1e3, Me = 3, Te = 5e3, Le = 500, Ae = 500, De = 300, Pe = /*
|
|
|
1285
1255
|
}
|
|
1286
1256
|
emitIfReady(t) {
|
|
1287
1257
|
const e = Date.now();
|
|
1288
|
-
e < this.cooldownUntil || (this.cooldownUntil = e +
|
|
1258
|
+
e < this.cooldownUntil || (this.cooldownUntil = e + k.COOLDOWN_MS, this.onFrustration(t));
|
|
1289
1259
|
}
|
|
1290
1260
|
emitHighPriority(t) {
|
|
1291
|
-
this.cooldownUntil = Date.now() +
|
|
1261
|
+
this.cooldownUntil = Date.now() + k.COOLDOWN_MS, this.onFrustration(t);
|
|
1292
1262
|
}
|
|
1293
1263
|
};
|
|
1294
|
-
|
|
1295
|
-
let
|
|
1264
|
+
k.COOLDOWN_MS = 6e4;
|
|
1265
|
+
let D = k;
|
|
1296
1266
|
function y(i) {
|
|
1297
1267
|
const t = i.tagName.toLowerCase(), e = i.id ? `#${i.id}` : "", s = i.className && typeof i.className == "string" ? "." + i.className.trim().split(/\s+/).slice(0, 2).join(".") : "", r = i.textContent?.trim().slice(0, 30) ?? "";
|
|
1298
1268
|
return `<${t}${e}${s}>${r ? ` "${r}"` : ""}`;
|
|
1299
1269
|
}
|
|
1300
|
-
function
|
|
1270
|
+
function Re() {
|
|
1301
1271
|
return {
|
|
1302
1272
|
page_url: window.location.href,
|
|
1303
1273
|
user_agent: navigator.userAgent,
|
|
@@ -1316,7 +1286,7 @@ function $e() {
|
|
|
1316
1286
|
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";
|
|
1317
1287
|
}
|
|
1318
1288
|
const Ie = "https://makethisbetter.dev/api/v1";
|
|
1319
|
-
class
|
|
1289
|
+
class Fe {
|
|
1320
1290
|
constructor(t, e, s = 1e3, r, n) {
|
|
1321
1291
|
this.projectKey = t, this.apiUrl = (e ?? Ie).replace(/\/$/, ""), this.retryDelayMs = s, this.userToken = r, this.userTokenFn = n;
|
|
1322
1292
|
}
|
|
@@ -1335,7 +1305,7 @@ class Oe {
|
|
|
1335
1305
|
}
|
|
1336
1306
|
e && s.append("feedback[screenshot]", e, "screenshot.png");
|
|
1337
1307
|
const r = await this.authHeaders();
|
|
1338
|
-
return r["X-Idempotency-Key"] =
|
|
1308
|
+
return r["X-Idempotency-Key"] = Oe(), (await this.fetchWithRetry(`${this.apiUrl}/widget/feedbacks`, {
|
|
1339
1309
|
method: "POST",
|
|
1340
1310
|
headers: r,
|
|
1341
1311
|
body: s
|
|
@@ -1376,7 +1346,7 @@ class Oe {
|
|
|
1376
1346
|
function W(i) {
|
|
1377
1347
|
return i <= 0 ? Promise.resolve() : new Promise((t) => setTimeout(t, i));
|
|
1378
1348
|
}
|
|
1379
|
-
function
|
|
1349
|
+
function Oe() {
|
|
1380
1350
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
1381
1351
|
}
|
|
1382
1352
|
function je(i, t, e, s, r, n) {
|
|
@@ -1421,6 +1391,8 @@ const Ue = {
|
|
|
1421
1391
|
success: {
|
|
1422
1392
|
title: "Thanks!",
|
|
1423
1393
|
message: "Your feedback has been received.",
|
|
1394
|
+
title_no_ai: "Sent — thanks!",
|
|
1395
|
+
message_no_ai: "We'll take it from here. You'll hear back when it's resolved.",
|
|
1424
1396
|
view_feedback: "View my feedback",
|
|
1425
1397
|
close: "Close"
|
|
1426
1398
|
},
|
|
@@ -1474,6 +1446,8 @@ const Ue = {
|
|
|
1474
1446
|
success: {
|
|
1475
1447
|
title: "感谢!",
|
|
1476
1448
|
message: "您的反馈已收到。",
|
|
1449
|
+
title_no_ai: "已发送,感谢!",
|
|
1450
|
+
message_no_ai: "我们会跟进处理,解决后会通知您。",
|
|
1477
1451
|
view_feedback: "查看我的反馈",
|
|
1478
1452
|
close: "关闭"
|
|
1479
1453
|
},
|
|
@@ -1527,6 +1501,8 @@ const Ue = {
|
|
|
1527
1501
|
success: {
|
|
1528
1502
|
title: "ありがとうございます!",
|
|
1529
1503
|
message: "フィードバックを受け付けました。",
|
|
1504
|
+
title_no_ai: "送信しました!",
|
|
1505
|
+
message_no_ai: "チームが対応します。解決次第お知らせします。",
|
|
1530
1506
|
view_feedback: "フィードバックを確認",
|
|
1531
1507
|
close: "閉じる"
|
|
1532
1508
|
},
|
|
@@ -1580,6 +1556,8 @@ const Ue = {
|
|
|
1580
1556
|
success: {
|
|
1581
1557
|
title: "감사합니다!",
|
|
1582
1558
|
message: "피드백이 접수되었습니다.",
|
|
1559
|
+
title_no_ai: "전송 완료!",
|
|
1560
|
+
message_no_ai: "팀에서 처리 후 알려드리겠습니다.",
|
|
1583
1561
|
view_feedback: "내 피드백 보기",
|
|
1584
1562
|
close: "닫기"
|
|
1585
1563
|
},
|
|
@@ -1633,6 +1611,8 @@ const Ue = {
|
|
|
1633
1611
|
success: {
|
|
1634
1612
|
title: "¡Gracias!",
|
|
1635
1613
|
message: "Tu comentario ha sido recibido.",
|
|
1614
|
+
title_no_ai: "¡Enviado!",
|
|
1615
|
+
message_no_ai: "Nos encargamos. Te avisaremos cuando se resuelva.",
|
|
1636
1616
|
view_feedback: "Ver mis comentarios",
|
|
1637
1617
|
close: "Cerrar"
|
|
1638
1618
|
},
|
|
@@ -1686,6 +1666,8 @@ const Ue = {
|
|
|
1686
1666
|
success: {
|
|
1687
1667
|
title: "Merci !",
|
|
1688
1668
|
message: "Votre avis a bien été reçu.",
|
|
1669
|
+
title_no_ai: "Envoyé !",
|
|
1670
|
+
message_no_ai: "On s'en occupe. Vous serez informé(e) dès que ce sera résolu.",
|
|
1689
1671
|
view_feedback: "Voir mes avis",
|
|
1690
1672
|
close: "Fermer"
|
|
1691
1673
|
},
|
|
@@ -1739,6 +1721,8 @@ const Ue = {
|
|
|
1739
1721
|
success: {
|
|
1740
1722
|
title: "Vielen Dank!",
|
|
1741
1723
|
message: "Ihr Feedback wurde empfangen.",
|
|
1724
|
+
title_no_ai: "Gesendet!",
|
|
1725
|
+
message_no_ai: "Wir kümmern uns darum. Sie werden benachrichtigt, sobald es gelöst ist.",
|
|
1742
1726
|
view_feedback: "Mein Feedback ansehen",
|
|
1743
1727
|
close: "Schließen"
|
|
1744
1728
|
},
|
|
@@ -1768,7 +1752,7 @@ const Ue = {
|
|
|
1768
1752
|
send: "Senden",
|
|
1769
1753
|
skip: "Überspringen"
|
|
1770
1754
|
}
|
|
1771
|
-
},
|
|
1755
|
+
}, w = {
|
|
1772
1756
|
en: Ue,
|
|
1773
1757
|
"zh-CN": ze,
|
|
1774
1758
|
ja: Be,
|
|
@@ -1778,29 +1762,33 @@ const Ue = {
|
|
|
1778
1762
|
de: Ve
|
|
1779
1763
|
};
|
|
1780
1764
|
function Ye(i) {
|
|
1781
|
-
if (
|
|
1765
|
+
if (w[i]) return w[i];
|
|
1782
1766
|
const t = i.split("-")[0];
|
|
1783
|
-
return
|
|
1767
|
+
return w[t] ? w[t] : w.en;
|
|
1784
1768
|
}
|
|
1785
|
-
const Xe = 60, Ge = "https://cdn.jsdelivr.net/npm/
|
|
1786
|
-
let
|
|
1769
|
+
const Xe = 60, Ge = "https://cdn.jsdelivr.net/npm/@rrweb/record@2.1.0/umd/record.min.js", Ke = "sha384-MrD66HBNSykaP2N95+6hQCFlF5oH2tvL3TD/zyvHNkP/sAFWZx98DX9MEDy8MdVT";
|
|
1770
|
+
let v = null;
|
|
1787
1771
|
function Je() {
|
|
1788
|
-
return
|
|
1772
|
+
return v || (v = Qe().catch(() => Ze()), v);
|
|
1789
1773
|
}
|
|
1790
1774
|
async function Qe() {
|
|
1791
1775
|
return (await import("rrweb")).record;
|
|
1792
1776
|
}
|
|
1777
|
+
function N() {
|
|
1778
|
+
const i = globalThis;
|
|
1779
|
+
return i.rrwebRecord?.record ?? i.rrweb?.record;
|
|
1780
|
+
}
|
|
1793
1781
|
function Ze() {
|
|
1794
1782
|
return new Promise((i, t) => {
|
|
1795
|
-
const e =
|
|
1796
|
-
if (e
|
|
1797
|
-
i(e
|
|
1783
|
+
const e = N();
|
|
1784
|
+
if (e) {
|
|
1785
|
+
i(e);
|
|
1798
1786
|
return;
|
|
1799
1787
|
}
|
|
1800
1788
|
const s = document.createElement("script");
|
|
1801
1789
|
s.src = Ge, s.integrity = Ke, s.crossOrigin = "anonymous", s.onload = () => {
|
|
1802
|
-
const r =
|
|
1803
|
-
r
|
|
1790
|
+
const r = N();
|
|
1791
|
+
r ? i(r) : t(new Error("rrweb record global not found after script load"));
|
|
1804
1792
|
}, s.onerror = () => t(new Error("Failed to load rrweb from CDN")), document.head.appendChild(s);
|
|
1805
1793
|
});
|
|
1806
1794
|
}
|
|
@@ -1888,12 +1876,12 @@ class ii {
|
|
|
1888
1876
|
this.session?.destroy(), this.session = null, this.bar?.destroy(), this.bar = null;
|
|
1889
1877
|
}
|
|
1890
1878
|
}
|
|
1891
|
-
class
|
|
1879
|
+
class V {
|
|
1892
1880
|
constructor(t) {
|
|
1893
|
-
this.tab = null, this.
|
|
1881
|
+
this.tab = null, this.toolbar = null, this.session = null, this.popup = null, this.clarify = null, this.success = null, this.frustrationPrompt = null, this.frustrationDetector = null, this.mode = "idle", this.currentAnnotation = null, this.recordingManager = null, this.config = t, this.messages = Ye(t.locale ?? "en"), this.apiClient = new Fe(t.projectKey, t.apiUrl, void 0, t.userToken, t.userTokenFn), this.consoleCollector = new Se(), this.consoleCollector.start(), this.buildUI(), t.frustrationDetection !== !1 && (this.frustrationDetector = new D(() => this.handleFrustration()), this.frustrationDetector.start());
|
|
1894
1882
|
}
|
|
1895
1883
|
buildUI() {
|
|
1896
|
-
this.shadow = new
|
|
1884
|
+
this.shadow = new nt(this.config.theme ?? "auto"), this.tab = new ot(
|
|
1897
1885
|
this.shadow,
|
|
1898
1886
|
this.messages,
|
|
1899
1887
|
this.config.position ?? "right",
|
|
@@ -1916,7 +1904,7 @@ class N {
|
|
|
1916
1904
|
this.frustrationPrompt?.destroy(), this.frustrationPrompt = null;
|
|
1917
1905
|
}
|
|
1918
1906
|
enterAnnotationMode() {
|
|
1919
|
-
this.mode = "annotating", this.tab?.setActive(!0), this.
|
|
1907
|
+
this.mode = "annotating", this.tab?.setActive(!0), this.toolbar = new ct(
|
|
1920
1908
|
this.shadow,
|
|
1921
1909
|
this.messages,
|
|
1922
1910
|
() => this.exitAll(),
|
|
@@ -1928,8 +1916,8 @@ class N {
|
|
|
1928
1916
|
handleToolbarModeChange(t) {
|
|
1929
1917
|
t === "record" ? (this.mode = "recording", this.session?.destroy(), this.session = null, this.recordingManager = new ii(), this.recordingManager.start(this.shadow, this.messages, () => {
|
|
1930
1918
|
this.recordingManager && (this.recordingManager.stop(), this.showPopup(window.innerWidth / 2, window.innerHeight / 2, this.messages.record.timer_label));
|
|
1931
|
-
}).catch(() => {
|
|
1932
|
-
this.mode === "recording" && (this.toolbar?.setMode("markup"), this.handleToolbarModeChange("markup"));
|
|
1919
|
+
}).catch((e) => {
|
|
1920
|
+
console.warn("[MakeThisBetter] Screen recording unavailable, falling back to markup:", e), this.mode === "recording" && (this.toolbar?.setMode("markup"), this.handleToolbarModeChange("markup"));
|
|
1933
1921
|
})) : (this.recordingManager?.destroy(), this.recordingManager = null, this.session || (this.session = new H(this.shadow, this.messages, (e, s) => {
|
|
1934
1922
|
this.currentAnnotation = e, this.showPopup(e.x, e.y, s);
|
|
1935
1923
|
})), this.mode = "annotating");
|
|
@@ -1949,7 +1937,7 @@ class N {
|
|
|
1949
1937
|
this.popup.setLoading(!0);
|
|
1950
1938
|
const e = this.currentAnnotation, s = this.recordingManager?.getRecording() ?? void 0, [r, n] = await Promise.all([
|
|
1951
1939
|
be(e ? [e] : []),
|
|
1952
|
-
Promise.resolve(
|
|
1940
|
+
Promise.resolve(Re())
|
|
1953
1941
|
]), o = je(
|
|
1954
1942
|
t,
|
|
1955
1943
|
n,
|
|
@@ -1960,13 +1948,13 @@ class N {
|
|
|
1960
1948
|
);
|
|
1961
1949
|
try {
|
|
1962
1950
|
const a = await this.apiClient.submitFeedback(o, r);
|
|
1963
|
-
this.popup?.destroy(), this.popup = null, this.session?.destroy(), this.session = null, this.recordingManager?.destroy(), this.recordingManager = null, a.ai_clarify_available === !1 ? this.showSuccess(a.project_id) : this.showClarify(a.id, a.project_id);
|
|
1951
|
+
this.popup?.destroy(), this.popup = null, this.session?.destroy(), this.session = null, this.recordingManager?.destroy(), this.recordingManager = null, a.skip_followup === !0 || a.ai_clarify_available === !1 ? this.showSuccess(a.project_id, { skipFollowup: !0 }) : this.showClarify(a.id, a.project_id);
|
|
1964
1952
|
} catch {
|
|
1965
1953
|
this.popup?.setLoading(!1), this.popup?.setError(this.messages.error.submit);
|
|
1966
1954
|
}
|
|
1967
1955
|
}
|
|
1968
1956
|
showClarify(t, e) {
|
|
1969
|
-
this.mode = "idle", this.tab?.setActive(!1), this.
|
|
1957
|
+
this.mode = "idle", this.tab?.setActive(!1), this.clarify = new wt(this.shadow, {
|
|
1970
1958
|
feedbackId: t,
|
|
1971
1959
|
apiClient: this.apiClient,
|
|
1972
1960
|
messages: this.messages,
|
|
@@ -1975,32 +1963,32 @@ class N {
|
|
|
1975
1963
|
}
|
|
1976
1964
|
});
|
|
1977
1965
|
}
|
|
1978
|
-
showSuccess(t) {
|
|
1979
|
-
this.mode = "idle", this.tab?.setActive(!1)
|
|
1980
|
-
const
|
|
1966
|
+
showSuccess(t, e) {
|
|
1967
|
+
this.mode = "idle", this.tab?.setActive(!1);
|
|
1968
|
+
const r = `${this.config.apiUrl ? this.config.apiUrl.replace(/\/api\/v1\/?$/, "") : "https://makethisbetter.dev"}/board/projects/${t}/feedbacks`, n = !!(this.config.userToken || this.config.userTokenFn);
|
|
1981
1969
|
this.success = new vt(this.shadow, this.messages, () => {
|
|
1982
1970
|
this.success?.destroy(), this.success = null;
|
|
1983
|
-
},
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1986
|
-
} : void 0);
|
|
1971
|
+
}, n ? async () => {
|
|
1972
|
+
const o = await this.apiClient.resolveUserToken();
|
|
1973
|
+
o && window.open(`${r}?identity=${encodeURIComponent(o)}`, "_blank");
|
|
1974
|
+
} : void 0, e);
|
|
1987
1975
|
}
|
|
1988
1976
|
exitAll() {
|
|
1989
|
-
this.mode = "idle", this.tab?.setActive(!1), this.
|
|
1977
|
+
this.mode = "idle", this.tab?.setActive(!1), this.toolbar?.destroy(), this.toolbar = null, this.session?.destroy(), this.session = null, this.popup?.destroy(), this.popup = null, this.clarify?.destroy(), this.clarify = null, this.currentAnnotation = null, this.recordingManager?.destroy(), this.recordingManager = null;
|
|
1990
1978
|
}
|
|
1991
1979
|
destroy() {
|
|
1992
|
-
this.exitAll(), this.consoleCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.
|
|
1980
|
+
this.exitAll(), this.consoleCollector.stop(), this.frustrationDetector?.stop(), this.dismissFrustrationPrompt(), this.clarify?.destroy(), this.success?.destroy(), this.tab?.destroy(), this.recordingManager?.destroy(), this.shadow.destroy();
|
|
1993
1981
|
}
|
|
1994
1982
|
}
|
|
1995
|
-
let
|
|
1983
|
+
let m = null;
|
|
1996
1984
|
const si = {
|
|
1997
1985
|
init(i) {
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
}) :
|
|
1986
|
+
m && (m.destroy(), m = null), document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => {
|
|
1987
|
+
m = new V(i);
|
|
1988
|
+
}) : m = new V(i);
|
|
2001
1989
|
},
|
|
2002
1990
|
destroy() {
|
|
2003
|
-
|
|
1991
|
+
m?.destroy(), m = null;
|
|
2004
1992
|
}
|
|
2005
1993
|
};
|
|
2006
1994
|
typeof window < "u" && (window.MakeThisBetter = si);
|